Skip to content

[Firebase AI] Add support for automatic functions#1426

Merged
a-maurice merged 3 commits intomainfrom
am-auto_func
Apr 15, 2026
Merged

[Firebase AI] Add support for automatic functions#1426
a-maurice merged 3 commits intomainfrom
am-auto_func

Conversation

@a-maurice
Copy link
Copy Markdown
Collaborator

Description

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

Add support for automated function calling in both Chat and TemplateChatSession.


Testing

Describe how you've tested these changes.

Running tests locally, with the included new tests.


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
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@AustinBenoit
Copy link
Copy Markdown
Contributor

/gemini review

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 automated function calling for Firebase AI Chat and TemplateChat sessions, enabling the model to automatically invoke local functions. Key additions include the AutoFunctionDeclaration and BaseAutoFunctionDeclaration classes, along with helper logic in ChatSessionHelpers to manage execution turns and history updates. Feedback identifies a critical deadlock risk when using task.Wait() in asynchronous contexts and suggests adding null checks for function delegates. Further improvements are recommended to enhance type safety by avoiding dynamic and to use more idiomatic LINQ for dictionary initialization.

Comment thread firebaseai/src/Internal/InternalHelpers.cs Outdated
Comment thread firebaseai/src/FunctionCalling.cs
Comment thread firebaseai/src/Chat.cs Outdated
Comment thread firebaseai/src/Internal/InternalHelpers.cs Outdated
Comment thread firebaseai/src/TemplateChatSession.cs Outdated
@a-maurice
Copy link
Copy Markdown
Collaborator Author

/gemini review

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 adds support for automated function calling in chat sessions, introducing the AutoFunctionDeclaration class, refactoring message handling into helper classes, and adding configurable turn limits. Feedback identifies a breaking API change in TemplateTool.FunctionDeclaration, missing [EnumeratorCancellation] attributes on async stream methods, and suggestions for improved error handling and constant usage.

Comment thread firebaseai/src/TemplateTool.cs
Comment thread firebaseai/src/Chat.cs
Comment thread firebaseai/src/Internal/InternalHelpers.cs
Comment thread firebaseai/src/RequestOptions.cs Outdated
Comment thread firebaseai/src/TemplateChatSession.cs
@a-maurice a-maurice requested a review from cynthiajoan April 15, 2026 17:53
@a-maurice a-maurice merged commit 7448bea into main Apr 15, 2026
4 checks passed
@a-maurice a-maurice deleted the am-auto_func branch April 15, 2026 20:27
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