Universal.Operative.Sdk.Google.Gemini
2.0.0
dotnet add package Universal.Operative.Sdk.Google.Gemini --version 2.0.0
NuGet\Install-Package Universal.Operative.Sdk.Google.Gemini -Version 2.0.0
<PackageReference Include="Universal.Operative.Sdk.Google.Gemini" Version="2.0.0" />
<PackageVersion Include="Universal.Operative.Sdk.Google.Gemini" Version="2.0.0" />
<PackageReference Include="Universal.Operative.Sdk.Google.Gemini" />
paket add Universal.Operative.Sdk.Google.Gemini --version 2.0.0
#r "nuget: Universal.Operative.Sdk.Google.Gemini, 2.0.0"
#:package Universal.Operative.Sdk.Google.Gemini@2.0.0
#addin nuget:?package=Universal.Operative.Sdk.Google.Gemini&version=2.0.0
#tool nuget:?package=Universal.Operative.Sdk.Google.Gemini&version=2.0.0
Universal.Operative.Sdk.Google.Gemini
Intent-focused Google Gemini tools for Universal.Operative.Sdk.
Default tools
gemini_imagegenerates and edits images. Its stablequalityprofiles map to the current Nano Banana family:fast,balanced, andpro(Nano Banana Pro).gemini_consultasks Gemini for analysis, reasoning, drafting, or a second opinion. Calls are stateless by default.
The lower-level gemini_api tool is available only from the advanced tool set. It allowlists supported operations and never accepts an arbitrary URL or HTTP method.
using Universal.Operative.Sdk.Google.Gemini;
using Universal.Operative.Sdk.Google.Gemini.Tools;
using Universal.Operative.Sdk.Tools;
using GoogleGeminiGateway gateway = new GoogleGeminiGateway("YOUR_GEMINI_API_KEY");
IReadOnlyList<ITool> tools = GoogleGeminiToolSet.CreateDefault(gateway);
To include the advanced API tool:
IReadOnlyList<ITool> tools = GoogleGeminiToolSet.CreateAdvanced(gateway);
Image tool
gemini_image accepts a prompt, optional reference images, an aspect ratio, output size, JPEG output, and a quality profile. Generated images are returned as native Operative ImageBlock values instead of base64 JSON text.
Quality profiles currently map as follows:
| Profile | Gemini model |
|---|---|
fast |
Gemini 3.1 Flash-Lite Image |
balanced |
Gemini 3.1 Flash Image (Nano Banana 2) |
pro |
Gemini 3 Pro Image (Nano Banana Pro) |
Reference images may be HTTPS/Gemini file URIs or local file paths. Local files are uploaded for the request and removed from Gemini Files afterward.
Conversation storage
Both default tools use the Interactions API. Requests set store=false unless gemini_consult is explicitly called with store=true. A stored response's interaction_id can be passed as previous_interaction_id on the next consultation.
Custom model mappings
Applications can replace model mappings without changing the tool schemas:
GoogleGeminiToolOptions options = new GoogleGeminiToolOptions
{
ProImageModel = "gemini-3-pro-image",
ReasoningConsultModel = "gemini-3.7-flash",
};
IReadOnlyList<ITool> tools = GoogleGeminiToolSet.CreateDefault(gateway, options);
Live tests
The test project shares the existing Google Gemini user-secret store. Its live tests call both the text tool and Nano Banana Pro through the real API:
dotnet user-secrets set "Google:Gemini:ApiKey" "<key>" --project Universal.Operative.Sdk.Google.Gemini.Tests
dotnet test Universal.Operative.Sdk.Google.Gemini.Tests --filter "TestCategory=GoogleGeminiLive"
Tool sets borrow the supplied gateway. API-key factory overloads have been removed: construct a using GoogleGeminiGateway, keep it alive while tools execute, then dispose it. Provider GeminiException values propagate unchanged with status and parsed error context. Uploaded references are all scheduled for deletion even after failure/cancellation; failed deletion throws an AggregateException whose inner failures include Data["GeminiFileName"]. If the operation also failed, its original exception is rethrown with Data["GeminiFileCleanupFailures"]. No payload is automatically logged. Advanced retrieval returns native image blocks for stored image interactions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- Universal.Google.Gemini.Client (>= 1.2.0)
- Universal.Operative.Sdk (>= 7.0.0)
-
net11.0
- Universal.Google.Gemini.Client (>= 1.2.0)
- Universal.Operative.Sdk (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Targets .NET 10 and .NET 11; removes .NET 8 support. Removed API-key tool-set overloads: own a GoogleGeminiGateway explicitly. Provider exceptions and reference cleanup failures retain context; stored image retrieval returns native image blocks.