Commit Graph
122 Commits
Author SHA1 Message Date
Paul Beusterien dd2cfa8df1 docs(ai): deprecate agentPlatform in favor of enterprise (#16685) 2026-09-23 08:57:25 -07:00
Andrew Heard f55af5b56f docs(ai): fix broken links in codebase and changelog (#16683) 2026-09-22 20:44:54 -04:00
Andrew Heard 97932016ef feat(ai): use VALIDATED function calling mode in GLM (#16649)
Default to VALIDATED function calling mode in GeminiLanguageModel and
switch guided generation to responseJsonSchema.
Previously, tool-calling requests mapped the default or allowed mode to
AUTO, which does not strictly enforce parameter schemas. Because Swift
decodes tool arguments strictly, schema malformation results in failed
turns. Additionally, guided generation used responseFormat, which the
Gemini backend ignores when VALIDATED mode is active during tool-calling
sessions, dropping response schemas and causing structured decoding
failures in respond(to:generating:).
* Default unset and explicit .allowed toolCallingMode to VALIDATED mode
  to strictly enforce schema adherence via constrained decoding.
* Throw LanguageModelError.unsupportedCapability on unrecognized future
  tool calling modes instead of silently falling back to allowed.
* Omit functionCallingConfig entirely when requests declare no functions
  to avoid contradictory constrained decoding states.
* Send responseJsonSchema with application/json MIME type for guided
  generation, which constrained decoding honors alongside VALIDATED.
* Remove unused _responseJsonSchema property from GenerationConfig.
* End SSE response streams and cancel tasks upon receiving terminal
  finish reasons or prompt feedback block reasons.
* Add integration test for combined tool calling and guided generation.
* Refresh cached App Check debug tokens proactively within TTL window.
2026-09-17 17:51:18 -04:00
Paul Beusterienandgemini-code-assist[bot] 7cbe0686da API doc link improvements (#16660)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-09-17 11:09:29 -04:00
Paul Beusterien 8f5e12c76c Deprecate Gemini 3.x tuning parameters (#16630) 2026-09-11 12:36:11 -07:00
Andrew Heard 27eaab3918 feat(ai): document and expose GeminiLanguageModel (#16631)
Remove the GEMINI_LANGUAGE_MODEL environment variable check in
Package.swift to unconditionally include GeminiLanguageModel targets
and dependencies on supported Swift 6.4+ toolchains.

Add DocC documentation comments for the GeminiLanguageModel integration
with Apple's Foundation Models framework.

Provide usage guidance, public preview warnings, and links to Apple's
LanguageModel protocol, LanguageModelSession, and DynamicProfile. In
addition, document FirebaseAI.geminiLanguageModel(name:) and include
a code example showing how to instantiate and use the model.
2026-09-09 15:57:01 -04:00
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
Paul Beusterien 58bd319bae Fix AppCheck concurrency infinite recursion bug in Auth (#16552) 2026-09-01 09:02:03 -07:00
Daymon 6e43483efa fix(ml): missing import causing build error (#16563) 2026-08-27 14:07:21 -05:00
Paul Beusterien 3b2287ec40 Remove deprecated Imagen APIs (#16483) 2026-08-06 09:51:46 -07:00
Andrew Heard 2bee8bc6a8 fix(ai): correct FunctionResponsePart role to "user" (#16478) 2026-08-05 12:19:57 -04:00
06d2b95fe5 feat(ai): add support for RealtimeInputConfig (#16441)
Co-authored-by: Andrew Heard <andrewheard@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-07-29 10:31:43 -05:00
Paul BeusterienandAndrew Heard f98844f320 docs(FirebaseAI): rename Vertex AI to Agent Platform Gemini API in comments (#16457)
Co-authored-by: Andrew Heard <andrewheard@google.com>
2026-07-28 07:57:06 -07:00
Mila ce61e5ac81 [AI] Mark speech output feature "public preview" (#16432) 2026-07-22 13:16:20 -04:00
Nick Cooke 1d28bb5de0 fix(firebaseai): prevent stream leak on cancellation (#16393) 2026-07-20 14:23:07 -05:00
Paul BeusterienandAndrew Heard 6b581ae875 [AI] Rename vertexAI to agentPlatform (#16372)
Co-authored-by: Andrew Heard <andrewheard@google.com>
2026-07-13 14:32:58 -07:00
Nick Cooke 1f73a56da7 fix(ailogic): xcode 27 renaming deprecation (#16297) 2026-06-30 15:47:19 -04:00
Paul Beusterien fa96c86bcc [Firebase AI Logic] Fix GenerateContentResponse decode failure when citation endIndex is missing (#16329) 2026-06-29 10:59:20 -07:00
Nick Cooke 71b30c0c56 fix(ailogic): stream errors should not be ignored (#16298) 2026-06-23 12:06:37 -04:00
5681734e91 [AI] Support SpeechConfig in Text-To-Speech (#16226)
Co-authored-by: Ryan Wilson <wilsonryan@google.com>
Co-authored-by: Daymon <daymxn@google.com>
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>
Co-authored-by: Nick Cooke <nickcooke@google.com>
2026-06-10 18:05:58 -05:00
Andrew Heard 57e4e51357 fix(ai): Handle Xcode 27 LanguageModelSession.Error collision (#16257) 2026-06-10 10:49:03 -04:00
Andrew Heard 2e6f24faec [AI] Revert rename of GeminiModel to GeminiLanguageModel (#16237) 2026-06-07 15:21:43 -04:00
Andrew Heard bf840dae85 [AI] Add public init for GeminiLanguageModel (#16234) 2026-06-05 06:29:52 -04:00
Andrew Heard 3257ea8e0f [AI] Add Hashable conformance to model config types (#16233) 2026-06-04 20:56:54 -04:00
Andrew Heard 67d2c5d0f2 [AI] Rename GeminiModel to GeminiLanguageModel (#16227) 2026-06-04 09:56:35 -04:00
Andrew Heard 3dbf64a63f [AI] Handle GenerateContentResponse with only usageMetadata (#16171) 2026-05-19 11:06:20 -04:00
Daymon 62c9ced719 fix(docs): fix maps grounding phrasing per Rachel's comment (#16180) 2026-05-15 17:16:18 -07:00
Seyed Mojtaba Hosseini Zeidabadi 33ca06ed47 chore: fix a bunch of typos in the swift files (#16179) 2026-05-15 06:38:45 -07:00
Andrew Heard 7de0b35fa7 [AI] Remove Gemma from header comment on GeminiModel (#16177) 2026-05-14 11:27:18 -07: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 e79590ee1e [AI] Add GenerateContentResponse.modelVersion to public API (#16132) 2026-04-28 23:42:08 -04:00
Andrew Heard ad11c22db8 [AI] Remove GenerativeModelSession public initializer (#16130) 2026-04-28 21:40:40 -04:00
c4a15f1f2c feat(ai): add live session resumption (#15904)
Co-authored-by: Daymon <daymxn@google.com>
Co-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>
2026-04-28 19:22:48 +00:00
d2ef47c3d5 [AI] Finish Reasons (#15931)
Co-authored-by: Andrew Heard <andrewheard@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>
Co-authored-by: Daymon <daymxn@google.com>
2026-04-28 19:09:08 +00:00
7c3c8b531a [AI] Add ImageConfig support for generateContent (#15923)
Co-authored-by: Andrew Heard <andrewheard@google.com>
Co-authored-by: Daymon <daymxn@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-04-28 14:04:34 -05:00
Andrew Heard d377408ea0 [AI] Refactor GeminiModelSession to use text(isThought:) (#16122) 2026-04-27 09:55:01 -04:00
Andrew Heard 223f04dc41 [AI] Lazily initialize sessions in HybridModelSession (#16119) 2026-04-25 11:38:21 -04:00
Andrew Heardandgemini-code-assist[bot] 59d89567f6 [AI] Add hybrid tag in x-goog-api-client header (#16118)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-04-24 17:19:18 -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
Andrew Heard 1067db6d57 [AI] Add HybridModel to support a fallback model (#16110) 2026-04-23 11:36:22 -04:00
Andrew Heard 90c17718b5 [AI] Extract Gemini-specific logic into GeminiModelSession (#16109) 2026-04-22 23:51:30 -04:00
Andrew Heard a67c7570b0 [AI] Add GenerationOptionsRepresentable for hybrid generation opts (#16105) 2026-04-22 10:44:11 -04:00
Andrew Heard dbe3b1bfc2 [AI] Add wrapper for FoundationModels.GenerationOptions (#16103) 2026-04-21 10:42:08 -04:00
Ryan Wilson a5172d2b46 Refactor GenerateContentResponse text accessors (#16087)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

This fixes an issue where `[FirebaseAI][I-VTX004001] Could not get a text part from the first candidate.` is logged during automatic function calling.

- Extracts core text retrieval logic into an internal text(isThought:) helper.
- Updates public text properties to perform logging only when accessed externally.
- Migrates internal consumers in GenerativeModelSession to avoid redundant logs.
2026-04-20 09:53:33 -04:00
Andrew Heard 289cf5633f [AI] Add wrapper for FoundationModels.SystemLanguageModel (#16086) 2026-04-16 10:16:43 -04:00
Paul Beusterien 90a9ae52ea [AI] feat: Add Google Maps Grounding support for Server Prompt Templates (#16067) 2026-04-13 08:32:39 -07:00