Files
firebase-ios-sdk/FirebaseAI
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
..

Firebase AI SDK

Development

After following the Swift Package Manager setup instructions, choose the FirebaseAI scheme to build the SDK.

Unit Tests

Important

These unit tests require mock response files, which can be downloaded by running scripts/update_vertexai_responses.sh from the root of this repository.

Choose the FirebaseAIUnit scheme to build and run the unit tests.

Updating Mock Responses

To update the mock responses, create a PR in the vertexai-sdk-test-data repo. After it is merged, re-run the update_vertexai_responses.sh script to download the updated files.