docs(google): fix incorrect mode enums and outdated limitations in Google provider docs - #2389
Closed
mimran-khan wants to merge 1 commit into
Closed
Conversation
…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
approved these changes
Jun 29, 2026
jxnl
left a comment
Collaborator
There was a problem hiding this comment.
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.
Collaborator
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.mdandgoogle.mdlistedMode.TOOLSandMode.JSONas both the deprecated modes and the recommended replacements, which makes no sense. The actual deprecated modes areMode.GENAI_TOOLS,Mode.GENAI_JSON, andMode.GENAI_STRUCTURED_OUTPUTS. Fixed to match what the code actually does.Optional types work fine -
genai.mdwarned 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.JSONdoesn't support streaming, then in the same section showed working streaming examples withMode.JSON. Clarified thatMode.TOOLSdoesn't stream, butMode.JSONdoes.Other fixes:
verify_no_unionsis a no-op)patching.mdto use genericMode.TOOLSinstead of deprecated provider-specific mode namesVerification
Cross-referenced all changes against the v2 source:
instructor/v2/providers/genai/handlers.py- registersMode.TOOLSandMode.JSONinstructor/v2/core/mode.py-DEPRECATED_TO_COREmap confirmsGENAI_TOOLS → TOOLS, etc.instructor/v2/providers/gemini/utils.py-verify_no_unions()always returnsTruePartially addresses #2289
Checklist before requesting a review