Microsoft.Extensions.AI 9.1.0-preview.1.25064.3

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

Showing the top 20 packages that depend on Microsoft.Extensions.AI.

Packages Downloads
mcpdotnet
.NET library for the Model Context Protocol (MCP)
5
Microsoft.SemanticKernel.Abstractions
Semantic Kernel interfaces and abstractions. This package is automatically installed by Semantic Kernel packages if needed.
4
Microsoft.SemanticKernel.Abstractions
Semantic Kernel interfaces and abstractions. This package is automatically installed by Semantic Kernel packages if needed.
5
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
2
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
3
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
4
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
5
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
6
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
7

Version Downloads Last updated
9.5.0 4 05/19/2025
9.5.0-preview.1.25262.9 1 05/17/2025
9.4.4-preview.1.25259.16 4 05/18/2025
9.4.3-preview.1.25230.7 6 05/02/2025
9.4.0-preview.1.25207.5 4 05/03/2025
9.3.0-preview.1.25161.3 5 05/02/2025
9.3.0-preview.1.25114.11 4 05/02/2025
9.1.0-preview.1.25064.3 4 05/02/2025
9.0.1-preview.1.24570.5 4 05/02/2025
9.0.0-preview.9.24556.5 4 05/02/2025
9.0.0-preview.9.24525.1 4 05/02/2025
9.0.0-preview.9.24507.7 4 05/03/2025