Commit Graph
14 Commits
Author SHA1 Message Date
Andrew Heard a512638ecd refactor(ai): consolidate HTTP request headers (#16612) 2026-09-04 21:45:01 -04:00
Andrew Heard 3796a55fdf feat(ai): add GeminiLanguageModel (#16601)
Implemented `GeminiLanguageModel`, providing an adapter for Google's
Gemini models conforming to Apple's `FoundationModels.LanguageModel`
protocol. This PR includes text to text generation capabilities; other
modalities and Gemini features will be handled in follow-up PRs.

**Note:** The `GeminiLanguageModel` implementation is guarded by the
environment variable `GEMINI_LANGUAGE_MODEL`. By default none of the
`GeminiLanguageModel` implementation is included.

Key additions:
- `GeminiLanguageModel`: Implements `LanguageModel` protocol with
  reasoning capabilities, configuring execution via `ModelResource`
  and `EndpointConfiguration`.
- `GeminiLanguageModelExecutor`: Converts prompt instructions and
  history into Gemini streaming requests, yielding responses as
  `LanguageModelSession.ResponseStream`.
- `GeminiTranscriptTranslator`: Translates Apple `Transcript` entries
  and segments into Gemini `Content` structures while preserving thought
  signatures and validating supported transcript features.
- `GeminiLanguageModel.Error` and `GeminiErrorMapper`: Translates Gemini
  API, HTTP, and network errors into standard `LanguageModelError` cases
  (`rateLimited`, `timeout`, `guardrailViolation`, `refusal`, and
  `unsupportedLanguageOrLocale`) or `GeminiLanguageModel.Error` cases
  (`serviceUnavailable`, `networkFailure`, `modelNotFound`, `apiError`).
  The `APIError` payload is designed for seamless forward compatibility
  with both GenerateContent and the upcoming Interactions API.
- Testing infrastructure: Adds `ConditionTrait.requireFoundationModels`
  to conditionally run Foundation Models tests only on supported
  platforms (macOS 27+, iOS 27+, watchOS 27+, visionOS 27+), along with
  shared test constants, mock fixtures, and comprehensive unit and
  integration test suites.
2026-09-04 18:05:45 -04:00
Andrew Heard 56c1eef4ea chore(ci): add xcode 27 to spm test matrix (#16604) 2026-09-04 11:38:33 -04:00
Andrew Heard 57e4e51357 fix(ai): Handle Xcode 27 LanguageModelSession.Error collision (#16257) 2026-06-10 10:49:03 -04:00
Andrew Heard d47bc4e3d2 [AI] Use respond(to:options:) for String generation (#16165) 2026-05-12 22:31:44 -04:00
Andrew Heard 09298bd555 [AI] Add hybrid and Foundation Models debug logging (#16134) 2026-04-29 00:16:01 -04:00
Andrew Heard b1c9e27fd0 [AI] Add hybrid support with Foundation Models (#16111) 2026-04-23 23:45:36 -04:00
Andrew Heard adb6dd46a2 [AI] Add visionOS 26.0 to @available annotations (#16114) 2026-04-23 19:06:33 -04:00
Paul Beusterien 4ab415ebc9 [SPM] Fix unfound file warnings from swift build (#16041) 2026-04-10 13:48:42 -07:00
2a57f97341 [AI] Automatic function calling (#15915)
Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-31 23:48:34 -04:00
Andrew Heard 6e71c8c5b6 [AI] Add IS_FOUNDATION_MODELS_SUPPORTED_PLATFORM flag (#15999) 2026-03-30 17:16:27 -04:00
Daymon dad019eb9a chore(ai): Add additional logging support for live api server messages (#15940) 2026-03-20 12:08:28 -04:00
Andrew Heard 150698e98a [AI] Lower minimum required deployment targets (#15928) 2026-03-12 18:33:33 -04:00
4565e79f78 [AI] Add GenerativeModelSession with structured output APIs (#15872)
Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-10 00:51:04 -04:00