diff --git a/server/utils/EmbeddingEngines/azureOpenAi/index.js b/server/utils/EmbeddingEngines/azureOpenAi/index.js index 1f9362c95d97222c231b107fd8e186af7994b018..62f69660a89f940a951731fecc49726d7af20d11 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 b19ea262224113d73eb0f554b30233193c3c2bbc..6874b4b32929a0d89c3b9d4b554a7c5a02efa6b7 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 2c9db2c734dda2a57875c52ddd52a4003efde1bd..0f4b79d844b622c720f9a577fc4dbfb4701bb4bc 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 04b754e067f2f86efbada5fa93dedf808a067db1..ae73c48968a952c1b848e65d0a7cfbea4fe5ac20 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 f6b33376a22b5734a915a489b6032884e885113a..2d1cea7ae12bfffc2a8b03721472c6763b59d393 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 49841343a61058e7747062ebda55290fa1e74561..a0d8a4f0f3a53e06c699267693b1582b04d03c8e 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] || []; }