embedding

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 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

Overview

Package embedding abstracts the text embedding service used by the semantic cache of mod_ai_cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOpenAIProvider

func NewOpenAIProvider(cfg Config) (*openAIProvider, error)

NewOpenAIProvider creates an OpenAI compatible embedding provider.

Types

type Config

type Config struct {
	ServiceHost string
	ServicePort int
	UseHttps    bool
	ApiKey      string // bearer credential, never logged
	Model       string
	TimeoutMs   int
}

Config carries the connection info of an OpenAI compatible embedding service.

type EmbeddingProvider

type EmbeddingProvider interface {
	Embed(text string) ([]float32, error)
}

EmbeddingProvider turns a question text into a dense vector. Implementations must enforce the configured timeout internally.

Jump to

Keyboard shortcuts

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