The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(interactions): follow Google spec drift replacing Turn with typed steps (#36730)
Mateo Wang73e555a3e3a7
diff --git a/tests/test_litellm/interactions/test_google_interactions_integration.py b/tests/test_litellm/interactions/test_google_interactions_integration.pyindex 9c651cc94f5..41f0fa0d7fb 100644--- a/tests/test_litellm/interactions/test_google_interactions_integration.py+++ b/tests/test_litellm/interactions/test_google_interactions_integration.py@@ -55,17 +55,10 @@ class TestGoogleInteractionsCreate:print(f"Usage: {response.usage}")def test_create_with_content_list(self, api_key):- """Test creating an interaction with a structured content list (Turn format)."""+ """Test creating an interaction with a structured content list (Content[] input)."""response = interactions.create(model="gemini/gemini-2.5-flash",- input=[- {- "role": "user",- "content": [- {"type": "text", "text": "What is the capital of France?"}- ],- }- ],+ input=[{"type": "text", "text": "What is the capital of France?"}],api_key=api_key,)@@ -169,25 +162,25 @@ class TestGoogleInteractionsStreaming:class TestGoogleInteractionsMultiTurn:- """Tests for multi-turn conversations using Turn[] input."""+ """Tests for multi-turn conversations using Step[] input."""def test_multi_turn_conversation(self, api_key):- """Test a multi-turn conversation per OpenAPI spec (Turn[] format)."""+ """Test a multi-turn conversation per OpenAPI spec (Step[] format)."""response = interactions.create(model="gemini/gemini-2.5-flash",input=[{- "role": "user",+ "type": "user_input","content": [{"type": "text", "text": "My name is Alice."}],},{- "role": "model",+ "type": "model_output","content": [{"type": "text", "text": "Hello Alice! Nice to meet you."}],},{- "role": "user",+ "type": "user_input","content": [{"type": "text", "text": "What is my name?"}],},],diff --git a/tests/test_litellm/interactions/test_openapi_compliance.py b/tests/test_litellm/interactions/test_openapi_compliance.pyindex 1fe343ca6ee..2665f8703a6 100644--- a/tests/test_litellm/interactions/test_openapi_compliance.py+++ b/tests/test_litellm/interactions/test_openapi_compliance.py@@ -167,17 +167,39 @@ class TestRequestCompliance:assert text_schema["properties"]["type"].get("const") == "text"print("✓ TextContent schema is correct")- def test_turn_schema(self, spec_dict):- """Verify Turn schema for multi-turn conversations."""- turn_schema = spec_dict["components"]["schemas"]["Turn"]-- assert "role" in turn_schema["properties"]- assert "content" in turn_schema["properties"]+ def test_step_schema(self, spec_dict):+ """Verify step-based multi-turn input.++ Google replaced the role-carrying `Turn` schema with typed steps+ (spec update of Aug 13, 2026): conversation history is now a `Step[]`+ where `UserInputStep`/`ModelOutputStep` pin `type` values that our+ transformations read to recover the role. Assert exactly what our code+ depends on: `InteractionsInput` accepts a Step array, both step kinds+ are part of the `Step` union, each pins its `type` const, and each+ carries a `Content[]` content field.+ """+ input_schema = spec_dict["components"]["schemas"]["InteractionsInput"]+ step_array_items = [+ option["items"]["$ref"].split("/")[-1]+ for option in input_schema["oneOf"]+ if option.get("type") == "array" and "$ref" in option.get("items", {})+ ]+ assert "Step" in step_array_items, f"InteractionsInput should accept Step[], got arrays of {step_array_items}"- # Content can be string or Content[]- content_prop = turn_schema["properties"]["content"]- assert "oneOf" in content_prop- print("✓ Turn schema supports role + content")+ step_variants = {+ option["$ref"].split("/")[-1]+ for option in spec_dict["components"]["schemas"]["Step"]["oneOf"]+ if "$ref" in option+ }+ assert {"UserInputStep", "ModelOutputStep"} <= step_variants, f"Step union is missing role steps: {step_variants}"++ for step_name, type_value in [("UserInputStep", "user_input"), ("ModelOutputStep", "model_output")]:+ step_schema = spec_dict["components"]["schemas"][step_name]+ assert step_schema["properties"]["type"].get("const") == type_value+ assert "type" in step_schema["required"]+ content_items = step_schema["properties"]["content"]["items"]+ assert content_items["$ref"].split("/")[-1] == "Content"+ print(f"✓ {step_name} pins type '{type_value}' with Content[] content")class TestResponseCompliance: