mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
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.
This commit is contained in:
parent
0a82e138a9
commit
5663bcf0d2
4 changed files with 2 additions and 17 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue