Skip to content

feat: Allow passing of additional parameters to HF Inference clients in HuggingFaceAPIChatGenerator and HuggingFaceAPIGenerator #9457

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

Merged
merged 5 commits into from
Jun 3, 2025

Conversation

sjrl
Copy link
Contributor

@sjrl sjrl commented May 30, 2025

Related Issues

Proposed Changes:

Allow passing of additional params to the underlying Inference clients through the already existing api_params variable. This now allows us to pass a provider like hf-inference which doesn't have the issue.

How did you test it?

Tested failing tests.

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@sjrl sjrl requested review from a team as code owners May 30, 2025 09:28
@sjrl sjrl requested review from dfokina, mpangrazzi and anakin87 and removed request for a team and mpangrazzi May 30, 2025 09:28
@sjrl sjrl self-assigned this May 30, 2025
@github-actions github-actions bot added the type:documentation Improvements on the docs label May 30, 2025
@coveralls
Copy link
Collaborator

coveralls commented May 30, 2025

Pull Request Test Coverage Report for Build 15343971673

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 90.371%

Files with Coverage Reduction New Missed Lines %
components/generators/hugging_face_api.py 2 96.34%
components/generators/chat/hugging_face_api.py 7 95.63%
Totals Coverage Status
Change from base Build 15342244268: 0.03%
Covered Lines: 11460
Relevant Lines: 12681

💛 - Coveralls

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

This also fixes #9350, and I would refine the release note to emphasize that using different Inference Providers via the HF API is now supported in Haystack.

@sjrl sjrl removed their assignment Jun 3, 2025
@sjrl sjrl enabled auto-merge (squash) June 3, 2025 10:02
@sjrl sjrl merged commit 5fcd7c4 into main Jun 3, 2025
25 of 27 checks passed
@sjrl sjrl deleted the fix-hf-api-tests branch June 3, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Inference Providers in HF API components
3 participants