mirror of
https://github.com/usestrix/strix.git
synced 2026-10-13 03:57:59 +00:00
Refactor API type handling in models.py
This commit is contained in:
parent
2eac866b51
commit
9585cea6d0
1 changed files with 9 additions and 3 deletions
|
|
@ -632,9 +632,11 @@ def configure_sdk_model_defaults(settings: Settings) -> None:
|
|||
if llm.api_base:
|
||||
os.environ["OPENAI_BASE_URL"] = llm.api_base
|
||||
_configure_litellm_default("api_base", llm.api_base)
|
||||
set_default_openai_api("chat_completions")
|
||||
else:
|
||||
set_default_openai_api("responses")
|
||||
api_type = llm.api_type
|
||||
if api_type is None:
|
||||
api_type = "chat_completions" if llm.api_base else "responses"
|
||||
|
||||
set_default_openai_api(api_type)
|
||||
_configure_extra_headers(llm)
|
||||
|
||||
|
||||
|
|
@ -806,6 +808,10 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue