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) 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.
Click to show internal directories.
Click to hide internal directories.