huggingface: fix embeddings return type (#31072)

Integration tests failing

cc @hanouticelina
This commit is contained in:
ccurme 2025-04-29 14:45:04 -04:00 committed by GitHub
parent 868f07f8f4
commit bdb7c4a8b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,7 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):
_model_kwargs = self.model_kwargs or {}
# api doc: https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/embed
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 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(
text=texts, **_model_kwargs
)
return responses
return responses.tolist()
def embed_query(self, text: str) -> list[float]:
"""Call out to HuggingFaceHub's embedding endpoint for embedding query text.