Microsoft.Extensions.AI 9.1.0-preview.1.25064.3

Prefix Reserved
This is a prerelease version of Microsoft.Extensions.AI.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Extensions.AI --version 9.1.0-preview.1.25064.3
                    
NuGet\Install-Package Microsoft.Extensions.AI -Version 9.1.0-preview.1.25064.3
                    
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="Microsoft.Extensions.AI" Version="9.1.0-preview.1.25064.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.1.0-preview.1.25064.3" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.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 Microsoft.Extensions.AI --version 9.1.0-preview.1.25064.3
                    
#r "nuget: Microsoft.Extensions.AI, 9.1.0-preview.1.25064.3"
                    
#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.
#:package Microsoft.Extensions.AI@9.1.0-preview.1.25064.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Extensions.AI&version=9.1.0-preview.1.25064.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.AI&version=9.1.0-preview.1.25064.3&prerelease
                    
Install as a Cake Tool

Microsoft.Extensions.AI

Provides utilities for working with generative AI components.

Install the package

From the command-line:

dotnet add package Microsoft.Extensions.AI

Or directly in the C# project file:

<ItemGroup>
  <PackageReference Include="Microsoft.Extensions.AI" Version="[CURRENTVERSION]" />
</ItemGroup>

Usage Examples

Please refer to the README for the Microsoft.Extensions.AI.Abstractions package.

Feedback & Contributing

We welcome feedback and contributions in our GitHub repo.

Running the integration tests

If you're working on this repo and want to run the integration tests, e.g., those in Microsoft.Extensions.AI.OpenAI.Tests, you must first set endpoints and keys. You can either set these as environment variables or - better - using .NET's user secrets feature as shown below.

Configuring OpenAI tests (OpenAI)

Run commands like the following. The settings will be saved in your user profile.

cd test/Libraries/Microsoft.Extensions.AI.Integration.Tests
dotnet user-secrets set OpenAI:Mode OpenAI
dotnet user-secrets set OpenAI:Key abcdefghijkl

Optionally also run the following. The values shown here are the defaults if you don't specify otherwise:

dotnet user-secrets set OpenAI:ChatModel gpt-4o-mini
dotnet user-secrets set OpenAI:EmbeddingModel text-embedding-3-small

Configuring OpenAI tests (Azure OpenAI)

Run commands like the following. The settings will be saved in your user profile.

cd test/Libraries/Microsoft.Extensions.AI.Integration.Tests
dotnet user-secrets set OpenAI:Mode AzureOpenAI
dotnet user-secrets set OpenAI:Endpoint https://YOUR_DEPLOYMENT.openai.azure.com/
dotnet user-secrets set OpenAI:Key abcdefghijkl

Optionally also run the following. The values shown here are the defaults if you don't specify otherwise:

dotnet user-secrets set OpenAI:ChatModel gpt-4o-mini
dotnet user-secrets set OpenAI:EmbeddingModel text-embedding-3-small

Your account must have models matching these names.

Configuring Azure AI Inference tests

Run commands like the following. The settings will be saved in your user profile.

cd test/Libraries/Microsoft.Extensions.AI.Integration.Tests
dotnet user-secrets set AzureAIInference:Endpoint https://YOUR_DEPLOYMENT.azure.com/
dotnet user-secrets set AzureAIInference:Key abcdefghijkl

Optionally also run the following. The values shown here are the defaults if you don't specify otherwise:

dotnet user-secrets set AzureAIInference:ChatModel gpt-4o-mini
dotnet user-secrets set AzureAIInference:EmbeddingModel text-embedding-3-small
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (60)

Showing the top 5 NuGet packages that depend on Microsoft.Extensions.AI:

Package Downloads
Microsoft.SemanticKernel.Abstractions

Semantic Kernel interfaces and abstractions. This package is automatically installed by Semantic Kernel packages if needed.

Aspire.Azure.AI.OpenAI

A client for Azure OpenAI that integrates with Aspire, including logging and telemetry.

Aspire.OpenAI

A client for OpenAI that integrates with Aspire, including metrics and telemetry.

CommunityToolkit.Aspire.OllamaSharp

A .NET Aspire client integration for the OllamaSharp library.

MCPSharp

Build Model Context Protocol (MCP) servers and clients in .NET with MCPSharp. Create MCP-compliant tools and functions that AI models can discover and use. Features easy to use attribute-based API allowing anyone to spin up a server in minutes, and a Microsoft.Extensions.AI compatible client that generates AIFunctions, ready to be consumed by any IChatClient or compatible system. await MCPServer.StartAsync("EchoServer", "1.0.0"); --- server: class MyTool { [McpTool("echo","returns the input string back to you")] public string echo(string input) => input; } ---client: var client = new MCPClient("MyClient","1.0.0", "EchoServer.exe" //or dotnet EchoServer.dll if you wish await client.CallToolAsync("echo", new Dictionary<string, object>{{"input", "input string to echo"}});

GitHub repositories (20)

Showing the top 20 popular GitHub repositories that depend on Microsoft.Extensions.AI:

Repository Stars
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dotnet/eShop
A reference .NET application implementing an eCommerce site
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
modelcontextprotocol/csharp-sdk
The official C# SDK for Model Context Protocol servers and clients. Maintained in collaboration with Microsoft.
microsoft/Generative-AI-for-beginners-dotnet
Five lessons, learn how to really apply AI to your .NET Applications
awaescher/OllamaSharp
The easiest way to use Ollama in .NET
getcellm/cellm
Use LLMs in Excel formulas
dotnet/ai-samples
CommunityToolkit/Aspire
A community project with additional components and extensions for .NET Aspire
thangchung/practical-dotnet-aspire
The practical .NET Aspire builds on the coffeeshop app business domain
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
afrise/MCPSharp
MCPSharp is a .NET library that helps you build Model Context Protocol (MCP) servers and clients - the standardized API protocol used by AI assistants and models.
PederHP/mcpdotnet
.NET implementation of the Model Context Protocol (MCP)
SteveSandersonMS/dotnet-ai-workshop
mehrandvd/skunit
skUnit is a testing tool for .NET AI units, such as IChatClient and SK kernels.
tghamm/Anthropic.SDK
An unofficial C#/.NET SDK for accessing the Anthropic Claude API
csharpfritz/Fritz.StreamTools
Handy tools for managing my live stream, built with ASP.NET Core
mscraftsman/generative-ai
Gemini AI SDK for .NET and ASP.NET Core enables developers to use Google's state-of-the-art generative AI models to build AI-powered features and applications.
gunpal5/Google_GenerativeAI
Most complete C# .Net SDK for Google Generative AI and Vertex AI (Google Gemini), featuring function calling, easiest JSON Mode, multi-modal live streaming, chat sessions, and more!
telerik/kendo-ui-demos-service
Back-end service used for the Kendo UI Online Demos
Version Downloads Last Updated
9.7.1 0 7/15/2025
9.7.0 5,867 7/8/2025
9.6.0 75,256 6/10/2025
9.5.0 318,208 5/16/2025
9.5.0-preview.1.25262.9 13,487 5/13/2025
9.4.4-preview.1.25259.16 7,709 5/10/2025
9.4.3-preview.1.25230.7 29,088 5/1/2025
9.4.0-preview.1.25207.5 158,464 4/8/2025
9.3.0-preview.1.25161.3 111,801 3/11/2025
9.3.0-preview.1.25114.11 122,627 2/16/2025
9.1.0-preview.1.25064.3 62,127 1/14/2025
9.0.1-preview.1.24570.5 103,344 11/21/2024
9.0.0-preview.9.24556.5 47,250 11/12/2024
9.0.0-preview.9.24525.1 35,171 10/26/2024
9.0.0-preview.9.24507.7 12,490 10/8/2024