Skip to content
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

[fix] error on invoke HuggingFaceEndpoint Bad request: following model_kwargs #27020

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Warra07
Copy link

@Warra07 Warra07 commented Oct 1, 2024

  • fix invoke error on HuggingFaceEndpoint: "fix invoke error HuggingFaceEndpoint Bad request"

    • Description: ability to set 'stop_sequences' parameter to None on models that doesn't uses it
    • Issue: from 18321 When trying to use invoke on some models with HuggingFaceEndpoint, users may get the following error:
      Bad request: The following model_kwargs are not used by the model: ['return_full_text', 'stop', 'watermark', 'stop_sequences']
      this is due to the fact that the call function send those parameters to the huggingface inferenceClient and huggingface raise an error if those parameters are not used, in this specific case, the user should set the unused parameters to None on the invoker.
      however for the specific case of 'stop_sequences' and 'stop', if we set them up to None an error occured because the call was still trying to iterate through the stop_sequences parameter and concatenate it
    • Dependencies: No new dependency
  • Add tests and docs: modified integration_tests/llms/test_huggingface_endpoint.py file to reflect the change, tests did not work properly previously.
    also added a note on HuggingFaceEndpoint docstring to inform users.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 1, 2024
Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 9:55am

@dosubot dosubot bot added community Related to langchain-community 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature community Related to langchain-community size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

1 participant