fix(gemini): remove redundant schema injection into system prompt#1071
Open
seheepeak wants to merge 1 commit intovectorize-io:mainfrom
Open
fix(gemini): remove redundant schema injection into system prompt#1071seheepeak wants to merge 1 commit intovectorize-io:mainfrom
seheepeak wants to merge 1 commit intovectorize-io:mainfrom
Conversation
GeminiLLM.call() was sending the structured output schema twice: once injected as text into system_instruction, and once via the native response_schema parameter. The native parameter (with response_mime_type set to application/json) already enforces structured output, so the prompt-side injection only wasted input tokens. Fixes vectorize-io#1070
nicoloboschi
approved these changes
Apr 15, 2026
Author
|
CI failures look unrelated to this PR — fixture setup fails with |
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
Removes the JSON schema text injection from
system_instructioninGeminiLLM.call(). The schema is already passed via the nativeresponse_schemaparameter (withresponse_mime_type="application/json"), so the prompt-side injection was duplicating it on every structured-output call and wasting input tokens.Fixes #1070
Test plan
retainstill works correctly with the Gemini provider after removing the linesruff check,ruff format --check,ty checkpass on the modified file