-
-
Notifications
You must be signed in to change notification settings - Fork 5
Mistral
Rasmus Wulff Jensen edited this page Dec 26, 2025
·
3 revisions
- AgentFactory (
MistralAgentFactory) - AIToolsFactory integration (tools in
MistralAgentOptions.Tools) - EmbeddingFactory (
MistralEmbeddingFactory)
dotnet add package AgentFrameworkToolkit.Mistral
MistralAgentFactory agentFactory = new("<apiKey>");
MistralAgent agent = agentFactory.CreateAgent("mistral-small-latest");
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);MistralEmbeddingFactory embeddingFactory = new("<apiKey>");
IEmbeddingGenerator<string, Embedding<float>> generator = embeddingFactory.GetEmbeddingGenerator();
Embedding<float> embedding = await generator.GenerateAsync(
"Hello",
options: new EmbeddingGenerationOptions { ModelId = ModelDefinitions.MistralEmbed });-
ApiKey(required) -
NetworkTimeout(optional)
builder.Services.AddMistralAgentFactory("<apiKey>");
builder.Services.AddMistralAgentFactory(new MistralConnection
{
ApiKey = "<apiKey>",
NetworkTimeout = TimeSpan.FromMinutes(5)
});- Mistral embeddings require the model id to be supplied in
EmbeddingGenerationOptions. - See EmbeddingFactories for more examples.
- See AgentFactories and AIToolsFactory for shared options.