langchain 无法通过huggingface_hub进行身份验证,

tcomlyy6  于 3个月前  发布在  其他
关注(0)|答案(1)|浏览(47)

检查其他资源

  • 我为这个问题添加了一个非常描述性的标题。
  • 我使用集成搜索在LangChain文档中进行了搜索。
  • 我使用GitHub搜索查找了一个类似的问题,但没有找到。
  • 我确信这是LangChain中的一个错误,而不是我的代码。
  • 通过更新到LangChain的最新稳定版本(或特定集成包)无法解决此错误。

示例代码

from langchain_community.llms import HuggingFaceEndpoint
llm = HuggingFaceEndpoint(endpoint_url="https://mixtral.ai.me", huggingfacehub_api_token=<token>)

### Error Message and Stack Trace (if applicable)

(can't paste because this issue is from an airgapped environment)

文件 /usr/local/lib/python3.10/dist-packages/pydantic/v1/main.py:341,在BaseModel.init
验证错误:HuggingFaceEndpoint有1个验证错误

无法通过huggingface_hub进行身份验证。请检查您的API令牌。 (类型=值错误)

### Description

I am trying to use HuggingFaceEndpoint in order to query my locally hosted mixtral. I have a proxy before the proxy that accepts Bearer API tokens. The tokens and API works in other places (e.g. postman) but not with langchain. 

### System Info

langchain==0.2.6
langchain-community==0.0.38
langchain-core==0.1.52
langchain-text-splitters==0.2.2

platform: Ubuntu 22.04

Python version: 3.10.12

The runtime is actually Nvidia's Pytorch container from the NGC catalog, tag 24.01. 
The environment is airgapped, and we go through a pipeline in order to bring in new library versions.
tez616oj

tez616oj1#

请考虑迁移到 langchain_huggingface.HuggingFaceEndpoint ——社区版本已被弃用。

相关问题