Skip to content

Conversation

@a-maurice
Copy link
Collaborator

Description

Provide details of the change, and generalize the change in the PR title above.

Add logic to support using Server Prompt Templates to generate content. Add automated tests. Also, update imagen tests to use 4 instead of 3.


Testing

Describe how you've tested these changes.

Running locally


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @a-maurice, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Firebase AI SDK by integrating support for server prompt templates. This feature allows developers to define and manage AI prompts on the server, then invoke them from the client with dynamic inputs. This abstraction simplifies prompt engineering, promotes reusability, and enables more flexible and powerful AI-driven applications, covering both text generation and image creation scenarios.

Highlights

  • Server Prompt Template Support: Introduced new functionality to support using server-side prompt templates for both generative AI models (e.g., Gemini) and image generation models (e.g., Imagen) within the Firebase AI SDK.
  • New Model Classes: Added TemplateGenerativeModel and TemplateImagenModel classes to interact with these server templates, providing methods for content and image generation.
  • FirebaseAI Integration: New public methods GetTemplateGenerativeModel and GetTemplateImagenModel were added to the FirebaseAI class, allowing easy instantiation of the new template-based models.
  • API Endpoint Handling: Implemented new helper functions in HttpHelpers.cs to construct appropriate API URLs for server prompt templates, supporting both VertexAI and GoogleAI backends.
  • Automated Testing: Comprehensive automated tests were added to validate the functionality of generating content and images using server prompt templates, including streaming capabilities.
  • Imagen Model Update: Updated existing Imagen model tests to use the newer imagen-4.0-generate-001 model instead of imagen-3.0-generate-002.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Server Prompt Templates for both generative and Imagen models. The changes include new model classes (TemplateGenerativeModel and TemplateImagenModel), corresponding factory methods in FirebaseAI, and helper methods for URL construction. Additionally, automated tests have been added to verify the new functionality. The implementation is solid, but I have a few suggestions to improve code organization and reduce duplication, such as moving a class to its own file and refactoring a helper method for better clarity.

@a-maurice a-maurice merged commit ffc44cb into main Nov 19, 2025
4 of 5 checks passed
@a-maurice a-maurice deleted the am-ai_templates branch November 19, 2025 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants