Repository navigation
fix(coach): retry a refused Gemini grounding turn without web search - #150
Open
foureight84 wants to merge 1 commit into
Open
foureight84 wants to merge 1 commit into
foureight84 wants to merge 1 commit into
Conversation
Port Android PR saksham2001#127: - When a Gemini google_search grounding turn returns HTTP 429, retry once without google_search as the plain schema turn with a note that web search was skipped. - Remember the refused API key for the process so subsequent turns skip grounding without an extra round trip; non-grounding 429s and retry 429s still surface normally.
This branch has not been deployed
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.
Ports Android PR #127 (
fix/123-gemini-grounding-429) to iOS.Summary
Free-tier Gemini API keys can be refused
google_searchgrounding with HTTP429 RESOURCE_EXHAUSTEDwhile plain, function-calling, and schema turns on the same key succeed. Previously this caused every Coach turn to fail whenever Web Search was enabled.GeminiClient.swift:google_searchgrounding turn returns HTTP429, retries once withoutgoogle_searchas the plain schema turn with a note instructing the model to note indata_quality_notethat web search was skipped.NSLock) so subsequent turns skip grounding without paying the extra failed round trip.429s and429s on the ungrounded retry still surface normally without marking the key.Verification
xcodebuild test -project PulseLoop.xcodeproj -scheme PulseLoop -destination 'platform=iOS Simulator,name=iPhone 17' -only-testing:PulseLoopTests/GeminiClientGroundingTests— 4/4 tests passed.