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 <i.prakhar-agarwal@devrev.ai>
This commit is contained in:
Prakhar Agarwal 2023-04-25 08:21:53 +05:30 committed by GitHub
parent 2b9f1cea4e
commit 53b14de636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,5 +66,5 @@ class TensorflowHubEmbeddings(BaseModel, Embeddings):
Embeddings for the text. Embeddings for the text.
""" """
text = text.replace("\n", " ") text = text.replace("\n", " ")
embedding = self.embed(text).numpy()[0] embedding = self.embed([text]).numpy()[0]
return embedding.tolist() return embedding.tolist()