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 ¶
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.
const ( Dimensions2048 = 2048 Dimensions1024 = 1024 // Default Dimensions512 = 512 Dimensions256 = 256 )
Dimension constants for Voyage AI embeddings.
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 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.
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 ¶
func (p *EmbeddingProvider) Embed( ctx context.Context, req providers.EmbeddingRequest, ) (providers.EmbeddingResponse, error)
Embed generates embeddings for the given texts.