VoyageAIEmbeddingProvider

org.llm4s.llmconnect.provider.VoyageAIEmbeddingProvider

Embedding provider implementation for the Voyage AI embedding API.

Generates text embeddings by posting batched input to the Voyage AI <baseUrl>/embeddings endpoint (the default base URL is https://api.voyageai.com/v1). Unlike Ollama, Voyage accepts multiple inputs in a single request, so all texts are sent in one HTTP call.

Requires a valid Voyage AI API key in the provider configuration.

Voyage's entry in the embedding half of the provider SPI.

Voyage is the case that shapes the SPI: it supplies embeddings and no chat client at all, which is why org.llm4s.llmconnect.spi.EmbeddingProviderDescriptor is a separate trait rather than a method on the chat descriptor.

It lives in llm4s-voyage and is registered by Llm4sVoyageModule; it was built into llm4s-core until #1132, package unchanged.

Attributes

See also

EmbeddingProvider for the common embedding interface

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

Builds the provider for the SPI; see fromConfig for the direct route.

Builds the provider for the SPI; see fromConfig for the direct route.

Attributes

Creates an EmbeddingProvider backed by Voyage AI using the given configuration.

Creates an EmbeddingProvider backed by Voyage AI using the given configuration.

Attributes

Inherited methods

def buildConfig(section: EmbeddingProviderSection, modelOverride: Option[String]): Result[EmbeddingProviderConfig]

Turns this provider's config section into the EmbeddingProviderConfig its client needs.

Turns this provider's config section into the EmbeddingProviderConfig its client needs.

The default implementation resolves model, base URL and API key against configSpec, which is all any of the project's own providers needs. Override it only for a provider whose config genuinely cannot be expressed that way.

Value parameters

modelOverride

the <model> half of EMBEDDING_MODEL=<id>/<model>, when the unified form was used. Takes precedence over the section.

section

the llm4s.embeddings.<id> section, already parsed, its apiKey already falling back to the shared llm4s.credentials.<id>.apiKey when it sets none. Empty rather than absent when the user configured nothing. Everything this method needs arrives typed, in here: a descriptor never reads configuration itself.

Attributes

Inherited from:
EmbeddingProviderDescriptor
def dimensionsOf(model: String): Option[Int]

The vector dimensions of model, when this provider knows them.

The vector dimensions of model, when this provider knows them.

Attributes

Inherited from:
EmbeddingProviderDescriptor

Concrete fields

override val aliases: Set[String]

Alternative spellings accepted in EMBEDDING_MODEL=<name>/<model>, folded onto id.

Alternative spellings accepted in EMBEDDING_MODEL=<name>/<model>, folded onto id.

Attributes

What this provider needs from llm4s.embeddings.<id>, and its defaults.

What this provider needs from llm4s.embeddings.<id>, and its defaults.

Attributes

val id: ProviderId

Canonical id, e.g. ProviderId("voyage"). Must be unique among the embedding providers in a registry.

Canonical id, e.g. ProviderId("voyage"). Must be unique among the embedding providers in a registry.

Chat and embedding ids live in separate namespaces, so a provider that supplies both — OpenAI, Ollama — uses the same id for each without a clash. That is what lets EMBEDDING_MODEL=ollama/nomic-embed-text and a named chat section with provider = "ollama" name the same provider.

Attributes

override val modelDimensions: Map[String, Int]

Default output dimensions. Several of these models accept an output_dimension request parameter; the client does not send one, so the default is what it gets.

Default output dimensions. Several of these models accept an output_dimension request parameter; the client does not send one, so the default is what it gets.

Attributes