[AI] Implement low-hanging fruit methods in on-device model#7673
[AI] Implement low-hanging fruit methods in on-device model#7673rlazo merged 11 commits intofeature/hybridfrom
Conversation
Ensure we don't accidentally change how converters work and break them accidentally.
The change introduces a new exception type to make it easier to wrap unknown errors thrown by MLKit. Additionally, we moved the `mlkitModel` field to the constructor for easier testing.
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. |
|
/gemini review |
Generated by 🚫 Danger |
There was a problem hiding this comment.
Code Review
This pull request implements several methods in GenerativeModelImpl that were previously marked as TODO. The implementations for isAvailable, getBaseModelName, getTokenLimit, and warmup now delegate to the underlying MLKit model. The mlkitModel has been moved to the constructor to improve testability. A new FirebaseAIOnDeviceUnknownException and a factory method FirebaseAIOnDeviceException.from have been introduced to provide a consistent way of handling and wrapping exceptions from MLKit. Overall, the changes are solid and improve the functionality and robustness of the on-device model.
...terop/src/main/kotlin/com/google/firebase/ai/ondevice/interop/FirebaseAIOnDeviceException.kt
Outdated
Show resolved
Hide resolved
firebase-ai-ondevice/src/main/kotlin/com/google/firebase/ai/ondevice/GenerativeModelImpl.kt
Outdated
Show resolved
Hide resolved
|
Test code depends on the changes introduced in #7672 |
The change introduces a new exception type to make it easier to wrap unknown errors thrown by MLKit.
Additionally, we moved the
mlkitModelfield to the constructor for easier testing.