VoyageAI.Microsoft.Extensions.AI
1.0.1
dotnet add package VoyageAI.Microsoft.Extensions.AI --version 1.0.1
NuGet\Install-Package VoyageAI.Microsoft.Extensions.AI -Version 1.0.1
<PackageReference Include="VoyageAI.Microsoft.Extensions.AI" Version="1.0.1" />
<PackageVersion Include="VoyageAI.Microsoft.Extensions.AI" Version="1.0.1" />
<PackageReference Include="VoyageAI.Microsoft.Extensions.AI" />
paket add VoyageAI.Microsoft.Extensions.AI --version 1.0.1
#r "nuget: VoyageAI.Microsoft.Extensions.AI, 1.0.1"
#:package VoyageAI.Microsoft.Extensions.AI@1.0.1
#addin nuget:?package=VoyageAI.Microsoft.Extensions.AI&version=1.0.1
#tool nuget:?package=VoyageAI.Microsoft.Extensions.AI&version=1.0.1
VoyageAI.Microsoft.Extensions.AI
Microsoft.Extensions.AI integration
for the Voyage AI .NET SDK. Implements
IEmbeddingGenerator<string, Embedding<float>> over Voyage text embeddings, so Voyage plugs
into the standard .NET AI composition model instead of a parallel abstraction.
This is the keystone package for product integrations: once Voyage speaks
IEmbeddingGenerator, the MongoDB driver's native auto-embedding, Microsoft.Extensions.VectorData,
Semantic Kernel, and MEAI's caching/batching/logging/OpenTelemetry middleware all work with
no per-integration embed code.
Targets .NET 10 and .NET 8 (LTS), AOT/trim safe on .NET 10.
Installation
dotnet add package VoyageAI.Microsoft.Extensions.AI
Quick start (DI + middleware composition)
Program.cs:
var builder = Host.CreateApplicationBuilder(args);
// Registers the Voyage SDK + an IEmbeddingGenerator over it, and returns a builder so
// the standard MEAI middleware composes on top.
builder.Services.AddVoyageEmbeddingGenerator(opts =>
{
opts.Model = VoyageAIModels.Voyage3Large;
opts.OutputDimension = 1024;
})
.UseOpenTelemetry(); // optional: trace every embedding call
var app = builder.Build();
var generator = app.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();
GeneratedEmbeddings<Embedding<float>> result =
await generator.GenerateAsync(["I like cats", "I like dogs"]);
Console.WriteLine($"{result.Count} embeddings, {result.Usage.TotalTokenCount} tokens");
API key is resolved the same way as the core SDK: the "VoyageAI:ApiKey" configuration
section, falling back to the VOYAGE_API_KEY environment variable.
Standalone (no DI)
IEmbeddingsClient client = ...; // resolved from the Voyage SDK
var generator = new VoyageEmbeddingGenerator(client, new VoyageEmbeddingGeneratorOptions
{
Model = VoyageAIModels.Voyage3,
InputType = InputType.Document,
});
Embedding<float> single = (await generator.GenerateAsync(["store hiking boots"]))[0];
Console.WriteLine($"{single.Vector.Length} dims");
Options reference
| Property | Default | Description |
|---|---|---|
Model |
voyage-3 |
Default model id; overridden per-call by EmbeddingGenerationOptions.ModelId. |
InputType |
Document |
Voyage query/document hint. Set Query for a search-time generator. null embeds verbatim. |
OutputDimension |
null |
Mapped from EmbeddingGenerationOptions.Dimensions when supplied; otherwise this default. |
Truncation |
true |
Truncate over-length inputs; false raises on over-length. |
How mappings work
Microsoft.Extensions.AI → Voyage request:
| MEAI | Voyage |
|---|---|
EmbeddingGenerationOptions.ModelId |
EmbeddingRequest.Model (falls back to Options.Model) |
EmbeddingGenerationOptions.Dimensions |
EmbeddingRequest.OutputDimension |
Options.InputType |
EmbeddingRequest.InputType |
| batch of N inputs | single EmbedAsync call with N inputs |
Voyage response → MEAI:
| Voyage | MEAI |
|---|---|
EmbeddingObject.AsMemory() |
Embedding<float>.Vector |
UsageInfo.TotalTokens |
UsageDetails.InputTokenCount + TotalTokenCount |
Getting the raw client back
GetService exposes the underlying client so components that need non-embedding capabilities
(rerank, multimodal) can reach them:
if (generator.GetService(typeof(IEmbeddingsClient)) is IEmbeddingsClient raw)
{
// use raw directly
}
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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 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. |
-
net10.0
- Microsoft.Extensions.AI (>= 10.7.0)
- Microsoft.Extensions.AI.Abstractions (>= 10.7.0)
- Microsoft.Extensions.Configuration (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.9)
- VoyageAI.Sdk (>= 1.0.1)
-
net8.0
- Microsoft.Extensions.AI (>= 10.7.0)
- Microsoft.Extensions.AI.Abstractions (>= 10.7.0)
- Microsoft.Extensions.Configuration (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.9)
- System.Text.Json (>= 10.0.9)
- VoyageAI.Sdk (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.