ernie

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ernie

type Ernie struct {
	// contains filtered or unexported fields
}

Ernie Embedding-V1 doc: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/alj562vvu

func NewErnie

func NewErnie(opts ...Option) (*Ernie, error)

NewErnie creates a new Ernie with options. Options for client, strip new lines and batch size.

func (*Ernie) EmbedDocuments

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

EmbedDocuments use ernie Embedding-V1.

func (*Ernie) EmbedQuery

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

EmbedQuery use ernie Embedding-V1.

type Option

type Option func(p *Ernie)

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

WithClient is an option for providing the LLM client.

func WithStripNewLines

func WithStripNewLines(stripNewLines bool) Option

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

Jump to

Keyboard shortcuts

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