The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
huggingface: Fix huggingface tei support (#22653)
Jiejun Tan2be66a38d849
diff --git a/libs/community/langchain_community/embeddings/huggingface_hub.py b/libs/community/langchain_community/embeddings/huggingface_hub.pyindex 0ee0881d2e..df95a2d272 100644--- a/libs/community/langchain_community/embeddings/huggingface_hub.py+++ b/libs/community/langchain_community/embeddings/huggingface_hub.py@@ -112,8 +112,9 @@ class HuggingFaceHubEmbeddings(BaseModel, Embeddings):# replace newlines, which can negatively affect performance.texts = [text.replace("\n", " ") for text in texts]_model_kwargs = self.model_kwargs or {}+ # api doc: https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/embedresponses = self.client.post(- json={"inputs": texts, "parameters": _model_kwargs}, task=self.task+ json={"inputs": texts, **_model_kwargs}, task=self.task)return json.loads(responses.decode())diff --git a/libs/partners/huggingface/langchain_huggingface/embeddings/huggingface_endpoint.py b/libs/partners/huggingface/langchain_huggingface/embeddings/huggingface_endpoint.pyindex 519a42ae39..20df972cb2 100644--- a/libs/partners/huggingface/langchain_huggingface/embeddings/huggingface_endpoint.py+++ b/libs/partners/huggingface/langchain_huggingface/embeddings/huggingface_endpoint.py@@ -108,8 +108,9 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):# replace newlines, which can negatively affect performance.texts = [text.replace("\n", " ") for text in texts]_model_kwargs = self.model_kwargs or {}+ # api doc: https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/embedresponses = self.client.post(- json={"inputs": texts, "parameters": _model_kwargs}, task=self.task+ json={"inputs": texts, **_model_kwargs}, task=self.task)return json.loads(responses.decode())