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

Dynamic tool -> single purpose #3697

Merged
merged 3 commits into from
Apr 28, 2023
Merged

Dynamic tool -> single purpose #3697

merged 3 commits into from
Apr 28, 2023

Conversation

vowelparrot
Copy link
Contributor

@vowelparrot vowelparrot commented Apr 28, 2023

I think the logic of #3684 (review) is too confusing.

I prefer this alternative because:

  • All Tool() implementations by default will be treated the same as before. No breaking changes.
  • Less reliance on pydantic magic
  • The decorator (which only is typed as returning a callable) can infer schema and generate a structured tool
  • Either way, the recommended way to create a custom tool is through inheriting from the base tool

@vowelparrot vowelparrot force-pushed the vwp/single_purpose branch 3 times, most recently from dce55ef to 85d30aa Compare April 28, 2023 07:43
vowelparrot and others added 3 commits April 28, 2023 06:24
Tradeoffs here:
- No lint-time checking for compatibility
- Differs from JS package
- The signature inference, etc. in the base tool isn't simple
- The `args_schema` is optional

Pros:
- Forwards compatibility retained
- Doesn't break backwards compatibility
- User doesn't have to think about which class to subclass (single base
tool or dynamic `Tool` interface regardless of input)
-  No need to change the load_tools, etc. interfaces

Co-authored-by: Hasan Patel <mangafield@gmail.com>
@vowelparrot vowelparrot merged commit da7b514 into master Apr 28, 2023
9 checks passed
@vowelparrot vowelparrot deleted the vwp/single_purpose branch April 28, 2023 16:38
samching pushed a commit to samching/langchain that referenced this pull request May 1, 2023
I think the logic of
langchain-ai#3684 (review)
is too confusing.

I prefer this alternative because:
- All `Tool()` implementations by default will be treated the same as
before. No breaking changes.
- Less reliance on pydantic magic
- The decorator (which only is typed as returning a callable) can infer
schema and generate a structured tool
- Either way, the recommended way to create a custom tool is through
inheriting from the base tool
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.

None yet

1 participant