-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support rest-style docstrings when loading tools from function #9004
base: main
Are you sure you want to change the base?
feat: support rest-style docstrings when loading tools from function #9004
Conversation
P.S. Parameter and return type definitions in ReST docstrings are currently ignored to avoid things being too complicated. |
Pull Request Test Coverage Report for Build 13759572106Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
When I originally developed the create_tool_from_function
utility function, I also considered docstring parsing. However, I ultimately chose to use Annotated
, which felt more robust and simpler.
I can see how the feature you're proposing could be valuable for some users, and I appreciate the effort you've put into this PR.
As framework maintainers, we need to strike a balance between introducing new features and keeping the codebase simple and maintainable. With that in mind, I'd suggest opening a GitHub issue, discussion, or Discord thread to gather feedback and see how much interest there is from the community (Unfortunately, I don't have much time to do this myself at the moment).
If there's significant interest, we can revisit this PR and explore ways to merge or refine it.
Thanks again for your contribution!
Related Issues
#9023
Proposed Changes:
Supports ReST-style docstrings when loading a tool from function.
The docstring will be automatically parsed for function-level descriptions and parameter descriptions.
It's a small feature due to the fact that I was too lazy to write parameter annotations in class and instance methods.
How did you test it?
Added a new unit test for it.
Notes for the reviewer
N/A
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.