voyageai

package
v1.3.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package voyageai provides embedding generation via the Voyage AI API. Voyage AI is recommended by Anthropic for embeddings with Claude-based systems.

Index

Constants

View Source
const (
	// DefaultModel is the recommended general-purpose model.
	DefaultModel = "voyage-3.5"

	// ModelVoyage35 is the latest general-purpose model for best performance.
	ModelVoyage35 = "voyage-3.5"

	// ModelVoyage35Lite is an efficient model with lower latency.
	ModelVoyage35Lite = "voyage-3.5-lite"

	// ModelVoyage3Large is a high-capacity model for complex tasks.
	ModelVoyage3Large = "voyage-3-large"

	// ModelVoyageCode3 is optimized for code embeddings.
	ModelVoyageCode3 = "voyage-code-3"

	// ModelVoyageFinance2 is optimized for finance domain.
	ModelVoyageFinance2 = "voyage-finance-2"

	// ModelVoyageLaw2 is optimized for legal domain.
	ModelVoyageLaw2 = "voyage-law-2"
)

Model constants for Voyage AI embeddings.

View Source
const (
	Dimensions2048 = 2048
	Dimensions1024 = 1024 // Default
	Dimensions512  = 512
	Dimensions256  = 256
)

Dimension constants for Voyage AI embeddings.

View Source
const (
	// InputTypeQuery indicates the input is a search query.
	InputTypeQuery = "query"

	// InputTypeDocument indicates the input is a document to be indexed.
	InputTypeDocument = "document"
)

InputType constants for retrieval optimization.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddingOption

type EmbeddingOption func(*EmbeddingProvider)

EmbeddingOption configures the EmbeddingProvider.

func WithAPIKey

func WithAPIKey(key string) EmbeddingOption

WithAPIKey sets the API key explicitly.

func WithBaseURL

func WithBaseURL(url string) EmbeddingOption

WithBaseURL sets a custom base URL.

func WithDimensions

func WithDimensions(dims int) EmbeddingOption

WithDimensions sets the output embedding dimensions.

func WithHTTPClient

func WithHTTPClient(client *http.Client) EmbeddingOption

WithHTTPClient sets a custom HTTP client.

func WithInputType

func WithInputType(inputType string) EmbeddingOption

WithInputType sets the input type for retrieval optimization. Use "query" for search queries and "document" for documents to be indexed.

func WithModel

func WithModel(model string) EmbeddingOption

WithModel sets the embedding model.

type EmbeddingProvider

type EmbeddingProvider struct {
	*providers.BaseEmbeddingProvider
	// contains filtered or unexported fields
}

EmbeddingProvider implements embedding generation via Voyage AI API.

func NewEmbeddingProvider

func NewEmbeddingProvider(opts ...EmbeddingOption) (*EmbeddingProvider, error)

NewEmbeddingProvider creates a Voyage AI embedding provider.

func (*EmbeddingProvider) Embed

Embed generates embeddings for the given texts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL