Skip to content

Conversation

@DanielSLew
Copy link
Contributor

@DanielSLew DanielSLew commented Dec 31, 2025

Note

Expands the structured output docs with provider-specific guidance and advanced usage patterns.

  • Renames "Response format" to LLM Structured Output support and clarifies variability across models
  • Adds jsonPromptInjection guidance and example, including a note/workaround for Gemini 2.5 when tools are enabled
  • Documents using a separate structuring model so a secondary agent generates only the structured output
  • Adds a multi-step prepareStep pattern to separate tool calls from structured output generation
  • Updates docs/src/content/en/docs/agents/structured-output.mdx with examples and explanations to improve reliability and flexibility

Written by Cursor Bugbot for commit d80bcea. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Documentation
    • Expanded structured output documentation with model-specific behavior guidance
    • Added advanced usage patterns for flexible configuration approaches, including separate structuring models and multi-step implementation methods

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

⚠️ No Changeset found

Latest commit: d80bcea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Dec 31, 2025

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

Project Deployment Review Updated (UTC)
assistant-ui Ready Ready Preview, Comment Dec 31, 2025 3:32pm
mastra-docs Ready Ready Preview, Comment Dec 31, 2025 3:32pm
mastra-docs-1.x Building Building Preview, Comment Dec 31, 2025 3:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Walkthrough

Documentation updates to the structured output guide expand the "Response format" section into "LLM Structured Output support" with content covering model variations, jsonPromptInjection handling, and two advanced usage patterns: separate structuring models and multi-step approaches with prepareStep.

Changes

Cohort / File(s) Summary
Structured Output Documentation
docs/src/content/en/docs/agents/structured-output.mdx
Expanded "Response format" section into comprehensive "LLM Structured Output support" guide. Added subsections covering model behavior variations, jsonPromptInjection callout, separate structuring model pattern, and multi-step prepareStep approach with example code blocks.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • abhiaiyer91
  • YujohnNattrass

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding more documentation content to the structured output section. It follows imperative mood, uses proper capitalization, and is concise at 37 characters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@github-actions
Copy link
Contributor

🚨 Redirect Validation Failed

The redirect validation found issues in vercel.json (duplicate sources or broken destination links).

Action Required: Review and fix the redirect configuration.

📋 View workflow logs for details

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/src/content/en/docs/agents/structured-output.mdx (2)

171-171: Remove marketing language from technical explanation.

Line 171 uses "built-in support," which reads as marketing copy. Reframe to focus on the technical capability without promotional language.

🔎 Proposed fix
-By default, Mastra passes the schema to the model provider using the `response_format` API parameter. Most model providers have built-in support for this, which reliably enforces the schema.
+By default, Mastra passes the schema to the model provider using the `response_format` API parameter. Most model providers support this, which reliably enforces the schema.

As per coding guidelines, documentation should avoid adjectives like "built-in" that read like marketing copy.


209-209: Simplify verbose phrasing.

The phrase "all of the steps" is unnecessarily wordy.

🔎 Proposed fix
-The main agent will handle all of the steps (including tool calling) and the structured output model will handle only the generation of structured output.
+The main agent will handle all the steps (including tool calling) and the structured output model will handle only the generation of structured output.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e978536 and d80bcea.

📒 Files selected for processing (1)
  • docs/src/content/en/docs/agents/structured-output.mdx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/writing-documentation.mdc)

**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as these read like marketing copy and developers don't like that
When writing developer documentation, do not use 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations like 'Check out', 'Learn more', 'Explore'. Do not use words like 'essential' or 'offers'
When writing developer documentation, do not use 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution' as these are marketing jargon that developers dislike
When writing developer documentation, avoid phrasing like 'without changing your code' or 'automatically handles' that obscures implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details. Focus on technical specifics and implementation details rather than high-level benefits. For example, avoid sentences like: 'This makes it easy to build AI applications that maintain meaningful conversations and remember important details, whether you're building a simple chatbot or a sophisticated AI assistant'
All H1 headings (# Heading) must use title case format, capitalizing the first letter of each major word. Examples: 'Getting Started', 'Human In-the-Loop Workflow', 'Agent as a Step'

Files:

  • docs/src/content/en/docs/agents/structured-output.mdx
**/*{docs,documentation}/**/*.{md,mdx}

📄 CodeRabbit inference engine (.windsurfrules)

**/*{docs,documentation}/**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as they read like marketing copy
When writing developer documentation, do not use words like 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations such as 'Check out', 'Learn more', 'Explore', 'essential', or 'offers'
When writing developer documentation, avoid marketing jargon such as 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution'
When writing developer documentation, do not use phrases like 'without changing your code' or 'automatically handles' as they glide over implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details; instead, focus on technical nuts and bolts with specific implementation details rather than abstract benefits

Files:

  • docs/src/content/en/docs/agents/structured-output.mdx
🧠 Learnings (1)
📚 Learning: 2025-11-10T19:12:09.916Z
Learnt from: H2Shami
Repo: mastra-ai/mastra PR: 9944
File: packages/core/src/llm/model/gateways/helicone.ts:85-99
Timestamp: 2025-11-10T19:12:09.916Z
Learning: Helicone AI Gateway has automated normalization mappers that translate provider-specific schemas (including structured outputs) to the destination provider's expected format, making it safe to set supportsStructuredOutputs: true across all providers accessed through Helicone.

Applied to files:

  • docs/src/content/en/docs/agents/structured-output.mdx
🪛 LanguageTool
docs/src/content/en/docs/agents/structured-output.mdx

[style] ~209-~209: Consider removing “of” to be more concise
Context: ...ured output. The main agent will handle all of the steps (including tool calling) and the ...

(ALL_OF_THE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Validate build outputs
  • GitHub Check: Cursor Bugbot
  • GitHub Check: test
  • GitHub Check: Lint
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
docs/src/content/en/docs/agents/structured-output.mdx (1)

165-249: Documentation expansion is well-structured and technically sound.

The new sections clearly explain structured output support variations, jsonPromptInjection handling, and two advanced patterns (separate structuring model and multi-step approach with prepareStep). The code examples are appropriate and illustrate each concept concretely. The Gemini 2.5 note is appropriately contextualized within the broader section.

@DanielSLew DanielSLew merged commit cc23183 into main Dec 31, 2025
42 of 43 checks passed
@DanielSLew DanielSLew deleted the docs/structured-output-more-info branch December 31, 2025 15:51
astout55555 pushed a commit to astout55555/mastra that referenced this pull request Jan 6, 2026
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.

3 participants