Skip to content

TEST: Improve tool test#4632

Open
littlegy wants to merge 7 commits into
InternLM:mainfrom
littlegy:improve_tool_test
Open

TEST: Improve tool test#4632
littlegy wants to merge 7 commits into
InternLM:mainfrom
littlegy:improve_tool_test

Conversation

@littlegy

Copy link
Copy Markdown
Contributor

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.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

Copilot AI left a comment

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.

Pull request overview

This PR strengthens the autotest suite around tool-calling and reasoning streaming by expanding stream collectors/validators (including HTTP SSE), adding concurrent multi-turn parity/stress tests, and standardizing larger completion budgets across tests.

Changes:

  • Add HTTP (sync + aiohttp async) streaming collectors and richer validation utilities for tool-call streams (tool_calls aggregation, [DONE], usage, output_ids, routed_experts, parser-drop detection).
  • Introduce new concurrent parity + stress test coverage for tool-call streaming, including input_ids payloads and formatted error handling.
  • Standardize max_completion_tokens usage via a new DEFAULT_MAX_COMPLETION_TOKENS constant and improve multi-turn tool message correctness by including name.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
autotest/utils/tool_reasoning_definitions.py Adds HTTP SSE collectors (sync/async), tokenizer helpers for input_ids, expanded stream aggregation/validation, and concurrent worker utilities.
autotest/utils/constant.py Introduces DEFAULT_MAX_COMPLETION_TOKENS and updates tool/reasoning model lists.
autotest/interface/restful/tool_parser/test_tool_call_concurrent_parity.py New concurrent parity + stress tests for tool-call streaming (including error formatting checks).
autotest/interface/restful/tool_parser/test_tool_call_basic.py Switches to shared helpers and adds additional streaming validations; standardizes token budget.
autotest/interface/restful/tool_parser/test_tool_call_advanced.py Adds token-id/routed-experts validations and multi-turn streaming coverage; standardizes token budget.
autotest/interface/restful/tool_parser/conftest.py Refactors shared base to reuse clients/tokenizers and adds Llama 3.1 parallel-tool skip at collection time.
autotest/interface/restful/reasoning_parser/test_reasoning_api.py Standardizes token budget and relaxes/centralizes post-tool-turn assertions.
autotest/interface/restful/reasoning_parser/conftest.py Adds shared assertion helpers and reuses a single logged client per test instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +263 to +267
timestamp = time.strftime('%Y%m%d_%H%M%S')
log_base = config.get('log_path', './logs')
log_dir = os.path.join(log_base, category)
os.makedirs(log_dir, exist_ok=True)
return os.path.join(log_dir, f'{safe_test_name}.log')
return os.path.join(log_dir, f'{safe_test_name}_{timestamp}.log')
Comment on lines +1073 to +1075
args = fn['arguments']
if isinstance(args, dict):
args = json.dumps(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants