Adjust how text is split depending on input type ()

resolves 
This commit is contained in:
Timothy Carambat 2024-04-30 10:11:56 -07:00 committed by GitHub
parent ca63012c0f
commit bf435b2861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 6 deletions
server/utils/EmbeddingEngines
azureOpenAi
lmstudio
localAi
native
ollama
openAi

View file

@ -23,7 +23,9 @@ class AzureOpenAiEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks(textInput);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}

View file

@ -31,7 +31,9 @@ class LMStudioEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks(textInput);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}

View file

@ -23,7 +23,9 @@ class LocalAiEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks(textInput);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}

View file

@ -119,7 +119,9 @@ class NativeEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks(textInput);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}

View file

@ -30,7 +30,9 @@ class OllamaEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks([textInput]);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}

View file

@ -19,7 +19,9 @@ class OpenAiEmbedder {
}
async embedTextInput(textInput) {
const result = await this.embedChunks(textInput);
const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || [];
}