Seems to fix the vetting stage
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user