Skip to content

[AI] Add TemplateChat for multi-turn template interactions#7986

Merged
rlazo merged 4 commits intomainfrom
rl.template.chat
Mar 27, 2026
Merged

[AI] Add TemplateChat for multi-turn template interactions#7986
rlazo merged 4 commits intomainfrom
rl.template.chat

Conversation

@rlazo
Copy link
Copy Markdown
Contributor

@rlazo rlazo commented Mar 27, 2026

Introduces TemplateChat for managing multi-turn conversations with server-side prompt templates, automatically handling chat history.

Based on the code from #7954

Internal b/496905495

Introduces `TemplateChat` for managing multi-turn conversations with
server-side prompt templates, automatically handling chat history.

Internal b/496905495
@gemini-code-assist
Copy link
Copy Markdown
Contributor

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

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@rlazo
Copy link
Copy Markdown
Contributor Author

rlazo commented Mar 27, 2026

/gemini review

@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject ai-logic_firebase-ai:
error: Added class com.google.firebase.ai.TemplateChat [AddedClass]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistory(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>,kotlin.coroutines.Continuation) [AddedMethod] error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistoryStream(String,java.util.Map,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.startChat(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

2 similar comments
@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject ai-logic_firebase-ai:
error: Added class com.google.firebase.ai.TemplateChat [AddedClass]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistory(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>,kotlin.coroutines.Continuation) [AddedMethod] error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistoryStream(String,java.util.Map,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.startChat(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject ai-logic_firebase-ai:
error: Added class com.google.firebase.ai.TemplateChat [AddedClass]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistory(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>,kotlin.coroutines.Continuation) [AddedMethod] error: Added method com.google.firebase.ai.TemplateGenerativeModel.generateContentWithHistoryStream(String,java.util.Map,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]
error: Added method com.google.firebase.ai.TemplateGenerativeModel.startChat(String,java.util.Map<java.lang.String,?>,java.util.List<com.google.firebase.ai.type.Content>) [AddedMethod]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

Copy link
Copy Markdown
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 multi-turn chat interactions using server prompt templates, adding the TemplateChat class and history-aware generation methods to TemplateGenerativeModel. The version is updated to 17.11.0, and unit tests are included. Feedback suggests refactoring TemplateGenerativeModel to eliminate code duplication and simplifying history management in TemplateChat for better readability.

@rlazo rlazo merged commit 4b76cbc into main Mar 27, 2026
31 checks passed
@rlazo rlazo deleted the rl.template.chat branch March 27, 2026 15:58
@github-actions github-actions bot mentioned this pull request Mar 28, 2026
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