fix(ai): respect model output token limits

closes #4539
This commit is contained in:
Mario Zechner
2026-05-16 23:33:06 +02:00
parent 7c5c3d6fd6
commit 22a9c484e7
2 changed files with 2 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, T
export function buildBaseOptions(model: Model<Api>, options?: SimpleStreamOptions, apiKey?: string): StreamOptions {
return {
temperature: options?.temperature,
maxTokens: options?.maxTokens ?? (model.maxTokens > 0 ? Math.min(model.maxTokens, 32000) : undefined),
maxTokens: options?.maxTokens ?? (model.maxTokens > 0 ? model.maxTokens : undefined),
signal: options?.signal,
apiKey: apiKey || options?.apiKey,
transport: options?.transport,