Skip to content

[smg][ci] migrate reasoning_content tests to new infrastructure#16741

Merged
slin1237 merged 1 commit intomainfrom
smg-ci-n/27
Jan 8, 2026
Merged

[smg][ci] migrate reasoning_content tests to new infrastructure#16741
slin1237 merged 1 commit intomainfrom
smg-ci-n/27

Conversation

@slin1237
Copy link
Copy Markdown
Collaborator

@slin1237 slin1237 commented Jan 8, 2026

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments (/tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci) or contact authorized users to do so.
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @slin1237, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the testing suite by migrating existing end-to-end tests for the reasoning_content feature within chat completions. The migration ensures that the functionality, particularly with the DeepSeek R1 reasoning parser and DeepSeek 7B model, is thoroughly validated under the new testing infrastructure, covering various streaming and non-streaming API interactions.

Highlights

  • Test Migration: Existing end-to-end tests for reasoning_content in chat completions have been migrated from e2e_grpc/features/test_reasoning_content.py to the new sgl-model-gateway/e2e_test/chat_completions/ infrastructure.
  • Reasoning Content Testing: The migrated tests validate the behavior of reasoning_content in both streaming and non-streaming chat completion scenarios, specifically checking the separate_reasoning and stream_reasoning parameters.
  • DeepSeek Integration: These tests are configured to run against the DeepSeek 7B model and utilize the DeepSeek R1 reasoning parser, ensuring proper integration and functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@slin1237 slin1237 added the run-ci label Jan 8, 2026
Copy link
Copy Markdown
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 successfully migrates the reasoning_content tests to the new pytest-based infrastructure. The new test file is well-structured and the migration appears correct. I've included a few suggestions to enhance code readability and reduce duplication by extracting a helper method and simplifying some assertions. Overall, this is a solid improvement to the test suite.

Comment on lines +30 to +84
def test_streaming_separate_reasoning_false(self, setup_backend):
"""Test streaming with separate_reasoning=False, reasoning_content should be empty."""
_, model, client, gateway = setup_backend

response = client.chat.completions.create(
model=model,
messages=[
{
"role": "user",
"content": "What is 1+3?",
}
],
max_tokens=100,
stream=True,
extra_body={"separate_reasoning": False},
)

reasoning_content = ""
content = ""
for chunk in response:
if chunk.choices[0].delta.content:
content += chunk.choices[0].delta.content
elif chunk.choices[0].delta.reasoning_content:
reasoning_content += chunk.choices[0].delta.reasoning_content

assert len(reasoning_content) == 0
assert len(content) > 0

def test_streaming_separate_reasoning_true(self, setup_backend):
"""Test streaming with separate_reasoning=True, reasoning_content should not be empty."""
_, model, client, gateway = setup_backend

response = client.chat.completions.create(
model=model,
messages=[
{
"role": "user",
"content": "What is 1+3?",
}
],
max_tokens=100,
stream=True,
extra_body={"separate_reasoning": True},
)

reasoning_content = ""
content = ""
for chunk in response:
if chunk.choices[0].delta.content:
content += chunk.choices[0].delta.content
elif chunk.choices[0].delta.reasoning_content:
reasoning_content += chunk.choices[0].delta.reasoning_content

assert len(reasoning_content) > 0
assert len(content) > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's duplicated code for processing streaming responses in test_streaming_separate_reasoning_false and test_streaming_separate_reasoning_true. You can extract this logic into a helper method to improve code reuse and readability. I've also simplified the assertions to be more Pythonic and removed the unused gateway variable.

    def _process_stream(self, response):
        """Helper to process streaming response and collect content."""
        reasoning_content = ""
        content = ""
        for chunk in response:
            if chunk.choices[0].delta.content:
                content += chunk.choices[0].delta.content
            elif chunk.choices[0].delta.reasoning_content:
                reasoning_content += chunk.choices[0].delta.reasoning_content
        return content, reasoning_content

    def test_streaming_separate_reasoning_false(self, setup_backend):
        """Test streaming with separate_reasoning=False, reasoning_content should be empty."""
        _, model, client, _ = setup_backend

        response = client.chat.completions.create(
            model=model,
            messages=[
                {
                    "role": "user",
                    "content": "What is 1+3?",
                }
            ],
            max_tokens=100,
            stream=True,
            extra_body={"separate_reasoning": False},
        )

        content, reasoning_content = self._process_stream(response)

        assert not reasoning_content
        assert content

    def test_streaming_separate_reasoning_true(self, setup_backend):
        """Test streaming with separate_reasoning=True, reasoning_content should not be empty."""
        _, model, client, _ = setup_backend

        response = client.chat.completions.create(
            model=model,
            messages=[
                {
                    "role": "user",
                    "content": "What is 1+3?",
                }
            ],
            max_tokens=100,
            stream=True,
            extra_body={"separate_reasoning": True},
        )

        content, reasoning_content = self._process_stream(response)

        assert reasoning_content
        assert content

self, setup_backend
):
"""Test streaming with separate_reasoning=True and stream_reasoning=False."""
_, model, client, gateway = setup_backend
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The gateway variable is unused and can be replaced with _ for clarity.

Suggested change
_, model, client, gateway = setup_backend
_, model, client, _ = setup_backend

Comment on lines +128 to +146
_, model, client, gateway = setup_backend

response = client.chat.completions.create(
model=model,
messages=[
{
"role": "user",
"content": "What is 1+3?",
}
],
max_tokens=100,
extra_body={"separate_reasoning": False},
)

assert (
not response.choices[0].message.reasoning_content
or len(response.choices[0].message.reasoning_content) == 0
)
assert len(response.choices[0].message.content) > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The assertion for checking empty reasoning_content can be simplified. Also, the gateway variable is unused and can be removed. The assertion for content can also be made more Pythonic.

        _, model, client, _ = setup_backend

        response = client.chat.completions.create(
            model=model,
            messages=[
                {
                    "role": "user",
                    "content": "What is 1+3?",
                }
            ],
            max_tokens=100,
            extra_body={"separate_reasoning": False},
        )

        assert not response.choices[0].message.reasoning_content
        assert response.choices[0].message.content

Comment on lines +150 to +165
_, model, client, gateway = setup_backend

response = client.chat.completions.create(
model=model,
messages=[
{
"role": "user",
"content": "What is 1+3?",
}
],
max_tokens=100,
extra_body={"separate_reasoning": True},
)

assert len(response.choices[0].message.reasoning_content) > 0
assert len(response.choices[0].message.content) > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The gateway variable is unused. Also, the assertions can be simplified to be more Pythonic by checking the truthiness of the strings directly.

        _, model, client, _ = setup_backend

        response = client.chat.completions.create(
            model=model,
            messages=[
                {
                    "role": "user",
                    "content": "What is 1+3?",
                }
            ],
            max_tokens=100,
            extra_body={"separate_reasoning": True},
        )

        assert response.choices[0].message.reasoning_content
        assert response.choices[0].message.content

@slin1237 slin1237 merged commit aecd5f5 into main Jan 8, 2026
69 of 72 checks passed
@slin1237 slin1237 deleted the smg-ci-n/27 branch January 8, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant