voyageai

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(v *VoyageAI)

Option is a function type that can be used to modify the client.

func WithBatchSize

func WithBatchSize(batchSize int) Option

WithBatchSize is an option for specifying the batch size.

func WithClient

func WithClient(client http.Client) Option

WithClient is an option for providing a custom http client.

func WithModel

func WithModel(model string) Option

WithModel is an option for providing the model name to use.

func WithStripNewLines

func WithStripNewLines(stripNewLines bool) Option

WithStripNewLines is an option for specifying the should it strip new lines.

func WithToken

func WithToken(token string) Option

WithToken is an option for providing the VoyageAI token.

type VoyageAI

type VoyageAI struct {
	Model         string
	StripNewLines bool
	BatchSize     int
	// contains filtered or unexported fields
}

VoyageAI is the embedder using the VoyageAI api to create embeddings.

func NewVoyageAI

func NewVoyageAI(opts ...Option) (*VoyageAI, error)

NewVoyageAI returns a new embedder that uses the VoyageAI api. The default model is "voyage-2". Use `WithModel` to change the model.

func (*VoyageAI) EmbedDocuments

func (v *VoyageAI) EmbedDocuments(ctx context.Context, texts []string) ([][]float32, error)

EmbedDocuments implements the `embeddings.Embedder` and creates an embedding for each of the texts.

func (*VoyageAI) EmbedQuery

func (v *VoyageAI) EmbedQuery(ctx context.Context, text string) ([]float32, error)

EmbedQuery implements the `embeddings.Embedder` and creates an embedding for the query text.

Jump to

Keyboard shortcuts

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