Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Google Gemini as an alternative AI coach provider - #9

Merged
saksham2001 merged 6 commits into
saksham2001:mainfrom
hoveeman:feature/multi-provider-gemini
Jun 26, 2026
Merged

saksham2001 merged 6 commits into
saksham2001:mainfrom
hoveeman:feature/multi-provider-gemini

Conversation

@hoveeman

Copy link
Copy Markdown
Contributor

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-flash
  • gemini-2.5-pro

How it works

  • GeminiClient adapts the app's existing ResponsesClient protocol to Gemini's generateContent API — translates request/response shapes, maps tools to functionDeclarations, and strips JSON-schema keywords Gemini rejects (additionalProperties, $schema, strict).
  • API key is stored separately in the Keychain (GeminiKeychainStore), so it coexists with the OpenAI key.
  • The existing OpenAI path is unchanged; Gemini is selected via Coach settings.

Testing

  • Tested on-device with a production Gemini API key.
  • Branch is merged up to date with main and builds cleanly on the iOS simulator.

🤖 Generated with Claude Code

hoveeman and others added 2 commits June 17, 2026 11:58
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
saksham2001 self-requested a review June 22, 2026 16:05
@saksham2001

Copy link
Copy Markdown
Owner

Thank you for the PR! I am reviewing it, fixing merge conflicts, and getting all the tests to pass.

@saksham2001
saksham2001 merged commit cd62903 into saksham2001:main Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants