Documentation
¶
Index ¶
- Constants
- func List() []string
- func Register(name string, factory Factory)
- func ResolveSTModel(model string) string
- type CachedEmbedder
- type ConcurrentEmbedder
- type EmbedOptions
- type Embedder
- type Factory
- type GeminiConfig
- type GeminiEmbedder
- type MockEmbedder
- type OllamaEmbedder
- type OpenAIEmbedder
- type ProviderConfig
- type SentenceTransformerEmbedder
- type TFIDFEmbedder
Constants ¶
const ( DefaultModel = "gemini-embedding-001" DefaultTaskType = "SEMANTIC_SIMILARITY" )
Variables ¶
This section is empty.
Functions ¶
func ResolveSTModel ¶ added in v0.1.0
ResolveSTModel expands model aliases to full model names.
Types ¶
type CachedEmbedder ¶
type CachedEmbedder struct {
// contains filtered or unexported fields
}
CachedEmbedder wraps an Embedder with a cache layer.
func NewCachedEmbedder ¶
func NewCachedEmbedder(inner Embedder, c cache.Cache, modelName string) *CachedEmbedder
func (*CachedEmbedder) Close ¶
func (ce *CachedEmbedder) Close() error
Close flushes the underlying cache to disk.
type ConcurrentEmbedder ¶
type ConcurrentEmbedder struct {
// contains filtered or unexported fields
}
ConcurrentEmbedder parallelizes embedding across batches using a worker pool.
func NewConcurrentEmbedder ¶
func NewConcurrentEmbedder(inner Embedder, concurrencyLimit int, qps float64, batchSize int) *ConcurrentEmbedder
type EmbedOptions ¶
EmbedOptions holds options for embedding generation.
type Embedder ¶
type Embedder interface {
Embed(ctx context.Context, blocks []model.Block, opts EmbedOptions) ([]model.Embedding, error)
}
Embedder generates embeddings for blocks.
type Factory ¶
Factory creates an Embedder from a ProviderConfig. It returns the embedder, a human-readable info string, and any error.
type GeminiConfig ¶
GeminiConfig configures the Gemini embedder.
type GeminiEmbedder ¶
type GeminiEmbedder struct {
// contains filtered or unexported fields
}
GeminiEmbedder uses Google's Gemini API for embeddings.
func NewGeminiEmbedder ¶
func NewGeminiEmbedder(client *genai.Client, cfg GeminiConfig) *GeminiEmbedder
type MockEmbedder ¶
type MockEmbedder struct {
Dimensions int
}
MockEmbedder generates deterministic embeddings based on character frequency. Used for testing boundary detection without an API dependency.
func NewMockEmbedder ¶
func NewMockEmbedder(dimensions int) *MockEmbedder
type OllamaEmbedder ¶
type OllamaEmbedder struct {
// contains filtered or unexported fields
}
OllamaEmbedder uses Ollama's local embedding API.
type OpenAIEmbedder ¶
type OpenAIEmbedder struct {
// contains filtered or unexported fields
}
OpenAIEmbedder uses OpenAI's Embeddings API for embeddings.
type ProviderConfig ¶
ProviderConfig holds common configuration for embedding providers.
type SentenceTransformerEmbedder ¶ added in v0.1.0
type SentenceTransformerEmbedder struct {
// contains filtered or unexported fields
}
SentenceTransformerEmbedder uses a SentenceTransformer HTTP server for embeddings.
type TFIDFEmbedder ¶
type TFIDFEmbedder struct {
Dimensions int
}
TFIDFEmbedder generates embeddings using character 3-gram TF-IDF. Used as a fallback when API embedding is unavailable.
func NewTFIDFEmbedder ¶
func NewTFIDFEmbedder(dims int) *TFIDFEmbedder