-
Notifications
You must be signed in to change notification settings - Fork 2.4k
add function call parser for DeepSeek V3 #5224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6ce1b8e
80444bd
ce47a14
bdc4f1e
958d70b
6c34a9e
8d28250
fd02d16
53852ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -938,6 +938,35 @@ def v1_chat_generate_request( | |
|
||
if chat_template_name is None: | ||
openai_compatible_messages = [] | ||
if ( | ||
tools | ||
and tokenizer_manager.server_args.tool_call_parser == "deepseekv3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we not add a chat template for this? this kind of prompt engineering is more suitable to add into a chat template. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree to update a new built-in template There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree to update a new built-in template There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, we can create a new PR by using custom chat template |
||
): | ||
# add function call prompt to deepseekv3 | ||
openai_compatible_messages.append( | ||
finger92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"role": "system", | ||
"content": """You are a helpful Assistant. | ||
## Tools | ||
### Function | ||
You have the following functions available: | ||
""" | ||
+ "".join( | ||
[ | ||
f""" | ||
- `{tool['name']}`: | ||
```json | ||
{json.dumps(tool)} | ||
``` | ||
""" | ||
for tool in tools | ||
] | ||
), | ||
} | ||
) | ||
# TODO fix the compatible issues with xgrammar | ||
strict_tag = None | ||
|
||
for message in request.messages: | ||
if isinstance(message.content, str): | ||
openai_compatible_messages.append( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#5054 (comment)