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

feat: Update handling of tools_strict to ensure compatibility with vLLM #150

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

Emil-io
Copy link
Contributor

@Emil-io Emil-io commented Dec 9, 2024

Proposed Changes:

Only add the "strict" dictionary to the openai_tools for generation, if tools_strict is available.

This ensures compatibility with vLLM (which adopts the OpenAI Interface). vLLM throws an error, if the "strict" dictionary is part of the tools list:

openai.BadRequestError: Error code: 400 - {'object': 'error', 'message': "[{'type': 'extra_forbidden', 'loc': ('body', 'tools', 0, 'function', 'strict'), 'msg': 'Extra inputs are not permitted', 'input': False}

How did you test it?

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

@Emil-io Emil-io requested a review from a team as a code owner December 9, 2024 15:47
@Emil-io Emil-io requested review from julian-risch and removed request for a team December 9, 2024 15:47
@coveralls
Copy link

coveralls commented Dec 9, 2024

Pull Request Test Coverage Report for Build 12260150231

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

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

Files with Coverage Reduction New Missed Lines %
components/generators/chat/openai.py 7 88.48%
components/extractors/llm_metadata_extractor.py 46 70.7%
Totals Coverage Status
Change from base Build 12246737953: 0.08%
Covered Lines: 2037
Relevant Lines: 2448

💛 - Coveralls

@julian-risch julian-risch changed the title Update handling of tools_strict to ensure compatibility with vLLM feat: Update handling of tools_strict to ensure compatibility with vLLM Dec 10, 2024
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

I have a small change request but other than that the PR looks good to me. I would like to get another review from @vblagoje or @anakin87 before we merge.

haystack_experimental/components/generators/chat/openai.py Outdated Show resolved Hide resolved
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.

LGTM!

Copy link
Member

@vblagoje vblagoje left a comment

Choose a reason for hiding this comment

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

LGTM as well

@anakin87 anakin87 dismissed julian-risch’s stale review December 10, 2024 17:58

the suggestion was incorporated

@anakin87 anakin87 merged commit 7ade6a2 into deepset-ai:main Dec 10, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants