embedder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	// Embed generates a vector embedding for a single text string.
	Embed(text string) ([]float32, error)

	// EmbedBatch generates vector embeddings for multiple texts.
	EmbedBatch(texts []string) ([][]float32, error)

	// Close releases any resources held by the embedder.
	Close() error
}

Embedder defines the interface for text embedding.

type ONNXEmbedder

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

ONNXEmbedder wraps direct ONNX Runtime inference for all-MiniLM-L6-v2.

func NewONNXEmbedder

func NewONNXEmbedder(runtimePath, modelPath, vocabPath string) (*ONNXEmbedder, error)

NewONNXEmbedder creates a new embedder. runtimePath: path to libonnxruntime.so (optional) modelPath: path to the all-MiniLM-L6-v2 ONNX model file vocabPath: path to the vocab.txt file

func (*ONNXEmbedder) Close

func (e *ONNXEmbedder) Close() error

Close releases resources.

func (*ONNXEmbedder) Embed

func (e *ONNXEmbedder) Embed(text string) ([]float32, error)

Embed generates an embedding for a single text string. Returns a 384-dimensional vector (all-MiniLM-L6-v2 output).

func (*ONNXEmbedder) EmbedBatch

func (e *ONNXEmbedder) EmbedBatch(texts []string) ([][]float32, error)

EmbedBatch generates embeddings for multiple texts.

Jump to

Keyboard shortcuts

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