Add Google Gemini as an alternative AI coach provider - #9
Merged
saksham2001 merged 6 commits intoJun 26, 2026
Merged
Conversation
Introduces a provider abstraction so the AI coach can run on Google Gemini in addition to OpenAI, selectable in Settings. The user's Gemini key is stored only in the iOS Keychain. - GeminiClient: adapts the app's ResponsesClient protocol to Gemini's generateContent API, translating request/response shapes and tool calls. Maintains conversation state across turns since the OpenAI Responses API is stateful but Gemini is not. - GeminiKeychainStore: separate Keychain entry so OpenAI/Gemini keys coexist. - Settings: provider picker, per-provider model list, and a Gemini key field mirroring the OpenAI one. - Coach view model, summary, and notification services resolve the active client from the selected provider. Schema handling for Gemini: rewrites JSON Schema union types (["string","null"]) to nullable, strips unsupported keywords, and omits the response schema on tool turns (Gemini rejects tools + responseSchema together), relying on the orchestrator's tool-less repair turn for the final structured output. Co-Authored-By: Claude Opus 4.8 <[email protected]>
saksham2001
self-requested a review
June 22, 2026 16:05
Owner
|
Thank you for the PR! I am reviewing it, fixing merge conflicts, and getting all the tests to pass. |
saksham2001
approved these changes
Jun 26, 2026
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.
Adds Google Gemini as an opt-in alternative to the existing OpenAI coach, behind a provider-agnostic adapter so no other component needs to know which provider is active.
Models (selectable in Coach settings)
gemini-2.5-flash(default)gemini-2.0-flashgemini-2.5-proHow it works
GeminiClientadapts the app's existingResponsesClientprotocol to Gemini'sgenerateContentAPI — translates request/response shapes, maps tools tofunctionDeclarations, and strips JSON-schema keywords Gemini rejects (additionalProperties,$schema,strict).GeminiKeychainStore), so it coexists with the OpenAI key.Testing
mainand builds cleanly on the iOS simulator.🤖 Generated with Claude Code