Documentation ¶
Index ¶
Constants ¶
const ( NormalizationNone NormalizationType = -1 NormalizationMaxAbsInt16 NormalizationType = 0 NormalizationTaxicab NormalizationType = 1 NormalizationL2 NormalizationType = 2 PoolingNone PoolingType = 0 PoolingMean PoolingType = 1 PoolingCls PoolingType = 2 PoolingLast PoolingType = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LlamaEmbedder ¶
type LlamaEmbedder struct {
// contains filtered or unexported fields
}
func NewLlamaEmbedder ¶
func NewLlamaEmbedder(modelPath string, opts ...Option) (*LlamaEmbedder, func(), error)
func (*LlamaEmbedder) Close ¶
func (e *LlamaEmbedder) Close()
Close closes the embedder and frees any resources
func (*LlamaEmbedder) EmbedTexts ¶
func (e *LlamaEmbedder) EmbedTexts(texts []string) ([][]float32, error)
EmbedTexts embeds the given texts using the model
func (*LlamaEmbedder) GetMetadata ¶
func (e *LlamaEmbedder) GetMetadata() map[string]string
GetMetadata returns the metadata associated with the model
type NormalizationType ¶
type NormalizationType int32
type Option ¶
type Option func(*LlamaEmbedder) error
func WithHFRepo ¶
WithHFRepo sets the Hugging Face repo to download the model from
func WithModelCacheDir ¶
WithModelCacheDir sets the directory to cache the model. If the directory does not exist, it will be created.
func WithNormalization ¶
func WithNormalization(norm NormalizationType) Option
WithNormalization sets the normalization type to use Possible values are NormalizationNone, NormalizationMaxAbsInt16, NormalizationTaxicab, NormalizationL2 (default)
func WithPooling ¶
func WithPooling(pool PoolingType) Option
WithPooling sets the pooling type to use Possible values are PoolingNone, PoolingMean (default), PoolingCls, PoolingLast
func WithSharedLibraryPath ¶
WithSharedLibraryPath sets the shared library path to use. LlamaEmbedder will look for shared library under this path. This overrides WithSharedLibraryVersion.
func WithSharedLibraryVersion ¶
WithSharedLibraryVersion sets the shared library version to use. This is overridden by WithSharedLibraryPath
type PoolingType ¶
type PoolingType int32