diff --git a/src/collections/config/types/vectorizer.ts b/src/collections/config/types/vectorizer.ts index ac3ad015..1a0e97d3 100644 --- a/src/collections/config/types/vectorizer.ts +++ b/src/collections/config/types/vectorizer.ts @@ -40,6 +40,7 @@ export type Vectorizer = | 'text2vec-huggingface' | 'text2vec-jinaai' | 'text2vec-nvidia' + | 'text2vec-digitalocean' | 'text2vec-mistral' | 'text2vec-model2vec' | 'text2vec-morph' @@ -524,6 +525,20 @@ export type Text2VecMistralConfig = { vectorizeCollectionName?: boolean; }; +/** + * The configuration for text vectorization using the DigitalOcean module. + * + * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/digitalocean/embeddings) for detailed usage. + */ +export type Text2VecDigitalOceanConfig = { + /** The base URL to use where API requests should go. Defaults to `https://inference.do-ai.run` on the server. */ + baseURL?: string; + /** The model to use, e.g. `qwen3-embedding-0.6b`. Required by the server. */ + model: string; + /** Whether to vectorize the collection name. */ + vectorizeCollectionName?: boolean; +}; + /** * The configuration for text vectorization using the Ollama module. * @@ -741,6 +756,8 @@ export type VectorizerConfigType = V extends 'img2vec-neural' ? Text2VecJinaAIConfig | undefined : V extends 'text2vec-nvidia' ? Text2VecNvidiaConfig | undefined + : V extends 'text2vec-digitalocean' + ? Text2VecDigitalOceanConfig | undefined : V extends 'text2vec-mistral' ? Text2VecMistralConfig | undefined : V extends 'text2vec-model2vec' diff --git a/src/collections/configure/types/vectorizer.ts b/src/collections/configure/types/vectorizer.ts index 5178e98d..e7247fd0 100644 --- a/src/collections/configure/types/vectorizer.ts +++ b/src/collections/configure/types/vectorizer.ts @@ -20,6 +20,7 @@ import { Text2VecCohereConfig, Text2VecContextionaryConfig, Text2VecDatabricksConfig, + Text2VecDigitalOceanConfig, Text2VecGPT4AllConfig, Text2VecGoogleConfig, Text2VecGoogleGeminiConfig, @@ -268,6 +269,8 @@ export type Text2VecJinaAIConfigCreate = Text2VecJinaAIConfig; export type Text2VecNvidiaConfigCreate = Text2VecNvidiaConfig; +export type Text2VecDigitalOceanConfigCreate = Text2VecDigitalOceanConfig; + export type Text2VecMistralConfigCreate = Text2VecMistralConfig; export type Text2VecModel2VecConfigCreate = Text2VecModel2Vec; @@ -338,6 +341,8 @@ export type VectorizerConfigCreateType = V extends 'img2vec-neural' ? Text2VecJinaAIConfigCreate | undefined : V extends 'text2vec-nvidia' ? Text2VecNvidiaConfigCreate | undefined + : V extends 'text2vec-digitalocean' + ? Text2VecDigitalOceanConfigCreate | undefined : V extends 'text2vec-mistral' ? Text2VecMistralConfigCreate | undefined : V extends 'text2vec-model2vec' diff --git a/src/collections/configure/unit.test.ts b/src/collections/configure/unit.test.ts index 99157a6a..ef813182 100644 --- a/src/collections/configure/unit.test.ts +++ b/src/collections/configure/unit.test.ts @@ -1422,6 +1422,45 @@ describe('Unit testing of the vectorizer factory class', () => { }); }); + it('should create the correct Text2VecDigitalOceanConfig type with only the required model', () => { + const config = configure.vectors.text2VecDigitalOcean({ model: 'qwen3-embedding-0.6b' }); + expect(config).toEqual>({ + name: undefined, + vectorIndex: { + name: 'hnsw', + config: undefined, + }, + vectorizer: { + name: 'text2vec-digitalocean', + config: { + model: 'qwen3-embedding-0.6b', + }, + }, + }); + }); + + it('should create the correct Text2VecDigitalOceanConfig type with all values', () => { + const config = configure.vectors.text2VecDigitalOcean({ + baseURL: 'https://inference.do-ai.run', + name: 'test', + model: 'qwen3-embedding-0.6b', + }); + expect(config).toEqual>({ + name: 'test', + vectorIndex: { + name: 'hnsw', + config: undefined, + }, + vectorizer: { + name: 'text2vec-digitalocean', + config: { + baseURL: 'https://inference.do-ai.run', + model: 'qwen3-embedding-0.6b', + }, + }, + }); + }); + it('should create the correct Text2VecOllamaConfig type with defaults', () => { const config = configure.vectors.text2VecOllama(); expect(config).toEqual>({ diff --git a/src/collections/configure/vectorizer.ts b/src/collections/configure/vectorizer.ts index 2851120d..9797ed03 100644 --- a/src/collections/configure/vectorizer.ts +++ b/src/collections/configure/vectorizer.ts @@ -637,6 +637,28 @@ const legacyVectors = { }, }); }, + /** + * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-digitalocean'`. + * + * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/digitalocean/embeddings) for detailed usage. + * + * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-digitalocean` vectorizer. `model` is required by the server. + * @returns {VectorConfigCreate, N, I, 'text2vec-digitalocean'>} The configuration object. + */ + text2VecDigitalOcean: ( + opts: ConfigureTextVectorizerOptions + ): VectorConfigCreate, N, I, 'text2vec-digitalocean'> => { + const { name, quantizer, sourceProperties, vectorIndexConfig, ...config } = opts; + return makeVectorizer(name, { + quantizer, + sourceProperties, + vectorIndexConfig, + vectorizerConfig: { + name: 'text2vec-digitalocean', + config: Object.keys(config).length === 0 ? undefined : config, + }, + }); + }, /** * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`. * @@ -882,6 +904,9 @@ const __vectors_shaded = { text2VecOllama: ( opts?: Omit, 'vectorizeCollectionName'> ) => legacyVectors.text2VecOllama(opts), + text2VecDigitalOcean: ( + opts: Omit, 'vectorizeCollectionName'> + ) => legacyVectors.text2VecDigitalOcean(opts), text2VecMistral: ( opts?: Omit, 'vectorizeCollectionName'> ) => legacyVectors.text2VecMistral(opts),