Repository navigation
Preserve iterable tool input examples across runner turns - #1991
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Author
|
The regression and related tests pass locally, with the validation details in the PR description. Could a maintainer approve the pending Actions run? |
This branch has not been deployed
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.
Fixes #1990.
Materialize input_examples into a list when constructing BaseFunctionTool. Its sync and async wrappers can then serialize the same examples on every request instead of sharing a consumed iterator. None remains omitted and an empty iterable remains an empty list.
This captures iterable membership once without deep-copying individual example dictionaries. The helper's accepted parameter types, generated schema and actual function execution are unchanged.
Validation
Twenty-four public-client cases cover sync/async and streaming/non-streaming runners with generator, list-iterator, list, tuple, empty-iterator and omitted inputs. Each run executes one tool and makes two requests. Tests check both complete outgoing tool definitions, exact example values, Unicode content, input nonmutation, generator visitation and the tool-result message.
Final regressions: 8 fail on unchanged main; all 24 pass with the fix, including sixteen controls.
Related function, runner and eager-tool suites: 243 passed and one existing expected failure on both Python 3.10.16 and 3.14.7.
The script's Pydantic v1 and optional MCP checks also passed, with unsupported Pydantic v1 cases skipped. Exact script summaries are recorded below.
Repository formatting, complete
./scripts/lintandgit diff --checkpassed.related310: 243 passed, 1 xfailed in 2.68s; 3 passed, 241 skipped in 2.62s; 39 passed in 2.51s
related314: 243 passed, 1 xfailed in 3.15s; 39 passed in 4.16s
UV_PYTHON=3.10.16 TEST_API_BASE_URL=http://127.0.0.1:9 ./scripts/test tests/lib/tools/test_input_example_iterables.py tests/lib/tools/test_functions.py tests/lib/tools/test_runners.py tests/lib/tools/test_runner_eager_tools.py UV_PYTHON='>=3.14.0' TEST_API_BASE_URL=http://127.0.0.1:9 ./scripts/test tests/lib/tools/test_input_example_iterables.py tests/lib/tools/test_functions.py tests/lib/tools/test_runners.py tests/lib/tools/test_runner_eager_tools.py ./scripts/lintTested on macOS arm64. Live services, other operating systems and the complete generated API runtime suite were not exercised. No dependencies, public signatures or release metadata changed.