Nodes/comfyui_LLM_Polymath/LLM Polymath Chat with Advanced Web and Link Search
ComfyUI Node

LLM Polymath Chat with Advanced Web and Link Search

The chat node that searches the web, cites its sources, and can even draw

By lum3on·Created 2 years ago·Updated 6 months ago· 75
LLM Polymath Chat with Advanced Web and Link Search
  • llm_settings
  • image
  • STRING
  • IMAGE
promptEnter your prompt here. Use {additional_text} as a placeholder if needed.
additional_text
seed42
modelGPT Image 1
custom_instructionNone
enable_web_searchfalse
list_sourcesfalse
num_search_results5
keep_contexttrue
ollama_chat_modefalse
compressfalse
compression_level
console_logtrue

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 splice additional_text in 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 .txt into custom_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:

  1. The README tells you to put keys in a .env file, but the code never reads .env. It calls os.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 ".env isn't being read" - that's this.
  2. The model dropdown is frozen at startup. Pull a new Ollama model and you must restart ComfyUI for it to show up.
  3. 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.

CategoryPolymath

Inputs (15)

NameTypeDefaultDescription
promptSTRINGEnter your prompt here. Use {additional_text} as a placeholder if needed.
additional_textSTRING
seedINT420–268435455
llm_settingsoptLLM_SETTINGS
modeloptCOMBOGPT Image 120 options: GPT Image 1, GPT Image 1.5, Claude 3.7 Sonnet, Claude 3.5 Sonnet, Grok 2 Vision, Grok 2 Image, +14
custom_instructionoptCOMBONone22 options: None, Video-Prompter, Python Debugger, expert prompter, GPT super instructor, Instruction Genius, +16
enable_web_searchoptBOOLEANfalse
list_sourcesoptBOOLEANfalse
num_search_resultsoptINT51–10
keep_contextoptBOOLEANtrue
ollama_chat_modeoptBOOLEANfalse
compressoptBOOLEANfalse
compression_leveloptCOMBO3 options: soft, medium, hard
console_logoptBOOLEANtrue
imageoptIMAGE

Outputs (2)

NameTypeDescription
STRINGSTRING
IMAGEIMAGE