Skip to content

[AI] Add GenerationOptionsRepresentable for hybrid generation opts#16105

Merged
andrewheard merged 8 commits intomainfrom
ah/ai-generation-opts-rep
Apr 22, 2026
Merged

[AI] Add GenerationOptionsRepresentable for hybrid generation opts#16105
andrewheard merged 8 commits intomainfrom
ah/ai-generation-opts-rep

Conversation

@andrewheard
Copy link
Copy Markdown
Contributor

Added a GenerationOptionsRepresentable protocol to support setting generation options for Gemini and/or FoundationModels.SystemLanguageModel in respond(to:options:) and streamResponse(to:options) calls. In particular, the hybrid(gemini:foundationModels:) is needed to allow different options to be specified for each model in hybrid (on-device and cloud) configurations in #16043.

Since the on-device and cloud (Gemini) models are dramatically different sizes, and offer different capabilities, it's unlikely that the same temperature, topP, etc., settings will be suitable for both models in hybrid use cases.

#no-changelog

@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.

@danger-firebase-ios
Copy link
Copy Markdown

1 Warning
⚠️ New public headers were added, did you remember to add them to the umbrella header?

Generated by 🚫 Danger

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 the GenerationOptionsRepresentable protocol and ResponseGenerationOptions struct to provide a unified interface for model generation settings across Gemini and Apple Foundation Models. The GenerativeModelSession methods have been updated to accept these new options, and corresponding tests have been added or updated. Feedback suggests improving API consistency by adding a hybrid configuration overload for direct FoundationModels.GenerationOptions support and using the .default static property instead of a direct initializer call in method signatures.

Comment thread FirebaseAI/Sources/GenerativeModelSession.swift Outdated
@andrewheard andrewheard marked this pull request as ready for review April 21, 2026 22:20
@andrewheard andrewheard requested a review from a team as a code owner April 21, 2026 22:20
@andrewheard andrewheard requested a review from paulb777 April 21, 2026 22:20
Comment thread FirebaseAI/Sources/Types/Public/ResponseGenerationOptions.swift Outdated
Comment thread FirebaseAI/Sources/GenerativeModelSession.swift
Comment thread FirebaseAI/Sources/GenerativeModelSession.swift
Comment thread FirebaseAI/Sources/Types/Public/ResponseGenerationOptions.swift
Comment thread FirebaseAI/Sources/Protocols/Public/GenerationOptionsRepresentable.swift Outdated
Comment thread FirebaseAI/Sources/Protocols/Public/GenerationOptionsRepresentable.swift Outdated
@paulb777
Copy link
Copy Markdown
Member

Thanks. All SGTM

@andrewheard andrewheard merged commit a67c757 into main Apr 22, 2026
87 checks passed
@andrewheard andrewheard deleted the ah/ai-generation-opts-rep branch April 22, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants