Skip to content

embedkit: provider abstraction over ollamakit with deterministic hash fallback #82

Description

@danieljustus

Goal

Add a configurable embedding provider to embedkit, defaulting to ollamakit.Client, with a deterministic FNV-1a hash fallback carrying its own model name — replacing the two independent implementations in symaira-seek and symaira-memory.

Why now

Both consumer repos implement the same fallback today: symaira-seek/internal/engine/embeddings.go wraps ollamakit.Embed with an FNV-1a fallback (local-hash); symaira-memory/internal/extractor/embeddings.go reimplements the same idea with a raw net/http client, bypassing ollamakit entirely. Consolidating removes one of the two duplicated code paths named in #74.

Current state / Evidence

  • symaira-seek/internal/engine/embeddings.goollamakit.Embed, FNV-1a fallback, localHashModelName, dimension autodetect
  • symaira-memory/internal/extractor/embeddings.go — own http.Client, FNV-1a fallback, DefaultDimensions = 768

In Scope

  • Configurable provider (ollamakit.Client as default), model name, target dimension
  • Deterministic hash fallback with its own model name, returning embedkit.Result (from the Result/SameSpace sub-issue)
  • Tests asserting the hash fallback is deterministic (same input → same vector) and carries a distinct Model value so SameSpace never conflates it with a real model's embeddings

Out of Scope

  • Cache (separate sub-issue)
  • Dimension pinning / renormalization (separate sub-issue)
  • Migrating symaira-seek / symaira-memory to use this package (their own issues)

Acceptance criteria

  • Provider is configurable; ollamakit.Client works as the default with no consumer-side wiring beyond construction
  • Hash fallback is deterministic and covered by tests
  • make test and make lint green, CGO_ENABLED=0 builds

Risks / Dependencies

Part of #74. Depends on the Result/SameSpace sub-issue landing first (the provider returns embedkit.Result).

Metadata

Metadata

Assignees

Labels

featureNew product capabilitygroup: local-modelsRelated issues to be planned and implemented togetherpriority: mediumPlanning priority

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions