core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRuntime

func EnsureRuntime() error

func L2Normalize

func L2Normalize(v []float32)

func MeanPool

func MeanPool(data []float32, dim int) ([]float32, error)

MeanPool averages a flat [1, numTokens, dim] tensor across the token dimension, returning a single [dim] vector.

func PoolAndNormalize

func PoolAndNormalize(data []float32, dim int) ([]float32, error)

PoolAndNormalize mean-pools data from [1, numTokens, dim] to [dim] if needed, then L2-normalizes the result.

func RuntimeLibPath

func RuntimeLibPath() (string, error)

Types

type Embedder

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

func NewEmbedder

func NewEmbedder(
	modelPath string,
	config modelConfig,
	options EmbedderOptions,
) (*Embedder, error)

func (*Embedder) Close

func (e *Embedder) Close() error

func (*Embedder) Embed

func (e *Embedder) Embed(path string) ([]float32, error)

type EmbedderOptions

type EmbedderOptions struct {
	Verbose bool
}

type ModelInfo

type ModelInfo struct {
	Path   string
	Config modelConfig
}

func EnsureModel

func EnsureModel(db *sql.DB, modelName string) (ModelInfo, error)

type ModelState

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

func GetModelState

func GetModelState(db *sql.DB, modelName string) (ModelState, error)

Jump to

Keyboard shortcuts

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