Wikipedia Tool
Give your LLM agent a real reference to check
- tool
Language models are confident even when they're wrong, and factual questions - dates, definitions, "who is this person" - are exactly where that bites you. Wikipedia Tool gives your LLM agent a way to actually go look something up instead of guessing from training data. It's one of this pack's set of "tool" nodes: rather than doing anything itself, it packages a Wikipedia search-and-retrieve capability into something an LLM can decide to call mid-conversation, the same mechanism this pack uses for its GitHub and DuckDuckGo tools.
How it works
The mechanism here is retrieval, not just search. query is the search term or question - note that its default is literally the placeholder string "query", which is a hint this field is normally overwritten dynamically rather than hand-typed, since in an agent context the LLM itself generates the search query based on what it needs to know. is_enable is this pack's standard toggle for pulling the tool out of the agent's available set without removing the node.
Where this node goes beyond a plain search wrapper is chunk_size (default 200) and chunk_overlap (default 50). A Wikipedia article is far too long to hand an LLM whole - so the retrieved text gets split into overlapping chunks of roughly chunk_size characters or tokens, with chunk_overlap worth of shared text between consecutive chunks so you don't lose context right at a chunk boundary. This is standard RAG chunking, and the two knobs trade off against each other the way they always do: smaller chunks give more precise retrieval but less surrounding context per chunk; more overlap protects against splitting a key sentence in half but means more redundant text getting processed.
The optional embedding_path and required device fields point to this being genuinely embedding-backed retrieval rather than naive keyword matching - device picks where that embedding step runs (auto, cuda, mps, cpu), matching this pack's Load Embeddings node conventions elsewhere. If you're already loading an embedding model via that node, wire its path in here so the chunk ranking is actually semantic rather than falling back to whatever this node does without one.
Output is a single tool string, same as this pack's other tool nodes - wire it into an LLM/agent node's tool-list input, and the model decides when a query calls for a Wikipedia lookup versus answering from what it already knows.
Where it fits
This is straightforward RAG-as-a-tool: instead of a static knowledge base you built once, the agent gets live access to a huge, general-purpose reference and only reaches for it when the conversation actually needs a fact-check. Combine it with this pack's other networking tools (DuckDuckGo, GitHub) and the agent has a genuinely useful toolbox instead of just its training-data memory.
Installing it
Standard pack install, no special extra step for this node specifically:
- ComfyUI Manager: search "comfyui_LLM_party", install, restart ComfyUI.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, thenpip install -r requirements.txtinside your ComfyUI Python environment, restart.
Common issues
If retrieval quality feels off - chunks that don't seem relevant to the query - check embedding_path first. Leaving it unset presumably falls back to some non-embedding retrieval mode, which will feel noticeably worse than semantic search once you're used to the embedding-backed version; if you want proper RAG-quality results here, pair this node with Load Embeddings rather than leaving that field blank.
Chunking parameters matter more than people expect. If the agent keeps missing information that's clearly in the source article, try a larger chunk_overlap before assuming the tool is broken - the fact you're after may simply be split across a chunk boundary at the defaults. And remember the LLM writes query itself in an agent context, not you - if lookups are consistently bad, the fix is often a better tool description on whichever node feeds this one into the agent's tool list, not a setting on this node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| query | STRING | query | — |
| is_enable | BOOLEAN | true | — |
| chunk_size | INT | 200 | — |
| chunk_overlap | INT | 50 | — |
| device | COMBO | auto | 4 options: auto, cuda, mps, cpu |
| embedding_pathopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| tool | STRING | — |