🎨 update ids of embeddings providers
This commit is contained in:
parent
4d759d0780
commit
884ffef0d8
5 changed files with 8 additions and 6 deletions
|
|
@ -43,7 +43,7 @@ export async function retrieveDocs(
|
|||
const downloadDocs = async () => {
|
||||
const config = configs.find((config) => config.startUrl === baseUrl);
|
||||
if (config) {
|
||||
await downloadPreIndexedDocs(config.title, embeddingsProviderId);
|
||||
await downloadPreIndexedDocs(embeddingsProviderId, config.title);
|
||||
return await retrieveDocs(
|
||||
baseUrl,
|
||||
vector,
|
||||
|
|
@ -62,12 +62,14 @@ export async function retrieveDocs(
|
|||
}
|
||||
|
||||
const table = await lance.openTable(DOCS_TABLE_NAME);
|
||||
const docs: LanceDbDocsRow[] = await table
|
||||
let docs: LanceDbDocsRow[] = await table
|
||||
.search(vector)
|
||||
.limit(nRetrieve)
|
||||
.where(`baseUrl = '${baseUrl}'`)
|
||||
.execute();
|
||||
|
||||
docs = docs.filter((doc) => doc.baseUrl === baseUrl);
|
||||
|
||||
if ((!docs || docs.length === 0) && !nested) {
|
||||
const downloaded = await downloadDocs();
|
||||
if (downloaded) return downloaded;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class DeepInfraEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
};
|
||||
|
||||
get id(): string {
|
||||
return "deepinfra::" + this.options.model;
|
||||
return this.options.model ?? "deepinfra";
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class OllamaEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
};
|
||||
|
||||
get id(): string {
|
||||
return "ollama::" + this.options.model;
|
||||
return this.options.model ?? "ollama";
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
};
|
||||
|
||||
get id(): string {
|
||||
return "openai::" + this.options.model;
|
||||
return this.options.model ?? "openai";
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
|
||||
get id(): string {
|
||||
return "transformers-js";
|
||||
return "sentence-transformers/all-MiniLM-L6-v2";
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue