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
deploy / deploy (push) Failing after 0s
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user