-
Notifications
You must be signed in to change notification settings - Fork 17
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(tool): returns schema #118
Conversation
I need the pull request number to review. Could you please provide the PR number you'd like me to review? |
118 |
@CharlieHelps, would you mind reviewing this PR? |
The review has been posted to GitHub. |
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.
The diff introduces increased type complexity and some potential pitfalls in the handling of tool metadata. In particular, the conditional types for the execute function can be hard to follow, the removal of the returns
property in chat may need review, and resetting the tool name in the compatibility layer could lead to unexpected behavior if not intentional.
Summary of changes
Summary of Changes
- Documentation Update: Added a new documentation example in
docs/content/docs/packages/tool.mdx
demonstrating how to use thereturns
schema with a tool. - Generics & Schema Enhancements: Updated the compatibility layer in
packages-ext/compat/src/utils/tool.ts
and the core tool implementation inpackages/tool/src/index.ts
to support generics with schema types, including a newreturns
field and conditional types for the execute function. - Type Definitions & API Updates: Modified the
Tool
interface inpackages/shared-chat/src/types/tool.ts
to include an experimentalreturns
property and refined the return type of the execute function. - Chat Utilities & Testing: Adjusted the chat utility in
packages/shared-chat/src/utils/chat.ts
to clean thereturns
property, and added new tests inpackages/tool/test/index.test.ts
to validate the tool behavior with a returns schema.
closed #110