Fix truncated LLM responses by populating catalog max_output

Requests were always sent with max_tokens: None, which defaulted to
4096 in the Anthropic provider, causing large outputs to be truncated.
Now build_request() looks up the model's max_output from the catalog
and passes it through, giving each model its full output capacity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-02-23 12:30:25 -05:00
parent 3a70e6711c
commit 5573e0e8a2
3 changed files with 10 additions and 8 deletions

View file

@ -396,7 +396,8 @@ impl Session {
response_format: None,
temperature: None,
top_p: None,
max_tokens: None,
max_tokens: llm::catalog::get_model_info(self.provider_profile.model())
.and_then(|m| m.max_output),
stop_sequences: None,
reasoning_effort: self.config.reasoning_effort.clone(),
metadata: None,

View file

@ -4,7 +4,7 @@
"provider": "anthropic",
"display_name": "Claude Opus 4.6",
"context_window": 200000,
"max_output": null,
"max_output": 128000,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -17,7 +17,7 @@
"provider": "anthropic",
"display_name": "Claude Sonnet 4.5",
"context_window": 200000,
"max_output": null,
"max_output": 64000,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -30,7 +30,7 @@
"provider": "openai",
"display_name": "GPT-5.2",
"context_window": 1047576,
"max_output": null,
"max_output": 128000,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -43,7 +43,7 @@
"provider": "openai",
"display_name": "GPT-5 Mini",
"context_window": 1047576,
"max_output": null,
"max_output": 128000,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -56,7 +56,7 @@
"provider": "openai",
"display_name": "GPT-5.2 Codex",
"context_window": 1047576,
"max_output": null,
"max_output": 128000,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -69,7 +69,7 @@
"provider": "gemini",
"display_name": "Gemini 3 Pro (Preview)",
"context_window": 1048576,
"max_output": null,
"max_output": 65536,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,
@ -82,7 +82,7 @@
"provider": "gemini",
"display_name": "Gemini 3 Flash (Preview)",
"context_window": 1048576,
"max_output": null,
"max_output": 65536,
"supports_tools": true,
"supports_vision": true,
"supports_reasoning": true,

View file

@ -52,6 +52,7 @@ mod tests {
assert!(info.supports_vision);
assert!(info.supports_reasoning);
assert_eq!(info.context_window, 200_000);
assert_eq!(info.max_output, Some(128_000));
}
#[test]