Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
91e2f902
Unverified
Commit
91e2f902
authored
Aug 08, 2025
by
Lianmin Zheng
Committed by
GitHub
Aug 08, 2025
Browse files
Fix kimi k2 function call format (#8968)
parent
a59cbea9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python/sglang/srt/function_call/kimik2_detector.py
python/sglang/srt/function_call/kimik2_detector.py
+3
-3
No files found.
python/sglang/srt/function_call/kimik2_detector.py
View file @
91e2f902
...
@@ -24,7 +24,7 @@ class KimiK2Detector(BaseFormatDetector):
...
@@ -24,7 +24,7 @@ class KimiK2Detector(BaseFormatDetector):
Format Structure:
Format Structure:
```
```
<|tool_calls_section_begin|>
<|tool_calls_section_begin|>
<|tool_call_begin|>functions.{func_name}:{index}
<|tool_call_argument_begin|>{json_args}<|tool_call_end|>
<|tool_call_begin|>functions.{func_name}:{index}<|tool_call_argument_begin|>{json_args}<|tool_call_end|>
<|tool_calls_section_end|>
<|tool_calls_section_end|>
```
```
...
@@ -219,7 +219,7 @@ class KimiK2Detector(BaseFormatDetector):
...
@@ -219,7 +219,7 @@ class KimiK2Detector(BaseFormatDetector):
def
get_info
(
name
:
str
)
->
StructureInfo
:
def
get_info
(
name
:
str
)
->
StructureInfo
:
return
StructureInfo
(
return
StructureInfo
(
begin
=
f
"<|tool_calls_section_begin|><|tool_call_begin|>functions.
{
name
}
:0
<|tool_call_argument_begin|>"
,
begin
=
f
"<|tool_calls_section_begin|><|tool_call_begin|>functions.
{
name
}
:0<|tool_call_argument_begin|>"
,
end
=
"<|tool_call_end|><|tool_calls_section_end|>"
,
end
=
"<|tool_call_end|><|tool_calls_section_end|>"
,
trigger
=
"<|tool_calls_section_begin|>"
,
trigger
=
"<|tool_calls_section_begin|>"
,
)
)
...
@@ -240,6 +240,6 @@ class KimiK2Detector(BaseFormatDetector):
...
@@ -240,6 +240,6 @@ class KimiK2Detector(BaseFormatDetector):
sequence_start_token
=
self
.
bot_token
,
sequence_start_token
=
self
.
bot_token
,
sequence_end_token
=
self
.
eot_token
,
sequence_end_token
=
self
.
eot_token
,
tool_call_separator
=
""
,
tool_call_separator
=
""
,
call_rule_fmt
=
'"<|tool_call_begin|>functions.{name}:"
[0-9]+
"
<|tool_call_argument_begin|>"
{arguments_rule}
"<|tool_call_end|>"'
,
call_rule_fmt
=
'"<|tool_call_begin|>functions.{name}:"[0-9]+
"
<|tool_call_argument_begin|>"{arguments_rule}"<|tool_call_end|>"'
,
function_format
=
"json"
,
function_format
=
"json"
,
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment