Commit Graph
8 Commits
Author SHA1 Message Date
Paul Beusterien dd61534812 fix(ai): harden handling of unexpected server response parts (#16756) 2026-10-02 07:26:35 -07:00
Andrew Heard 5dd4053791 docs(ai): mark prompt templates as public preview (#16741)
Revert the General Availability (GA) designation for Server Prompt
Templates in docstrings and CHANGELOG.md. Multi-turn conversations
(`TemplateChat`) and function calling (`TemplateTool`) remain public,
annotated with Public Preview warnings.

Key changes:
- Add Public Preview annotations and warnings across the Server Prompt
  Templates public API surface (TemplateGenerativeModel, TemplateChat,
  TemplateTool, and TemplateToolConfig).
- Update CHANGELOG.md to reflect Public Preview status.
2026-09-30 12:15:54 -04:00
Andrew Heard 3f9bc4e013 refactor(ai)!: rename Tool to GenerativeModel.Tool (#16700)
Nest `Tool` inside `GenerativeModel` as `GenerativeModel.Tool` to avoid
naming conflicts with Apple's `FoundationModels.Tool` protocol when both
modules are imported in the same file.

Moving `Tool` into `GenerativeModel` allows developers to adopt Apple's
Foundation Models framework without ambiguous symbol errors for
unqualified `Tool`. Call sites passing tools via leading-dot syntax
(e.g., `tools: [.googleSearch()]`) continue to work without changes.

- Nest `Tool` inside `GenerativeModel` and remove top-level `Tool`.
- Move static conveniences (`.googleSearch()`, `.googleMaps()`,
  `.functionDeclarations()`, `.urlContext()`, `.codeExecution()`) to an
  extension on `GenerativeModel.Tool`.
- Update `FirebaseAI.generativeModel`, `FirebaseAI.liveModel`,
  `LiveGenerativeModel`, and internal request types to use
  `GenerativeModel.Tool`.
- Remove leftover internal `isFoundationModeCompatible` property.
- Update DocC links and unit/integration tests across the module.

BREAKING CHANGE: The top-level `Tool` type in `FirebaseAILogic` has been
removed and nested inside `GenerativeModel` as `GenerativeModel.Tool`.
Call sites explicitly typed as `Tool` must update to
`GenerativeModel.Tool`. Calls using leading-dot syntax continue to
compile unmodified.
2026-09-24 12:17:30 -04:00
Andrew Heard 67debaf689 feat(ai): GA prompt templates API with chat/func calling (#16676)
Promote Server Prompt Templates to General Availability (GA) in the
FirebaseAILogic Swift SDK, enabling developers to decouple prompt
engineering, schemas, and model configs from client release cycles.

Key changes:
- Expose TemplateGenerativeModel publicly via FirebaseAI's
  templateGenerativeModel(tools:toolConfig:requestOptions:).
- Introduce TemplateChat and TemplateGenerativeModel.startChat for
  multi-turn conversations with templates containing {{history}},
  supporting empty turns to run template prompts.
- Add TemplateTool with functionDeclarations and googleMaps, as well
  as TemplateToolConfig for Grounding with Google Maps.
- Add Schema.toJSONSchema() to convert Schema instances to JSON Schema
  Draft 7/2020-12 for function parameter declarations.
- Add TemplateInput conversion supporting primitives, arrays, and
  dictionaries, with NSNumber boolean disambiguation and rich errors.
- Sanitize and percent-encode template IDs in request URLs to prevent
  path and method injection.
- Add comprehensive unit test coverage and end-to-end integration
  tests covering generation, streaming, chat, and function calling.
2026-09-23 17:47:48 -04:00
Daymon 62c9ced719 fix(docs): fix maps grounding phrasing per Rachel's comment (#16180) 2026-05-15 17:16:18 -07:00
Paul Beusterien 90a9ae52ea [AI] feat: Add Google Maps Grounding support for Server Prompt Templates (#16067) 2026-04-13 08:32:39 -07:00
Andrew Heard 150698e98a [AI] Lower minimum required deployment targets (#15928) 2026-03-12 18:33:33 -04:00
4f36a1cc7b [AI] Server Prompt Templates (#15402)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Andrew Heard <andrewheard@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-31 16:48:46 -07:00