Seems to fix the vetting stage

This commit is contained in:
2025-08-21 21:07:20 +00:00
parent d689facb61
commit a2455bcbec
+15 -4
View File
@@ -425,10 +425,21 @@ class LLMAgent(AgentWithMemory):
)
conversation_messages = [m for m in messages if m.get("role") != "system"]
contents: List[Dict[str, Any]] = [
{"role": msg["role"], "parts": [{"text": msg["content"]}]}
for msg in conversation_messages
]
# Map roles to Google Gemini's expected format
role_mapping = {
"user": "user",
"assistant": "model",
"model": "model" # In case it's already mapped
}
contents: List[Dict[str, Any]] = []
for msg in conversation_messages:
original_role = msg.get("role", "user")
gemini_role = role_mapping.get(original_role, "user")
contents.append({
"role": gemini_role,
"parts": [{"text": msg["content"]}]
})
data: Dict[str, Any] = {
"contents": contents,