-
-
Notifications
You must be signed in to change notification settings - Fork 87
feat: add docs for structured outputs #185
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
base: main
Are you sure you want to change the base?
Conversation
π WalkthroughWalkthroughThis pull request adds documentation for a structured outputs feature, consisting of a navigation configuration entry and a comprehensive guide page explaining the feature's purpose, usage patterns, supported schema libraries, and best practices. Changes
Estimated code review effortπ― 1 (Trivial) | β±οΈ ~5 minutes Poem
Pre-merge checks and finishing touchesβ Failed checks (1 inconclusive)
β Passed checks (2 passed)
β¨ Finishing touchesπ§ͺ Generate unit tests (beta)
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. Comment |
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.
Actionable comments posted: 1
π Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
π Files selected for processing (2)
docs/config.jsondocs/guides/structured-outputs.md
π§° Additional context used
π§ Learnings (1)
π Learning: 2025-12-13T17:09:09.794Z
Learnt from: CR
Repo: TanStack/ai PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T17:09:09.794Z
Learning: Applies to **/*.{ts,tsx} : Use Zod for runtime schema validation and type inference, particularly for tool input/output definitions with `toolDefinition()` and Zod schema inference
Applied to files:
docs/guides/structured-outputs.md
π Additional comments (8)
docs/config.json (1)
53-56: LGTM!The navigation entry is properly structured and logically placed in the guides section between agentic concepts and streaming topics.
docs/guides/structured-outputs.md (7)
40-68: LGTM!The basic usage example is clear, complete, and demonstrates the key concepts effectively with proper imports, schema definition, and usage.
182-219: LGTM!The tool integration example correctly demonstrates using Zod schemas with
toolDefinition()for type-safe tool definitions, aligning with established patterns. The workflow explanation is clear.Based on learnings, this follows the recommended pattern for using Zod with tool definitions.
263-300: LGTM!The best practices section provides valuable guidance with clear examples, and the error handling pattern is appropriate for production use.
226-226: TheJSONSchematype is correctly exported from"@tanstack/ai"and the import statement in the documentation is valid. The type is defined in the package's type exports and can be freely imported for use.Likely an incorrect or invalid review comment.
74-77: The return type behavior is accurate. The type definitionTextActivityResult<TSchema, TStream>correctly implements the distinction: whenTSchema extends SchemaInput(outputSchema provided), it returnsPromise<InferSchemaType<TSchema>>; otherwise with default parameters, it returnsAsyncIterable<StreamChunk>. The table correctly represents this API behavior.
7-7: No issues found. The link to standardschema.dev is accessible (HTTP 200) and "Standard JSON Schema" is the correct terminology for the specification being referenced. The documentation is accurate.
29-29: The documentation is accurate. Zod v4 is stable as of 2025, and v4.2+ is the correct minimum versionβit specifically introduced the JSON Schema/Standard Schema conversion features (z.fromJSONSchema/.toJSONSchema). No changes needed.Likely an incorrect or invalid review comment.
π― Changes
β Checklist
pnpm run test:pr.π Release Impact
Summary by CodeRabbit
βοΈ Tip: You can customize this high-level summary in your review settings.