Skip to content

docs(google): fix incorrect mode enums and outdated limitations in Google provider docs - #2389

Closed
mimran-khan wants to merge 1 commit into
567-labs:mainfrom
mimran-khan:docs/fix-google-provider-mode-docs
Closed

docs(google): fix incorrect mode enums and outdated limitations in Google provider docs#2389
mimran-khan wants to merge 1 commit into
567-labs:mainfrom
mimran-khan:docs/fix-google-provider-mode-docs

Conversation

@mimran-khan

@mimran-khan mimran-khan commented Jun 24, 2026

Copy link
Copy Markdown

Summary

I ran into the same confusion described in #2289 while setting up Instructor with Google GenAI. The docs had several issues that made it genuinely hard to figure out which modes to use. Here's what I fixed:

Mode enum confusion - The backwards-compatibility notes in both genai.md and google.md listed Mode.TOOLS and Mode.JSON as both the deprecated modes and the recommended replacements, which makes no sense. The actual deprecated modes are Mode.GENAI_TOOLS, Mode.GENAI_JSON, and Mode.GENAI_STRUCTURED_OUTPUTS. Fixed to match what the code actually does.

Optional types work fine - genai.md warned that "Gemini doesn't have support for Union and Optional types", but Optional (X | None) works correctly. Only true Union types (e.g., str | int) are unsupported.

Streaming warning contradicted itself - It said Mode.JSON doesn't support streaming, then in the same section showed working streaming examples with Mode.JSON. Clarified that Mode.TOOLS doesn't stream, but Mode.JSON does.

Other fixes:

  • Removed outdated Enum limitation (enums work fine, verify_no_unions is a no-op)
  • Fixed a Python syntax error in the Vertex AI migration example (misplaced parenthesis)
  • Removed "Coming soon" for Gemini Flash-8b which has been available for over a year
  • Updated patching.md to use generic Mode.TOOLS instead of deprecated provider-specific mode names

Verification

Cross-referenced all changes against the v2 source:

  • instructor/v2/providers/genai/handlers.py - registers Mode.TOOLS and Mode.JSON
  • instructor/v2/core/mode.py - DEPRECATED_TO_CORE map confirms GENAI_TOOLS → TOOLS, etc.
  • instructor/v2/providers/gemini/utils.py - verify_no_unions() always returns True

Partially addresses #2289

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • If it is a core feature, I have added documentation.

…ogle provider docs

The Google/GenAI/Vertex AI docs had several inaccuracies:

- Backwards compatibility notes listed generic modes (Mode.TOOLS, Mode.JSON)
  as both "deprecated" and "recommended", making them nonsensical. Fixed to
  correctly reference the actual legacy modes (GENAI_TOOLS, GENAI_JSON,
  GENAI_STRUCTURED_OUTPUTS).
- Union/Optional warning in genai.md incorrectly stated Optional types are
  unsupported. Optional (X | None) works correctly; only true Union types
  are unsupported.
- Streaming limitations warning was self-contradictory (suggested Mode.JSON
  as workaround while also stating it doesn't support streaming).
- Removed outdated Enum limitation (enums work in GENAI_STRUCTURED_OUTPUTS).
- Fixed syntax error in Vertex AI migration code examples.
- Updated "Available Models" to remove "Coming soon" for long-released model.
- Replaced deprecated provider-specific mode references in patching.md with
  generic Mode.TOOLS references matching the v2 architecture.

Partially addresses 567-labs#2289

@jxnl jxnl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the docs changes. This is the best current Google docs PR for #2289: it fixes the incorrect legacy mode names, narrows the Union/Optional guidance, removes the stale enum limitation, clarifies streaming mode behavior, and fixes the Vertex example syntax without over-expanding the migration story. Good to merge after maintainer merge approval.

@jxnl

jxnl commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Selected this as the Google docs PR to carry #2289 forward. I closed narrower duplicate #2329 and left #2343 open only as a possible narrower follow-up for provider-prefix / Vertex migration wording after this lands.

jxnl commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Consolidated these Google/GenAI/Vertex docs corrections into draft PR #2400. Closing this PR so the reviewed docs fixes land through the weekly maintenance consolidation.

@jxnl jxnl closed this Jun 29, 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.

2 participants