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

Allow react.Tool to wrap methods #1856

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Conversation

tkellogg
Copy link
Contributor

The big reason for this is to pass parameters out-of-band, e.g. a user_id to ensure the LLM doesn't get the wrong data.

The unit test includes a usage, you can't use it as a decorator this way, but it works.

The alternative, of course, is to have a very long function and have all the tools be nested functions. It works, but can lead to some very long functions. I prefer long classes over long functions.

The big reason for this is to pass parameters out-of-band, e.g. a
user_id to ensure the LLM doesn't get the wrong data.

The unit test includes a usage, you can't use it as a decorator this
way, but it works.

The alternative, of course, is to have a very long function and have all
the tools be nested functions. It works, but can lead to some very long
functions. I prefer long classes over long functions.
@tkellogg
Copy link
Contributor Author

Alright, it's ready for merge

@okhat
Copy link
Collaborator

okhat commented Nov 25, 2024

Amazing, thank you @tkellogg !

@okhat okhat merged commit 1b10e23 into stanfordnlp:main Nov 25, 2024
4 checks passed
@tkellogg tkellogg deleted the react-methods branch November 25, 2024 17:21
isaacbmiller pushed a commit that referenced this pull request Dec 11, 2024
The big reason for this is to pass parameters out-of-band, e.g. a
user_id to ensure the LLM doesn't get the wrong data.

The unit test includes a usage, you can't use it as a decorator this
way, but it works.

The alternative, of course, is to have a very long function and have all
the tools be nested functions. It works, but can lead to some very long
functions. I prefer long classes over long functions.
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.

2 participants