embeddings

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAgentEmbeddingPayload

func BuildAgentEmbeddingPayload(agent *models.AgentJSON) string

BuildAgentEmbeddingPayload mirrors BuildServerEmbeddingPayload but for AgentJSON entries.

func BuildServerEmbeddingPayload

func BuildServerEmbeddingPayload(server *apiv0.ServerJSON) string

BuildServerEmbeddingPayload converts a server document into the canonical text payload used for semantic embeddings. The payload deliberately combines all metadata that describes the resource so checksum comparisons stay stable across systems.

func GenerateSemanticEmbedding

func GenerateSemanticEmbedding(ctx context.Context, provider Provider, payload string, expectedDimensions int) (*database.SemanticEmbedding, error)

GenerateSemanticEmbedding transforms the provided payload into a SemanticEmbedding by invoking the configured provider. The payload must be non-empty. When expectedDimensions > 0, the provider output is validated against it.

func PayloadChecksum

func PayloadChecksum(payload string) string

PayloadChecksum returns the deterministic checksum for an embedding payload.

Types

type Payload

type Payload struct {
	Text     string
	Metadata map[string]string
}

Payload represents the textual input used to generate an embedding.

type Provider

type Provider interface {
	Generate(ctx context.Context, payload Payload) (*Result, error)
}

Provider defines the interface every embedding provider must implement.

func Factory

func Factory(cfg *config.EmbeddingsConfig, httpClient *http.Client) (Provider, error)

Factory creates a Provider from configuration.

type Result

type Result struct {
	Vector      []float32
	Provider    string
	Model       string
	Dimensions  int
	GeneratedAt time.Time
}

Result captures the vector returned by an embedding provider.

Jump to

Keyboard shortcuts

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