-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Problem
On every add_memory, the LLM extracts keywords and tags that enrich each memory. These are stored in ChromaDB metadata but are never included in the text that gets embedded. Only the raw content string is passed to the vector index:
# retrievers.py add_document()
self.collection.add(
documents=[document], # ← raw content only
metadatas=[processed_metadata],
ids=[doc_id]
)This means a query like "ollama GPU setup" won't match a memory whose content is "NVIDIA driver 590.48.01 is compatible with kernel 6.17" even though it has tags ["ollama", "gpu", "nvidia"]. The LLM's extraction work is wasted at search time.
Proposed fix
Concatenate content with its tags and keywords before embedding:
searchable_text = content
if tags:
searchable_text += " " + " ".join(tags)
if keywords:
searchable_text += " " + " ".join(keywords)Pass searchable_text as the document to ChromaDB while keeping content as the stored field in metadata. This ensures the embedding captures the enriched signal without changing what gets returned to callers.
Alternative
A proper hybrid search (BM25 over keywords + dense vector over content, with score fusion) would be more principled, but the simple concatenation approach above is low-effort and likely captures most of the gain.