Mistral 0.0.0-dev.183
This is a prerelease version of Mistral.
dotnet add package Mistral --version 0.0.0-dev.183
NuGet\Install-Package Mistral -Version 0.0.0-dev.183
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="Mistral" Version="0.0.0-dev.183" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mistral" Version="0.0.0-dev.183" />
<PackageReference Include="Mistral" />
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 Mistral --version 0.0.0-dev.183
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mistral, 0.0.0-dev.183"
#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 Mistral@0.0.0-dev.183
#: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=Mistral&version=0.0.0-dev.183&prerelease
#tool nuget:?package=Mistral&version=0.0.0-dev.183&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Mistral
Features 🔥
- Fully generated C# SDK based on official Mistral OpenAPI specification using AutoSDK
- Same day update to support new features
- Updated and supported automatically if there are no breaking changes
- All modern .NET features - nullability, trimming, NativeAOT, etc.
- Support .Net Framework/.Net Standard 2.0
- Microsoft.Extensions.AI
IChatClientsupport
Usage
using Mistral;
using var client = new MistralClient(apiKey);
ChatCompletionResponse response = await client.Agents.AgentsCompletionAsync(
agentId: "Test",
messages: new List<OneOf<UserMessage, AssistantMessage, ToolMessage>>
{
new UserMessage
{
Content = "Hello",
},
});
Microsoft.Extensions.AI
The SDK implements IChatClient for seamless integration with the .NET AI ecosystem:
using Mistral;
using Meai = Microsoft.Extensions.AI;
Meai.IChatClient chatClient = new MistralClient(apiKey);
var response = await chatClient.GetResponseAsync(
[new Meai.ChatMessage(Meai.ChatRole.User, "Hello!")],
new Meai.ChatOptions { ModelId = "mistral-large-latest" });
Console.WriteLine(response.Text);
Note: Use the
Meaialias because the Mistral SDK has its own generatedIChatClientinterface.
Chat Client Five Random Words Streaming
using var client = new MistralClient(apiKey);
Meai.IChatClient chatClient = client;
var updates = chatClient.GetStreamingResponseAsync(
[
new Meai.ChatMessage(Meai.ChatRole.User, "Generate 5 random words.")
],
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
});
var deltas = new List<string>();
await foreach (var update in updates)
{
if (!string.IsNullOrWhiteSpace(update.Text))
{
deltas.Add(update.Text);
}
}
Chat Client Five Random Words
using var client = new MistralClient(apiKey);
Meai.IChatClient chatClient = client;
var response = await chatClient.GetResponseAsync(
[
new Meai.ChatMessage(Meai.ChatRole.User, "Generate 5 random words.")
],
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
});
Chat Client Get Service Returns Chat Client Metadata
using var client = CreateTestClient();
Meai.IChatClient chatClient = client;
var metadata = Meai.ChatClientExtensions.GetService<Meai.ChatClientMetadata>(chatClient);
Chat Client Get Service Returns Null For Unknown Key
using var client = CreateTestClient();
Meai.IChatClient chatClient = client;
var result = Meai.ChatClientExtensions.GetService<Meai.ChatClientMetadata>(chatClient, serviceKey: "unknown");
Chat Client Get Service Returns Self
using var client = CreateTestClient();
Meai.IChatClient chatClient = client;
var self = Meai.ChatClientExtensions.GetService<MistralClient>(chatClient);
Chat Client Tool Calling Multi Turn
using var client = new MistralClient(apiKey);
var getWeatherTool = Meai.AIFunctionFactory.Create(
(string location) => $"The weather in {location} is 72°F and sunny.",
name: "get_weather",
description: "Gets the current weather for a given location.");
Meai.IChatClient chatClient = client;
var messages = new List<Meai.ChatMessage>
{
new(Meai.ChatRole.User, "What is the weather in Paris?"),
};
// First turn: model requests tool call
var response = await chatClient.GetResponseAsync(
messages,
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
Tools = [getWeatherTool],
});
var functionCall = response.Messages
.SelectMany(m => m.Contents)
.OfType<Meai.FunctionCallContent>()
.FirstOrDefault();
// Add assistant message with function call and tool result
messages.AddRange(response.Messages);
var toolResult = await getWeatherTool.InvokeAsync(
functionCall!.Arguments is { } args ? new Meai.AIFunctionArguments(args) : null);
messages.Add(new Meai.ChatMessage(Meai.ChatRole.Tool,
[
new Meai.FunctionResultContent(functionCall.CallId, toolResult),
]));
// Second turn: model should produce a final text response
var finalResponse = await chatClient.GetResponseAsync(
messages,
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
Tools = [getWeatherTool],
});
Chat Client Tool Calling Single Turn
using var client = new MistralClient(apiKey);
var getWeatherTool = Meai.AIFunctionFactory.Create(
(string location) => $"The weather in {location} is 72°F and sunny.",
name: "get_weather",
description: "Gets the current weather for a given location.");
Meai.IChatClient chatClient = client;
var response = await chatClient.GetResponseAsync(
[
new Meai.ChatMessage(Meai.ChatRole.User, "What is the weather in Paris?")
],
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
Tools = [getWeatherTool],
});
var functionCall = response.Messages
.SelectMany(m => m.Contents)
.OfType<Meai.FunctionCallContent>()
.FirstOrDefault();
Chat Client Tool Calling Streaming
using var client = new MistralClient(apiKey);
var getWeatherTool = Meai.AIFunctionFactory.Create(
(string location) => $"The weather in {location} is 72°F and sunny.",
name: "get_weather",
description: "Gets the current weather for a given location.");
Meai.IChatClient chatClient = client;
var updates = chatClient.GetStreamingResponseAsync(
[
new Meai.ChatMessage(Meai.ChatRole.User, "What is the weather in Paris?")
],
new Meai.ChatOptions
{
ModelId = "mistral-small-latest",
Tools = [getWeatherTool],
});
var functionCalls = new List<Meai.FunctionCallContent>();
await foreach (var update in updates)
{
functionCalls.AddRange(update.Contents.OfType<Meai.FunctionCallContent>());
}
Test
using var client = new MistralClient(apiKey);
ChatCompletionResponse response = await client.Agents.AgentsCompletionAsync(
agentId: "Test",
messages: new List<MessagesItem3>
{
new UserMessage
{
Content = "Hello",
},
});
Support
Priority place for bugs: https://github.com/tryAGI/Mistral/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Mistral/discussions
Discord: https://discord.gg/Ca2xhfBf3v
Acknowledgments
This project is supported by JetBrains through the Open Source Support Program.
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.AI.Abstractions (>= 10.4.1)
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.0.0-dev.183 | 44 | 4/1/2026 |
| 0.0.0-dev.180 | 47 | 3/29/2026 |
| 0.0.0-dev.179 | 42 | 3/29/2026 |
| 0.0.0-dev.174 | 143 | 3/28/2026 |
| 0.0.0-dev.172 | 40 | 3/28/2026 |
| 0.0.0-dev.171 | 41 | 3/28/2026 |
| 0.0.0-dev.170 | 39 | 3/28/2026 |
| 0.0.0-dev.169 | 42 | 3/27/2026 |
| 0.0.0-dev.165 | 38 | 3/27/2026 |
| 0.0.0-dev.164 | 36 | 3/27/2026 |
| 0.0.0-dev.156 | 50 | 3/20/2026 |
| 0.0.0-dev.155 | 37 | 3/20/2026 |
| 0.0.0-dev.152 | 38 | 3/20/2026 |
| 0.0.0-dev.148 | 37 | 3/20/2026 |
| 0.0.0-dev.147 | 37 | 3/20/2026 |
| 0.0.0-dev.144 | 35 | 3/19/2026 |
| 0.0.0-dev.142 | 36 | 3/19/2026 |
| 0.0.0-dev.141 | 31 | 3/19/2026 |
| 0.0.0-dev.140 | 43 | 3/19/2026 |
| 0.0.0-dev.139 | 37 | 3/19/2026 |
Loading failed