mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-25 16:13:25 +00:00
huggingface: fix embeddings return type (#31072)
Integration tests failing cc @hanouticelina
This commit is contained in:
parent
868f07f8f4
commit
bdb7c4a8b3
@ -115,7 +115,7 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):
|
|||||||
_model_kwargs = self.model_kwargs or {}
|
_model_kwargs = self.model_kwargs or {}
|
||||||
# api doc: https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/embed
|
# api doc: https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/embed
|
||||||
responses = self.client.feature_extraction(text=texts, **_model_kwargs)
|
responses = self.client.feature_extraction(text=texts, **_model_kwargs)
|
||||||
return responses
|
return responses.tolist()
|
||||||
|
|
||||||
async def aembed_documents(self, texts: list[str]) -> list[list[float]]:
|
async def aembed_documents(self, texts: list[str]) -> list[list[float]]:
|
||||||
"""Async Call to HuggingFaceHub's embedding endpoint for embedding search docs.
|
"""Async Call to HuggingFaceHub's embedding endpoint for embedding search docs.
|
||||||
@ -132,7 +132,7 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):
|
|||||||
responses = await self.async_client.feature_extraction(
|
responses = await self.async_client.feature_extraction(
|
||||||
text=texts, **_model_kwargs
|
text=texts, **_model_kwargs
|
||||||
)
|
)
|
||||||
return responses
|
return responses.tolist()
|
||||||
|
|
||||||
def embed_query(self, text: str) -> list[float]:
|
def embed_query(self, text: str) -> list[float]:
|
||||||
"""Call out to HuggingFaceHub's embedding endpoint for embedding query text.
|
"""Call out to HuggingFaceHub's embedding endpoint for embedding query text.
|
||||||
|
Loading…
Reference in New Issue
Block a user