GeminiDotnet.Extensions.AI
0.6.0-preview
See the version list below for details.
dotnet add package GeminiDotnet.Extensions.AI --version 0.6.0-preview
NuGet\Install-Package GeminiDotnet.Extensions.AI -Version 0.6.0-preview
<PackageReference Include="GeminiDotnet.Extensions.AI" Version="0.6.0-preview" />
paket add GeminiDotnet.Extensions.AI --version 0.6.0-preview
#r "nuget: GeminiDotnet.Extensions.AI, 0.6.0-preview"
// Install GeminiDotnet.Extensions.AI as a Cake Addin #addin nuget:?package=GeminiDotnet.Extensions.AI&version=0.6.0-preview&prerelease // Install GeminiDotnet.Extensions.AI as a Cake Tool #tool nuget:?package=GeminiDotnet.Extensions.AI&version=0.6.0-preview&prerelease
GeminiDotnet.Extensions.AI
This package provides an implementation of Microsoft.Extensions.AI.IChatClient
for interacting with Google Gemini models using 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 IChatClient
abstraction, you can read the 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 | Versions 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. |
-
net9.0
- GeminiDotnet (>= 0.6.0)
- Microsoft.Extensions.AI.Abstractions (>= 9.3.0-preview.1.25114.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.6.1-preview | 42 | 2/18/2025 |
0.6.0-preview | 37 | 2/18/2025 |
0.5.0-preview | 41 | 2/17/2025 |
0.4.1-preview | 43 | 2/16/2025 |
0.4.0-preview | 37 | 2/15/2025 |
0.3.0-preview | 42 | 2/10/2025 |
0.2.0-preview | 40 | 2/9/2025 |
0.1.2-preview | 34 | 1/23/2025 |
0.1.1-preview | 32 | 1/23/2025 |
0.1.0-preview | 37 | 1/23/2025 |