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

Fixing ToolSelector handling finish_reason properly #60

Merged
merged 3 commits into from
Oct 6, 2024

Conversation

jamesbraza
Copy link
Collaborator

From https://platform.openai.com/docs/guides/function-calling/configuring-function-calling-behavior-using-the-tool_choice-parameter, it turns out if one requires a tool call, the finish_reason will be stop not required (which imo is a bad API set up).

This gotcha was not implemented yesterday in #59, but it snuck through here due to our test cassettes. This PR:

  1. Fixes the logic to handle the varied finish_reason
  2. Updates test logic and cassettes to reveal this possibility

@jamesbraza jamesbraza added the bug Something isn't working label Oct 6, 2024
@jamesbraza jamesbraza self-assigned this Oct 6, 2024
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 6, 2024
@jamesbraza jamesbraza force-pushed the fixing-finish-reason branch from 24bc8fb to 4bff08a Compare October 6, 2024 19:03
Copy link
Contributor

@Ryan-Rhys Ryan-Rhys left a comment

Choose a reason for hiding this comment

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

LGTM!

@jamesbraza
Copy link
Collaborator Author

jamesbraza commented Oct 6, 2024

I just made BerriAI/litellm#6091 so we can someday upstream this logic to LiteLLM

@jamesbraza jamesbraza merged commit 6f930a5 into main Oct 6, 2024
6 checks passed
@jamesbraza jamesbraza deleted the fixing-finish-reason branch October 6, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants