mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
fix(gemini): filter out thought=true image parts in LiteLLM vertex parser
Gemini image-preview models may return intermediate images during reasoning with `thought=true`. LiteLLM was including these images in final responses, resulting in multiple images returned. This patch filters out parts where `thought=true` during image extraction.
This commit is contained in:
parent
9942d59631
commit
1bf5a88408
1 changed files with 2 additions and 0 deletions
|
|
@ -1431,6 +1431,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
|
|||
"""Extract image response from parts if present"""
|
||||
images: List[ImageURLListItem] = []
|
||||
for part in parts:
|
||||
if isinstance(part, dict) and part.get("thought") is True:
|
||||
continue
|
||||
if "inlineData" in part:
|
||||
inline_data = part.get("inlineData", {})
|
||||
mime_type = inline_data.get("mimeType", "")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue