[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 <erick@langchain.dev>
Co-authored-by: ccurme <chester.curme@gmail.com>
This commit is contained in:
Mohammad Mohtashim 2024-06-28 00:37:20 +05:00 committed by GitHub
parent 644723adda
commit 4796b7eb15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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