Documentation
¶
Overview ¶
Package vectorindex is the swappable vector-search seam behind the runbook-RAG find_runbook tool. The OSS build ships an in-memory cosine top-K index (Memory) that holds the whole runbook corpus in process — no external vector database, so an operator's data never leaves the box. The Index interface is the seam an enterprise hosted/scalable vector backend swaps in without forking the tool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Doc ¶
type Doc struct {
ID string
Title string
Service string
Source string
Excerpt string
Vector []float32
}
Doc is one indexed runbook excerpt plus its cached embedding vector. The vector is computed once at ingestion and reloaded at boot, so the index never needs to re-embed the corpus.
type Index ¶
Index is the read-only search seam the find_runbook tool depends on (via a local interface in the tools package). Implementations return the top-`limit` documents most similar to `query`, optionally restricted to a single service. A nil/empty index yields no results and no error.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is the in-memory cosine top-K index. It is safe to build once at boot and read concurrently afterwards; it is not written to after construction (ingestion rewrites the backing store and the index is rebuilt at the next boot).
func NewMemory ¶
NewMemory returns an empty in-memory index bounded at maxDocs documents (Add silently drops documents beyond the bound so a runaway corpus cannot exhaust memory). A non-positive maxDocs applies the built-in default.
func (*Memory) Add ¶
Add appends a document to the index. Documents with an empty vector are skipped (they could never match). Documents beyond the configured bound are dropped.
func (*Memory) Search ¶
Search implements Index. It scores every document by cosine similarity against query, optionally filters by service (case-insensitive exact match), sorts by descending score, and returns at most limit results. A non-positive limit applies a default of 5. An empty index or empty query yields no results.