Skip to content

[smg][ci] migrate function calling tests to new infrastructure#16748

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

[smg][ci] migrate function calling tests to new infrastructure#16748
slin1237 merged 1 commit intomainfrom
smg-ci-n/30

Conversation

@slin1237
Copy link
Copy Markdown
Collaborator

@slin1237 slin1237 commented Jan 8, 2026

Migrate function calling and tool choice tests from e2e_grpc to chat_completions using the new pytest fixture infrastructure.

Tests migrated from test_openai_function_calling.py:

  • TestOpenAIServerFunctionCalling (llama-1b, llama parser): 10 tests for function calling format, streaming, and tool_choice options
  • TestOpenAIPythonicFunctionCalling (llama-8b, pythonic parser): 2 tests for pythonic function calling format

Tests migrated from test_tool_choice.py:

  • TestToolChoiceLlama (llama-1b, llama parser): 13 tests for tool_choice auto/required/specific modes with streaming and non-streaming
  • TestToolChoiceQwen (qwen-7b, qwen parser): inherits all tests
  • TestToolChoiceMistral (mistral-7b, mistral parser): inherits all tests with test_complex_parameters_required_non_streaming skipped

Total: 25 test methods across 5 test classes using 4 different models.

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 significantly refactors the end-to-end testing framework for function calling and tool choice features. By moving these tests to a new pytest fixture-based infrastructure under chat_completions, it aims to streamline test execution, enhance modularity, and ensure consistent validation across different language models and tool parsing mechanisms. This change improves the robustness and maintainability of the test suite for these critical functionalities.

Highlights

  • Test Infrastructure Migration: Migrated existing function calling and tool choice tests from the e2e_grpc framework to the new chat_completions infrastructure, leveraging pytest fixtures for improved organization and maintainability.
  • Consolidated Test Suites: Consolidated tests from test_openai_function_calling.py and test_tool_choice.py into a single, unified test file, test_function_calling.py.
  • Comprehensive Test Coverage: The migration includes 25 test methods across 5 test classes, covering various aspects of function calling and tool choice, including streaming, argument parsing, tool_choice modes (auto, required, specific), and error handling.
  • Multi-Model Support: Tests are configured to run against multiple models (Llama 1B, Llama 8B, Qwen 7B, Mistral 7B) with different tool parsers (llama, pythonic, qwen, mistral), ensuring broad compatibility.
  • Flaky Test Identification: Identified and marked specific tests as 'flaky' for Llama and Mistral models, providing clarity on known inconsistencies.

🧠 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.

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 function calling and tool choice end-to-end tests to a new pytest-based infrastructure, which is a great improvement for test maintainability and clarity. The new tests are comprehensive and cover a wide range of scenarios across different models and parsers. I've identified one logic bug in a test case that could lead to false positives and another area where the code for reconstructing streaming responses could be made more robust. I've provided specific suggestions for both points. Overall, this is a solid contribution to improving the testing framework.

Comment thread sgl-model-gateway/e2e_test/chat_completions/test_function_calling.py Outdated
Comment thread sgl-model-gateway/e2e_test/chat_completions/test_function_calling.py Outdated
@slin1237 slin1237 force-pushed the smg-ci-n/30 branch 2 times, most recently from a564965 to e248fe3 Compare January 8, 2026 18:02
Migrate function calling and tool choice tests from e2e_grpc to
chat_completions using the new pytest fixture infrastructure.

Tests migrated from test_openai_function_calling.py:
- TestOpenAIServerFunctionCalling (llama-1b, llama parser): 10 tests
  for function calling format, streaming, and tool_choice options
- TestOpenAIPythonicFunctionCalling (llama-8b, pythonic parser): 2 tests
  for pythonic function calling format

Tests migrated from test_tool_choice.py:
- TestToolChoiceLlama (llama-1b, llama parser): 13 tests for tool_choice
  auto/required/specific modes with streaming and non-streaming
- TestToolChoiceQwen (qwen-7b, qwen parser): inherits all tests
- TestToolChoiceMistral (mistral-7b, mistral parser): inherits all tests
  with test_complex_parameters_required_non_streaming skipped

Total: 25 test methods across 5 test classes using 4 different models.
@slin1237 slin1237 merged commit 49305fa into main Jan 8, 2026
80 of 86 checks passed
@slin1237 slin1237 deleted the smg-ci-n/30 branch January 8, 2026 19:08
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