mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 15:19:33 +00:00
## **Description** This PR updates the LangChain documentation to address an issue where the `HuggingFaceEndpoint` example **does not specify the required `task` argument**. Without this argument, users on `huggingface_hub == 0.28.1` encounter the following error: ``` ValueError: Task unknown has no recommended model. Please specify a model explicitly. ``` --- ## **Issue** Fixes #29685 --- ## **Changes Made** ✅ **Updated `HuggingFaceEndpoint` documentation** to explicitly define `task="text-generation"`: ```python llm = HuggingFaceEndpoint( repo_id=GEN_MODEL_ID, huggingfacehub_api_token=HF_TOKEN, task="text-generation" # Explicitly specify task ) ``` ✅ **Added a deprecation warning note** and recommended using `InferenceClient`: ```python from huggingface_hub import InferenceClient from langchain.llms.huggingface_hub import HuggingFaceHub client = InferenceClient(model=GEN_MODEL_ID, token=HF_TOKEN) llm = HuggingFaceHub( repo_id=GEN_MODEL_ID, huggingfacehub_api_token=HF_TOKEN, client=client, ) ``` --- ## **Dependencies** - No new dependencies introduced. - Change only affects **documentation**. --- ## **Testing** - ✅ Verified that adding `task="text-generation"` resolves the issue. - ✅ Tested the alternative approach with `InferenceClient` in Google Colab. --- ## **Twitter Handle (Optional)** If this PR gets announced, a shout-out to **@AkmalJasmin** would be great! 🚀 --- ## **Reviewers** 📌 **@langchain-maintainers** Please review this PR. Let me know if further changes are needed. 🚀 This fix improves **developer onboarding** and ensures the **LangChain documentation remains up to date**! 🚀
This commit is contained in:
parent
3de445d521
commit
bc5fafa20e
@ -443,6 +443,7 @@
|
||||
"llm = HuggingFaceEndpoint(\n",
|
||||
" repo_id=GEN_MODEL_ID,\n",
|
||||
" huggingfacehub_api_token=HF_TOKEN,\n",
|
||||
" task=\"text-generation\",\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user