[AI] Add GenerationOptionsRepresentable for hybrid generation opts#16105
[AI] Add GenerationOptionsRepresentable for hybrid generation opts#16105andrewheard merged 8 commits intomainfrom
GenerationOptionsRepresentable for hybrid generation opts#16105Conversation
Using Gemini Code AssistThe 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
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 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. |
Generated by 🚫 Danger |
There was a problem hiding this comment.
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.
|
Thanks. All SGTM |
Added a
GenerationOptionsRepresentableprotocol to support setting generation options for Gemini and/orFoundationModels.SystemLanguageModelinrespond(to:options:)andstreamResponse(to:options)calls. In particular, thehybrid(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