2026/2/19 5:33:41
网站建设
项目流程
wordpress建站教程pdf,wordpress防机器注册,吴江企业建设网站,网站开发的抓包本文详细介绍了如何从零实现基于ReAct模式的智能Agent系统#xff0c;通过思考-行动-观察循环机制#xff0c;展示了Agent核心框架、工具函数集合和执行引擎的实现方法。文章涵盖了温度参数设置、对话历史管理、Prompt设计等关键技术要点#xff0c;并分享了实战…本文详细介绍了如何从零实现基于ReAct模式的智能Agent系统通过思考-行动-观察循环机制展示了Agent核心框架、工具函数集合和执行引擎的实现方法。文章涵盖了温度参数设置、对话历史管理、Prompt设计等关键技术要点并分享了实战经验、性能优化建议和调试技巧。完整代码与深度解析帮助读者快速掌握智能Agent的构建方法适合对大模型应用感兴趣的程序员学习参考。手把手实现一个基于ReAct模式的智能Agent包含完整代码和深度技术解析。文档信息创建时间2026-01-08作者zuozewei功能从零实现基于ReAct模式的智能Agent系统技术栈Python、OpenAI API、DeepSeek源代码 https://github.com/zuozewei/blog-example/tree/master/AI-LLM前言ReActReasoning Acting是当前最流行的Agent推理模式之一。与传统大模型对话不同ReAct通过“思考-行动-观察”的循环机制让AI像人类一样工作先分析问题选择合适的工具执行观察结果后继续推理。这篇文章从零实现一个完整的ReAct Agent系统代码简洁但功能完整适合作为Agent开发入门项目。项目结构从头实现一个Agent/├── agent.py # Agent核心框架├── main.py # ReAct执行引擎└── tools.py # 工具函数集合一、Agent核心框架Agent核心实现如下负责管理对话历史和调用大模型API。1.1 核心代码# agent.pyimport osimport dotenvfrom openai import OpenAI# 加载环境变量dotenv.load_dotenv()client OpenAI( api_keyos.getenv(OPENAI_API_KEY), base_urlos.getenv(OPENAI_API_BASE))DEFAULT_MODEL os.getenv(AI_MODEL, deepseek-chat)class Agent: Agent推理框架 def __init__(self, system_prompt): self._messages [] if system_prompt: self._messages.append({role: system, content: system_prompt}) def invoke(self, query: str) - str: 调用Agent进行推理 self._messages.append({role: user, content: query}) result self.exec() self._messages.append({role: assistant, content: result}) return result def exec(self) - str: 执行推理返回结果 completion client.chat.completions.create( modelDEFAULT_MODEL, messagesself._messages, temperature0# 推理场景需要确定性输出 ) return completion.choices[0].message.content1.2 设计要点为什么temperature设为0在推理场景中我们希望Agent的输出更加确定和可控。temperature参数控制模型输出的随机性temperature0模型选择概率最高的token输出最确定temperature0.7增加一些随机性适合创意任务**temperature1.0**高度随机适合生成多样化内容在ReAct Agent中我们使用temperature0原因如下工具调用需要精确匹配工具名称和参数必须完全正确减少幻觉避免Agent编造不存在的工具提高稳定性相同输入产生相同输出便于调试temperature选择指南# 推理任务工具调用、逻辑推理temperature 0# 创意任务故事写作、头脑风暴temperature 0.7 - 1.0# 平衡任务需要一定创造性但也要准确temperature 0.3 - 0.5实际案例我在项目中遇到过temperature设置不当的问题# 错误示例temperature0.7Question: Calculate 5 * 6Thought: I need to multiply 5 by 6.Action: calc: 5 * 6 # 工具名错误应该是calculatePAUSE# 正确示例temperature0Question: Calculate 5 * 6Thought: I need to multiply 5 by 6.Action: calculate: 5 * 6 # 工具名正确PAUSE消息列表的作用_messages维护了完整的对话历史包括system消息定义Agent的角色和行为准则user消息用户的输入assistant消息Agent的回复这个历史会在每次API调用时完整传递给大模型让Agent能够理解上下文。对话历史管理策略随着对话进行消息列表会越来越长导致API调用变慢Token成本增加可能超出模型上下文限制解决方案class Agent: def __init__(self, system_prompt, max_history10): self._messages [] self.max_history max_history if system_prompt: self._messages.append({role: system, content: system_prompt}) def invoke(self, query: str) - str: self._messages.append({role: user, content: query}) result self.exec() self._messages.append({role: assistant, content: result}) # 压缩历史保留system消息和最近的N条消息 if len(self._messages) self.max_history: self._messages self._messages[:1] self._messages[-self.max_history:] return resultmax_history的选择简单任务5-10条消息足够复杂任务10-20条消息长期对话考虑实现摘要机制二、工具函数集合Agent需要工具来执行具体操作。我们定义两个简单工具计算器和水果价格查询。# tools.pydef calculate(expression: str) - float: 计算数学表达式 ⚠️ 警告此实现使用eval()仅用于演示目的。 生产环境务必使用 ast.literal_eval() 或 numexpr 等安全方案 return eval(expression)def ask_fruit_unit_price(fruit: str) - str: 查询水果单价 if fruit.casefold() apple: returnApple unit price is 10/kg if fruit.casefold() banana: returnBanana unit price is 6/kg returnf{fruit} unit price is 20/kg⚠️安全警告上述代码中的eval()存在代码注入风险仅供学习演示。生产环境建议使用ast.literal_eval()或专门的数学表达式解析库如numexpr、sympy。三、ReAct执行引擎整个系统的核心部分驱动“思考-行动-观察”循环。3.1 Prompt设计Prompt的质量直接决定Agent的表现。一个好的Prompt需要清晰定义执行流程、可用工具和输出格式。Prompt设计核心原则1. 明确执行流程Agent需要知道每一步该做什么。我们使用Thought → Action → PAUSE → Observation → Answer的循环模式。react_prompt You run in a loop of Thought, Action, PAUSE, Observation.At the end of the loop you output an AnswerUse Thought to describe your thoughts about the question.Use Action to run one of the available actions - then return PAUSE.Observation will be the result of running those actions..strip()为什么需要PAUSEPAUSE是一个明确的信号告诉执行引擎我已经完成思考等待观察结果。如果没有PAUSEAgent可能会继续输出导致解析失败。2. 提供完整示例示例比抽象描述更有效。一个好的示例应该展示完整的执行流程包括思考、行动、观察和最终答案。example_session Example session:Question: What is the unit price of apple?Thought: I need to ask the user for the price of an apple.Action: ask_fruit_unit_price: applePAUSEYou will be called again with this:Observation: Apple unit price is 10/kgYou then output:Answer: The unit price of apple is 10 per kg.示例设计技巧完整流程展示从问题到答案的完整路径真实场景使用实际会遇到的场景格式统一确保示例格式与要求一致多角度覆盖提供不同类型的示例3. 格式标准化Action使用固定格式便于正则匹配。我们选择Action: 工具名: 参数的格式。# Action指令正则匹配action_re re.compile(r^Action: (\w): (.*)$)为什么选择这种格式冒号分隔清晰易读工具名和参数分开便于解析与其他输出格式区分明显4. 工具描述清晰每个工具都需要清晰的说明包括功能、参数和返回值。tool_descriptions Available actions:calculate:e.g. calculate: 4 * 7 / 3Runs a calculation and returns the number - uses Python so be sure to use floating point syntax if necessaryask_fruit_unit_price:e.g. ask_fruit_unit_price: appleAsks for the price of a fruit工具描述要素工具名称清晰易懂的名称使用示例展示如何调用功能说明描述工具的作用注意事项特殊情况的说明Prompt优化技巧技巧1Few-shot Learning提供多个示例覆盖不同场景。react_prompt You run in a loop of Thought, Action, PAUSE, Observation.At the end of the loop you output an AnswerAvailable actions:calculate:e.g. calculate: 4 * 7 / 3Runs a calculation and returns the numberask_fruit_unit_price:e.g. ask_fruit_unit_price: appleAsks for the price of a fruitExample 1:Question: What is the unit price of apple?Thought: I need to ask for the price of an apple.Action: ask_fruit_unit_price: applePAUSEObservation: Apple unit price is 10/kgAnswer: The unit price of apple is 10 per kg.Example 2:Question: What is 5 * 6?Thought: I need to calculate 5 times 6.Action: calculate: 5 * 6PAUSEObservation: 30Answer: 5 times 6 is 30.Example 3:Question: What is the total cost of 2kg apple at 10/kg?Thought: First I need to calculate the cost: 2 * 10Action: calculate: 2 * 10PAUSEObservation: 20Answer: The total cost is 20..strip()技巧2明确边界条件告诉Agent在什么情况下停止推理。react_prompt Important:- Stop when you have enough information to answer the question- If you dont know the answer after 3 actions, say I dont have enough information- Always output Answer at the end, never leave the loop without an Answer技巧3错误处理指导告诉Agent遇到错误时如何处理。react_prompt If a tool returns an error:1. Read the error message carefully2. Try to fix the issue (e.g., correct the calculation)3. If you cant fix it, explain the error in your Answer技巧4输出格式约束明确答案的格式要求。react_prompt Your Answer should:- Be concise and direct- Include the final result- Show your work if its a calculation- Be in the same language as the question完整Prompt示例react_prompt You run in a loop of Thought, Action, PAUSE, Observation.At the end of the loop you output an AnswerUse Thought to describe your thoughts about the question.Use Action to run one of the available actions - then return PAUSE.Observation will be the result of running those actions.Available actions:calculate:e.g. calculate: 4 * 7 / 3Runs a calculation and returns the number - uses Python so be sure to use floating point syntax if necessaryask_fruit_unit_price:e.g. ask_fruit_unit_price: appleAsks for the price of a fruitExample session:Question: What is the unit price of apple?Thought: I need to ask the user for the price of an apple.Action: ask_fruit_unit_price: applePAUSEYou will be called again with this:Observation: Apple unit price is 10/kgYou then output:Answer: The unit price of apple is 10 per kg.Important:- Stop when you have enough information to answer the question- If a tool returns an error, try to fix it or explain the error- Always output Answer at the end- Be concise and direct in your Answer.strip()3.2 执行引擎实现# main.pyimport refrom agent import Agentfrom tools import calculate, ask_fruit_unit_price# 工具注册表known_tools { calculate: calculate, ask_fruit_unit_price: ask_fruit_unit_price,}# Action指令正则匹配action_re re.compile(r^Action: (\w): (.*)$)def react(query: str, max_turns: int 5) - None: ReAct执行引擎 agent Agent(system_promptreact_prompt) question query for turn in range(max_turns): print(fQuestion: {question}) # 获取Agent的思考结果 result agent.invoke(question) # 解析Action指令 actions [action_re.match(a) for a in result.split(\n) if action_re.match(a)] # 如果没有Action说明推理结束 ifnot actions: print(Finish) return # 执行工具调用 tool, params actions[0].groups() if tool notin known_tools: print(fUnknown tool: {tool}) return print(fcall tool: {tool}, params: {params}) observation known_tools[tool](params) print(fobservation: {observation}) # 将观察结果作为下一轮输入 question fObservation: {observation}\n\nif __name__ __main__: react(queryWhat is the total price of 3kg of apple and 2kg of banana?, max_turns10)3.3 执行流程解析用一个实际例子说明整个流程问题计算3kg苹果和2kg香蕉的总价第1轮Agent思考需要先查询苹果单价Action: ask_fruit_unit_price: appleObservation: Apple unit price is 10/kg第2轮Agent思考现在需要查询香蕉单价Action: ask_fruit_unit_price: bananaObservation: Banana unit price is 6/kg第3轮Agent思考现在可以计算总价了Action: calculate: 3 * 10 2 * 6Observation: 42第4轮Agent思考已经得到结果输出答案Answer: The total price is 42完整输出Question: What is the total price of 3kg of apple and 2kg of banana?call tool: ask_fruit_unit_price, params: appleobservation: Apple unit price is 10/kgQuestion: Observation: Apple unit price is 10/kgcall tool: ask_fruit_unit_price, params: bananaobservation: Banana unit price is 6/kgQuestion: Observation: Banana unit price is 6/kgcall tool: calculate, params: 3 * 10 2 * 6observation: 42Question: Observation: 42Finish四、ReAct模式深度解析4.1 为什么需要ReAct传统的AI对话是一问一答模式大模型直接根据问题生成答案。这种方式在简单场景下够用但在复杂任务中会遇到明显问题问题1知识截止问题问“今天北京的天气怎么样” 答“我无法获取实时天气信息。”大模型的知识截止到训练时间无法获取最新数据。问题2计算不准确问“12345 × 67890 ” 答“838102050”实际答案是838102050但大模型经常在复杂计算中出错。ReAct如何解决这些问题ReAct通过思考-行动-观察的循环让AI学会先思考需要什么信息选择合适的工具获取信息观察工具返回的结果基于真实结果继续推理这样AI不再依赖记忆和猜测而是通过工具获取真实数据大大提高了准确性。4.2 ReAct与其他模式对比模式工作原理优点缺点适用场景直接回答直接根据问题生成答案简单快速成本低容易产生幻觉无法获取实时信息简单问答、创意写作CoTChain of Thought让模型逐步思考推理过程提高复杂问题的准确性仍然依赖模型知识无法获取外部信息数学推理、逻辑分析ReAct思考→行动→观察的循环可获取真实数据可扩展性强实现复杂成本较高需要外部信息的复杂任务Plan-and-Solve先制定计划再逐步执行结构清晰可控性强计划可能不完善需要调整多步骤任务、工作流自动化实际选择建议从我实际项目经验来看简单问答直接用大模型ReAct反而增加复杂度需要外部信息必须用ReAct比如查询数据库、调用API复杂推理ReAct CoT组合效果最好实时任务ReAct是唯一选择比如监控告警、实时决策4.3 ReAct模式的优势相比直接让大模型回答问题ReAct模式有几个明显优势可追溯性每一步思考都明确记录便于调试可扩展性通过添加工具扩展能力无需重新训练模型准确性工具执行的结果是精确的避免了幻觉问题可控性可以限制工具的使用范围提高安全性4.4 技术要点总结正则表达式的作用action_re re.compile(r^Action: (\w): (.*)$)这个正则负责从Agent的输出中提取Action指令。两个捕获组分别对应工具名称和参数。max_turns的作用限制最大推理轮次防止Agent陷入无限循环。实际应用中可以根据任务复杂度调整。为什么需要max_turns在实际应用中Agent可能会遇到以下情况陷入死循环反复调用同一个工具无法获得有用信息无法收敛不断尝试不同的工具组合但始终无法得到答案成本失控每轮调用都需要消耗API费用无限循环会导致成本爆炸max_turns的选择策略# 简单任务单步或两步推理max_turns 3# 中等复杂度任务需要查询多个信息max_turns 5# 复杂任务多步骤推理max_turns 10# 超复杂任务需要多次迭代max_turns 20实际案例# 案例1简单任务react(queryWhat is 5 * 6?, max_turns3)# 实际使用1轮# 结果30# 案例2中等复杂度任务react(queryWhat is the total price of 3kg apple and 2kg banana?, max_turns5)# 实际使用3轮# - 第1轮查询apple价格# - 第2轮查询banana价格# - 第3轮计算总价# 结果42# 案例3复杂任务react(queryCompare the total cost of buying 5kg apple vs 3kg banana 2kg orange, max_turns10)# 实际使用5轮# - 第1轮查询apple价格# - 第2轮查询banana价格# - 第3轮查询orange价格# - 第4轮计算apple总价# - 第5轮计算bananaorange总价# 结果Apple is cheapermax_turns设置不当的后果# 设置过小max_turns 2react(queryWhat is the total price of 3kg apple and 2kg banana?)# 问题只够查询apple价格无法完成计算# 结果Agent无法给出完整答案# 设置过大max_turns 100react(queryWhat is 5 * 6?)# 问题浪费资源实际只需要1轮# 结果成本增加但结果相同最佳实践def react(query: str, max_turns: int 5, timeout: int 60): 改进的ReAct执行引擎 Args: query: 用户问题 max_turns: 最大推理轮次 timeout: 超时时间秒 agent Agent(system_promptreact_prompt) question query import time start_time time.time() for turn in range(max_turns): # 检查超时 if time.time() - start_time timeout: print(Timeout reached) return result agent.invoke(question) actions [action_re.match(a) for a in result.split(\n) if action_re.match(a)] ifnot actions: print(Finish) return tool, params actions[0].groups() if tool notin known_tools: print(fUnknown tool: {tool}) return observation known_tools[tool](params) question fObservation: {observation}\n\n print(fReached max_turns ({max_turns}) without finishing)max_turns vs 超时机制两种保护机制各有优劣机制优点缺点适用场景max_turns简单直接易于理解无法处理单轮耗时过长的情况快速任务超时机制灵活适应不同任务复杂度实现复杂可能中断正在执行的工具慢速任务两者结合最全面的保护增加代码复杂度生产环境建议生产环境同时使用max_turns和timeout机制。为什么需要PAUSEPAUSE作为明确的停止信号告诉执行引擎“我已经完成思考等待观察结果”。缺少这个信号Agent可能会继续输出导致解析失败。4.4 常见问题Q1Agent不按格式输出怎么办A优化Prompt增加更多示例。也可以在代码中添加容错机制处理格式不规范的情况。Q2工具调用失败如何处理A在工具函数中添加try-except返回友好的错误信息。Agent会根据错误信息调整策略。Q3如何添加新工具A三步走在tools.py中定义工具函数在known_tools中注册在Prompt中添加工具说明五、实战经验与踩坑记录5.1 实际开发中的常见问题问题1Agent不按格式输出现象Agent输出Action: calculate 3 * 5而不是Action: calculate: 3 * 5导致正则匹配失败。原因Prompt不够明确Agent没有严格遵循格式。解决方案在Prompt中增加更多格式示例使用few-shot learning提供3-5个完整示例在代码中添加容错机制处理格式不规范的情况# 改进后的正则匹配容错处理def parse_action(result: str): patterns [ r^Action: (\w): (.*)$, # 标准格式 r^Action: (\w)\s(.*)$, # 容错格式 r^(\w):\s*(.*)$, # 简化格式 ] for pattern in patterns: match re.search(pattern, result, re.MULTILINE) if match: return match.groups() return None问题2工具调用失败导致无限循环现象Agent一直调用同一个工具但工具返回错误导致无限循环。原因缺少错误处理机制Agent无法从错误中学习。解决方案在工具函数中添加try-except返回友好的错误信息让Agent理解问题设置max_turns防止无限循环def calculate(expression: str) - str: try: result eval(expression) return str(result) except Exception as e: return fError: {str(e)}. Please check your expression.问题3温度设置不当导致工具调用失败现象temperature0.7时Agent经常输出错误的工具名称或参数。解决方案推理场景统一使用temperature0保证输出的确定性。关于temperature参数的详细说明见第一章「1.2 设计要点」。问题4对话历史过长导致性能下降现象随着推理轮次增加API调用越来越慢成本也越来越高。解决方案实现对话历史压缩具体方案见第一章「对话历史管理策略」。5.2 性能优化建议优化1工具调用缓存对于重复的工具调用可以缓存结果避免重复计算。from functools import lru_cachelru_cache(maxsize100)def calculate(expression: str) - str: return str(eval(expression))优化2并行工具调用如果多个工具调用之间没有依赖关系可以并行执行。import concurrent.futuresdef parallel_tool_calls(tools_and_params): with concurrent.futures.ThreadPoolExecutor() as executor: futures [] for tool_name, params in tools_and_params: future executor.submit(known_tools[tool_name], params) futures.append(future) results [] for future in concurrent.futures.as_completed(futures): results.append(future.result()) return results优化3Prompt模板化将Prompt中不变的部分提取为模板减少每次构造Prompt的开销。from string import TemplateREACT_TEMPLATE Template(You run in a loop of Thought, Action, PAUSE, Observation.At the end of the loop you output an AnswerAvailable actions:$toolsExample session:$example)def build_prompt(tools, example): return REACT_TEMPLATE.substitute( tools\n.join(tools), exampleexample )5.3 调试技巧技巧1打印完整推理过程在开发阶段打印每一步的思考过程便于调试。def react(query: str, max_turns: int 5, debugFalse): agent Agent(system_promptreact_prompt) question query for turn in range(max_turns): result agent.invoke(question) if debug: print(f\n Turn {turn 1} ) print(fQuestion: {question}) print(fAgent Output:\n{result}) actions [action_re.match(a) for a in result.split(\n) if action_re.match(a)] ifnot actions: break tool, params actions[0].groups() observation known_tools[tool](params) if debug: print(fTool: {tool}) print(fParams: {params}) print(fObservation: {observation}) question fObservation: {observation}\n\n技巧2保存对话历史将推理过程保存到文件便于后续分析。import jsonfrom datetime import datetimedef save_conversation(messages, filenameNone): if filename is None: filename fconversation_{datetime.now().strftime(%Y%m%d_%H%M%S)}.json with open(filename, w, encodingutf-8) as f: json.dump(messages, f, ensure_asciiFalse, indent2) print(fConversation saved to {filename})技巧3使用日志系统用logging替代print便于管理日志级别。import logginglogging.basicConfig( levellogging.INFO, format%(asctime)s - %(name)s - %(levelname)s - %(message)s)logger logging.getLogger(__name__)def react(query: str, max_turns: int 5): logger.info(fStarting ReAct with query: {query}) for turn in range(max_turns): result agent.invoke(question) logger.debug(fTurn {turn}: {result}) actions [action_re.match(a) for a in result.split(\n) if action_re.match(a)] ifnot actions: logger.info(No more actions, finishing) break tool, params actions[0].groups() logger.info(fCalling tool: {tool} with params: {params}) observation known_tools[tool](params) logger.info(fObservation: {observation}) question fObservation: {observation}\n\n5.4 最佳实践实践1工具函数设计原则单一职责每个工具只做一件事参数简单避免复杂参数结构返回明确返回值要清晰易懂错误处理捕获异常并返回友好信息文档完善添加详细的docstringdef search_database(query: str, limit: int 10) - str: 在数据库中搜索数据 Args: query: 搜索关键词 limit: 返回结果数量限制默认10 Returns: 搜索结果的JSON字符串格式为 { total: 总数量, results: [结果列表] } Raises: ValueError: 当query为空时 ifnot query: raise ValueError(Query cannot be empty) try: results db.search(query, limitlimit) return json.dumps({ total: len(results), results: results }) except Exception as e: return json.dumps({ error: str(e), message: Database search failed })实践2Prompt设计原则明确指令用祈使句清晰表达期望提供示例用few-shot learning提高理解格式统一使用固定的输出格式边界说明明确工具的能力边界错误提示告诉Agent遇到错误怎么办实践3安全考虑输入验证验证工具参数的合法性权限控制限制工具的访问范围审计日志记录所有工具调用沙箱执行危险操作在隔离环境执行import subprocessdef execute_command(command: str) - str: 执行系统命令沙箱环境 Args: command: 要执行的命令 Returns: 命令执行结果 Raises: ValueError: 当命令包含危险操作时 dangerous_commands [rm, format, del, shutdown] if any(cmd in command for cmd in dangerous_commands): raise ValueError(Dangerous command detected) try: result subprocess.run( command, shellTrue, capture_outputTrue, textTrue, timeout30# 防止长时间运行 ) return result.stdout except subprocess.TimeoutExpired: returnCommand execution timeout六、扩展方向这个基础实现还有很多可以优化的地方工具描述优化为每个工具添加详细的描述帮助Agent更好地理解工具用途多工具并行支持同时调用多个工具提高效率记忆机制添加长期记忆跨会话保持信息错误恢复工具调用失败时的自动重试和降级策略可视化展示推理链路方便调试和展示七、环境配置依赖安装pip install openai python-dotenvPython版本要求Python 3.8环境变量配置在项目根目录创建.env文件OPENAI_API_KEYyour_api_keyOPENAI_API_BASEhttps://api.deepseek.com/v1AI_MODELdeepseek-chat结语抛开LangChain等框架用更底层的方式实现了一个基于ReAct框架的Agent。整个过程中我们看到了如何编写ReAct提示词让大模型通过思考Thought、行动Action、观察Observation来完成更多的工作。在这个实现中规划通过ReAct提示词完成记忆通过聊天历史实现动作通过一个一个的函数实现如果这篇文章你只记住一件事那请记住Agent的执行过程本质上就是一个循环由大模型引导着一次次地做着各种动作以达成我们的目标。后续可以在此基础上添加更多工具比如网络搜索、文件操作、数据库查询等逐步构建更强大的Agent应用。如何系统的学习大模型 AI 由于新岗位的生产效率要优于被取代岗位的生产效率所以实际上整个社会的生产效率是提升的。但是具体到个人只能说是“最先掌握AI的人将会比较晚掌握AI的人有竞争优势”。这句话放在计算机、互联网、移动互联网的开局时期都是一样的道理。我在一线互联网企业工作十余年里指导过不少同行后辈。帮助很多人得到了学习和成长。我意识到有很多经验和知识值得分享给大家也可以通过我们的能力和经验解答大家在人工智能学习中的很多困惑所以在工作繁忙的情况下还是坚持各种整理和分享。但苦于知识传播途径有限很多互联网行业朋友无法获得正确的资料得到学习提升故此将并将重要的AI大模型资料包括AI大模型入门学习思维导图、精品AI大模型学习书籍手册、视频教程、实战学习等录播视频免费分享出来。一直在更新更多的大模型学习和面试资料已经上传带到CSDN的官方了有需要的朋友可以扫描下方二维码免费领取【保证100%免费】01.大模型风口已至月薪30K的AI岗正在批量诞生2025年大模型应用呈现爆发式增长根据工信部最新数据国内大模型相关岗位缺口达47万初级工程师平均薪资28K数据来源BOSS直聘报告70%企业存在能用模型不会调优的痛点真实案例某二本机械专业学员通过4个月系统学习成功拿到某AI医疗公司大模型优化岗offer薪资直接翻3倍02.大模型 AI 学习和面试资料1️⃣ 提示词工程把ChatGPT从玩具变成生产工具2️⃣ RAG系统让大模型精准输出行业知识3️⃣ 智能体开发用AutoGPT打造24小时数字员工熬了三个大夜整理的《AI进化工具包》送你✔️ 大厂内部LLM落地手册含58个真实案例✔️ 提示词设计模板库覆盖12大应用场景✔️ 私藏学习路径图0基础到项目实战仅需90天第一阶段10天初阶应用该阶段让大家对大模型 AI有一个最前沿的认识对大模型 AI 的理解超过 95% 的人可以在相关讨论时发表高级、不跟风、又接地气的见解别人只会和 AI 聊天而你能调教 AI并能用代码将大模型和业务衔接。大模型 AI 能干什么大模型是怎样获得「智能」的用好 AI 的核心心法大模型应用业务架构大模型应用技术架构代码示例向 GPT-3.5 灌入新知识提示工程的意义和核心思想Prompt 典型构成指令调优方法论思维链和思维树Prompt 攻击和防范…第二阶段30天高阶应用该阶段我们正式进入大模型 AI 进阶实战学习学会构造私有知识库扩展 AI 的能力。快速开发一个完整的基于 agent 对话机器人。掌握功能最强的大模型开发框架抓住最新的技术进展适合 Python 和 JavaScript 程序员。为什么要做 RAG搭建一个简单的 ChatPDF检索的基础概念什么是向量表示Embeddings向量数据库与向量检索基于向量检索的 RAG搭建 RAG 系统的扩展知识混合检索与 RAG-Fusion 简介向量模型本地部署…第三阶段30天模型训练恭喜你如果学到这里你基本可以找到一份大模型 AI相关的工作自己也能训练 GPT 了通过微调训练自己的垂直大模型能独立训练开源多模态大模型掌握更多技术方案。到此为止大概2个月的时间。你已经成为了一名“AI小子”。那么你还想往下探索吗为什么要做 RAG什么是模型什么是模型训练求解器 损失函数简介小实验2手写一个简单的神经网络并训练它什么是训练/预训练/微调/轻量化微调Transformer结构简介轻量化微调实验数据集的构建…第四阶段20天商业闭环对全球大模型从性能、吞吐量、成本等方面有一定的认知可以在云端和本地等多种环境下部署大模型找到适合自己的项目/创业方向做一名被 AI 武装的产品经理。硬件选型带你了解全球大模型使用国产大模型服务搭建 OpenAI 代理热身基于阿里云 PAI 部署 Stable Diffusion在本地计算机运行大模型大模型的私有化部署基于 vLLM 部署大模型案例如何优雅地在阿里云私有部署开源大模型部署一套开源 LLM 项目内容安全互联网信息服务算法备案…学习是一个过程只要学习就会有挑战。天道酬勤你越努力就会成为越优秀的自己。如果你能在15天内完成所有的任务那你堪称天才。然而如果你能完成 60-70% 的内容你就已经开始具备成为一名大模型 AI 的正确特征了。这份完整版的大模型 AI 学习资料已经上传CSDN朋友们如果需要可以微信扫描下方CSDN官方认证二维码免费领取【保证100%免费】