From 1fecc7a8f8ec44d39ed0c6b6cf5efe48b95104e0 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Sat, 31 Oct 2026 05:16:40 -0700 Subject: [PATCH] test(snowflake): expect a string system prompt's cache_control mark on Snowflake Claude Snowflake Claude now builds its system prompt with the shared Anthropic transform, which keeps a message-level cache_control mark on a string system prompt the way the anthropic, vertex, and bedrock routes do. The base dropped that mark on Snowflake alone while it already sent the same block shape for marked system content lists. --- .../test_responses_bridge_message_cache_control_wire.py | 2 +- .../snowflake/chat/test_snowflake_chat_transformation.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/integration/providers/test_responses_bridge_message_cache_control_wire.py b/tests/integration/providers/test_responses_bridge_message_cache_control_wire.py index 4b25275285e..1d3551fe549 100644 --- a/tests/integration/providers/test_responses_bridge_message_cache_control_wire.py +++ b/tests/integration/providers/test_responses_bridge_message_cache_control_wire.py @@ -962,10 +962,10 @@ def _shaped_requests(model: str, shape: str) -> tuple[dict[str, JsonValue], dict pytest.param(f"openrouter/anthropic/{ANTHROPIC_MODEL}", "system", True, id="openrouter-claude"), pytest.param("openrouter/google/gemini-3.8-flash", "system", True, id="openrouter-gemini"), pytest.param("snowflake/claude-4-sonnet", "tool", True, id="snowflake-claude-tool-output"), + pytest.param("snowflake/claude-4-sonnet", "system", True, id="snowflake-claude-string-system"), pytest.param("vertex-claude", "system", True, id="vertex-claude"), pytest.param("sap-claude", "system", True, id="sap-claude"), pytest.param("anthropic/my-gateway-model", "system", True, id="anthropic-non-claude-name"), - pytest.param("snowflake/claude-4-sonnet", "system", False, id="snowflake-claude-string-system"), pytest.param("openrouter/openai/gpt-5.4", "system", False, id="openrouter-gpt"), pytest.param("snowflake/llama3.1-70b", "system", False, id="snowflake-llama"), pytest.param("snowflake/llama-claude-distill", "system", False, id="snowflake-claude-inside-the-name"), diff --git a/tests/unit/llms/snowflake/chat/test_snowflake_chat_transformation.py b/tests/unit/llms/snowflake/chat/test_snowflake_chat_transformation.py index a51174c90c3..f907e92e4ab 100644 --- a/tests/unit/llms/snowflake/chat/test_snowflake_chat_transformation.py +++ b/tests/unit/llms/snowflake/chat/test_snowflake_chat_transformation.py @@ -359,6 +359,15 @@ class TestSnowflakeCortexClaudeFixes: ) assert body["system"] == [{"type": "text", "text": "You are helpful", "cache_control": {"type": "ephemeral"}}] + def test_string_system_prompt_keeps_its_message_cache_control_without_ttl(self): + body = self._transform( + [ + {"role": "system", "content": "You are helpful", "cache_control": {"type": "ephemeral", "ttl": "1h"}}, + {"role": "user", "content": "hi"}, + ] + ) + assert body["system"] == [{"type": "text", "text": "You are helpful", "cache_control": {"type": "ephemeral"}}] + def test_direct_system_param_is_normalized(self): body = self._transform( [{"role": "user", "content": "hi"}],