Documentation
¶
Overview ¶
Package embedcache caches embedding vectors keyed by (model_id, dim, sha256(text)) so repeated ingest runs over the same corpus do not re-embed unchanged chunks. The store is its own SQLite file; it shares no schema with memmy's reference backend.
Index ¶
- func HashText(text string) string
- type Cache
- func (c *Cache) Close() error
- func (c *Cache) Count(ctx context.Context) (int, error)
- func (c *Cache) EmbedBatch(ctx context.Context, e embed.Embedder, modelID string, task embed.EmbedTask, ...) ([][]float32, error)
- func (c *Cache) Get(ctx context.Context, modelID string, dim int, text string) ([]float32, bool, error)
- func (c *Cache) Put(ctx context.Context, modelID string, dim int, text string, vec []float32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a content-addressed embedding cache backed by SQLite.
func (*Cache) EmbedBatch ¶
func (c *Cache) EmbedBatch(ctx context.Context, e embed.Embedder, modelID string, task embed.EmbedTask, texts []string) ([][]float32, error)
EmbedBatch returns vectors aligned with `texts`, hitting the cache for known content and calling embedder for the misses. The result preserves input order regardless of cache hit pattern.
Click to show internal directories.
Click to hide internal directories.