Repository navigation
Expand file tree
/
Copy pathch15.html
More file actions
565 lines (518 loc) · 24.2 KB
/
Copy pathch15.html
File metadata and controls
565 lines (518 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="AI学习笔记 - 从零开始系统学习人工智能,涵盖前置基础、核心原理、工程实践、应用工具、进阶展望">
<meta name="keywords" content="AI, 人工智能, 机器学习, 深度学习, Python, 数学基础">
<meta name="author" content="AI Learner">
<title>第十五章:AI智能体(Agent) - AI学习笔记</title>
<!-- Google Fonts - Inter -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<!-- KaTeX - 轻量级数学公式渲染 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js"
onload="renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '\\[', right: '\\]', display: true},
{left: '\\(', right: '\\)', display: false},
{left: '$', right: '$', display: false}
],
throwOnError: false
});"></script>
<!-- Prism.js 代码高亮 - tomorrow-night 主题 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script>
<!-- 自定义样式表 -->
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../css/dark-mode.css">
<link rel="stylesheet" href="../../css/mobile-optimizations.css">
<!-- 内联CSS样式 -->
<!-- AI-Notes共享样式 -->
<link rel="stylesheet" href="assets/ai-notes.css">
</head>
<body>
<!-- ==================== 导航栏 ==================== -->
<nav class="ai-nav">
<a href="../../index.html" class="ai-nav-brand">
<i class="fas fa-brain"></i>
AI学习笔记
</a>
<ul class="ai-nav-links" id="navLinks">
<li><a href="../../index.html"><i class="fas fa-home"></i> 首页</a></li>
<li><a href="ch15.html"><i class="fas fa-robot"></i> Agent</a></li>
<li><a href="ch16.html"><i class="fas fa-tools"></i> 工具</a></li>
<li><a href="ch17.html"><i class="fas fa-book-open"></i> 知识库</a></li>
<li><a href="ch18.html"><i class="fas fa-layer-group"></i> 记忆</a></li>
<li><a href="ch19.html"><i class="fas fa-comment-dots"></i> 提示</a></li>
<li><a href="ch20.html"><i class="fas fa-database"></i> 数据</a></li>
<li><a href="ch21.html"><i class="fas fa-exclamation-circle"></i> 局限</a></li>
<li><a href="ch22.html"><i class="fas fa-toolbox"></i> 平台</a></li>
<li><a href="ch23.html"><i class="fas fa-history"></i> 简史</a></li>
<li><a href="ch24.html"><i class="fas fa-rocket"></i> 实战</a></li>
</ul>
<button class="ai-nav-toggle" id="navToggle" aria-label="切换导航">
<i class="fas fa-bars"></i>
</button>
</nav>
<!-- ==================== Hero Section ==================== -->
<section class="ai-hero">
<h1><i class="fas fa-brain"></i> AI 学习笔记</h1>
<p>第十五章:AI智能体(Agent)</p>
<div class="ai-hero-badges">
<span class="ai-hero-badge"><i class="fas fa-book"></i> 系统学习</span>
<span class="ai-hero-badge"><i class="fas fa-code"></i> 实践导向</span>
</div>
</section>
<!-- ==================== 主内容区域 ==================== -->
<div class="content-wrapper">
<!-- ========== 主内容 ========== -->
<main class="main-content">
<nav class="ai-chapter-nav">
<div class="breadcrumb">
<a href="../../index.html"><i class="fas fa-home"></i> 首页</a>
<span class="separator">/</span>
<span class="current">第十五章:AI智能体(Agent)</span>
</div>
<div class="chapter-nav-links">
<a href="ch14.html" class="prev-chapter"><i class="fas fa-arrow-left"></i> 上一章</a>
<a href="ch16.html" class="next-chapter">下一章 <i class="fas fa-arrow-right"></i></a>
</div>
</nav>
<!-- 第十五章:AI智能体(Agent) -->
<!-- ============================================================ -->
<h2 class="ai-section-title"><i class="fas fa-robot"></i> 第十五章:AI智能体(Agent)</h2>
<div class="ai-box ai-box--objectives">
<h3><i class="fas fa-bullseye"></i> 学习目标</h3>
<ul>
<li>理解AI智能体(Agent)的概念和核心能力</li>
<li>掌握Agent的工作流程和关键组件</li>
<li>理解ReAct模式和Function Calling机制</li>
<li>能够使用LangChain构建简单的Agent</li>
<li>了解Agent的评估维度</li>
</ul>
</div>
<div class="ai-box ai-box--prereq">
<h3><i class="fas fa-book"></i> 前置要求</h3>
<p>建议先学习<strong>第十一章:大语言模型(LLM)详解</strong>,了解LLM的基本原理,因为Agent的核心"大脑"通常就是一个LLM。</p>
</div>
<div class="concept-section">
<h2><i class="fas fa-robot"></i> 什么是AI智能体(Agent)?</h2>
<p><span class="keyword-highlight">AI智能体(AI Agent)</span>是一种能够自主感知环境、做出决策并执行动作的AI系统。与普通LLM只能"对话"不同,Agent可以主动使用工具、调用API、规划任务,像一个"数字员工"一样完成复杂工作。</p>
<div class="concept-box">
<h4><i class="fas fa-lightbulb"></i> 简单理解</h4>
<p>普通LLM就像一个"被关在房间里只能说话的专家",而Agent就像一个"可以走出门、使用工具、与人协作的全能助手"。Agent = LLM + 工具 + 记忆 + 规划能力。</p>
</div>
<figure style="margin:2rem 0;">
<iframe src="assets/images/agent-architecture.html" style="width:100%;height:380px;border:none;background:var(--bg-color,#f8f9fa);border-radius:8px;"></iframe>
<figcaption style="text-align:center;font-size:0.9rem;color:#718096;margin-top:0.5rem;">Agent架构:感知-思考-行动循环模型</figcaption>
</figure>
<h3>Agent的核心能力</h3>
<div class="diagram-section">
<div class="diagram-card">
<div class="icon"><i class="fas fa-brain"></i></div>
<h4>感知</h4>
<p>理解用户意图和环境状态</p>
</div>
<div class="diagram-card">
<div class="icon"><i class="fas fa-sitemap"></i></div>
<h4>规划</h4>
<p>将复杂任务分解为子任务</p>
</div>
<div class="diagram-card">
<div class="icon"><i class="fas fa-tools"></i></div>
<h4>执行</h4>
<p>调用工具和API完成任务</p>
</div>
<div class="diagram-card">
<div class="icon"><i class="fas fa-memory"></i></div>
<h4>记忆</h4>
<p>存储和回忆历史信息</p>
</div>
</div>
<h3>Agent工作流程</h3>
<div class="flow-diagram">
<div class="flow-step">
<div class="step-number">1</div>
<div class="step-content">
<h4>接收任务</h4>
<p>用户输入任务描述</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">2</div>
<div class="step-content">
<h4>理解与规划</h4>
<p>LLM理解任务,制定执行计划</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">3</div>
<div class="step-content">
<h4>选择工具</h4>
<p>根据任务需要选择合适的工具</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">4</div>
<div class="step-content">
<h4>执行动作</h4>
<p>调用工具执行具体操作</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">5</div>
<div class="step-content">
<h4>观察结果</h4>
<p>获取执行结果,判断是否完成</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">6</div>
<div class="step-content">
<h4>返回结果</h4>
<p>向用户返回最终结果或继续下一步</p>
</div>
</div>
</div>
<figure style="margin:2rem 0;">
<iframe src="assets/images/agent-workflow.html" style="width:100%;height:340px;border:none;background:var(--bg-color,#f8f9fa);border-radius:8px;"></iframe>
<figcaption style="text-align:center;font-size:0.9rem;color:#718096;margin-top:0.5rem;">Agent工作流程:从感知到行动的完整执行循环</figcaption>
</figure>
<h3>Agent的关键组件</h3>
<table class="comparison-table">
<tr>
<th>组件</th>
<th>功能</th>
<th>说明</th>
</tr>
<tr>
<td><strong>LLM(大脑)</strong></td>
<td>理解、推理、决策</td>
<td>Agent的核心,负责理解任务和制定计划</td>
</tr>
<tr>
<td><strong>工具(Tools)</strong></td>
<td>执行具体操作</td>
<td>如搜索、计算、API调用、文件操作等</td>
</tr>
<tr>
<td><strong>记忆(Memory)</strong></td>
<td>存储信息</td>
<td>短期记忆(对话历史)和长期记忆(知识库)</td>
</tr>
<tr>
<td><strong>规划(Planning)</strong></td>
<td>任务分解与调度</td>
<td>将复杂任务拆解为可执行的子任务序列</td>
</tr>
</table>
<h3>常见的Agent类型</h3>
<ul>
<li><strong>ReAct Agent</strong>:基于推理(Reasoning)和行动(Acting)交替的Agent模式</li>
<li><strong>Plan-and-Execute Agent</strong>:先制定完整计划,再逐步执行</li>
<li><strong>Multi-Agent</strong>:多个Agent协作完成复杂任务</li>
<li><strong>AutoGPT</strong>:高度自主的Agent,可以自行设定目标和子任务</li>
</ul>
<p>常见Agent框架:<strong>LangChain Agents</strong>、<strong>AutoGen</strong>、<strong>CrewAI</strong>、<strong>MetaGPT</strong></p>
</div>
<div class="concept-section">
<h2><i class="fas fa-sync-alt"></i> ReAct模式详解</h2>
<p><span class="keyword-highlight">ReAct(Reasoning + Acting)</span>是一种让LLM交替进行"思考"和"行动"的Agent模式。LLM先推理下一步该做什么(Thought),然后执行具体操作(Action),再观察结果(Observation),如此循环直到任务完成。</p>
<h3>ReAct循环流程</h3>
<figure class="ai-figure">
<img src="https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=ReAct%20loop%20cycle%20diagram%20for%20AI%20agent%2C%20three%20stages%20Thought%20Reasoning%20in%20blue%20circle%2C%20Action%20tool%20call%20in%20green%20circle%2C%20Observation%20result%20in%20orange%20circle%2C%20circular%20arrows%20connecting%20them%2C%20LLM%20brain%20icon%20at%20center%2C%20clean%20infographic%20style%2C%20white%20background&image_size=landscape_4_3" alt="ReAct 思考-行动-观察循环流程图" loading="lazy">
<figcaption><strong>图15-1</strong> ReAct循环:Thought(思考下一步)→ Action(调用工具执行)→ Observation(观察结果),循环往复直到任务完成</figcaption>
</figure>
<div class="flow-diagram">
<div class="flow-step">
<div class="step-number">T</div>
<div class="step-content">
<h4>Thought(思考)</h4>
<p>分析当前状态,决定下一步操作</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-right"></i></div>
<div class="flow-step">
<div class="step-number">A</div>
<div class="step-content">
<h4>Action(行动)</h4>
<p>调用工具执行具体操作</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-right"></i></div>
<div class="flow-step">
<div class="step-number">O</div>
<div class="step-content">
<h4>Observation(观察)</h4>
<p>获取工具返回的结果</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-left"></i></div>
</div>
<div class="concept-box">
<h4><i class="fas fa-comment-dots"></i> ReAct示例</h4>
<p><strong>用户</strong>:北京今天天气怎么样?需要带伞吗?</p>
<p><strong>Thought 1</strong>:用户想知道北京今天的天气和是否需要带伞。我需要先查询北京的天气信息。</p>
<p><strong>Action 1</strong>:调用天气查询工具,参数:城市="北京"</p>
<p><strong>Observation 1</strong>:北京今天:多云转小雨,气温18-25°C,降水概率70%</p>
<p><strong>Thought 2</strong>:天气显示有小雨,降水概率70%,建议带伞。</p>
<p><strong>Action 2</strong>:返回最终答案</p>
<p><strong>Final Answer</strong>:北京今天多云转小雨,气温18-25°C,降水概率较高(70%),建议出门带伞。</p>
</div>
</div>
<div class="concept-section">
<h2><i class="fas fa-phone-alt"></i> Function Calling机制详解</h2>
<p><span class="keyword-highlight">Function Calling</span>是让LLM能够调用外部函数(工具)的机制。LLM本身只能生成文本,但通过Function Calling,它可以输出结构化的函数调用指令,由外部系统执行后返回结果。</p>
<h3>Function Calling流程</h3>
<div class="flow-diagram">
<div class="flow-step">
<div class="step-number">1</div>
<div class="step-content">
<h4>定义工具</h4>
<p>向LLM描述可用工具的名称、参数和功能</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">2</div>
<div class="step-content">
<h4>用户提问</h4>
<p>用户输入问题</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">3</div>
<div class="step-content">
<h4>LLM决策</h4>
<p>LLM判断是否需要调用工具,输出函数名和参数</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">4</div>
<div class="step-content">
<h4>执行函数</h4>
<p>外部系统执行函数,返回结果给LLM</p>
</div>
</div>
<div class="flow-arrow"><i class="fas fa-arrow-down"></i></div>
<div class="flow-step">
<div class="step-number">5</div>
<div class="step-content">
<h4>生成回答</h4>
<p>LLM根据函数结果生成最终回答</p>
</div>
</div>
</div>
<div class="concept-box">
<h4><i class="fas fa-cloud-sun"></i> Function Calling示例:天气查询</h4>
<p><strong>工具定义</strong>:</p>
<p>函数名:<code>get_weather</code>,参数:<code>city</code>(字符串,城市名称),返回:天气信息JSON</p>
<p><strong>用户</strong>:上海今天天气如何?</p>
<p><strong>LLM输出</strong>:调用 <code>get_weather(city="上海")</code></p>
<p><strong>系统执行</strong>:返回 <code>{"temp": 28, "condition": "晴", "humidity": 65}</code></p>
<p><strong>LLM回答</strong>:上海今天天气晴朗,气温28°C,湿度65%,适合外出活动。</p>
</div>
</div>
<div class="concept-section">
<h2><i class="fas fa-code"></i> 使用LangChain构建简单Agent</h2>
<pre><code class="language-python">from langchain_community.llms import Ollama
from langchain.agents import create_react_agent, AgentExecutor
from langchain.tools import tool
# 1. 定义工具
@tool
def search(query: str) -> str:
"""搜索互联网获取信息。输入:搜索关键词。"""
return f"搜索'{query}'的结果:这是模拟的搜索结果。"
@tool
def calculator(expression: str) -> str:
"""计算数学表达式。输入:数学表达式字符串。"""
try:
result = eval(expression)
return f"计算结果:{result}"
except Exception as e:
return f"计算错误:{e}"
tools = [search, calculator]
# 2. 定义Agent提示词模板
prompt = """回答以下问题,你可以使用以下工具:
{tools}
工具名称:{tool_names}
请按照以下格式回答:
Thought: 我需要思考下一步做什么
Action: 工具名称
Action Input: 工具输入参数
Observation: 工具返回的结果(系统自动填充)
... (Thought/Action/Observation可以重复多次)
Thought: 我现在知道最终答案了
Final Answer: 最终答案
开始!
Question: {input}
Thought:{agent_scratchpad}"""
# 3. 创建Agent
llm = Ollama(model="qwen2.5:7b")
agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# 4. 运行Agent
result = agent_executor.invoke({
"input": "2024年有多少天?请先搜索2024年是否是闰年,再计算。"
})
print(result["output"])</code></pre>
</div>
<div class="concept-section">
<h2><i class="fas fa-tachometer-alt"></i> Agent评估维度</h2>
<p>评估Agent的质量需要从多个维度综合考量:</p>
<table class="comparison-table">
<tr>
<th>评估维度</th>
<th>指标</th>
<th>说明</th>
</tr>
<tr>
<td><strong>任务完成率</strong></td>
<td>成功率</td>
<td>Agent正确完成任务的比例,是最核心的指标</td>
</tr>
<tr>
<td><strong>工具调用准确率</strong></td>
<td>正确调用次数/总调用次数</td>
<td>Agent选择正确工具和参数的能力</td>
</tr>
<tr>
<td><strong>响应时间</strong></td>
<td>平均耗时</td>
<td>从接收任务到返回结果的时间,影响用户体验</td>
</tr>
<tr>
<td><strong>步骤效率</strong></td>
<td>实际步骤数/最优步骤数</td>
<td>Agent是否用最少的步骤完成任务</td>
</tr>
<tr>
<td><strong>错误恢复能力</strong></td>
<td>从错误中恢复的比例</td>
<td>工具调用失败时,Agent能否调整策略继续执行</td>
</tr>
</table>
</div>
<div class="concept-section video-section">
<h2><i class="fas fa-play-circle"></i> 推荐视频</h2>
<p>如果你觉得文字讲解不够直观,推荐观看以下视频:</p>
<div class="video-card">
<div class="video-icon"><i class="fas fa-graduation-cap"></i></div>
<div class="video-info">
<h4>Agentic AI</h4>
<p class="video-author">作者:吴恩达</p>
<p class="video-desc">为什么推荐:Agent技术的权威讲解</p>
<a href="https://www.deeplearning.ai/courses/agentic-ai" target="_blank" class="video-link">
<i class="fas fa-external-link-alt"></i> 点击观看
</a>
</div>
</div>
</div>
<div class="ai-box ai-box--summary">
<h3><i class="fas fa-clipboard-list"></i> 本章小结</h3>
<ol>
<li>AI Agent是能够自主感知、规划、执行和记忆的AI系统,核心公式为 Agent = LLM + 工具 + 记忆 + 规划。</li>
<li>ReAct模式通过Thought→Action→Observation的循环,让LLM能够交替推理和行动,是Agent最基础的工作模式。</li>
<li>Function Calling是LLM调用外部工具的标准机制,通过结构化的函数定义和调用,让LLM能够获取实时信息和执行操作。</li>
<li>LangChain提供了便捷的Agent构建框架,通过定义工具和提示词模板,可以快速搭建功能完整的Agent。</li>
<li>Agent评估需关注任务完成率、工具调用准确率、响应时间、步骤效率和错误恢复能力等多个维度。</li>
</ol>
</div>
<div class="ai-box ai-box--exercise">
<h3><i class="fas fa-pencil-alt"></i> 练习题</h3>
<ol>
<li>
<p><strong>ReAct模式中的三个核心步骤是什么?</strong></p>
<p>A. Input → Process → Output<br/>B. Thought → Action → Observation<br/>C. Plan → Execute → Evaluate<br/>D. Encode → Decode → Translate</p>
<p><strong>答案:B</strong>。ReAct(Reasoning + Acting)的核心循环是:Thought(思考下一步)→ Action(执行操作)→ Observation(观察结果),如此反复直到任务完成。</p>
</li>
<li>
<p><strong>Function Calling的主要作用是什么?</strong></p>
<p>A. 让LLM生成更长的文本<br/>B. 让LLM能够调用外部函数获取信息或执行操作<br/>C. 让LLM的训练速度更快<br/>D. 让LLM支持更多语言</p>
<p><strong>答案:B</strong>。Function Calling让LLM能够输出结构化的函数调用指令,由外部系统执行后返回结果,使LLM能够获取实时信息、执行计算等操作。</p>
</li>
<li>
<p><strong>以下哪个不是Agent的核心组件?</strong></p>
<p>A. LLM(大脑)<br/>B. 工具(Tools)<br/>C. 数据标注平台<br/>D. 记忆(Memory)</p>
<p><strong>答案:C</strong>。Agent的核心组件包括LLM(大脑)、工具(执行操作)、记忆(存储信息)和规划(任务分解)。数据标注平台是训练阶段的工具,不是Agent的运行时组件。</p>
</li>
</ol>
</div>
<!-- ============================================================ -->
</main>
</div>
<!-- 页脚 -->
<!-- ============================================================ -->
<footer class="footer">
<div class="footer-content">
<div class="footer-section">
<h3><i class="fas fa-graduation-cap"></i> AI学习笔记</h3>
<p>从零开始系统学习人工智能</p>
<p>涵盖前置基础、核心原理、工程实践、应用工具、进阶展望</p>
</div>
<div class="footer-section">
<h3><i class="fas fa-bookmark"></i> 内容导航</h3>
<p>第1-11章:基础与核心(见 ai-notes-core.html)</p>
<p>第12-23章:工程实践与进阶(本文件)</p>
<p>附录A:GPU与算力指南</p>
<p>附录B:术语表</p>
</div>
<div class="footer-section">
<h3><i class="fas fa-info-circle"></i> 说明</h3>
<p>本笔记仅供学习参考,内容如有错误欢迎指正。</p>
<p>AI技术发展迅速,部分信息可能随时间变化。</p>
</div>
</div>
<div class="footer-bottom">
<p>AI学习笔记 © 2024 | 持续更新中</p>
</div>
</footer>
</div><!-- /ai-notes-container -->
<!-- Scripts -->
<script src="../../js/mobile-menu.js"></script>
<script src="../../js/dark-mode.js"></script>
<script>
// 目录滚动高亮
(function() {
const tocLinks = document.querySelectorAll('.toc-sidebar a');
const sections = [];
tocLinks.forEach(link => {
const id = link.getAttribute('href');
if (id && id.startsWith('#')) {
const el = document.querySelector(id);
if (el) sections.push({ link, el });
}
});
function updateActive() {
const scrollY = window.scrollY + 100;
let current = sections[0];
for (const s of sections) {
if (s.el.offsetTop <= scrollY) current = s;
}
tocLinks.forEach(l => l.classList.remove('active'));
if (current) current.link.classList.add('active');
}
window.addEventListener('scroll', updateActive);
updateActive();
})();
</script>
<script src="assets/ai-notes.js"></script>
</body>
</html>