diff --git a/server/utils/EmbeddingEngines/azureOpenAi/index.js b/server/utils/EmbeddingEngines/azureOpenAi/index.js index 1f9362c95..62f69660a 100644 --- a/server/utils/EmbeddingEngines/azureOpenAi/index.js +++ b/server/utils/EmbeddingEngines/azureOpenAi/index.js @@ -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] || []; } diff --git a/server/utils/EmbeddingEngines/lmstudio/index.js b/server/utils/EmbeddingEngines/lmstudio/index.js index b19ea2622..6874b4b32 100644 --- a/server/utils/EmbeddingEngines/lmstudio/index.js +++ b/server/utils/EmbeddingEngines/lmstudio/index.js @@ -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] || []; } diff --git a/server/utils/EmbeddingEngines/localAi/index.js b/server/utils/EmbeddingEngines/localAi/index.js index 2c9db2c73..0f4b79d84 100644 --- a/server/utils/EmbeddingEngines/localAi/index.js +++ b/server/utils/EmbeddingEngines/localAi/index.js @@ -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] || []; } diff --git a/server/utils/EmbeddingEngines/native/index.js b/server/utils/EmbeddingEngines/native/index.js index 04b754e06..ae73c4896 100644 --- a/server/utils/EmbeddingEngines/native/index.js +++ b/server/utils/EmbeddingEngines/native/index.js @@ -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] || []; } diff --git a/server/utils/EmbeddingEngines/ollama/index.js b/server/utils/EmbeddingEngines/ollama/index.js index f6b33376a..2d1cea7ae 100644 --- a/server/utils/EmbeddingEngines/ollama/index.js +++ b/server/utils/EmbeddingEngines/ollama/index.js @@ -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] || []; } diff --git a/server/utils/EmbeddingEngines/openAi/index.js b/server/utils/EmbeddingEngines/openAi/index.js index 49841343a..a0d8a4f0f 100644 --- a/server/utils/EmbeddingEngines/openAi/index.js +++ b/server/utils/EmbeddingEngines/openAi/index.js @@ -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] || []; }