TEST: Improve tool test#4632
Open
littlegy wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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_idspayloads and formatted error handling. - Standardize
max_completion_tokensusage via a newDEFAULT_MAX_COMPLETION_TOKENSconstant and improve multi-turn tool message correctness by includingname.
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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