GeminiDotnet.Extensions.AI 0.7.1-preview

This is a prerelease version of GeminiDotnet.Extensions.AI.
dotnet add package GeminiDotnet.Extensions.AI --version 0.7.1-preview
                    
NuGet\Install-Package GeminiDotnet.Extensions.AI -Version 0.7.1-preview
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GeminiDotnet.Extensions.AI" Version="0.7.1-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GeminiDotnet.Extensions.AI" Version="0.7.1-preview" />
                    
Directory.Packages.props
<PackageReference Include="GeminiDotnet.Extensions.AI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GeminiDotnet.Extensions.AI --version 0.7.1-preview
                    
#r "nuget: GeminiDotnet.Extensions.AI, 0.7.1-preview"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=GeminiDotnet.Extensions.AI&version=0.7.1-preview&prerelease
                    
Install GeminiDotnet.Extensions.AI as a Cake Addin
#tool nuget:?package=GeminiDotnet.Extensions.AI&version=0.7.1-preview&prerelease
                    
Install GeminiDotnet.Extensions.AI as a Cake Tool

GeminiDotnet.Extensions.AI

This package provides implementations of the Microsoft.Extensions.AI.Abstractions APIs. These provide common abstractions over generative AI models, allowing users to swap out their model provider without rewriting their code. These implementations are backed by the modern and lightweight GeminiDotnet package.

Note: This package is marked as "preview" because Microsoft.Extensions.AI.Abstractions is in preview. It will become stable once Microsoft.Extensions.AI is.

For more information on why you may want to use the Microsoft.Extensions.AI.Abstractions APIs, you can read its announcement blog post.

Getting Started

First, install the NuGet package into your project.

dotnet add package GeminiDotnet.Extensions.AI

Then, you can create and use the IChatClient abstraction to interact with Gemini as follows.

var options = new GeminiClientOptions 
{
    ApiKey = "<your-api-key>"
};

IChatClient chatClient = new GeminiChatClient(options);

var response = await chatClient.GetResponseAsync("What is AI?");

Console.WriteLine(response.Message);

Or, to get access to the results as they are streamed back from the model, you can use GetStreamingResponseAsync.

var options = new GeminiClientOptions { ApiKey = "<your-api-key>" };

IChatClient chatClient = new GeminiChatClient(options);

await foreach (var update in chatClient.GetStreamingResponseAsync("What is AI?"))
{
    Console.Write(update);
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on GeminiDotnet.Extensions.AI:

Package Downloads
Weavy.Core

A class library containing core business logic, data access and utility methods required by Weavy.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.1-preview 136 3/15/2025
0.7.0-preview 120 3/13/2025
0.6.1-preview 73 2/18/2025
0.6.0-preview 62 2/18/2025
0.5.0-preview 66 2/17/2025
0.4.1-preview 77 2/16/2025
0.4.0-preview 59 2/15/2025
0.3.0-preview 67 2/10/2025
0.2.0-preview 62 2/9/2025
0.1.2-preview 54 1/23/2025
0.1.1-preview 51 1/23/2025
0.1.0-preview 58 1/23/2025