From 4796b7eb15b4c3a352c950f56a30659f0379f6e2 Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Fri, 28 Jun 2024 00:37:20 +0500 Subject: [PATCH] [Community [HuggingFace]]: Small Fix for ChatHuggingFace. (#22925) - **Description:** A small fix where I moved the `available_endpoints` in order to avoid the token error in the below issue. Also I have added conftest file and updated the `scripy`,`numpy` versions to support newer python versions in poetry files. - **Issue:** #22804 --------- Co-authored-by: Erick Friis Co-authored-by: ccurme --- .../langchain_huggingface/chat_models/huggingface.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py index 23c31655097..dc95c25359a 100644 --- a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py +++ b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py @@ -443,7 +443,6 @@ class ChatHuggingFace(BaseChatModel): from huggingface_hub import list_inference_endpoints # type: ignore[import] - available_endpoints = list_inference_endpoints("*") if _is_huggingface_hub(self.llm) or ( hasattr(self.llm, "repo_id") and self.llm.repo_id ): @@ -456,7 +455,7 @@ class ChatHuggingFace(BaseChatModel): return else: endpoint_url = self.llm.endpoint_url - + available_endpoints = list_inference_endpoints("*") for endpoint in available_endpoints: if endpoint.url == endpoint_url: self.model_id = endpoint.repository