Skip to content

Commit 9c8fa6b

Browse files
committed
chore: fixed deepseek finally
1 parent 5b3a031 commit 9c8fa6b

File tree

2 files changed

+226
-131
lines changed

2 files changed

+226
-131
lines changed

lib/parsers/src/tool_calling/config.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ pub struct JsonParserConfig {
2323
pub tool_call_start_tokens: Vec<String>,
2424
/// End token for individual tool calls (e.g., "</TOOLCALL>")
2525
pub tool_call_end_tokens: Vec<String>,
26+
/// Separator tokens between function name and arguments
27+
/// (e.g., "<|tool▁sep|>" for DeepSeek v3.1)
28+
/// Used by some models to separate function name from arguments
29+
pub tool_call_separator_tokens: Vec<String>,
2630
/// The key for the function name in the tool call
2731
/// i.e. `{"name": "function", "arguments": {...}}` it would be
2832
/// "name"
@@ -42,6 +46,7 @@ impl Default for JsonParserConfig {
4246
Self {
4347
tool_call_start_tokens: vec!["<TOOLCALL>".to_string(), "<|python_tag|>".to_string()],
4448
tool_call_end_tokens: vec!["</TOOLCALL>".to_string(), "".to_string()],
49+
tool_call_separator_tokens: vec![],
4550
function_name_keys: vec!["name".to_string()],
4651
arguments_keys: vec!["arguments".to_string(), "parameters".to_string()],
4752
parser_type: JsonParserType::Basic,
@@ -154,8 +159,29 @@ impl ToolCallConfig {
154159
tool_call_start_tokens: vec![
155160
"<|tool▁calls▁begin|>".to_string(),
156161
"<|tool▁call▁begin|>".to_string(),
162+
"<|tool▁calls▁begin|>".to_string(),
163+
"<|tool▁call▁begin|>".to_string(),
164+
"<|tool_calls_begin|>".to_string(),
165+
"<|tool_call_begin|>".to_string(),
166+
"<|tool_calls_begin|>".to_string(),
167+
"<|tool_call_begin|>".to_string(),
168+
],
169+
tool_call_end_tokens: vec![
170+
"<|tool▁calls▁end|>".to_string(),
171+
"<|tool▁call▁end|>".to_string(),
172+
"<|tool▁calls▁end|>".to_string(),
173+
"<|tool▁call▁end|>".to_string(),
174+
"<|tool_calls_end|>".to_string(),
175+
"<|tool_call_end|>".to_string(),
176+
"<|tool_calls_end|>".to_string(),
177+
"<|tool_call_end|>".to_string(),
178+
],
179+
tool_call_separator_tokens: vec![
180+
"<|tool▁sep|>".to_string(),
181+
"<|tool▁sep|>".to_string(),
182+
"<|tool_sep|>".to_string(),
183+
"<|tool_sep|>".to_string(),
157184
],
158-
tool_call_end_tokens: vec!["<|tool▁calls▁end|>".to_string()],
159185
parser_type: JsonParserType::DeepseekV31,
160186
..Default::default()
161187
},

0 commit comments

Comments
 (0)