Skip to content
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: make Tool.from_function more configurable #155

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

anakin87
Copy link
Member

@anakin87 anakin87 commented Dec 12, 2024

Related Issues

Proposed Changes:

  • Simply allow passing name and description in Tool.from_function class method

How did you test it?

CI, adapted tests and new tests

Notes for the reviewer

Unit tests are failing for reasons unrelated to this PR. I'm trying to fix them in #156

Checklist

@@ -106,7 +106,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "Tool":
return cls(**data)

@classmethod
def from_function(cls, function: Callable, docstring_as_desc: bool = True) -> "Tool":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to remove docstring_as_desc since the new parameters allow for more configurability.
We can do that because we are in experimental.

@anakin87 anakin87 marked this pull request as ready for review December 12, 2024 17:47
@anakin87 anakin87 requested a review from a team as a code owner December 12, 2024 17:47
@anakin87 anakin87 requested review from julian-risch and removed request for a team December 12, 2024 17:47
@coveralls
Copy link

coveralls commented Dec 14, 2024

Pull Request Test Coverage Report for Build 12354141486

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 83.197%

Totals Coverage Status
Change from base Build 12343503963: -0.01%
Covered Lines: 2035
Relevant Lines: 2446

💛 - Coveralls

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks quite good to me already. The new description that defaults to the docstring is a nice simplification compared to the previous docstring_as_desc.
I have one suggestion to simplify one of the test cases. Let me know what you think and if you see any reason to keep that test case as is. Otherwise the PR is ready to be merged.

test/dataclasses/test_tool.py Outdated Show resolved Hide resolved
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@anakin87 anakin87 merged commit 813157d into main Dec 16, 2024
8 checks passed
@anakin87 anakin87 deleted the tool-from-fun-flexible branch December 16, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make name and description configurable in Tool.from_function
3 participants