config: configurable max_new generation budget (default 16384) so CoT+answer are not truncated

This commit is contained in:
adm committed 2026-11-27 18:13:18 +01:00
1 parent 862897fdbc
commit 4cdc4334d8
6 files changed
+70 -16

No files matched your search

+15 -1
View File
@@ -86,7 +86,7 @@ fn build_prompt_renders_and_encodes() {
assert!(prompt.ids.contains(&text_id));
assert!(prompt.ids.contains(&2)); // "hello"
assert!(prompt.ids.contains(&end_id));
assert_eq!(prompt.max_new, 2048); // default
assert_eq!(prompt.max_new, 16384); // default (raised so CoT is not truncated)
let _ = std::fs::remove_file(&path);
}
@@ -144,6 +144,20 @@ fn max_tokens_override_is_honored() {
let _ = std::fs::remove_file(&path);
}
#[test]
fn with_max_new_overrides_default_budget() {
let (fmt, _tok, path) = formatter();
assert_eq!(fmt.default_max_new(), 16384);
let fmt = fmt.with_max_new(8192);
assert_eq!(fmt.default_max_new(), 8192);
let req: ChatRequest = serde_json::from_value(
json!({"model": "test-model", "messages": [{"role": "user", "content": "hello"}]}),
)
.unwrap();
assert_eq!(fmt.build_prompt(&req).unwrap().max_new, 8192);
let _ = std::fs::remove_file(&path);
}
#[test]
fn decoder_emits_structured_tool_call() {
let (fmt, tok, path) = formatter();