embedder

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	// Embed returns the embedding vector for the given text.
	Embed(ctx context.Context, text string) ([]float64, error)
	EmbedBatch(ctx context.Context, text []string) ([][]float64, error)
}

Embedder computes embeddings for text. Implementations can use OpenAI, local models, or other embedding services.

func NewGatewayEmbedder

func NewGatewayEmbedder(provider llm.Provider, dim int) Embedder

NewGatewayEmbedder returns an embedder that uses the LLM gateway with the knowledge's embedding provider/model and the project's default key. Requires ctx to load the project.

type GatewayEmbedder

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

GatewayEmbedder implements Embedder by calling the LLM gateway. Used for semantic chunking which needs per-sentence embeddings.

func (*GatewayEmbedder) Embed

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

func (*GatewayEmbedder) EmbedBatch

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

Jump to

Keyboard shortcuts

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