Skip to content

Commit 8781321

Browse files
fix: 🐛 forward labels parameter to Vertex AI API requests
This fix addresses the issue where the 'labels' parameter was not being forwarded to Vertex AI API requests, preventing Google partnership labels from being properly tracked. Changes: - Added 'labels' field to RequestBody TypedDict in vertex_ai.py - Updated _transform_request_body to extract and pass labels to API - Labels are now correctly included in the request body sent to Vertex AI Fixes #13692
1 parent c0890e7 commit 8781321

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

litellm/llms/vertex_ai/gemini/transformation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ def _transform_request_body(
495495
# Only add labels for Vertex AI endpoints (not Google GenAI/AI Studio) and only if non-empty
496496
if labels and custom_llm_provider != LlmProviders.GEMINI:
497497
data["labels"] = labels
498+
499+
# Add any extra body params passed to the request body
500+
extra_body = optional_params.get("extra_body", {})
501+
if extra_body is not None:
502+
data = {**extra_body, **data}
498503
except Exception as e:
499504
raise e
500505

0 commit comments

Comments
 (0)