test(snowflake): expect a string system prompt's cache_control mark on Snowflake Claude
Some checks are pending
Cost map pins recheck / rerun-cost-map-guard (push) Waiting to run
LiteLLM Rust DB / db-queries (push) Waiting to run
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
LiteLLM Rust / rust-wheel (push) Waiting to run
Terraform Provider / gofmt, vet, build, test (push) Waiting to run
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Waiting to run

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.
This commit is contained in:
mateo-berri 2026-10-31 05:16:40 -07:00
parent fb753f003d
commit 1fecc7a8f8
2 changed files with 10 additions and 1 deletions

View file

@ -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"),

View file

@ -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"}],