Skip to content
Snippets Groups Projects
Unverified Commit bf435b28 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

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

resolves #1230
parent ca63012c
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,9 @@ class AzureOpenAiEmbedder { ...@@ -23,7 +23,9 @@ class AzureOpenAiEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks(textInput); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
...@@ -31,7 +31,9 @@ class LMStudioEmbedder { ...@@ -31,7 +31,9 @@ class LMStudioEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks(textInput); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
...@@ -23,7 +23,9 @@ class LocalAiEmbedder { ...@@ -23,7 +23,9 @@ class LocalAiEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks(textInput); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
...@@ -119,7 +119,9 @@ class NativeEmbedder { ...@@ -119,7 +119,9 @@ class NativeEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks(textInput); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
...@@ -30,7 +30,9 @@ class OllamaEmbedder { ...@@ -30,7 +30,9 @@ class OllamaEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks([textInput]); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
...@@ -19,7 +19,9 @@ class OpenAiEmbedder { ...@@ -19,7 +19,9 @@ class OpenAiEmbedder {
} }
async embedTextInput(textInput) { async embedTextInput(textInput) {
const result = await this.embedChunks(textInput); const result = await this.embedChunks(
Array.isArray(textInput) ? textInput : [textInput]
);
return result?.[0] || []; return result?.[0] || [];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment