From 5663bcf0d20a01ebb56a5bd27a349dc2cbc06ce0 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Mon, 22 Jun 2026 16:16:51 +0000 Subject: [PATCH] fix(interactions): drop role from Interaction response to match Google spec Google removed the output-only role field from the Interaction schema (it now lives only on Turn), so the live OpenAPI compliance canary started failing with 'role' not in spec. Reconcile our generated types by removing role from Interaction, CreateModelInteractionParams, CreateAgentInteractionParams and from the LiteLLM InteractionsAPIResponse/InteractionsAPIStreamingResponse, stop stamping role=model in the responses-to-interactions transformation, and update the compliance and integration tests accordingly. Turn.role is kept since the spec still defines it. --- .../transformation.py | 3 --- litellm/types/interactions/generated.py | 11 ----------- .../test_google_interactions_integration.py | 1 - .../interactions/test_openapi_compliance.py | 4 ++-- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/litellm/interactions/litellm_responses_transformation/transformation.py b/litellm/interactions/litellm_responses_transformation/transformation.py index 173d4ca8764..0ff1a97cd0b 100644 --- a/litellm/interactions/litellm_responses_transformation/transformation.py +++ b/litellm/interactions/litellm_responses_transformation/transformation.py @@ -300,9 +300,6 @@ class LiteLLMResponsesInteractionsConfig: "total_output_tokens": getattr(usage, "output_tokens", 0), } - # Add role - interactions_response_dict["role"] = "model" - # Add updated (same as created for now) interactions_response_dict["updated"] = created diff --git a/litellm/types/interactions/generated.py b/litellm/types/interactions/generated.py index b38cd8f58b9..a07642073af 100644 --- a/litellm/types/interactions/generated.py +++ b/litellm/types/interactions/generated.py @@ -954,9 +954,6 @@ class Interaction(BaseModel): None, description="Output only. The time at which the response was last updated in ISO 8601 format\n(YYYY-MM-DDThh:mm:ssZ).", ) - role: Optional[str] = Field( - None, description="Output only. The role of the interaction." - ) outputs: Optional[List[Content]] = Field( None, description="Output only. Responses from the model." ) @@ -1031,9 +1028,6 @@ class CreateModelInteractionParams(BaseModel): None, description="Output only. The time at which the response was last updated in ISO 8601 format\n(YYYY-MM-DDThh:mm:ssZ).", ) - role: Optional[str] = Field( - None, description="Output only. The role of the interaction." - ) outputs: Optional[List[Content]] = Field( None, description="Output only. Responses from the model." ) @@ -1101,9 +1095,6 @@ class CreateAgentInteractionParams(BaseModel): None, description="Output only. The time at which the response was last updated in ISO 8601 format\n(YYYY-MM-DDThh:mm:ssZ).", ) - role: Optional[str] = Field( - None, description="Output only. The role of the interaction." - ) outputs: Optional[List[Content]] = Field( None, description="Output only. Responses from the model." ) @@ -1323,7 +1314,6 @@ class InteractionsAPIResponse(BaseLiteLLMOpenAIResponseObject): status: Optional[str] = None created: Optional[str] = None updated: Optional[str] = None - role: Optional[str] = None # Legacy schema field (Api-Revision: 2026-05-07). Remove after June 8, 2026. outputs: Optional[List[Dict[str, Any]]] = None # New schema field (Api-Revision: 2026-05-20). @@ -1356,7 +1346,6 @@ class InteractionsAPIStreamingResponse(BaseLiteLLMOpenAIResponseObject): status: Optional[str] = None created: Optional[str] = None updated: Optional[str] = None - role: Optional[str] = None # Legacy schema field (Api-Revision: 2026-05-07). Remove after June 8, 2026. outputs: Optional[List[Dict[str, Any]]] = None # New schema field (Api-Revision: 2026-05-20). diff --git a/tests/test_litellm/interactions/test_google_interactions_integration.py b/tests/test_litellm/interactions/test_google_interactions_integration.py index cfff26d51ef..9c651cc94f5 100644 --- a/tests/test_litellm/interactions/test_google_interactions_integration.py +++ b/tests/test_litellm/interactions/test_google_interactions_integration.py @@ -299,7 +299,6 @@ class TestGoogleInteractionsResponseStructure: assert hasattr(response, "outputs") assert hasattr(response, "usage") assert hasattr(response, "model") or hasattr(response, "agent") - assert hasattr(response, "role") assert hasattr(response, "created") assert hasattr(response, "updated") diff --git a/tests/test_litellm/interactions/test_openapi_compliance.py b/tests/test_litellm/interactions/test_openapi_compliance.py index aededaaca77..810c6a0ca08 100644 --- a/tests/test_litellm/interactions/test_openapi_compliance.py +++ b/tests/test_litellm/interactions/test_openapi_compliance.py @@ -159,13 +159,13 @@ class TestResponseCompliance: # schema no longer carries `steps`. Keep this aligned with the live spec. schema = spec_dict["components"]["schemas"]["Interaction"] - # Output fields (readOnly). + # Output fields (readOnly). `role` was removed from the `Interaction` + # schema by Google; it now lives only on `Turn`. output_fields = [ "id", "status", "created", "updated", - "role", "steps", "usage", ]