fix: cherry-pick upstream metadata None check [sc-521238] - #28
Merged
mateo-di merged 4 commits intoNov 14, 2025
Merged
Conversation
If the client sets the `labels` field in the request to the LiteLLM: - pass the `labels` field to the Vertex AI backend If the client sets the `metadata` field in the request to the LiteLLM: - if the `labels` field is not set, fill it with `metadata` key/value pairs for all string values
mateo-di
marked this pull request as ready for review
November 12, 2025 12:58
The check_if_part_exists_in_parts function exists in upstream-sync-resolver/24 but not in carto/main yet. Removing tests until that branch is merged.
The upstream cherry-pick removed CARTO's provider-specific labels logic from PR BerriAI#14563. Google AI Studio (gemini provider) should NOT include labels field. This commit preserves BOTH fixes: - Upstream metadata None check (from commit 944176f) - CARTO provider-aware filtering (from PR BerriAI#14563 / commit 5748d6d)
3 tasks
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Shortcut
Cherry-picks upstream fix for TypeError when
litellm_params['metadata']is None for custom Google AI Studio models.Bug Report
Reported by: Ana Manzanares (Slack, 2025-11-12)
Error:
TypeError: argument of type 'NoneType' is not iterableattransformation.py:369Affected: Custom Google AI Studio models (e.g.,
ac_cb7b9151::gemini-2.5-pro)Works: OpenAI models, CARTO Managed Models
Solution
Cherry-picked two upstream commits:
Bug introduced (March 2025): Optional
labelsfield in Vertex AI request3626b6d9baBug fixed (September 2025): Check if metadata is not None
60f640a9ecChanges
Fixed:
litellm/llms/vertex_ai/gemini/transformation.py:369metadata is not None andbefore theinchecktype(v) is strtoisinstance(v, str)(better practice)Note: Cherry-pick initially removed
speechConfigfromvertex_ai.pydue to merge context differences - this was corrected andspeechConfigis preserved.Type of change
Acceptance
GitHub Actions will validate:
Basic checklist
Notes