/** * Visible-answer generation settings shared by consultation and rectification. * * DeepSeek V4 Flash thinks by default, and those hidden tokens share * `max_tokens` with the spoken answer. Consultation and rectification may * enable a separate Chinese thinking channel; the spoken answer still uses * this visible token budget. Default remains disabled for other callers. */ export const AGENT_MAX_OUTPUT_TOKENS = 8192; type ThinkingMode = "enabled" | "disabled"; export function agentGenerationSettings( model?: unknown, options: { thinking?: ThinkingMode } = {}, ) { const thinking = { thinking: { type: (options.thinking ?? "disabled") as ThinkingMode } }; const providerId = typeof model === "string" ? model : model && typeof model === "object" && "providerId" in model && typeof model.providerId === "string" ? model.providerId : undefined; const providerOptions: Record = { openai: thinking, }; if (providerId) providerOptions[providerId] = thinking; return { modelSettings: { maxOutputTokens: AGENT_MAX_OUTPUT_TOKENS }, providerOptions, }; }