-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
[gpt-oss] Add model_identity to system message retrieval for harmony chat template #30247
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: LFu <lyuwen@users.noreply.github.com>
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
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.
Code Review
This pull request aims to pass the model_identity from chat_template_kwargs to the system message formatter for the harmony chat template. However, the current implementation has a critical bug where it does not handle the case where request.chat_template_kwargs is None, which will lead to an AttributeError and crash the server. I've provided a suggestion to fix this issue.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: LFu <lyuwen@users.noreply.github.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run You ask your reviewers to trigger select CI tests on top of Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
|
@lyuwen could you share some examples in your test plans. what's the rendered messages before and after the change? |
|
For example, if I run this before the patch: from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key="EMPTY")
MODEL_NAME = "gpt-oss-120b"
response = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "What are you?"}],
extra_body={
"chat_template_kwargs": {"model_identity": "You are DeepSeek developed by MoonShot.", "reasoning_effort": "high"},
}
)
print("Reasoning:")
print(response.choices[0].message.reasoning_content)
print("Final:")
print(response.choices[0].message.content)The output would be : But the expected behavior is the model assuming the provided identity and respond with something like the following: Upon investigation, below are the reason this parameter is not taking effect - the vllm/vllm/entrypoints/openai/serving_chat.py Lines 1763 to 1768 in 73a484c
And system message just used the default model identity: https://github.com/openai/harmony/blob/ec7606df9e87e3d0a1fec9f50928c1e407f0c438/python/openai_harmony/__init__.py#L181-L184 |
|
The model_identity parameter itself is already in the vLLM code base, it just wasn't used. vllm/vllm/entrypoints/openai/parser/harmony_utils.py Lines 87 to 96 in 7cab92f
So the prompt with chat template should look like But without model_identity passed in, it used the default: |
Purpose
When using GPT-OSS,
model_identitypassed in fromchat_template_kwargsis not being used to adjust model's identity. This PR is to pass themodel_identityfrom chat/completion to the system message formatter.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.