-
Notifications
You must be signed in to change notification settings - Fork 64
Added the MLKit Prompting API #1310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
@mattleibow I've opened a new pull request, #1313, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mattleibow What powers do I need to become LLM Whisperer? |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Not sure, i thiunk copilot is having issues because it did nothing. |
Mental health? |
Removed 'Google.MLKit.GenAI.Common.Internal' from the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds .NET bindings for two new Google ML Kit GenAI packages: com.google.mlkit:genai-common and com.google.mlkit:genai-prompt. These enable on-device generative AI capabilities in .NET for Android applications.
Key changes:
- Added bindings for ML Kit GenAI Common (v1.0.0-beta2) and GenAI Prompt (v1.0.0-alpha1) libraries
- Configured enum mappings for error codes and finish reasons
- Applied metadata transforms to handle Kotlin-specific constructs and naming conventions
- Registered new namespaces for the bindings
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| config.json | Added two new artifact entries for genai-common and genai-prompt packages |
| source/com.google.mlkit/genai-common/Transforms/Metadata.xml | Metadata transforms to remove Kotlin helpers, rename types, and clean up generated API |
| source/com.google.mlkit/genai-common/Transforms/EnumMethods.xml | Maps GenAIException methods to use GenAIErrorCode enum type |
| source/com.google.mlkit/genai-common/Transforms/EnumFields.xml | Defines GenAIErrorCode enum values from Java interface constants |
| source/com.google.mlkit/genai-common/PublicAPI/PublicAPI.Unshipped.txt | Public API surface for genai-common package |
| source/com.google.mlkit/genai-common/PublicAPI/PublicAPI.Shipped.txt | Placeholder for shipped API (empty) |
| source/com.google.mlkit/genai-prompt/Transforms/Metadata.xml | Metadata transforms for prompt API including companion object handling |
| source/com.google.mlkit/genai-prompt/Transforms/EnumMethods.xml | Maps Candidate.getFinishReason to use CandidateFinishReason enum |
| source/com.google.mlkit/genai-prompt/Transforms/EnumFields.xml | Defines CandidateFinishReason enum values |
| source/com.google.mlkit/genai-prompt/PublicAPI/PublicAPI.Unshipped.txt | Public API surface for genai-prompt package |
| source/com.google.mlkit/genai-prompt/PublicAPI/PublicAPI.Shipped.txt | Placeholder for shipped API (empty) |
| published-namespaces.txt | Added four new namespace entries for the GenAI bindings |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request adds support for two new ML Kit GenAI libraries (
genai-commonandgenai-prompt) to the project, including their configuration, API surface, and metadata transforms. The changes introduce the necessary NuGet package entries, public API definitions, and enum mappings to enable usage of Google's GenAI features in Xamarin. The most important changes are grouped below:Configuration and Package Integration:
Xamarin.Google.MLKit.GenAI.CommonandXamarin.Google.MLKit.GenAI.Prompttoconfig.json, specifying their group IDs, artifact IDs, versions, NuGet IDs, and types.Public API Exposure:
PublicAPI.Unshipped.txtfiles for bothgenai-commonandgenai-prompt, declaring all new types, methods, properties, and enums exposed by the GenAI libraries. This includes classes likeAudioSource,BaseOptions,GenAiException,IGenerativeModel,GenerateContentRequest, and many more. [1] [2]PublicAPI.Shipped.txtfor both GenAI libraries to improve null safety and code clarity.Enum and Metadata Mapping:
EnumFields.xmlto map theGenAiErrorCodeenum between CLR and JNI names/values for proper interop.EnumMethods.xmlto map methods that use theGenAiErrorCodeenum inGenAiException.Metadata.xmlto remove unused internal classes and resolve naming conflicts for the GenAI exception error code interface.