huggingface

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Huggingface

type Huggingface struct {
	Model string
	Task  string

	StripNewLines bool
	BatchSize     int
	// contains filtered or unexported fields
}

Huggingface is the embedder using the Huggingface hub api.

func NewHuggingface

func NewHuggingface(opts ...Option) (*Huggingface, error)

func (*Huggingface) EmbedDocuments

func (e *Huggingface) EmbedDocuments(ctx context.Context, texts []string) ([][]float64, error)

func (*Huggingface) EmbedQuery

func (e *Huggingface) EmbedQuery(ctx context.Context, text string) ([]float64, error)

type Option

type Option func(p *Huggingface)

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 huggingface.LLM) Option

WithClient is an option for providing the LLM 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 WithTask

func WithTask(task string) Option

WithTask is an option for providing the task to call the model with.

Jump to

Keyboard shortcuts

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