AI概念 一图流
RAG graph LR subgraph "Query Process 💬 问答流程" direction TB Q1((用户问题)) --> Q2{{"Embedding模型🧮<br>向量化"}} Q2 --> Q3{"检索Retrieval🔍<br>计算相似度(topK)"} Q3 -.查询.-> VectorDB VectorDB -.topk个结果.-> Q3 Q3 --> Q4[["相关片段📄"]] Q4 -.注入上下文.-> Q5("增强/Augmented🔀<br>Prompt=问题+相关片段") Q1 -.原始问题.-> Q5 Q5 -.输入.-> Q6{{"大语言模型🤖"}} Q6 --> Q7[["最终回答💬"]] end subgraph "Index Process 🔧 离线数据准备" direction TB KB["(私有知识库📚<br>PDF/Word/Wiki)"] --> Chunking("切片/Chunking🔪<br>长文本切分成小段") Chunking --> Embedding{{"Embedding模型🧮<br>向量化"}} Embedding --> VectorDB["(向量数据库🗄️<br> VectorDB ..)"] end style KB fill:#e1f5ff,stroke:#007acc,stroke-width:2px style VectorDB fill:#e1f5ff,stroke:#007acc,stroke-width:2px style Q1 fill:#fff2cc,stroke:#d6b656,stroke-width:2px style Q7 fill:#d5e8d4,stroke:#82b366,stroke-width:2px style Embedding fill:#f0e1ff,stroke:#9673a6,stroke-width:2px style Q6 fill:#f0e1ff,stroke:#9673a6,stroke-width:2px style Q4 fill:#ffe6cc,stroke:#d79b00,stroke-width:2px MCP sequenceDiagram User->>MCP Client/IDE/Agent:User Query(今天天气怎么样?) MCP Client/IDE/Agent->>MCP Server:连接 MCP Server & Get Tools MCP Server->>MCP Client/IDE/Agent:Tools List(文件工具、天气工具...) MCP Client/IDE/Agent->>LLM:User Query(今天天气怎么样?) + Tools List(这些工具可以用) LLM->>MCP Client/IDE/Agent: 建议调用的Tool + 参数(建议使用天气工具 参数:date:'20260127',city:'武汉') MCP Client/IDE/Agent->>MCP Server:使用参数调用Tool(天气工具(date, city)) MCP Server->>MCP Server:内部触发逻辑 MCP Server->>MCP Client/IDE/Agent:返回值/Error(temp:30°, weather:sunny) MCP Client/IDE/Agent->>LLM: Tool的返回值(temp:30°, weather:sunny) note over LLM: 思考、推理 LLM->>MCP Client/IDE/Agent:总结归纳后的自然语言(明日(20260127)天气为晴天,温度30°,建议穿凉爽的衣服) MCP Client/IDE/Agent->>User: 格式化结果 Agent React graph RL Input((Task/Input<br>任务输入)) --> Thought["Thought<br>思考: 分析任务,决定步骤"] subgraph ReAct_Loop ["ReAct Loop 循环"] direction TB Thought --> Action{Action<br>行动: 选择工具/动作} Action -- 调用工具 --> Execute["Environment/Tool<br>执行环境/工具"] Execute --> Observation["Observation<br>观察: 获取执行结果"] Observation --> Thought end Action -- 任务完成 --> Final["Final Answer<br>最终回答"] style Input fill:#fff2cc,stroke:#d6b656,stroke-width:2px style Final fill:#d5e8d4,stroke:#82b366,stroke-width:2px style Thought fill:#e1f5ff,stroke:#007acc,stroke-width:2px style Action fill:#f0e1ff,stroke:#9673a6,stroke-width:2px style Observation fill:#ffe6cc,stroke:#d79b00,stroke-width:2px