Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
20aca5d
Add DeepSeek V4 parser support
ishandhanani Apr 24, 2026
fcb30aa
chore: deepseek-v4 reasoning and tool calling streamning tests
ayushag-nv Apr 24, 2026
587d668
chore: port v4 formatter
ayushag-nv Apr 24, 2026
6a159fe
chore: add formatter to template -- critical path
ayushag-nv Apr 24, 2026
e1bbc46
fix: reasoning
ayushag-nv Apr 24, 2026
d187c88
fix: copyright issues
ayushag-nv Apr 24, 2026
95bda37
fix: harchoded path
ayushag-nv Apr 24, 2026
5cef9b6
fix(preprocessor): key DeepSeek-V4/V3.2 detection off config.json mod…
biswapanda Apr 24, 2026
38a2b95
fix(preprocessor): treat empty config.json model_type as no-signal
biswapanda Apr 24, 2026
934e117
perf(deepseek_v4): size to_json buffer from compact length instead of 64
biswapanda Apr 24, 2026
408daec
perf(dsml): cache compiled regexes per config instead of recompiling …
biswapanda Apr 24, 2026
b04a92f
perf(deepseek_v4): collapse render_tools 4-replace chain into one for…
biswapanda Apr 24, 2026
e90c6ff
perf(deepseek_v4): drop per-message clone in merge_tool_messages
biswapanda Apr 24, 2026
fffbe30
perf(deepseek_v4): dedupe find_last_user_index scans in encode path
biswapanda Apr 24, 2026
b46e21a
chore(deepseek_v4): code clean up
biswapanda Apr 24, 2026
fb4fbeb
chore(deepseek_v4): code clean up part-2 — Rust idiomaticity
biswapanda Apr 24, 2026
77602e4
fix(llm,v4): use char slice for clippy::manual_pattern_char_comparison
ayushag-nv Apr 24, 2026
3fcb045
test(parsers): add CASE.* taxonomy docs and V4 corner-case pinning tests
keivenchang Apr 24, 2026
bfc6004
refactor(llm,v4): split render_message into per-role helpers + extrac…
keivenchang Apr 24, 2026
2aab621
test(llm,v4): drop unused finish_reason from special_chars fixture
keivenchang Apr 24, 2026
44fb33a
investigate tmrw
ishandhanani Apr 24, 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
2 changes: 1 addition & 1 deletion .github/workflows/copyright-check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ $global:copyright_results = @{

$ignored_files = @('.clang-format', '.gitattributes', '.gitignore', '.gitkeep', '.patch', 'Cargo.lock', 'LICENSE', 'uv.lock', 'rust-toolchain.toml', 'codespell.txt', 'exclusions.txt')
write-debug "<copyright-check> ignored_files = ['$($ignored_files -join "','")']."
$ignored_paths = @('.github', '.mypy_cache', '.pytest_cache', 'lib/llm/tests/data/sample-models', 'lib/llm/tests/data/deepseek-v3.2')
$ignored_paths = @('.github', '.mypy_cache', '.pytest_cache', 'lib/llm/tests/data/sample-models', 'lib/llm/tests/data/deepseek-v3.2', 'lib/llm/tests/data/deepseek-v4')
write-debug "<copyright-check> ignored_paths = ['$($ignored_paths -join "','")']."
$ignored_types = @('.bat', '.gif', '.ico', '.ipynb', '.jpg', '.jpeg', '.patch', '.png', '.pyc', '.pyi', '.rst', '.zip', '.md', '.json')
write-debug "<copyright-check> ignored_types = ['$($ignored_types -join "', '")']."
Expand Down
2 changes: 1 addition & 1 deletion components/src/dynamo/frontend/sglang_prepost.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def build_tool_call_guided_decoding(
)
constraint = parser.get_structure_constraint(
tool_choice,
parallel_tool_calls=parallel_tool_calls,
# parallel_tool_calls=parallel_tool_calls,
)

if isinstance(constraint, tuple) and len(constraint) == 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ async def generate(
**input_param,
sampling_params=sampling_params,
stream=True,
return_routed_experts=return_routed_experts,
# return_routed_experts=return_routed_experts,
bootstrap_host=bootstrap_info["bootstrap_host"],
bootstrap_port=bootstrap_info["bootstrap_port"],
bootstrap_room=bootstrap_info["bootstrap_room"],
Expand Down Expand Up @@ -346,7 +346,7 @@ async def generate(
video_data=video_data,
sampling_params=sampling_params,
stream=True,
return_routed_experts=return_routed_experts,
# return_routed_experts=return_routed_experts,
external_trace_header=trace_header,
rid=trace_id,
data_parallel_rank=dp_rank,
Expand Down
52 changes: 49 additions & 3 deletions lib/llm/src/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,9 @@ impl OpenAIPreprocessor {
/// For kimi_k25: disabled when chat_template_args contains "thinking": false.
/// For nemotron_nano: disabled when chat_template_args contains "enable_thinking": false
/// or "force_nonempty_content": true.
/// For deepseek_r1: disabled when chat_template_args contains "thinking": false
/// or "thinking_mode": "chat".
/// For deepseek_r1 / deepseek_v4: disabled when chat_template_args contains
/// "thinking": false or "thinking_mode": "chat" — matches the V4 formatter's
/// `resolve_thinking_mode` convention, so the parser and the prompt stay in sync.
fn is_reasoning_disabled_by_request(
reasoning_parser: Option<&str>,
chat_template_args: Option<&std::collections::HashMap<String, serde_json::Value>>,
Expand Down Expand Up @@ -1257,7 +1258,8 @@ impl OpenAIPreprocessor {
}
false
}
Some("deepseek_r1") => {
Some("deepseek_r1") | Some("deepseek_v4") | Some("deepseek-v4")
| Some("deepseekv4") => {
if let Some(args) = chat_template_args {
if let Some(thinking) = args.get("thinking") {
return thinking == &serde_json::Value::Bool(false);
Expand Down Expand Up @@ -1829,6 +1831,50 @@ mod tests {
false,
"nemotron_nano + empty args → enabled",
),
// deepseek_v4 — same convention as deepseek_r1; verify all three aliases
// (deepseek_v4 / deepseek-v4 / deepseekv4) plus both signal keys.
(
Some("deepseek_v4"),
Some(&thinking_false),
true,
"deepseek_v4 + thinking=false → disabled",
),
(
Some("deepseek_v4"),
Some(&thinking_true),
false,
"deepseek_v4 + thinking=true → enabled",
),
(
Some("deepseek_v4"),
Some(&thinking_mode_chat),
true,
"deepseek_v4 + thinking_mode=chat → disabled",
),
(
Some("deepseek_v4"),
Some(&thinking_mode_thinking),
false,
"deepseek_v4 + thinking_mode=thinking → enabled",
),
(
Some("deepseek_v4"),
None,
false,
"deepseek_v4 + no args → enabled",
),
(
Some("deepseek-v4"),
Some(&thinking_false),
true,
"deepseek-v4 (hyphen alias) + thinking=false → disabled",
),
(
Some("deepseekv4"),
Some(&thinking_mode_chat),
true,
"deepseekv4 (joined alias) + thinking_mode=chat → disabled",
),
];

for (parser, args, expected, desc) in cases {
Expand Down
1 change: 1 addition & 0 deletions lib/llm/src/preprocessor/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use std::sync::Arc;
use crate::preprocessor::media::MediaDecoder;

pub mod deepseek_v32;
pub mod deepseek_v4;
mod template;

pub use template::{ChatTemplate, ContextMixins};
Expand Down
Loading
Loading