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: unnecessary prevention of tool calls for finish reason #257

Merged
merged 2 commits into from
May 18, 2024
Merged

Conversation

willbakst
Copy link
Contributor

@willbakst willbakst commented May 18, 2024

Closes #256

  • Noticed that we were unnecessarily preventing correct behavior if finish_reason not in ["tool_calls", "function_call"] even if tools were present.
  • This prevented proper use of tool_choice="required" since it results (sometimes? always?) in finish_reason == "stop"
  • Now instead we simply check if finish_reason == "length" so let the user know it failed to call the tool (if it was trying to) because it ran out of tokens.
  • Made other similar changes for other providers

Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b74ed17) to head (a3bb545).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #257   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          126       126           
  Lines         6371      6384   +13     
=========================================
+ Hits          6371      6384   +13     
Flag Coverage Δ
tests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@willbakst willbakst merged commit e6b4fbe into dev May 18, 2024
8 checks passed
@willbakst willbakst deleted the fix-256 branch May 18, 2024 15:12
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.

OpenAI GPT tool_choice="required" finishes with stop reason stop which throws error even though tool is called
1 participant