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:
@@ -10,10 +10,10 @@ ALLOW_LEGACY_HEADER_AUTH=0
|
|||||||
|
|
||||||
AI_PROVIDER=openai_compatible
|
AI_PROVIDER=openai_compatible
|
||||||
AI_API_BASE=https://api.openai.com/v1
|
AI_API_BASE=https://api.openai.com/v1
|
||||||
AI_API_KEY=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
|
AI_API_KEY=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
|
||||||
AI_MODEL=gpt-4o-mini
|
AI_MODEL=gpt-5-nano
|
||||||
AI_TIMEOUT_SECONDS=30
|
AI_TIMEOUT_SECONDS=30
|
||||||
AI_VOICE_AI_TIMEOUT_SECONDS=10
|
AI_VOICE_AI_TIMEOUT_SECONDS=15
|
||||||
AI_WEB_SEARCH_ENABLED=1
|
AI_WEB_SEARCH_ENABLED=1
|
||||||
AI_WEB_SEARCH_MAX_RESULTS=5
|
AI_WEB_SEARCH_MAX_RESULTS=5
|
||||||
AI_WEB_SEARCH_GL=kz
|
AI_WEB_SEARCH_GL=kz
|
||||||
|
|||||||
@@ -2357,13 +2357,18 @@ def _request_structured_model_decision(
|
|||||||
if not _ai_api_base() or not _ai_api_key():
|
if not _ai_api_base() or not _ai_api_key():
|
||||||
raise RuntimeError("AI_API_BASE / AI_API_KEY are required for openai_compatible provider")
|
raise RuntimeError("AI_API_BASE / AI_API_KEY are required for openai_compatible provider")
|
||||||
started = time.perf_counter()
|
started = time.perf_counter()
|
||||||
payload = {
|
model = _ai_model()
|
||||||
"model": _ai_model(),
|
payload: dict[str, Any] = {
|
||||||
"temperature": 0.2,
|
"model": model,
|
||||||
"max_tokens": _ai_decision_max_tokens(),
|
|
||||||
"response_format": {"type": "json_object"},
|
"response_format": {"type": "json_object"},
|
||||||
"messages": messages,
|
"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()
|
effective_timeout = timeout_seconds if timeout_seconds is not None else _ai_timeout_seconds()
|
||||||
with httpx.Client(timeout=effective_timeout) as client:
|
with httpx.Client(timeout=effective_timeout) as client:
|
||||||
response = client.post(
|
response = client.post(
|
||||||
|
|||||||
Reference in New Issue
Block a user