fix(models): keep LiteLLM chat-completions tool schema when STRIX_API_TYPE=responses

This commit is contained in:
Alex Schapiro 2026-09-16 14:57:17 +00:00
parent 7968ab44c6
commit 80c7f6cd60
2 changed files with 4 additions and 4 deletions

View file

@ -808,13 +808,11 @@ def uses_chat_completions_tool_schema(model_name: str, settings: Settings) -> bo
"""Return whether the resolved SDK route can only receive JSON function tools."""
if codex.subscription_model(model_name):
return False
if settings.llm.api_type == "chat_completions":
return True
if settings.llm.api_type == "responses":
return False
model = model_name.strip().lower()
if "/" in model and not model.startswith("openai/"):
return True
if settings.llm.api_type is not None:
return settings.llm.api_type == "chat_completions"
if settings.llm.api_base:
return True
return not model_supports_reasoning(model_name)

View file

@ -184,6 +184,8 @@ def test_api_type_override_settings(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_LLM", "openai/gpt-4")
monkeypatch.setenv("STRIX_API_TYPE", "responses")
assert uses_chat_completions_tool_schema("openai/gpt-4", Settings()) is False
monkeypatch.setenv("STRIX_LLM", "anthropic/claude-sonnet-4-5")
assert uses_chat_completions_tool_schema("anthropic/claude-sonnet-4-5", Settings()) is True
@pytest.mark.parametrize(