-
Notifications
You must be signed in to change notification settings - Fork 568
Unclock mutual exclusivity of argument: tool-call-parser
and reasoning-parser
#3550
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
Merged
lvhan028
merged 3 commits into
InternLM:main
from
jingyibo123:parsers-mutually-inclusive
May 19, 2025
Merged
Unclock mutual exclusivity of argument: tool-call-parser
and reasoning-parser
#3550
lvhan028
merged 3 commits into
InternLM:main
from
jingyibo123:parsers-mutually-inclusive
May 19, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ning-parser` For QwQ and Qwen3 models, `tool-call-parser` and `reasoning-parser` can be activated simultaneously.
…r and reasoning parser
Test with client = OpenAI(
base_url="",
api_key="",
)
MODEL="qwq-32B"
hello_msgs=[
{"role": "system", "content": ""},
{"role": "user", "content": "你好吗"}
]
hello_re = client.chat.completions.create(
messages=hello_msgs,
model=MODEL,
temperature=0.7,
top_p=1.0,
stream=False
)
print(hello_re)
tools = [
{
"type": "function",
"function": {
"name": "get_current_temperature",
"description": "Get current temperature at a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The location to get the temperature for, in the format \"City, State, Country\"."
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
],
"description": "The unit to return the temperature in. Defaults to \"celsius\"."
}
},
"required": [
"location"
]
}
}
},
{
"type": "function",
"function": {
"name": "get_temperature_date",
"description": "Get temperature at a location and date.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The location to get the temperature for, in the format \"City, State, Country\"."
},
"date": {
"type": "string",
"description": "The date to get the temperature for, in the format \"Year-Month-Day\"."
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
],
"description": "The unit to return the temperature in. Defaults to \"celsius\"."
}
},
"required": [
"location",
"date"
]
}
}
}
]
tool_msgs=[
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.\n\nCurrent Date: 2024-09-30"},
{"role": "user", "content": "What's the temperature in San Francisco now? How about tomorrow?"}
]
tool_re = client.chat.completions.create(
messages=tool_msgs,
model=MODEL,
temperature=0.7,
top_p=1.0,
stream=False,
tools=tools
)
print(tool_re) Result:
|
RunningLeon
approved these changes
May 15, 2025
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.
LGTM
Hi, @jingyibo123 pip install pre-commit==3.8.0 # make sure the python version < 3.11
cd lmdeploy # the root directory of lmdeploy repo
pre-commit install
pre-commit run --all-files |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For QwQ and Qwen3 models,
tool-call-parser
andreasoning-parser
can be activated simultaneously.Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Related issue: 3431