EasyRAG - Vector Store Builder (FAISS)
The node that actually does the 'R' in RAG
- documents
- RAG Index
- summary
The two loaders just get text into the graph. This is the node that makes retrieval possible. EasyRAG - Vector Store Builder (FAISS) takes the RAG_DOCUMENTS from a loader, chops them into chunks, runs a local embedding model over every chunk, and writes a FAISS index to disk. Once that's built, every chat node in the pack can search it - and search results, not your whole document, are what get fed to the LLM. That search-then-answer step is the entire difference between "chat with your docs" and "dumped your whole corpus into the context window until it overflowed."
How it works, mechanism first
The build is three steps, all on CPU and all visible in the console:
- Chunking. The current version splits on non-empty lines - each line becomes one retrieval chunk. This is worth knowing because it makes
chunk_sizeandchunk_overlapmostly decorative right now: they're accepted, recorded into the index metadata, and ignored by the actual splitter. For a prompt library where each line is a complete prompt, that's the correct behavior. For long prose paragraphs, each paragraph-ish line becomes a chunk, which is... fine, but don't expect smart windowing. - Embedding. Every chunk goes through a
SentenceTransformermodel (the one you pick) and gets normalized to unit length. - Indexing. The vectors go into
faiss.IndexFlatIP- inner product, which with normalized vectors is cosine similarity. The whole thing (index +chunks.json+meta.json) is saved toComfyUI/models/RAG/VectorDB/<your-index-name>/, and it persists across restarts.
The node is also smart about not re-doing work: if you point it at an index that already exists on disk, it skips the rebuild, loads the metadata, and hands you the RAG_INDEX handle straight away. You don't need to re-embed a 10k-prompt file every time you touch the workflow.
The inputs that matter
The full list of required inputs is: documents, build_mode, index_list, index_name, embedding_model, chunk_size, chunk_overlap, show_retrieval_log, and unload_embedding_model_after_build. A beginner really only sets four of them:
documents- theRAG_DOCUMENTSoutput from either loader. Non-negotiable.build_mode-create_newvsuse_existing. The web UI trims this to just those two options (the backend tolerates a few legacy spellings).index_name- type a name here to build a fresh index.index_listis the companion dropdown that picks an existing one when you're inuse_existingmode. The tooltip says it plainly: leaveindex_nameempty to use the selection above.embedding_model- a dropdown of model folders sitting inComfyUI/models/embeddings. The README recommendsbge-small-zh-v1.5(it's a Chinese pack, so of course); English users get better results from something likeall-MiniLM-L6-v2. Any sentence-transformers folder with aconfig.jsonworks.
show_retrieval_log prints what got retrieved to the console - keep it on while you're debugging, it's genuinely useful. And unload_embedding_model_after_build (default on) is the pack's whole VRAM philosophy in one checkbox: the embedding model gets forced off the GPU the moment it's done, so your SDXL/FLUX model isn't fighting for memory with a sentence encoder.
Gotchas
- Empty embedding dropdown = the build fails. There's no auto-download fallback in this version; the node just raises "please select a valid embedding model." Drop a sentence-transformers model folder into
models/embeddingsand refresh. - The index is bound to its embedding model.
meta.jsonrecords which model built it, and at query time the same model is reloaded to embed your question. Swap embedding models between build and query and retrieval silently gets worse - cosine similarity between differently-embedded vectors is meaningless. - Line-based chunking, again. If you notice retrieval returning whole multi-sentence lines instead of tight snippets, that's the splitter, not a bug.
Install
It's part of the pack, so: ComfyUI Manager → search "ComfyUI Easy RAG" → install, or
cd ComfyUI/custom_nodes
git clone https://github.com/nregret/Comfyui-Easy-RAG
cd Comfyui-Easy-RAG
pip install -r requirements.txt
then restart. Dependencies are faiss-cpu, sentence-transformers, requests, pypdf - the build itself is CPU-bound, so no GPU drama, and the unload-after-build toggle keeps the memory footprint of even a big embedding model to a blip.
Verdict: this is the node that makes the pack worth installing. Everything else in EasyRAG is a chat client you could bolt together from any LLM API - but a persisted, local, FAISS-backed index that your private docs actually get embedded into is the part that takes real setup. Build it once, reuse it forever.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| documents | RAG_DOCUMENTS | — | |
| build_mode | COMBO | create_new | Choose whether to create a new vector store or use an existing one |
| index_list | COMBO | default_index | Select an existing vector store |
| index_name | STRING | Leave empty to use selection above; enter a name to create a new index | |
| embedding_model | COMBO | Select a local embedding model | |
| chunk_size | INT | 4000100–4000 | — |
| chunk_overlap | INT | 00–2000 | — |
| show_retrieval_log | BOOLEAN | true | — |
| unload_embedding_model_after_build | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| RAG Index | RAG_INDEX | — |
| summary | STRING | — |