mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 21:20:33 +00:00
[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:
parent
644723adda
commit
4796b7eb15
@ -443,7 +443,6 @@ class ChatHuggingFace(BaseChatModel):
|
|||||||
|
|
||||||
from huggingface_hub import list_inference_endpoints # type: ignore[import]
|
from huggingface_hub import list_inference_endpoints # type: ignore[import]
|
||||||
|
|
||||||
available_endpoints = list_inference_endpoints("*")
|
|
||||||
if _is_huggingface_hub(self.llm) or (
|
if _is_huggingface_hub(self.llm) or (
|
||||||
hasattr(self.llm, "repo_id") and self.llm.repo_id
|
hasattr(self.llm, "repo_id") and self.llm.repo_id
|
||||||
):
|
):
|
||||||
@ -456,7 +455,7 @@ class ChatHuggingFace(BaseChatModel):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
endpoint_url = self.llm.endpoint_url
|
endpoint_url = self.llm.endpoint_url
|
||||||
|
available_endpoints = list_inference_endpoints("*")
|
||||||
for endpoint in available_endpoints:
|
for endpoint in available_endpoints:
|
||||||
if endpoint.url == endpoint_url:
|
if endpoint.url == endpoint_url:
|
||||||
self.model_id = endpoint.repository
|
self.model_id = endpoint.repository
|
||||||
|
Loading…
Reference in New Issue
Block a user