Repository navigation
Conversation
Contributor
|
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.
📝 Changes Description
Fix
dspy.Toolschema inference forfunctools.partialcallables.Prebinding context is useful when exposing a Python function as an agent tool. Currently,
Tool(partial(lookup, "demo"))inspects the genericpartial.__call__method and advertises requiredargs/kwargsinstead of the remaining typed arguments. Native function-calling adapters pass that incorrect schema to the model even though the original partial can execute correctly.This change reads the effective signature from the partial and the type hints from its underlying function, bound method, or callable instance. Positional bindings disappear from the schema; keyword bindings remain overridable defaults, matching Python semantics. Existing names/descriptions and explicit schema overrides are unchanged. No dependencies or public options added.
Minimal baseline example:
Verification
f2267837922811fc3b2bc1ba0f3056ae3e58e146:python -m pytest tests/adapters/test_tool.py tests/adapters/test_json_adapter.py -q -k 'not formats_with_nested_documents': 82 passed / 1 deselected.test_json_adapter_formats_with_nested_documents, becausedspy.experimentalis not exposed. Reverting only the parser fix reproduces that same failure alongside all five new failures. One existing Pydantic ReadOnly warning remains.✅ Contributor Checklist
AI assistance was used for investigation, implementation, tests, and self-review. No live model/provider calls were made. Full repository tests, cross-platform execution, and non-introspectable builtin callables were not verified. This does not turn prebound keyword arguments into an authorization boundary; they remain overridable as Python permits.