Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/collections/config/types/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type Vectorizer =
| 'text2vec-huggingface'
| 'text2vec-jinaai'
| 'text2vec-nvidia'
| 'text2vec-digitalocean'
| 'text2vec-mistral'
| 'text2vec-model2vec'
| 'text2vec-morph'
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -741,6 +756,8 @@ export type VectorizerConfigType<V> = 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'
Expand Down
5 changes: 5 additions & 0 deletions src/collections/configure/types/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Text2VecCohereConfig,
Text2VecContextionaryConfig,
Text2VecDatabricksConfig,
Text2VecDigitalOceanConfig,
Text2VecGPT4AllConfig,
Text2VecGoogleConfig,
Text2VecGoogleGeminiConfig,
Expand Down Expand Up @@ -268,6 +269,8 @@ export type Text2VecJinaAIConfigCreate = Text2VecJinaAIConfig;

export type Text2VecNvidiaConfigCreate = Text2VecNvidiaConfig;

export type Text2VecDigitalOceanConfigCreate = Text2VecDigitalOceanConfig;

export type Text2VecMistralConfigCreate = Text2VecMistralConfig;

export type Text2VecModel2VecConfigCreate = Text2VecModel2Vec;
Expand Down Expand Up @@ -338,6 +341,8 @@ export type VectorizerConfigCreateType<V> = 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'
Expand Down
39 changes: 39 additions & 0 deletions src/collections/configure/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-digitalocean'>>({
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<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-digitalocean'>>({
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<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-ollama'>>({
Expand Down
25 changes: 25 additions & 0 deletions src/collections/configure/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, N, I, 'text2vec-digitalocean'>} opts The configuration for the `text2vec-digitalocean` vectorizer. `model` is required by the server.
* @returns {VectorConfigCreate<PrimitiveKeys<T>, N, I, 'text2vec-digitalocean'>} The configuration object.
*/
text2VecDigitalOcean: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
opts: ConfigureTextVectorizerOptions<T, N, I, 'text2vec-digitalocean'>
): VectorConfigCreate<PrimitiveKeys<T>, 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'`.
*
Expand Down Expand Up @@ -882,6 +904,9 @@ const __vectors_shaded = {
text2VecOllama: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
opts?: Omit<ConfigureTextVectorizerOptions<T, N, I, 'text2vec-ollama'>, 'vectorizeCollectionName'>
) => legacyVectors.text2VecOllama(opts),
text2VecDigitalOcean: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
opts: Omit<ConfigureTextVectorizerOptions<T, N, I, 'text2vec-digitalocean'>, 'vectorizeCollectionName'>
) => legacyVectors.text2VecDigitalOcean(opts),
text2VecMistral: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
opts?: Omit<ConfigureTextVectorizerOptions<T, N, I, 'text2vec-mistral'>, 'vectorizeCollectionName'>
) => legacyVectors.text2VecMistral(opts),
Expand Down
Loading