LLM Polymath Chat with Advanced Web and Link Search
The chat node that searches the web, cites its sources, and can even draw
- llm_settings
- image
- STRING
- IMAGE
Polymath Chat is the flagship of the comfyui_LLM_Polymath pack and, honestly, the reason the pack exists. It's an LLM chat node that lives inside your ComfyUI graph: you type a prompt, it hits a model over an API, and the text comes back as a STRING you can wire straight into a CLIPTextEncode or a ShowText. It doesn't just chat, either - it fetches the web pages you link, runs a real Google search and stuffs the results into context, hands an image tensor to a vision model, and with the right model selected, generates images right in the graph. It's the most "do everything" node in the pack, and also the one most likely to need setup before it does anything.
How it works
The node's model dropdown is built at startup from two places: a bundled config.json (Claude 3.7/3.5 Sonnet, Grok 2/3 family, Deepseek Chat/Reasoner, Gemini 2.5, and the gpt-image-1 / gpt-image-1.5 generation models) and - if Ollama is running at http://127.0.0.1:11434 - every model you've pulled locally. The API is picked automatically from whichever model you select; no per-model keys to juggle beyond the five environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, GEMINI_API_KEY). If you don't have any keys and don't want to pay for tokens, Ollama is the whole point: install it, ollama pull gemma:2b, keep the CLI open, and your local model appears in the dropdown after a restart. One person on r/comfyui described exactly that setup as the thing they "use all the time" for a local research assistant.
The web search is where it gets fun. Turn on enable_web_search and the node scans your prompt for URLs, extracts their text with BeautifulSoup, then runs a Google search for the whole query and pulls the top results' content too. Everything lands in the prompt as quoted sources, and list_sources makes the model cite them. It's a genuinely useful RAG-lite pattern - the prompt literally ends with "Based on this information, please provide a response."
Inputs that actually matter
- prompt - your query. Use
{additional_text}as a placeholder and the node will spliceadditional_textin there; otherwise additional text just gets appended. - model - the dropdown. Here's the trap: the default is "GPT Image 1", an image-generation model. Click Run and you'll get an image out, not prose. If you want text, pick a chat model first.
- custom_instruction - 22 bundled
.txt"agents": expert prompter, flux T5/ClipL captioners, a Python debugger, "DSD captioning," a JSON converter, even the "node finder" and "smart assistant" the README brags about. Drop a.txtintocustom_nodes/comfyui_LLM_Polymath/custom_instructions/and it appears here on restart - that's the extensibility story. - seed, keep_context, compress - seed for reproducibility, keep_context holds a chat history between runs (so you can hold a real conversation), and compress appends an output-length cap (soft ~250 chars, hard ~75).
Outputs
Two, always: a STRING (the model's text answer, or an error message) and an IMAGE. For chat models the IMAGE output is empty; for gpt-image-1 / Gemini image models the node does a generation or edit call and the picture comes out on IMAGE. Pass an image tensor in and it's base64-encoded into the request - that's how you do image-editing prompts or ask a vision model to look at your render.
Installation and gotchas
Install via ComfyUI Manager (search "comfyui_LLM_Polymath") or cd ComfyUI/custom_nodes && git clone https://github.com/lum3on/comfyui_LLM_Polymath, then pip install -r requirements.txt and restart. The requirements list is heavy - openai, anthropic, google-genai, ollama, easyocr, jax, gallery-dl - so expect the install to take a while and to see the node missing if any import fails.
Three things to know before you blame yourself:
- The README tells you to put keys in a
.envfile, but the code never reads.env. It callsos.getenv()directly. On Windows portable,set OPENAI_API_KEY=...in your.bat; elsewhere export the vars in the shell that launches ComfyUI. The release thread is full of people whose ".envisn't being read" - that's this. - The model dropdown is frozen at startup. Pull a new Ollama model and you must restart ComfyUI for it to show up.
- The author's own advice: the "node finder" agent works best on an OpenAI model - those have the biggest context window for the huge ComfyUI-Manager node list it loads. On a 2B local model it'll be mush.
One more caveat: this is an indie pack ("Node Lab project, Lumeon"), released early 2025 and maintained lightly. Expect rough edges and a config.json that lags the latest model versions - fine for a first LLM-in-ComfyUI try, less so for a production pipeline.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Enter your prompt here. Use {additional_text} as a placeholder if needed. | — |
| additional_text | STRING | — | |
| seed | INT | 420–268435455 | — |
| llm_settingsopt | LLM_SETTINGS | — | |
| modelopt | COMBO | GPT Image 1 | 20 options: GPT Image 1, GPT Image 1.5, Claude 3.7 Sonnet, Claude 3.5 Sonnet, Grok 2 Vision, Grok 2 Image, +14 |
| custom_instructionopt | COMBO | None | 22 options: None, Video-Prompter, Python Debugger, expert prompter, GPT super instructor, Instruction Genius, +16 |
| enable_web_searchopt | BOOLEAN | false | — |
| list_sourcesopt | BOOLEAN | false | — |
| num_search_resultsopt | INT | 51–10 | — |
| keep_contextopt | BOOLEAN | true | — |
| ollama_chat_modeopt | BOOLEAN | false | — |
| compressopt | BOOLEAN | false | — |
| compression_levelopt | COMBO | 3 options: soft, medium, hard | |
| console_logopt | BOOLEAN | true | — |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| IMAGE | IMAGE | — |