mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
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.
Firebase AI SDK
- For developer documentation, please visit https://firebase.google.com/docs/ai-logic.
- Try out the sample app to get started.
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.shfrom 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.