Skip to content

feat(ai-sdk): createTool, implementTool helpers - #1151

Merged
dinwwwh merged 6 commits into
mainfrom
unnoq/issue1150
Oct 31, 2025
Merged

feat(ai-sdk): createTool, implementTool helpers#1151
dinwwwh merged 6 commits into
mainfrom
unnoq/issue1150

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 30, 2025

Copy link
Copy Markdown
Member

Implement or create AI SDK tool from contract/procedure.

Closes: #1150

Summary by CodeRabbit

  • New Features

    • Added @orpc/ai-sdk package enabling integration of oRPC contracts with the Vercel AI SDK
    • Provides functions to map contract-first definitions to AI SDK tools
    • Includes comprehensive documentation with TypeScript examples for AI SDK integration
  • Documentation

    • Added detailed guides for integrating AI SDK tools with oRPC contracts

@vercel

vercel Bot commented Oct 30, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
orpc Ready Ready Preview Comment Oct 31, 2025 3:52am

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 30, 2025
@coderabbitai

coderabbitai Bot commented Oct 30, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unnoq has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 440b07e and fe7169f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • apps/content/docs/integrations/ai-sdk.md (1 hunks)
  • apps/content/package.json (1 hunks)
  • packages/ai-sdk/.gitignore (1 hunks)
  • packages/ai-sdk/README.md (1 hunks)
  • packages/ai-sdk/package.json (1 hunks)
  • packages/ai-sdk/src/index.test.ts (1 hunks)
  • packages/ai-sdk/src/index.ts (1 hunks)
  • packages/ai-sdk/src/tool.test-d.ts (1 hunks)
  • packages/ai-sdk/src/tool.test.ts (1 hunks)
  • packages/ai-sdk/src/tool.ts (1 hunks)
  • packages/ai-sdk/tsconfig.json (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch unnoq/issue1150

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @unnoq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant new feature: the createTool helper, housed within a newly created @orpc/ai-sdk package. This helper simplifies the process of integrating oRPC contracts with the AI SDK by automatically generating AI SDK tools from defined oRPC contract procedures. This enhancement aims to improve developer experience and promote consistency when building AI-powered applications using oRPC.

Highlights

  • New createTool helper: Introduces a new utility function createTool within the @orpc/ai-sdk package.
  • oRPC contract to AI SDK tool conversion: This helper allows developers to leverage existing oRPC contract definitions to create AI SDK tools, streamlining integration.
  • Dedicated AI SDK package: A new package, @orpc/ai-sdk, has been added to house AI SDK related functionalities.
  • Comprehensive documentation and tests: Extensive documentation, type definition tests, and unit tests have been added for the new createTool helper to ensure correctness and ease of use.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new @orpc/ai-sdk package with a createTool helper function. This is a great feature that allows developers to leverage their existing oRPC contracts to create AI SDK tools, reducing boilerplate and improving type safety. The implementation is clean, well-tested, and the new documentation is helpful. I have a couple of suggestions to improve the documentation example and dependency management.

Comment thread apps/content/docs/integrations/ai-sdk.md
Comment thread packages/ai-sdk/package.json
@pkg-pr-new

pkg-pr-new Bot commented Oct 30, 2025

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@1151

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1151

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1151

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1151

@orpc/experimental-durable-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-iterator@1151

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@1151

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@1151

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1151

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1151

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1151

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@1151

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@1151

@orpc/experimental-publisher

npm i https://pkg.pr.new/@orpc/experimental-publisher@1151

@orpc/react

npm i https://pkg.pr.new/@orpc/react@1151

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@1151

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@1151

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1151

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1151

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@1151

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@1151

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@1151

@orpc/standard-server-fastify

npm i https://pkg.pr.new/@orpc/standard-server-fastify@1151

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@1151

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@1151

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@1151

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@1151

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1151

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@1151

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1151

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@1151

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@1151

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1151

commit: fe7169f

@codecov

codecov Bot commented Oct 30, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 31, 2025
@dinwwwh dinwwwh changed the title feat(ai-sdk): createTool helper feat(ai-sdk): createTool, implementTool helpers Oct 31, 2025
@dinwwwh
dinwwwh merged commit d92c7aa into main Oct 31, 2025
11 checks passed
@dinwwwh
dinwwwh deleted the unnoq/issue1150 branch June 22, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add createTool helper to convert oRPC contracts/procedures into AI SDK tools

1 participant