feat(llm): GeminiLLM declares supports_structured_output = True - #622
Closed
matteomedioli wants to merge 1 commit into
Closed
feat(llm): GeminiLLM declares supports_structured_output = True#622matteomedioli wants to merge 1 commit into
matteomedioli wants to merge 1 commit into
Conversation
matteomedioli
marked this pull request as ready for review
September 9, 2026 08:57
GeminiLLM already supports structured output via response_schema/ response_mime_type, but never declared the capability flag — pipeline components checking it fell back to prompt-based JSON. Breaking: SimpleKGPipeline, SchemaFromTextExtractor, and LLMEntityRelationExtractor now enable structured output by default with GeminiLLM. Use use_structured_output=False to keep the previous behavior. Reimplements the intent of #573 (closed, badly stale) fresh on current main. Independent of #572/#621 — different concern, no conflict.
matteomedioli
force-pushed
the
matteo/gemini-supports-structured-output
branch
from
September 9, 2026 11:15
715eede to
8ac30ec
Compare
| capability flag must say so, or SimpleKGPipeline/SchemaFromTextExtractor/ | ||
| LLMEntityRelationExtractor silently fall back to prompt-based JSON.""" | ||
| llm = GeminiLLM("gemini-2.0-flash") | ||
| assert llm.supports_structured_output is True |
Contributor
There was a problem hiding this comment.
the most LLM test ever... set a default... test the default is default :D
Contributor
Author
|
postponed for the next release. |
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.
What & Why
GeminiLLMalready supports structured output viaresponse_schema/response_mime_type, but never declared thesupports_structured_outputcapability flag. Pipeline components that check the flag (SimpleKGPipeline,SchemaFromTextExtractor,LLMEntityRelationExtractor) sawFalseand silently fell back to prompt-based JSON instead of schema-enforced structured output.Reimplements the intent of #573 (closed without merging, and now badly stale — 193 files of drift) fresh on current
main.Breaking for pipeline users: the components above now enable structured output by default with
GeminiLLM. To keep the previous behavior, construct them withuse_structured_output=False. Same shape as the existingAnthropicLLM.supports_structured_outputbreaking-change entry in 1.19.0's CHANGELOG.How
supports_structured_output: bool = TrueonBaseGeminiLLM(same placeBaseVertexAILLM/AnthropicLLMdeclare it).Testing
1329 passed — no fallout from the flag flip elsewhere in the suite. mypy/ruff clean.