Nodes/comfyui_LLM_party/💻Advanced Embedding Tool
ComfyUI Node

💻Advanced Embedding Tool

Turn a local file into a RAG tool your LLM agent can query

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
💻Advanced Embedding Tool
  • ebd_model
  • tool
path
is_enableenable
k5
deviceauto
chunk_size200
chunk_overlap50
file_name
file_content
base_path

Stuffing a whole document into an LLM's context window works right up until the document is bigger than the window, or you're paying per token and don't want to re-send the same 40-page PDF on every single message. Advanced Embedding Tool is comfyui_LLM_party's answer: instead of pasting a file into the prompt, you turn it into a searchable little vector index and hand the LLM a tool it can call to fetch just the relevant chunks. This is the pack's actual RAG building block - the thing that lets an agent "know" a document without carrying it around in every turn.

How it works

Point it at a file (or paste text straight in), and it chunks the content, embeds each chunk into vector space, and stores the result. When the agent later needs an answer, it calls the tool with a query, the tool does a similarity search over the embedded chunks, and returns the top matches - not the whole file, just the parts that are actually relevant. That's the whole trick behind retrieval-augmented generation, minus the usual hassle of standing up a separate vector database: this node is the vector store, scoped to one call.

The inputs and outputs that matter

  • path / file_name - where the source document lives. If you'd rather skip the filesystem, the optional file_content input lets you pipe text in directly from an upstream node instead.
  • k (default 5) - how many chunks come back per query. This is your recall/precision knob: too low and the LLM might miss the right paragraph, too high and you're back to dumping half the document into context.
  • chunk_size (default 200) and chunk_overlap (default 50) - how the document gets sliced before embedding. Smaller chunks are more precise but lose surrounding context; the overlap keeps sentences from getting cut in half at chunk boundaries.
  • device (auto/cuda/mps/cpu) - where the embedding model runs. Leave it on auto unless you're specifically trying to keep this off your GPU while a diffusion model is using it.
  • The optional ebd_model input lets you wire in a specific embedding model loader if you want control over which embedder does the work; leave it unplugged and the node falls back to its own default.
  • One output: tool (a STRING) - this isn't text to read, it's a tool definition. Plug it into the party's tool-list input on your LLM/agent node, and the model gains the ability to query this document mid-conversation.

How to install it

Two real ways to get the pack itself:

  • ComfyUI Manager - search "comfyui_LLM_party", install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then restart.

Either way, you still need the Python dependencies: from inside the comfyui_LLM_party folder run pip install -r requirements.txt in your ComfyUI environment (portable Windows installs use python_embeded\python.exe -m pip install -r requirements.txt). This node specifically pulls in an embedding stack on top of the pack's usual LLM-calling dependencies, so it's one of the heavier installs in the family - if you're tight on disk or just want the basics, the README's fast_installed = True setting in config.ini skips the GGUF-related weight and can shrink the install.

Common issues & troubleshooting

The node loads but nothing seems to happen. Double-check path actually resolves - a typo'd path silently indexes nothing, and the tool will just return empty results without a loud error.

Retrieval feels off-topic. Play with chunk_size before blaming the embedder - chunks that are too large mix multiple ideas together and dilute the similarity match; chunks too small lose the sentence's own context. k is the second lever: bump it up if the right passage is close but not quite making the cut.

Install fails partway through. This pack has a real, current failure mode reported by users: installing via Manager, running requirements.txt manually, and the node still refusing to import - usually a CUDA/PyTorch mismatch with no clear list of supported versions to check against. If a node from this pack won't even show up in the node browser, it's almost always this, not something specific to embeddings.

GPU contention with your diffusion model. If you're running the embedder and a big checkpoint on the same card, setting device to cpu for this node is a legitimate way to avoid VRAM fights - embedding a handful of chunks is cheap enough that CPU is fine.

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

Inputs (10)

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

Outputs (1)

NameTypeDescription
toolSTRING