项目: assafelovic/gpt-researcher
Stars: 29k+ | License: Apache 2.0 | 语言: Python
定位: 首个开源深度研究 Agent,支持 Web 和本地数据源的自主研究与报告生成
1. 整体架构概览
GPT-Researcher 采用 技能化(Skills-based)分层架构,核心是一个中央协调 Agent(GPTResearcher 类),通过组合多个专职技能模块完成研究流程。架构灵感来自 Plan-and-Solve 和 RAG 论文。
┌─────────────────────────────────────────────────────────┐
│ GPTResearcher (Agent) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │
│ │ Research │ │ Context │ │ Report │ │ Deep │ │
│ │ Conductor│ │ Manager │ │ Generator │ │ Research │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └─────┬──────┘ │
│ │ │ │ │ │
│ ┌────┴────┐ ┌─────┴─────┐ ┌───┴───┐ ┌─────┴──────┐ │
│ │Retrievers│ │Compressor │ │Writer │ │Source │ │
│ │(Web/MCP/ │ │(Embedding │ │(LLM) │ │Curator │ │
│ │ Local) │ │ Filtering)│ │ │ │ │ │
│ └─────────┘ └───────────┘ └───────┘ └────────────┘ │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │
│ │ Memory │ │ Config │ │ LLM │ │ Browser │ │
│ │(Embeddings│ │ Manager │ │ Provider │ │ Manager │ │
│ │ + Vector) │ │ │ │ │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ └────────────┘ │
└─────────────────────────────────────────────────────────┘
Agent 核心类的初始化展示了其模块化组合设计:
class GPTResearcher:
def __init__(
self,
query: str,
report_type: str = ReportType.ResearchReport.value,
report_source: str = ReportSource.Web.value,
tone: Tone = Tone.Objective,
source_urls: list[str] | None = None,
vector_store=None,
config_path=None,
websocket=None,
agent=None,
role=None,
parent_query: str = "",
subtopics: list | None = None,
mcp_configs: list[dict] | None = None,
mcp_strategy: str | None = None,
**kwargs
):
该构造函数暴露了 20+ 个可配置参数,覆盖报告类型、数据源、LLM 角色、MCP 集成等维度,体现了高度可定制性。
(更多…)