Skip to content

Voyage

VoyageProvider in the Vercel.AI.Voyage namespace creates the Voyage models that this port implements. The API reference lists every option: VoyageProvider.

Browse the upstream catalog of Voyage models and their pricing on the Vercel AI Gateway models page.

Kind Factory method Model ids in this port’s tests and docs
Embedding EmbeddingModel voyage-3.5
Reranking RerankingModel rerank-2.5

A model id in the table is one that the tests or docs use. It is not the complete list of ids the provider accepts. Pass any id that the provider documents. An id that links to the Vercel AI Gateway catalog has a Gateway slug listed there.

Embedding model:

var model = (VoyageProvider.VoyageEmbeddingModel)
VoyageProvider.Create().EmbeddingModel("voyage-3.5");
var result = await model.EmbedAsync(
new VoyageEmbeddingRequest(new[] { "sunny day at the beach" }),
CancellationToken.None
);
Console.WriteLine(result.Embeddings[0].Length);

snippet source | anchor

Reranking model:

var model = (VoyageProvider.VoyageRerankingModel)
VoyageProvider.Create().RerankingModel("rerank-2.5");
var result = await model.RerankAsync(
new VoyageRerankRequest
{
Query = "What is an agent?",
TextDocuments = new[] { "An agent calls tools in a loop.", "Bananas are yellow." },
TopK = 1,
},
CancellationToken.None
);
foreach (var ranked in result.Ranking)
{
Console.WriteLine($"{ranked.Index}: {ranked.Score}");
}

snippet source | anchor

See the Providers guide for authentication and provider options.

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product