Skip to content

Pinned latest litellm for tool_choice=Tool's finish_reason fix #244

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 2 commits into from
Jun 13, 2025

Conversation

jamesbraza
Copy link
Collaborator

Apparently the latest litellm minor version fixed some unexpected behavior

@jamesbraza jamesbraza self-assigned this Jun 13, 2025
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 01:13
@jamesbraza jamesbraza added the enhancement New feature or request label Jun 13, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the dependency for litellm to a pinned version (>=1.72.0) to address issues with the finish_reason behavior when using tool_choice, and removes an outdated assignment and TODO comment in the utils module.

  • Pin litellm dependency to version 1.72.0
  • Remove the unused expected_finish_reason variable and its associated comment

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/aviary/tools/utils.py Removed an unused expected_finish_reason variable and its TODO
pyproject.toml Updated and simplified the litellm dependency pinning
Comments suppressed due to low confidence (2)

src/aviary/tools/utils.py:71

  • Since litellm now fixes the finish_reason behavior, consider removing the outdated TODO and verifying that no other part of the code depends on the expected_finish_reason variable.
-            expected_finish_reason = {"stop"}  # TODO: should this be .add("stop") too?

pyproject.toml:82

  • Ensure that removing the python_version dependent conditions for litellm does not impact environments that might require a lower version; if all targeted environments are supported by this version, the change is acceptable.
+    "litellm>=1.72.0",  # Pin for fixed finish_reason when specifying a tool_choice

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 13, 2025
@@ -69,7 +69,6 @@ async def __call__(
"type": "function",
"function": {"name": tool_choice.info.name},
}
expected_finish_reason = {"stop"} # TODO: should this be .add("stop") too?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I never understood why the finish_reason was "stop" when we'd directly specified to call a Tool.

Turns out it was a litellm bug fixed sometime between litellm==1.71.1 and litellm==1.72.0

@jamesbraza jamesbraza merged commit 3e5debb into main Jun 13, 2025
10 checks passed
@jamesbraza jamesbraza deleted the newer-litellm branch June 13, 2025 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants