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
                    
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="VoyageAI.Microsoft.Extensions.AI" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VoyageAI.Microsoft.Extensions.AI" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="VoyageAI.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 VoyageAI.Microsoft.Extensions.AI --version 1.0.1
                    
#r "nuget: VoyageAI.Microsoft.Extensions.AI, 1.0.1"
                    
#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 VoyageAI.Microsoft.Extensions.AI@1.0.1
                    
#: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=VoyageAI.Microsoft.Extensions.AI&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=VoyageAI.Microsoft.Extensions.AI&version=1.0.1
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 145 6/21/2026
1.0.0 120 6/21/2026