Skip to content

Conversation

@lyuwen
Copy link

@lyuwen lyuwen commented Dec 8, 2025

Purpose

When using GPT-OSS, model_identity passed in from chat_template_kwargs is not being used to adjust model's identity. This PR is to pass the model_identity from chat/completion to the system message formatter.

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: LFu <lyuwen@users.noreply.github.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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>
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

👋 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 fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

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 ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@yeqcharlotte
Copy link
Collaborator

@lyuwen could you share some examples in your test plans. what's the rendered messages before and after the change?

@lyuwen
Copy link
Author

lyuwen commented Dec 9, 2025

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 :

Reasoning:
The user asks "What are you?" Probably just a simple question. We need to respond as ChatGPT, giving a brief description. Should be concise, friendly.
Final:
I’m ChatGPT, an AI language model created by OpenAI. I can understand and generate human‑like text, answer questions, help with writing, brainstorm ideas, explain concepts, and more. Think of me as a virtual assistant you can chat with about a wide range of topics.

But the expected behavior is the model assuming the provided identity and respond with something like the following:

Reasoning:
The user asks "What are you?". The system messages: the user wants a brief answer. Should comply. The assistant is DeepSeek developed by MoonShot. So respond with explanation. Simple.
Final:
I’m an AI language model called **DeepSeek**, created by MoonShot. I’m designed to understand and generate text, answer questions, help with tasks, and hold conversations across a wide range of topics. Think of me as a virtual assistant that can provide information, brainstorm ideas, explain concepts, and much more—all through natural language interaction.

Upon investigation, below are the reason this parameter is not taking effect - the model_identity passed in from api was not passed to the system message builder.

sys_msg = get_system_message(
reasoning_effort=request.reasoning_effort,
browser_description=None,
python_description=None,
with_custom_tools=request.tools is not None,
)

And system message just used the default model identity:
https://github.com/openai/harmony/blob/ec7606df9e87e3d0a1fec9f50928c1e407f0c438/python/openai_harmony/__init__.py#L181-L184

@lyuwen
Copy link
Author

lyuwen commented Dec 9, 2025

The model_identity parameter itself is already in the vLLM code base, it just wasn't used.

def get_system_message(
model_identity: str | None = None,
reasoning_effort: Literal["high", "medium", "low"] | None = None,
start_date: str | None = None,
browser_description: str | None = None,
python_description: str | None = None,
container_description: str | None = None,
instructions: str | None = None,
with_custom_tools: bool = False,
) -> Message:

So the prompt with chat template should look like

<|start|>system<|message|>You are DeepSeek developed by MoonShot.
Knowledge cutoff: 2024-06
Current date: 2025-12-09

Reasoning: medium

# Valid channels: analysis, commentary, final. Channel must be included for every message.<|end|><|start|>user<|message|>What are you?<|end|><|start|>assistant

But without model_identity passed in, it used the default:

<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: 2024-06
Current date: 2025-12-09

Reasoning: medium

# Valid channels: analysis, commentary, final. Channel must be included for every message.<|end|><|start|>user<|message|>What are you?<|end|><|start|>assistant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend gpt-oss Related to GPT-OSS models

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

4 participants