Skip to content

openaiclient: Fix updateToolCalls method for calls proxied with LiteLLM#1440

Open
dzbanek717 wants to merge 10 commits intotmc:mainfrom
dzbanek717:fix/litellm-function-calls
Open

openaiclient: Fix updateToolCalls method for calls proxied with LiteLLM#1440
dzbanek717 wants to merge 10 commits intotmc:mainfrom
dzbanek717:fix/litellm-function-calls

Conversation

@dzbanek717
Copy link

@dzbanek717 dzbanek717 commented Dec 9, 2025

When using LiteLLM as LLM proxy for accessing multiple models with one LLM agent in streaming mode the parameter type: function is always provided due to API conversion on LiteLLM side.

Despite the fact that it seems to be a problem on integration with LiteLLM side the whole problem lays in updateToolCalls function check. The assumption that type is not provided seems to be based more on the observation, rather than actual contract.

Basing on function name not being provided and part of arguments being provided this assumption seems to be also fine. Providing arguments for next tool shall always start with tool name. Therefore we are receiving parts of arguments until we received a new name. And it makes OpenAI Client compatible with both standard OpenAI API and LiteLLM proxy.

PR Checklist

  • Read the Contributing documentation.
  • Read the Code of conduct documentation.
  • Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
  • Describes the source of new concepts.
  • References existing implementations as appropriate.
  • Contains test coverage for new functions.
  • Passes all golangci-lint checks.

@dzbanek717
Copy link
Author

Hello @tmc , any chance on reviewing this?

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.

1 participant