Skip to content

Commit e701bc1

Browse files
authored
feat(v1.10): AI-powered search changes (#1692)
1 parent 727e3f7 commit e701bc1

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/types/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ export type OpenAiEmbedder = {
366366
documentTemplate?: string;
367367
dimensions?: number;
368368
distribution?: Distribution;
369+
url?: string;
369370
};
370371

371372
export type HuggingFaceEmbedder = {
@@ -388,12 +389,10 @@ export type RestEmbedder = {
388389
apiKey?: string;
389390
dimensions?: number;
390391
documentTemplate?: string;
391-
inputField?: string[] | null;
392-
inputType?: 'text' | 'textArray';
393-
query?: Record<string, any> | null;
394-
pathToEmbeddings?: string[] | null;
395-
embeddingObject?: string[] | null;
396392
distribution?: Distribution;
393+
request: Record<string, any>;
394+
response: Record<string, any>;
395+
headers?: Record<string, string>;
397396
};
398397

399398
export type OllamaEmbedder = {
@@ -403,6 +402,7 @@ export type OllamaEmbedder = {
403402
model?: string;
404403
documentTemplate?: string;
405404
distribution?: Distribution;
405+
dimensions?: number;
406406
};
407407

408408
export type Embedder =

tests/embedders.test.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
118118
mean: 0.7,
119119
sigma: 0.3,
120120
},
121+
url: 'https://api.openai.com/v1/embeddings',
121122
},
122123
};
123124
const task: EnqueuedTask = await client
@@ -169,17 +170,25 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
169170
dimensions: 1536,
170171
documentTemplate:
171172
"A movie titled '{{doc.title}}' whose description starts with {{doc.overview|truncatewords: 20}}",
172-
inputField: ['input'],
173-
inputType: 'textArray',
174-
query: {
175-
model: 'text-embedding-ada-002',
176-
},
177-
pathToEmbeddings: ['data'],
178-
embeddingObject: ['embedding'],
179173
distribution: {
180174
mean: 0.7,
181175
sigma: 0.3,
182176
},
177+
request: {
178+
model: 'text-embedding-3-small',
179+
input: ['{{text}}', '{{..}}'],
180+
},
181+
response: {
182+
data: [
183+
{
184+
embedding: '{{embedding}}',
185+
},
186+
'{{..}}',
187+
],
188+
},
189+
headers: {
190+
'Custom-Header': 'CustomValue',
191+
},
183192
},
184193
};
185194
const task: EnqueuedTask = await client
@@ -197,7 +206,7 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
197206
});
198207
});
199208

200-
test.skip(`${permission} key: Update embedders with 'ollama' source`, async () => {
209+
test(`${permission} key: Update embedders with 'ollama' source`, async () => {
201210
const client = await getClient(permission);
202211
const newEmbedder: Embedders = {
203212
default: {
@@ -210,6 +219,7 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
210219
mean: 0.7,
211220
sigma: 0.3,
212221
},
222+
dimensions: 512,
213223
},
214224
};
215225
const task: EnqueuedTask = await client

0 commit comments

Comments
 (0)