Adjust how text is split depending on input type (#1238)

resolves #1230
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

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] || [];
}