-
Notifications
You must be signed in to change notification settings - Fork 16.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: HuggingFaceEndpoint Requires Explicit task
Argument, but Documentation Omits It
#29685
Closed
2 tasks done
Labels
🤖:docs
Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
Comments
jasminaaa20
added a commit
to jasminaaa20/langchain
that referenced
this issue
Feb 8, 2025
XinyaoWa
added a commit
to XinyaoWa/GenAIComps
that referenced
this issue
Feb 11, 2025
Some bugs exists when using HuggingFaceEndpoint with latest langchain and huggingface_hub version, fix version until fix Related issue link: langchain-ai/langchain#29685, https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407/discussions/42#67a8c255bc29a95bc04e9ec2 Signed-off-by: Xinyao Wang <[email protected]>
bluearrow98
pushed a commit
to bluearrow98/langchain
that referenced
this issue
Feb 13, 2025
…nt in documentation (langchain-ai#29686) ## **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 langchain-ai#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**! 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🤖:docs
Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
URL
https://python.langchain.com/docs/integrations/document_loaders/docling/
Checklist
Issue with current documentation:
Issue Description
The current LangChain documentation does not specify that the
HuggingFaceEndpoint
class requires an explicittask
argument when using Hugging Face models.Running the provided documentation code results in an error due to the missing task argument, with
huggingface_hub == 0.28.1
.Affected Documentation Code
Error Message (from Colab)
Environment Details
latest
0.28.1
3.11
Reproduction Steps
huggingface_hub == 0.28.1
.task
.task="text-generation"
→ The issue gets resolved.Screenshots
Attached below is an image of the error message that comes up when I run the documentation notebook in Colab.
This issue ensures better onboarding for LangChain users and prevents errors in production. 🚀
Idea or request for content:
No response
The text was updated successfully, but these errors were encountered: