Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
4e56fd7
feat(llm): integrate MiniMax M3 unified parsing
mattwittwer Oct 24, 2026
d71877b
refactor(frontend): remove MiniMax M3 reasoning gate override
mattwittwer Oct 29, 2026
b47de28
refactor(frontend): restore shared structural-tag reasoning interface
mattwittwer Oct 29, 2026
f9a6b85
test(llm): simplify MiniMax M3 structural-tag integration coverage
mattwittwer Oct 29, 2026
be7cda5
Merge main into mwittwer/dis-3197-minimax-m3-unified
mattwittwer Oct 30, 2026
aa3f744
build(deps): bump dynamo-parsers-v2 to 0.9.0
mattwittwer Oct 30, 2026
713e274
fix(llm): align MiniMax M3 disabled reasoning and streaming tests
mattwittwer Oct 30, 2026
7da8448
Merge main into mwittwer/dis-3197-minimax-m3-unified
mattwittwer Oct 30, 2026
a577161
Merge branch 'main' into mwittwer/dis-3197-minimax-m3-unified
mattwittwer Oct 30, 2026
e1809f3
fix(llm): decide MiniMax M3 explicit guided output from its first bytes
mattwittwer Oct 30, 2026
1713ae3
fix(llm): gate MiniMax M3 unified reasoning on the rendered prompt
mattwittwer Oct 30, 2026
eae13a4
Merge branch 'main' into mwittwer/dis-3197-minimax-m3-unified
mattwittwer Oct 30, 2026
45ab7f0
Merge branch 'main' into mwittwer/dis-3197-minimax-m3-unified
mattwittwer Nov 2, 2026
e954bf8
Merge remote-tracking branch 'origin/main' into mwittwer/dis-3197-min…
mattwittwer Nov 3, 2026
e90e696
Merge branch 'main' into mwittwer/dis-3197-minimax-m3-unified
furionw Nov 3, 2026
d0e56ab
fix(llm): enable MiniMax M3 unified parsing by default
furionw Nov 3, 2026
ecafb39
chore: merge main and preserve MiniMax M3 routing
furionw Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dynamo-parsers = { version = "=10.2.2" }
# Published on crates.io. To see all available versions:
# web: https://crates.io/crates/dynamo-parsers-v2/versions
# sparse index: curl https://index.crates.io/dy/na/dynamo-parsers-v2 (one JSON line per release; read the "vers" field)
dynamo-parsers-v2 = { version = "=0.8.9" }
dynamo-parsers-v2 = { version = "=0.9.0" }
Comment thread
mattwittwer marked this conversation as resolved.
Resolved
dynamo-backend-common = { path = "lib/backend-common", version = "1.7.0" }
dynamo-sidecar-common = { path = "lib/sidecar/common", version = "1.7.0" }

Expand Down
4 changes: 2 additions & 2 deletions lib/bindings/kvbm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/bindings/python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 64 additions & 22 deletions lib/llm/src/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17365,6 +17365,14 @@ responses_tools: None,
}
}

fn minimax_m3_uses_unified_parser() -> bool {
crate::protocols::openai::chat_completions::unified_parser::selected_family(
Some("minimax_m3"),
Some("minimax_m3"),
)
.is_some()
}

/// `(content, reasoning_content, finish_reason set)` for the first choice
/// of each chunk that carries one.
fn minimax_m3_chunk_placement(
Expand Down Expand Up @@ -17718,8 +17726,8 @@ responses_tools: None,
) {
return;
}
// Text the parser held to EOF rides the terminal chunk, never a chunk
// after `finish_reason`.
// Adaptive output has no prompt-opened thought. V2 streams its visible
// text immediately; v1 holds it until the terminal chunk.
let regex = minimax_m3_merge_body(
serde_json::json!({"guided_regex": "Paris|London"}),
&serde_json::json!({"chat_template_kwargs": {"thinking_mode": "adaptive"}}),
Expand All @@ -17731,11 +17739,19 @@ responses_tools: None,
);
assert_eq!(
placed,
vec![
(String::new(), String::new(), false),
(String::new(), String::new(), false),
("Paris".to_string(), String::new(), true),
],
if minimax_m3_uses_unified_parser() {
vec![
("Par".to_string(), String::new(), false),
("is".to_string(), String::new(), false),
(String::new(), String::new(), true),
]
} else {
vec![
(String::new(), String::new(), false),
(String::new(), String::new(), false),
("Paris".to_string(), String::new(), true),
]
},
"guided_regex + adaptive: placement per chunk"
);

Expand Down Expand Up @@ -17886,8 +17902,8 @@ responses_tools: None,
"rows whose (content, reasoning_content) was wrong without a finish_reason"
);

// The held text arrives once, in one chunk after the last backend
// chunk, with no `finish_reason` because the backend sent none.
// Text arrives once, without inventing a finish_reason. V1 flushes at
// EOF, while v2 has already delivered both adaptive answer fragments.
let regex = minimax_m3_merge_body(
serde_json::json!({"guided_regex": "Paris|London"}),
&serde_json::json!({"chat_template_kwargs": {"thinking_mode": "adaptive"}}),
Expand All @@ -17899,11 +17915,18 @@ responses_tools: None,
);
assert_eq!(
placed,
vec![
(String::new(), String::new(), false),
(String::new(), String::new(), false),
("Paris".to_string(), String::new(), false),
],
if minimax_m3_uses_unified_parser() {
vec![
("Par".to_string(), String::new(), false),
("is".to_string(), String::new(), false),
]
} else {
vec![
(String::new(), String::new(), false),
(String::new(), String::new(), false),
("Paris".to_string(), String::new(), false),
]
},
"guided_regex + adaptive without a finish_reason: placement per chunk"
);
}
Expand Down Expand Up @@ -17987,12 +18010,30 @@ responses_tools: None,
.filter_map(|item| item.data.clone())
.collect::<Vec<_>>(),
);
assert!(
placed
.iter()
.all(|(content, reasoning, _)| content.is_empty() && reasoning.is_empty()),
"{desc}: held text must be dropped: {placed:?}"
);
if minimax_m3_uses_unified_parser() {
assert!(
placed
.iter()
.all(|(_, reasoning, finished)| reasoning.is_empty() && !finished),
"{desc}: no reasoning or successful finish before the error: {placed:?}"
);
assert_eq!(
placed
.iter()
.map(|(content, _, _)| content.as_str())
.collect::<String>(),
model_output,
"{desc}: adaptive text is delivered before the backend error"
);
} else {
assert!(
placed
.iter()
.all(|(content, reasoning, _)| content.is_empty()
&& reasoning.is_empty()),
"{desc}: held text must be dropped: {placed:?}"
);
}
}
}
}
Expand Down Expand Up @@ -18038,12 +18079,13 @@ responses_tools: None,
usage.inner.choices.is_empty() && usage.inner.usage.is_some(),
"the usage chunk must come last: {chunks:?}"
);
let flushed = before_usage.last().expect("the flushed chunk");
let flushed = before_usage.last().expect("the last content chunk");
assert_eq!(flushed.inner.choices.len(), 1);
assert!(
matches!(
&flushed.inner.choices[0].delta.content,
Some(ChatCompletionMessageContent::Text(text)) if text == "Paris"
Some(ChatCompletionMessageContent::Text(text))
if text == if minimax_m3_uses_unified_parser() { "is" } else { "Paris" }
),
"the held text must be flushed: {flushed:?}"
);
Expand Down
63 changes: 63 additions & 0 deletions lib/llm/src/preprocessor/tool_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,69 @@ mod tests {
);
}

#[test]
fn minimax_m3_native_tags_and_relaxed_schema_fallback() {
if crate::test_utils::run_isolated(
concat!(
module_path!(),
"::minimax_m3_native_tags_and_relaxed_schema_fallback"
),
&[(
dynamo_runtime::config::environment_names::llm::DYN_PARSER_VERSION,
"2",
)],
) {
return;
}
let preprocessor = preprocessor("minimax_m3", StructuralTagMode::On);
for strict in [None, Some(true), Some(false)] {
for named in [false, true] {
let mut definitions = tools();
definitions[0]["function"]["parameters"]["additionalProperties"] = json!(false);
definitions[0]["function"]["parameters"]["properties"]["location"]["enum"] =
json!(["Paris", "Tokyo"]);
if let Some(strict) = strict {
definitions[0]["function"]["strict"] = json!(strict);
}
let choice = if named {
json!({"type": "function", "function": {"name": "get_weather"}})
} else {
json!("required")
};
let request = request(json!({"tools": definitions, "tool_choice": choice}));
let mut common = preprocessed_request();
let constraint = preprocessor
.apply_tool_choice_guided_decoding(&request, &mut common, false)
.unwrap();
let grammar = common.sampling_options.guided_decoding.unwrap();
if strict == Some(false) {
assert_eq!(
constraint,
if named {
GuidedToolConstraint::GuidedJsonNamed {
tool_name: "get_weather".into(),
}
} else {
GuidedToolConstraint::GuidedJsonRequired
}
);
assert!(grammar.json.is_some());
assert!(grammar.structural_tag.is_none());
} else {
assert_eq!(constraint, GuidedToolConstraint::StructuralTag);
assert!(
grammar
.structural_tag
.unwrap()
.to_string()
.contains("minimax_m3_xml")
);
assert!(grammar.json.is_none());
}
}
}
}

#[test]
fn kimi_k3_builder_error_uses_native_fallback() {
let request = request(json!({
Expand Down
Loading
Loading