Package profile
- Status
- Verified
- Publisher
- @FrostySDXL
- Source
- GitHub
README
comfyui-tag-rag
ComfyUI custom nodes for tag-based prompt RAG using CSV tag datasets, lexical/optional FAISS retrieval, and local llama.cpp generation.
Status
Experimental / Pre-Alpha. The current usable path is:
CSV tags -> TagRAG Index -> lexical/semantic retrieval -> TagRAG Prompt/Chat/Image -> native llama-cpp-python generation by default or alternate llama-server generation
Implemented now:
- CSV loading with encoding fallback.
- Normalized
TagRecord/TagCatalogdata model. - Lexical retrieval over tags, aliases, categories, descriptions, exclusions, and weights.
- Basic
TagRAG Indexnode that returns a serialized JSONindex_ref. - Basic
TagRAG Promptnode that reloads the CSV fromindex_ref, retrieves tags, builds a deterministic one-shot prompt, and calls native llama-cpp-python by default or a local llama-server endpoint when selected. - Native llama-cpp-python embeddings for semantic/hybrid retrieval when an embedding-capable GGUF is provided, plus alternate llama-server embeddings through
/v1/embeddingsor legacy/embedding. - Optional FAISS semantic indexes persisted beside the CSV under
.tag_rag_indexes/<index_name>/. - Semantic and hybrid retrieval modes when
faiss-cpuand an embedding endpoint are available. - Basic
TagRAG Chatnode with bounded in-memory conversation history and RAG retrieval per turn. TagRAG Imagenode that accepts existing tag strings as the primary path, can optionally run built-in WD14-style ONNX tagging when image extras/model files are manually installed, retrieves related CSV tags, and optionally refines through llama-server.- Native
llama-cpp-pythonin-process GGUF generation backend for Prompt, Chat, and Image refinement is the normal/default path; llama-server remains supported.
Future:
- Advanced vision-language image conversation/collaboration workflows.
Goal
Help users craft better ComfyUI image-generation prompts by combining:
- A personal CSV tag dataset.
- Retrieval over that dataset.
- Local llama.cpp-based text generation.
- Optional chat and tag-to-prompt/image-to-tag workflows.
Quick Start: Lexical Retrieval + Prompt Generation
-
Install the package into your ComfyUI
custom_nodes/directory. -
Install core requirements:
pip install -r requirements.txt -
Provide an existing local generation GGUF through
model_pathfor the default native backend. No model is downloaded automatically.Or start/point to an existing local llama.cpp server if you prefer
generation_backend=llama_server:http://127.0.0.1:8080/v1/chat/completions -
Add
TagRAG Indexin ComfyUI.- Set
csv_pathto your CSV file. - Set
tag_columnto the column containing tag text. - Optional columns:
aliases,category,description,source,weight. - The node returns a JSON
index_refstring.
- Set
-
Wire
index_refintoTagRAG Prompt. -
Enter an
idea,model_path,top_k,max_tokens, andtemperature. -
Leave
generation_backend=llama_cpp_pythonfor the default path, or switch tollama_serverand usebase_url/model. -
Use the
positive_promptoutput in your ComfyUI generation workflow.
No FAISS or embedding model/server is required for the lexical retrieval path.
Optional: Semantic or Hybrid Retrieval
-
Normal ComfyUI installs use
requirements.txt, which now includes FAISS and native/image dependencies. If you maintain split installs, semantic retrieval needs:pip install -r requirements-rag.txt -
Choose an embedding backend in
TagRAG Index.Native default for semantic/hybrid:
embedding_backend: llama_cpp_python embedding_model_path: path to an embedding-capable GGUFAlternate llama-server backend:
OpenAI-compatible: http://127.0.0.1:8080/v1/embeddings Legacy llama.cpp: http://127.0.0.1:8080/embedding -
In
TagRAG Index, setretrieval_modetosemanticor `hy
Nodes in this pack
4 nodes
Nodes in this pack
4 nodes- TagRAGChat
- TagRAGImage
- TagRAGIndex
- TagRAGPrompt
Sources
3 sources
Sources
3 sourcesVerified Oct 11
Verified Oct 11
Source excerpts
1 excerpt
Source excerpts
1 excerptSource context: Repo FrostySDXL/comfyui-tag-rag
