Skip to content

Pass extra_body params in the request-body to vertexAI - #14311

Closed
bhanu97 wants to merge 3 commits into
BerriAI:mainfrom
bhanu97:pass-extrabody-params-to-vertexAI
Closed

Pass extra_body params in the request-body to vertexAI#14311
bhanu97 wants to merge 3 commits into
BerriAI:mainfrom
bhanu97:pass-extrabody-params-to-vertexAI

Conversation

@bhanu97

@bhanu97 bhanu97 commented Sep 7, 2025

Copy link
Copy Markdown

Title

Support for passing extra_body (eg:- labels ) parameters to Vertex AI models

Relevant issues

#13692

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

litellm/llms/vertex_ai/gemini/transformation.py: Logic to pass along extra_body params
tests/test_litellm/llms/vertex_ai/test_vertex.py: Added Test case

extra body params passed to the request body
@vercel

vercel Bot commented Sep 7, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Sep 7, 2025 1:18pm

@CLAassistant

CLAassistant commented Sep 7, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@bhanu97

bhanu97 commented Sep 7, 2025

Copy link
Copy Markdown
Author

I’ve updated the implementation to support passing labels and other explicitly allowed fields via extra_body as per the suggestions in #9175

  • extra_body keys are now merged into the Vertex AI request body without overriding already set parameters
  • This keeps the request transformation safe while still giving flexibility to add optional fields like labels.

Could you please take a look and approve if everything looks good? Please let me know of any suggestions/changes.

@krrishdholakia @ishaan-jaff

@ghost

ghost commented Sep 7, 2025

Copy link
Copy Markdown

This is not needed. Provider specific params are already passed straight through. https://docs.litellm.ai/docs/completion/provider_specific_params

Can you share the issue you face today? With steps to repro

@bhanu97

bhanu97 commented Sep 8, 2025

Copy link
Copy Markdown
Author

@krrishdholakia Unfortunately, that's not the case with Vertex-AI. There are only a few parameters that are being set in the requestBody (attached the code snippet), all other optional_parameters are ignored. More info - #9175
image

There are other parameters which Vertex-AI support Eg: labels which is a must to have cost observability. Really looking forward for this feature to pass-along labels , please have a look

@zrottier

Copy link
Copy Markdown

Any more progress on this one? Seems to be stuck in open with solution proposed?

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions Bot added the stale label Jan 12, 2026
@github-actions github-actions Bot closed this Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants