-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix tool code generation in case of multiline descriptions #613
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
fix tool code generation in case of multiline descriptions #613
Conversation
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.
Thank you @sysradium !
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.
Thanks! It would be awesome to have a regression test.
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.
Just wondering about an alternative approach.
@albertvillanova frankly speaking I wanted to refactor tests a bit :) They became a bit too hard to maintain and can be improved (for example by removing side-effects). But maybe I can squeeze in a test for this specific case. No problem |
1068ec9
to
030a83f
Compare
@aymeric-roucher For the future do you have any particular attachment to old-school unittest.TestCase, or as I go I can change then and/or use pytest tests with fixture and parametrization? |
030a83f
to
41d276a
Compare
@albertvillanova about @sysradium's question above: which do you prefer? I see you've introduced many pytest tests, are these preferred? |
I advise to switch to pytest, because you are using pytest runner anyways, but loose the benefits pytest brings, e.g.: https://docs.pytest.org/en/stable/how-to/unittest.html#pytest-features-in-unittest-testcase-subclasses classes are a nice way to group tests, probably, but instead you can group them using files. |
We are using Lines 16 to 18 in 0153e37
smolagents/.github/workflows/tests.yml Line 44 in 0153e37
However:
|
@albertvillanova we just loose a bit of feature if we keep using classes. For example, you can't use tables-tests, or mark tests as deprecated, make them conditioned on python version. I am not saying we need to go a rewrite everything, but maybe newer test can be just pure functions instead. I know it is a heated discussion, and quite often people still push for classes, that's why I decided to ask first :) Currently it is a bit of a mix in this project, I want to have some alignment on that. |
@sysradium when I say we can use test classes in pytest, I don't mean to use unittest classes, but just regular classes. And I remember I have already deprecated and skipped tests that were implemented as pytest class methods. Here the link to Pytest docs about grouping tests in a class: https://docs.pytest.org/en/stable/getting-started.html#group-multiple-tests-in-a-class |
@albertvillanova my bad. Understood. Thank you! :) |
If a tool decorated with
@tool
contains a multiline comment:It breaks
to_dict
. It produces something like this: