Skip to content

Fix additional anyOf corner cases for Vertex AI Gemini tool calls - issue #11164 #12797

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ericgtkb
Copy link

Fix some additional anyof corner cases for #11164

In issue #11164 and PR #11195. The fix adds "title" and "description" back into items in the "anyOf" key for tool calls. However, for cases where neither "title" or "description" exists the fix returns the original schema_dict.

Tool calls that include both "anyOf" and "default" keys at the same level (without "title" or "description") still result in a Bad Request error.

This PR fixes this issue.

Relevant issues

Issue #11164
PR #11195

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
image
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

Vertex AI anyOf in tool calls

  • litellm/llms/vertex_ai/common_utils.py: When no "title" or "description" exists we still filter to keep only the "anyOf" key.
  • tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py: Added a second test case with only "anyOf" and "default" (without "title" or "description").

Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 3:34am

@krrishdholakia
Copy link
Contributor

@ericgtkb Bump me once testing is passing 👍

Thanks for this PR!

@ericgtkb
Copy link
Author

Looks like tests just passed! @krrishdholakia

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.

2 participants