Skip to content

Commit 92ef31b

Browse files
authored
Add dimensions parameter for cohere embedding configurations (#366)
1 parent c70ef1d commit 92ef31b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/collections/config/types/vectorizer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ export type Multi2VecCohereConfig = {
153153
imageFields?: string[];
154154
/** The specific model to use. */
155155
model?: string;
156+
/** The number of dimensions for the generated embeddings. */
157+
dimensions?: number;
156158
/** The text fields used when vectorizing. */
157159
textFields?: string[];
158160
/** The truncation strategy to use. */
@@ -371,6 +373,8 @@ export type Text2VecCohereConfig = {
371373
baseURL?: string;
372374
/** The model to use. */
373375
model?: string;
376+
/** The number of dimensions for the generated embeddings. */
377+
dimensions?: number;
374378
/** Whether to truncate the input texts to fit within the context length. */
375379
truncate?: boolean;
376380
/** Whether to vectorize the collection name. */

src/collections/configure/unit.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ describe('Unit testing of the vectorizer factory class', () => {
331331
const config = configure.vectors.multi2VecCohere({
332332
name: 'test',
333333
model: 'model',
334+
dimensions: 512,
334335
imageFields: [
335336
{ name: 'field1', weight: 0.1 },
336337
{ name: 'field2', weight: 0.2 },
@@ -350,6 +351,7 @@ describe('Unit testing of the vectorizer factory class', () => {
350351
name: 'multi2vec-cohere',
351352
config: {
352353
model: 'model',
354+
dimensions: 512,
353355
imageFields: ['field1', 'field2'],
354356
textFields: ['field3', 'field4'],
355357
weights: {
@@ -1002,6 +1004,7 @@ describe('Unit testing of the vectorizer factory class', () => {
10021004
name: 'test',
10031005
baseURL: 'base-url',
10041006
model: 'model',
1007+
dimensions: 512,
10051008
truncate: true,
10061009
});
10071010
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-cohere'>>({
@@ -1015,6 +1018,7 @@ describe('Unit testing of the vectorizer factory class', () => {
10151018
config: {
10161019
baseURL: 'base-url',
10171020
model: 'model',
1021+
dimensions: 512,
10181022
truncate: true,
10191023
},
10201024
},

0 commit comments

Comments
 (0)