fix: use max_completion_tokens instead of max_tokens for GPT-4o
Azure OpenAI GPT-4o and newer models require 'max_completion_tokens' instead of 'max_tokens'. Fixed in all 3 services: - chat_service.py (2 call sites) - azure_ai.py (validation service) - tenants/router.py (test connection endpoint) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -193,7 +193,7 @@ async def test_tenant_ai_config(
|
|||||||
client.chat.completions.create(
|
client.chat.completions.create(
|
||||||
model=deployment,
|
model=deployment,
|
||||||
messages=[{"role": "user", "content": "ping"}],
|
messages=[{"role": "user", "content": "ping"}],
|
||||||
max_tokens=5,
|
max_completion_tokens=5,
|
||||||
)
|
)
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ def _call_azure_vision(
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
max_tokens=max_tokens,
|
max_completion_tokens=max_tokens,
|
||||||
temperature=temperature,
|
temperature=temperature,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -701,7 +701,7 @@ async def chat_with_agent(
|
|||||||
messages=messages,
|
messages=messages,
|
||||||
tools=TOOLS,
|
tools=TOOLS,
|
||||||
tool_choice="auto",
|
tool_choice="auto",
|
||||||
max_tokens=creds["max_tokens"],
|
max_completion_tokens=creds["max_tokens"],
|
||||||
temperature=creds["temperature"],
|
temperature=creds["temperature"],
|
||||||
)
|
)
|
||||||
if response.usage:
|
if response.usage:
|
||||||
@@ -744,7 +744,7 @@ async def chat_with_agent(
|
|||||||
messages=messages,
|
messages=messages,
|
||||||
tools=TOOLS,
|
tools=TOOLS,
|
||||||
tool_choice="auto",
|
tool_choice="auto",
|
||||||
max_tokens=creds["max_tokens"],
|
max_completion_tokens=creds["max_tokens"],
|
||||||
temperature=creds["temperature"],
|
temperature=creds["temperature"],
|
||||||
)
|
)
|
||||||
if response.usage:
|
if response.usage:
|
||||||
|
|||||||
Reference in New Issue
Block a user