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

feat(tool): returns schema #118

Merged
merged 8 commits into from
Mar 24, 2025
Merged

feat(tool): returns schema #118

merged 8 commits into from
Mar 24, 2025

Conversation

kwaa
Copy link
Member

@kwaa kwaa commented Mar 24, 2025

closed #110

@kwaa kwaa added the enhancement New feature or request label Mar 24, 2025
@kwaa kwaa added this to the v0.2 "over the reality" milestone Mar 24, 2025
Copy link

charliechecks bot commented Mar 24, 2025

I need the pull request number to review. Could you please provide the PR number you'd like me to review?

@kwaa
Copy link
Member Author

kwaa commented Mar 24, 2025

I need the pull request number to review. Could you please provide the PR number you'd like me to review?

118

@kwaa
Copy link
Member Author

kwaa commented Mar 24, 2025

@CharlieHelps, would you mind reviewing this PR?

Copy link

charliechecks bot commented Mar 24, 2025

The review has been posted to GitHub.

Copy link

@charliechecks charliechecks bot left a 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 the returns schema with a tool.
  • Generics & Schema Enhancements: Updated the compatibility layer in packages-ext/compat/src/utils/tool.ts and the core tool implementation in packages/tool/src/index.ts to support generics with schema types, including a new returns field and conditional types for the execute function.
  • Type Definitions & API Updates: Modified the Tool interface in packages/shared-chat/src/types/tool.ts to include an experimental returns 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 the returns property, and added new tests in packages/tool/test/index.test.ts to validate the tool behavior with a returns schema.

@charliechecks charliechecks bot removed the request for review from CharlieHelps March 24, 2025 14:17
@kwaa kwaa merged commit eceb7d9 into main Mar 24, 2025
1 check passed
@kwaa kwaa deleted the feat/tool-returns branch March 24, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tool Output Schema
2 participants