From 53b14de636080e09e128d829aafa9ea34ac34a94 Mon Sep 17 00:00:00 2001 From: Prakhar Agarwal <56273982+prakhar7651@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:21:53 +0530 Subject: [PATCH] pass list of strings to embed method in tf_hub (#3284) This fixes the below mentioned issue. Instead of simply passing the text to `tensorflow_hub`, we convert it to a list and then pass it. https://github.com/hwchase17/langchain/issues/3282 Co-authored-by: Prakhar Agarwal --- langchain/embeddings/tensorflow_hub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/embeddings/tensorflow_hub.py b/langchain/embeddings/tensorflow_hub.py index 25e63949c4..0dc439233a 100644 --- a/langchain/embeddings/tensorflow_hub.py +++ b/langchain/embeddings/tensorflow_hub.py @@ -66,5 +66,5 @@ class TensorflowHubEmbeddings(BaseModel, Embeddings): Embeddings for the text. """ text = text.replace("\n", " ") - embedding = self.embed(text).numpy()[0] + embedding = self.embed([text]).numpy()[0] return embedding.tolist()