Added the MLKit Prompting API#1310
Merged
Merged
Conversation
Contributor
|
Member
Author
Contributor
|
@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. |
Contributor
|
@mattleibow What powers do I need to become LLM Whisperer? |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Member
Author
|
Not sure, i thiunk copilot is having issues because it did nothing. |
Contributor
Mental health? |
Removed 'Google.MLKit.GenAI.Common.Internal' from the list.
mattleibow
requested review from
Copilot and
jonathanpeppers
and removed request for
Copilot
November 5, 2025 02:05
There was a problem hiding this comment.
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>
jonathanpeppers
approved these changes
Nov 6, 2025
jonathanpeppers
pushed a commit
that referenced
this pull request
Nov 6, 2025
This pull request adds support for two new ML Kit GenAI libraries (`genai-common` and `genai-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:** * Added new entries for `Xamarin.Google.MLKit.GenAI.Common` and `Xamarin.Google.MLKit.GenAI.Prompt` to `config.json`, specifying their group IDs, artifact IDs, versions, NuGet IDs, and types. **Public API Exposure:** * Introduced `PublicAPI.Unshipped.txt` files for both `genai-common` and `genai-prompt`, declaring all new types, methods, properties, and enums exposed by the GenAI libraries. This includes classes like `AudioSource`, `BaseOptions`, `GenAiException`, `IGenerativeModel`, `GenerateContentRequest`, and many more. [[1]](diffhunk://#diff-2b143bb59f6a9252cb3498890690de011d8b139c1f4cd478fda23de9a2afe4ddR1-R93) [[2]](diffhunk://#diff-ef4ea7f0911b08ca9042afe31f3cf65a9c2c3ef3fbc298ac8931903c811ce4a4R1-R124) * Enabled nullable reference types in the `PublicAPI.Shipped.txt` for both GenAI libraries to improve null safety and code clarity. **Enum and Metadata Mapping:** * Added `EnumFields.xml` to map the `GenAiErrorCode` enum between CLR and JNI names/values for proper interop. * Added `EnumMethods.xml` to map methods that use the `GenAiErrorCode` enum in `GenAiException`. * Added `Metadata.xml` to remove unused internal classes and resolve naming conflicts for the GenAI exception error code interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.