fix: support GPT-5 request contract (max_completion_tokens, reasoning_effort) and switch aimaq voice decisions to gpt-5-nano
deploy / deploy (push) Failing after 0s

This commit is contained in:
a.arystanbek
2026-08-30 20:37:35 +00:00
parent 9bf367abf4
commit 75d105f636
2 changed files with 12 additions and 7 deletions
+9 -4
View File
@@ -2357,13 +2357,18 @@ def _request_structured_model_decision(
if not _ai_api_base() or not _ai_api_key():
raise RuntimeError("AI_API_BASE / AI_API_KEY are required for openai_compatible provider")
started = time.perf_counter()
payload = {
"model": _ai_model(),
"temperature": 0.2,
"max_tokens": _ai_decision_max_tokens(),
model = _ai_model()
payload: dict[str, Any] = {
"model": model,
"response_format": {"type": "json_object"},
"messages": messages,
}
if model.startswith("gpt-5"):
payload["max_completion_tokens"] = _ai_decision_max_tokens()
payload["reasoning_effort"] = "minimal"
else:
payload["temperature"] = 0.2
payload["max_tokens"] = _ai_decision_max_tokens()
effective_timeout = timeout_seconds if timeout_seconds is not None else _ai_timeout_seconds()
with httpx.Client(timeout=effective_timeout) as client:
response = client.post(