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

Fixed argref_by_name bug with kwargs #50

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Fixed argref_by_name bug with kwargs #50

merged 2 commits into from
Sep 27, 2024

Conversation

whitead
Copy link
Contributor

@whitead whitead commented Sep 26, 2024

Found an awful dirty bug when using @argref_by_name. To route strings, I wrote it so if a kwarg is passed - like (foo='bar') instead of ('bar') then it will not try to dereference that string to an object from the state. However - SimpleAgent calls all tools via kwarg and ReactAgent calls all tools via args. So, ReactAgent looked great and SimpleAgent was passing strings around and breaking code.

I made it so that if strings are passed and if they do not match a key, just assume they're meant to be used as a literal. However, I did keep an error check if the first argument is a string and not found in state as a valid key, then it throws an error.

I also cleaned up the function a bit and split up tests

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 26, 2024
Copy link
Collaborator

@jamesbraza jamesbraza left a comment

Choose a reason for hiding this comment

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

Nice catch, wow in the weeds. Thanks for testing

src/aviary/tools/argref.py Show resolved Hide resolved
@whitead whitead merged commit a6eb7d1 into main Sep 27, 2024
6 checks passed
@whitead whitead deleted the argref-bug branch September 27, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants