Versions in this module Expand all Collapse all v0 v0.0.1 Aug 9, 2024 Changes in this version + var ErrAllTextsLenZero = errors.New("all texts have length 0") + var ErrVectorsNotSameSize = errors.New("vectors gotten not the same size") + func BatchTexts(texts []string, batchSize int) [][]string + func BatchedEmbed(ctx context.Context, embedder EmbedderClient, texts []string, batchSize int) ([][]float32, error) + func CombineVectors(vectors [][]float32, weights []int) ([]float32, error) + func MaybeRemoveNewLines(texts []string, removeNewLines bool) []string + type Embedder interface + EmbedDocuments func(ctx context.Context, texts []string) ([][]float32, error) + EmbedQuery func(ctx context.Context, text string) ([]float32, error) + type EmbedderClient interface + CreateEmbedding func(ctx context.Context, texts []string) ([][]float32, error) + type EmbedderClientFunc func(ctx context.Context, texts []string) ([][]float32, error) + func (e EmbedderClientFunc) CreateEmbedding(ctx context.Context, texts []string) ([][]float32, error) + type EmbedderImpl struct + BatchSize int + StripNewLines bool + func NewEmbedder(client EmbedderClient, opts ...Option) (*EmbedderImpl, error) + func (ei *EmbedderImpl) EmbedDocuments(ctx context.Context, texts []string) ([][]float32, error) + func (ei *EmbedderImpl) EmbedQuery(ctx context.Context, text string) ([]float32, error) + type Option func(p *EmbedderImpl) + func WithBatchSize(batchSize int) Option + func WithStripNewLines(stripNewLines bool) Option