fix: send max tokens to cloud on model update (#901)

This commit is contained in:
Ari Webb
2026-02-10 15:23:41 -08:00
committed by GitHub
parent b0783ef195
commit 394aaf6777

View File

@@ -137,8 +137,12 @@ function buildModelSettings(
settings = {};
}
// Apply max_output_tokens for all providers if specified
if (typeof updateArgs?.max_output_tokens === "number") {
// Apply max_output_tokens only when provider_type is present.
// Without provider_type the discriminated union rejects the payload (e.g. MiniMax).
if (
typeof updateArgs?.max_output_tokens === "number" &&
"provider_type" in settings
) {
(settings as Record<string, unknown>).max_output_tokens =
updateArgs.max_output_tokens;
}
@@ -175,6 +179,9 @@ export async function updateAgentLLMConfig(
model: modelHandle,
...(hasModelSettings && { model_settings: modelSettings }),
...(contextWindow && { context_window_limit: contextWindow }),
...(typeof updateArgs?.max_output_tokens === "number" && {
max_tokens: updateArgs.max_output_tokens,
}),
});
const finalAgent = await client.agents.retrieve(agentId);