You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LiteLLM ADK wrapper does not handle instructions properly. #3657
Uses [role='system'] directly in [Content] objects
OR passes [system_instruction] in [GenerateContentConfig] (not as a message)
Gemini API natively understands this field
LiteLLM ADK Wrapper:
Converts [system_instruction] to a message with [role='developer']
Tries to use OpenAI's convention
But the "developer" role is OpenAI-specific!
Claude/Anthropic expect [role='system']
LiteLLM's Anthropic handler filters for [role='system'], not [role='developer']
Result and bug: System instruction is ignored or mishandled.
This causes system instructions to be lost for Claude, resulting in a poorly formatted output.
The best is to patch ADK to use [role="system"] and that would work for everyone.
Here is a proposed patch.
# in lite_llm.py around like 902
messages.insert(
0,
ChatCompletionSystemMessage( # Changed from ChatCompletionDeveloperMessage
role="system", # Changed from "developer"
content=llm_request.config.system_instruction,
),
)
Activity
fix: Update LiteLLM system instruction role from "developer" to "system"
fix: Update LiteLLM system instruction role from "developer" to "system"
fix: Update LiteLLM system instruction role from "developer" to "system"