mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
Merge 52134a2602 into 1af7a403c6
This commit is contained in:
commit
f18b2e5fe3
2 changed files with 28 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ class CacheControlSupportedModels(str, Enum):
|
|||
MINIMAX = "minimax"
|
||||
GLM = "glm"
|
||||
ZAI = "z-ai"
|
||||
QWEN = "qwen"
|
||||
|
||||
|
||||
class OpenrouterConfig(OpenAIGPTConfig):
|
||||
|
|
@ -50,6 +51,11 @@ class OpenrouterConfig(OpenAIGPTConfig):
|
|||
):
|
||||
supported_params.append("reasoning_effort")
|
||||
supported_params.append("thinking")
|
||||
|
||||
if self._supports_cache_control_in_content(model):
|
||||
supported_params.append("cache_control")
|
||||
supported_params.append("cache_control_injection_points")
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
return list(dict.fromkeys(supported_params))
|
||||
|
|
|
|||
|
|
@ -40,3 +40,25 @@ def test_openrouter_embedding():
|
|||
assert resp.data[0]["embedding"] is not None
|
||||
assert isinstance(resp.data[0]["embedding"], list)
|
||||
assert len(resp.data[0]["embedding"]) > 0
|
||||
|
||||
|
||||
def test_openrouter_qwen_cache_control_supported():
|
||||
"""
|
||||
Validates that Qwen models routed through OpenRouter cleanly support
|
||||
cache_control and cache_control_injection_points parameters,
|
||||
resolving issue #29322.
|
||||
"""
|
||||
from litellm.llms.openrouter.chat.transformation import OpenrouterConfig
|
||||
|
||||
config = OpenrouterConfig()
|
||||
qwen_model = "openrouter/qwen/qwen3.6-flash"
|
||||
|
||||
# Retrieve the dynamically mapped parameters for the Qwen endpoint
|
||||
supported_params = config.get_supported_openai_params(model=qwen_model)
|
||||
|
||||
# Assertions to ensure the translation layer captures the caching parameters
|
||||
assert "cache_control" in supported_params, f"cache_control missing from supported parameters for {qwen_model}"
|
||||
assert "cache_control_injection_points" in supported_params, f"cache_control_injection_points missing from supported parameters for {qwen_model}"
|
||||
print("✅ test_openrouter_qwen_cache_control_supported passed!")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue