How ruc-nlpir/webthinker works
Project Type and Purpose
• WebThinker is a Python‐based research framework (a full‐stack CLI + demo application without a traditional frontend) that empowers large reasoning models (LRMs) to autonomously search the web, extract information, and generate research reports end to end.
High-Level Architecture Components
A. User Interfaces
• CLI Scripts (“scripts/run_web_thinker.py”, “scripts/run_web_thinker_report.py”, etc.)
• Demo UI (Streamlit app in demo/run_demo.py)
B. Orchestration Layer
• Main Orchestrator modules in “scripts/run_*.py”
• Demo controller in “demo/run_demo.py”
C. Tooling & Connectors
• Deep Web Explorer: scripts/search/bing_search.py + optional Crawl4AI client
• Prompt modules: “demo/prompts.py”, “scripts/prompts/prompts.py”, lcb_runner/prompts
D. LLM Invocation Layer
• lcb_runner framework (“scripts/lcb_runner/runner/…”) abstracts calls to vLLM‐served models (main reasoning and auxiliary)
• Pluggable runners for OpenAI, Gemini, Qwen, Claude, etc.
E. Data Layer
• Local benchmarks and question sets (“data/GAIA”, “data/GPQA”, etc.)
• Outputs folder storing generated markdown reports (“outputs/…”)
F. Evaluation Layer
• scripts/evaluate/evaluate.py (QA evaluation)
• scripts/evaluate/evaluate_report.py (report quality evaluation)
Relationships and Data Flows
• User (CLI or Demo UI) → invokes Orchestrator
• Orchestrator → calls Deep Web Explorer to issue Bing Search API requests and parse results
• Retrieved web content → fed into LLM Invocation Layer (via lcb_runner)
• LLMs (main reasoning model & auxiliary model) ↔ Orchestrator: multi-step think→search→draft cycles
• Draft outputs → written as markdown under “outputs/…”
• Evaluation scripts → read outputs and benchmarks from “data/…” → optionally call evaluation LLMs → produce metrics
Architectural Patterns & Principles
• Modular separation of concerns: UI, orchestration, tool integration, LLM invocation, data I/O, evaluation
• Plugin architecture for model runners (add new LLMs by implementing a runner)
• Tool‐augmented LLM pattern: agent uses search and navigation tools during generation
• Clear I/O boundaries: JSON/text I/O for data, markdown for outputs, standardized CLI flags
Technology Stack
• Python 3.9+
• vLLM for model serving (main & auxiliary)
• Bing Search API (or optional Crawl4AI client) for web crawling
• Streamlit (demo UI)
• lcb_runner framework (runner abstraction)
• Standard libraries & utilities (requests, asyncio, JSON, file I/O)