feat: support rest-style docstrings when loading tools from function#9004
feat: support rest-style docstrings when loading tools from function#9004LastRemote wants to merge 1 commit intodeepset-ai:mainfrom
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 |
anakin87
left a comment
There was a problem hiding this comment.
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.