diff --git a/datapizza-ai-core/datapizza/type/type.py b/datapizza-ai-core/datapizza/type/type.py index 268d76ea..d86facaf 100644 --- a/datapizza-ai-core/datapizza/type/type.py +++ b/datapizza-ai-core/datapizza/type/type.py @@ -29,7 +29,10 @@ def google_role(self) -> str: elif self == ROLE.ASSISTANT or self == ROLE.SYSTEM: return "model" elif self == ROLE.TOOL: - return "tool" + # Gemini 3.x rejects the "tool" role with 400 INVALID_ARGUMENT + # ("Role 'tool' is not supported"); function responses must be + # sent as "user" turns, which older models accept as well. + return "user" else: raise ValueError(f"Unknown role: {self}")