Nodes/comfyui_LLM_party/🖥️Embeddings Tool
ComfyUI Node

🖥️Embeddings Tool

The pack's RAG building block

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
🖥️Embeddings Tool
  • ebd_model
  • tool
model_path
is_enableenable
k5
deviceauto
chunk_size200
chunk_overlap50
file_content
base_path

This is comfyui_LLM_party's answer to "how do I make my LLM answer questions about a document it wasn't trained on" - retrieval-augmented generation (RAG), in one node. The README name-drops this as "word vector RAG and GraphRAG to localize the management of the industry knowledge base," which is a mouthful, but the mechanism underneath is the standard RAG recipe: chop your document into chunks, turn each chunk into a vector with an embedding model, and at query time pull back whichever chunks are closest to the question so the LLM can actually reference them instead of hallucinating an answer.

The knobs map directly onto that pipeline. model_path is the path to your embedding model - a sentence-embedding model from HuggingFace, not the chat model itself; embeddings and chat generation are different model types even when they come from related families. chunk_size (default 200) and chunk_overlap (default 50) control how the source text gets split before embedding: smaller chunks give more precise retrieval but less context per chunk, and the overlap keeps you from cutting an idea in half right at a chunk boundary. k (default 5) is how many top-matching chunks come back per query - more k means more context handed to the LLM but also a longer prompt and a higher chance of pulling in a less-relevant chunk. device picks where the embedding model runs (auto/cuda/mps/cpu), and is_enable is the standard toggle. On the optional side, file_content is where you feed in the actual document text to index, base_path lets you point at a folder instead of a single blob, and ebd_model accepts an already-loaded embedding model object if you'd rather load it once upstream and reuse it than have this node manage the load itself.

The output is a single tool string - same pattern as the pack's Google Search Tool and MCP tool - meant to be wired into an LLM node's tools input. Once it's connected, the model can decide to query your knowledge base mid-conversation instead of you manually retrieving and pasting context into the prompt yourself. That's the actual value proposition here: it turns "search my documents" into something the LLM invokes on its own when it decides it needs to, rather than a separate manual step you run first.

Installing it is the standard pack install: search "comfyui_LLM_party" in ComfyUI Manager, or git clone https://github.com/heshengtao/comfyui_LLM_party into custom_nodes and restart, then run pip install -r requirements.txt from inside the pack folder using ComfyUI's own Python (portable installs: python_embeded\python.exe -m pip install -r requirements.txt, not your system pip).

Where this actually goes wrong in practice: an embedding model is a separate download from your chat model, and it's easy to accidentally point model_path at a chat model instead - that'll either error out or silently produce useless embeddings depending on how the underlying library handles the mismatch. chunk_size/chunk_overlap are also worth revisiting if retrieval feels off: too-small chunks with no overlap can slice a relevant sentence across two chunks and cause the retriever to miss it entirely, while chunks that are too large dilute the vector and hurt precision. And like everything else that talks to a model in this pack, don't forget device - leaving it on cuda when you're actually CPU-only, or vice versa, is a common first-run error.

Category大模型派对(llm_party)/工具(tools)/知识库(Knowbase)

Inputs (9)

NameTypeDefaultDescription
model_pathSTRING
is_enableCOMBOenable2 options: enable, disable
kINT5
deviceCOMBOauto4 options: auto, cuda, mps, cpu
chunk_sizeINT200
chunk_overlapINT50
file_contentoptSTRING
base_pathoptSTRING
ebd_modeloptEBD_MODEL

Outputs (1)

NameTypeDescription
toolSTRING