CouncilEx.AutoCouncil.Strategies.Embedding (CouncilEx v0.1.0)

Copy Markdown View Source

Stub. Semantic strategy: embed the prompt, cosine-similarity against precomputed catalog vectors, return the top match above a threshold.

Planned interface

Catalog entries provide a :vector field (precomputed at registration time). The strategy reads :embedder and :threshold from the parent AutoCouncil's :options:

AutoCouncil.new(
  strategy: :embedding,
  catalog:  catalog_with_vectors,
  options:  [
    embedder:  &MyApp.Embed.embed/1,   # binary -> [float]
    threshold: 0.72
  ]
)

Open design questions (deferred)

  • Where vectors live: alongside the registry entry vs a parallel store.
  • Re-embedding on description edits — versioning / staleness signal.
  • Pluggable similarity function (cosine vs dot).

Cache notes (also deferred)

Prompt → decision cache could live here, keyed by the embedding bucket rather than exact text. Use a versioned catalog hash to bust on changes. Cache for :llm_* strategies first; embedding is already cheap.

Calling resolve/2 today returns {:error, :not_implemented}.