Advanced workflows for templates


For Firebase AI Logic , the Firebase console provides a guided UI for you to specify the contents of a template. However, there are several use cases where you may need more advanced ways to set up a template, including:

The advanced workflows described in this page use the Firebase AI Logic REST API .

Be aware of the following when using the REST API:

  • If you provision a template in a specific location, then the request from your app must access the model in that same location. If the locations don't match, then the request will fail.

  • The list of templates in the Firebase console only shows templates that are (at minimum) provisioned in the global location.

  • If a template is unlocked, then you can overwrite the template by using the same template ID in your REST API call. A locked template cannot be overwritten.

Specify a location for a template

This section is only applicable if you're using the Vertex AI Gemini API and your use case requires location-based restrictions. Learn more about setting a location for accessing a model .

By default, when you use the guided UI in the Firebase console, we provision the template in all available regions for Firebase AI Logic . We do this so that no matter what location you set in your request, the template will be available. However, if you want your template to only be available in a specific location , then you need to create the template using our REST API.

When you call the projects.locations.templates.create endpoint , specify the location of the template as part of creating a PromptTemplate .

Provide the template as a file

You can provide the contents of a server prompt template file by calling the projects.locations.templates.create endpoint .

Create a Mobile Website
View Site in Mobile | Classic
Share by: