做类似交易猫的网站建设银行网站注册用户名不通过
2026/4/16 16:12:08 网站建设 项目流程
做类似交易猫的网站,建设银行网站注册用户名不通过,商家店铺小程序,最专业的营销网站建设公司在大型语言模型#xff08;LLM#xff09;的时代#xff0c;基于大型语言模型的智能Agen在过去一年中取得了显著进展。 本文主要介绍基于大型语言模型的智能Agent#xff0c;目录如下#xff1a; Agent技术的起源。人工智能Agent技术的发展历程。基于LLM的Agent架构。基…在大型语言模型LLM的时代基于大型语言模型的智能Agen在过去一年中取得了显著进展。本文主要介绍基于大型语言模型的智能Agent目录如下Agent技术的起源。人工智能Agent技术的发展历程。基于LLM的Agent架构。基于LLM的Agent应用。使用简单代码实现基于LLM的Agent。Agent技术的起源什么是Agent代理/智能体Agent又可以翻译为代理或者智能体Agent的定义和性质因学科或文化背景而异。通常Agent是一个具有自主性的个体能够行使自己的意志做出决定并采取行动而不仅仅是被动地响应外部刺激。人类是这个星球上最复杂的Agent。人工智能Agent自20世纪80年代中期以来人工智能领域关于Agent的研究显著增加。基于此Wooldridge将人工智能定义为旨在设计和构建表现出智能行为的计算机Agent。从本质上讲人工智能Agent是对Agent概念的具体化。如图1所示人工智能Agent是一个通过传感器感知其环境、做出决策并相应地响应的人造实体。人工智能Agent的发展阶段人工智能Agent研究的技术演变历史主要包括以下几个阶段。符号Agent在人工智能研究的早期阶段主要采用的方法是符号人工智能它使用逻辑规则和符号表示来封装知识并促进推理过程。符号Agent的架构如图2所示以前的各种基于知识的专家系统就是最常见的符号Agent。该类系统主要由知识库、推理引擎和解释器组成。然而正如决策引擎逐渐被AI模型所淘汰人工构建的决策逻辑通常太过死板难以具有应用价值。反应型Agent与符号Agent不同反应型Agent不采用复杂的符号推理。他们主要关注Agent与环境之间的互动优先考虑快速和实时的反应。反应型Agent通常使用预定义的规则集来指导其行为如图3所示相对于符号Agent反应型Agent所使用的策略更为简单举个例子符号Agent类似于编译器决策引擎中有大量逻辑推演规则而反应型Agent则就是一堆if else通过读取环境数据快速进行判断。基于强化学习的Agent在LLM出现之前基于强化学习的Agent属于是研究热点最著名的应该就是AlphaGo。这一领域的主要关注点是如何使Agent通过与环境的互动来学习以在特定任务中获得最大的累积奖励。深度学习出现后深度神经网络与强化学习整合。这使得Agent能够从高维输入中学习复杂的策略。如图4所示。然而强化学习的问题包括长时间的训练周期、采样效率低、在复杂的现实世界环境中模型不稳定。基于LLM的Agent近年来大型语言模型LLM非常火热潜力巨大。因此一个新的研究领域已经出现使用LLM作为Agent的核心控制器以让Agent拥有人类水平的决策能力。这是文章的重点接下来将详细说明。基于LLM的Agent的架构基于LLM的Agent的架构形式各异。然而所有架构的核心模块都包括记忆、规划和行动。四模块框架Wang et al.提出了一个统一框架如图5所示。这个框架包括一个分析(Profile)模块、一个记忆(Memory)模块、一个规划(Planning)模块和一个行动(Action)模块。分析模块Agent在执行任务时通常会预定义一个身份比如教师、某领域的专家等。分析模块的作用是定义这些agent所扮演的角色的详细档案这些档案会被写入到提示中用以影响大型语言模型LLM的行为。Agent档案一般包含基本信息如年龄、性别、职业、个性相关的心理学信息以及描述Agent间社交关系的信息。选择哪些信息主要取决于应用的具体场景。记忆模块基于LLM大型语言模型的Agent的记忆机制仿照了人类记忆。人类记忆可以分为短期记忆短暂保持信息和长期记忆在较长时间内巩固信息。而在LLM中短期记忆指transformer架构限制的上下文窗口内的输入信息。长期记忆类似于外部向量存储Agent可以根据需要快速查询和检索。规划模块面对复杂任务时人类倾向于将其分解为更简单的子任务并分别解决它们。规划模块的目标是赋予Agent这种人类能力使Agent的行为更加强大。思维链就是一种常见的规划策略。行动模块行动模块将Agent的决策转化为具体的输出。这个模块直接与环境互动。它受到分析、记忆和规划模块的影响。行动模块可以分为4部分行动目标涉及Agent执行特定行动所达成的具体目标。行动产生描述了行动是如何从Agent的决策过程中产生出来的包括决策逻辑、策略选择等。行动空间定义了在特定环境中Agent可以采取的所有可能行动的集合。行动影响考虑了行动执行后对环境、Agent自身状态或整个任务进展产生的后果。三模块框架此外也有一些其他的框架Xi et al.提出了一个基于LLM的Agent的一般概念框架由三个关键部分组成大脑brain、感知perception和行动action如图6所示。大脑模块作为控制器处理基本任务如记忆、思考和决策。感知模块解释和处理来自外部环境的多模态信息而行动模块则执行响应并使用工具与环境互动。举个例子来说明工作流程假设有人问今天是否会下雨。感知模块将这个查询转换成LLM可以理解的格式。然后大脑模块根据当前的天气情况和在线天气报告进行推断。最后行动模块作出响应并给这个人递一把伞。通过这一过程Agent能够持续接收反馈并与环境互动。基于LLM的Agent的应用根据领域的不同基于LLM的Agent的应用可以分为三类社会科学、自然科学和工程如图7所示。根据应用场景的不同基于LLM的Agent的应用又可以分为单一Agent、多重Agent和人机交互Agent如图8所示。单一Agent具有多样化的能力。当多个Agent互动时它们可以通过合作或对抗性互动加强性能。人与Agent的互动中人类的反馈可以使Agent更有效地执行任务。动手实现基于LLM的Agent接下来我们将用Langchain和python实现一个Agent的demodemo的整体架构图如下环境配置这里我用了anaconda来配置环境命令如下sh 复制代码 (base) Florian: conda create -n agent python3.11 (base) Florian: conda activate agent (agent) Florian: pip install langchain (agent) Florian: pip install langchain_openai (agent) Florian: pip install duckduckgo-search最终所用库的版本如下js 复制代码 langchain 0.1.15 langchain-community 0.0.32 langchain-core 0.1.41 langchain-openai 0.1.2 langchain-text-splitters 0.0.1 duckduckgo_search 5.3.0首先导入库python 复制代码 import os os.environ[OPENAI_API_KEY] YOUR_OPENAI_API_KEY from langchain.agents import AgentExecutor, Tool, ZeroShotAgent from langchain.chains import LLMChain from langchain.memory import ConversationBufferMemory from langchain_openai import OpenAI from langchain_community.utilities import DuckDuckGoSearchAPIWrapper为Agent引入搜索能力这里我使用DuckDuckGo库作为Agent可以使用的工具从而为Agent赋予搜索能力。tools定义了一个工具列表其中包含一个名为Search的工具该工具使用search.run函数。python 复制代码 search DuckDuckGoSearchAPIWrapper() tools [ Tool( nameSearch, funcsearch.run, descriptionuseful for when you need to answer questions about current events, ) ]计划模块和行动模块如前所述计划模块和行动模块是一个Agent的核心这里我使用ReAct算法构建计划模块和行动模块。该算法如下图所示ReAct算法解析以做一道菜为例切好菜和打开煤气之间有一个这样的推理或者说内心独白”现在我切好菜了后面要煮菜了我需要打开煤气。“在做菜过程中如果发生意外发现没有盐时有这样一个推理”没有盐了今天我就用胡椒粉调味“然后我们就会去拿胡椒粉。通过这个洞察作者提出一个方法让LLM把内心独白说出来然后再根据独白做相应的动作来提高LLM答案的准确性。以下面这个问题为例除了Apple遥控器还有什么其他设备可以控制相关软件相关软件指的是Apple遥控器最早可以控制的软件。说明Apple遥控器最早只能控制Front Row软件。Front Row软件可以被两种设备控制Apple遥控器和键盘的功能键。所以正确答案是键盘的功能键。ReAct方法即推理动作。得到结果想法1我需要搜索Apple遥控器并找到Apple遥控器最早可以控制的软件。动作1搜索【Apple 遥控器】结果1Apple遥控器是一种遥控器……最早可以控制“Front Row”……想法2Apple遥控器最早可以控制Front Row。我需要搜索Front Row下一步找出还有什么其他设备可以控制他动作2搜索【Front Row】结果2无结果可以试试“Front Row Seat to Earth”和“Front Row软件”想法3Front Row没有找到我可以搜索“Front Row软件”动作3搜索【Front Row软件】结果3FrontRow是一种过时软件……可以被Apple遥控器和键盘功能键控制。想法4现在我知道答案了。动作4完成【键盘功能键】答案正确。通过显式推理加上动作LLM Agent自主找到了答案。整个过程感觉就像是个不是特别聪明的孩子要把想法写出来然后去综合所有想法和观察接着再做出相应的动作。但显然这个方法很有效它最终找到了答案。代码实现python 复制代码 prefix Have a conversation with a human, answering the following questions as best you can. You have access to the following tools: suffix Begin! {chat_history} Question: {input} {agent_scratchpad} # 使用ZeroShotAgent.create_prompt方法创建一个提示该提示将用于与LLM交互。 prompt ZeroShotAgent.create_prompt( tools, prefixprefix, suffixsuffix, input_variables[input, chat_history, agent_scratchpad], )这里定义了对话的前缀和后缀以及对话历史、用户输入和Agent的思考过程的占位符。使用ZeroShotAgent.create_prompt方法创建一个prompt这里可能有读者疑惑ReAct算法在哪使用呢————在prompt里这里展示下内容vbnet 复制代码 Have a conversation with a human, answering the following questions as best you can. You have access to the following tools: Search: useful for when you need to answer questions about current events Use the following format: Question: the input question you must answer Thought: you should always think about what to do Action: the action to take, should be one of [Search] Action Input: the input to the action Observation: the result of the action ... (this Thought/Action/Action Input/Observation can repeat N times) Thought: I now know the final answer Final Answer: the final answer to the original input question Begin! {chat_history} Question: {input} {agent_scratchpad}prompt将使用一个定义好的[search]工具并且prompt末尾有三个变量chat_history包含存储在记忆中的内容。这包括之前的对话、Agent的内部状态、或者是先前任务的上下文信息。input指用户输入的问题。这是Agent需要处理和响应的主要输入。agent_scratchpad代表Agent之前的思考过程包括思考、行动、行动输入、观察等。这个变量会在Agent的执行过程中不断更新记录Agent的推理过程和决策依据。记忆模块langchain已经提供了默认的记忆模块的函数python 复制代码 memory ConversationBufferMemory(memory_keychat_history)创建一个ConversationBufferMemory实例用于存储对话历史。创建Agentpython 复制代码 #创建一个LLMChain实例它将使用OpenAI模型和之前创建的提示。 llm_chain LLMChain(llmOpenAI(temperature0), promptprompt) #创建一个ZeroShotAgent实例它将使用LLM链和工具列表。 agent ZeroShotAgent(llm_chainllm_chain, toolstools, verboseTrue) #创建一个AgentExecutor实例它将用于运行agent。 agent_executor AgentExecutor.from_agent_and_tools( agentagent, toolstools, verboseTrue, memorymemory )测试用例python 复制代码 agent_executor.run(inputHow many people live in canada?) agent_executor.run(inputwhat is their national anthem called?) agent_executor.run(inputwhat is their capital?)这里连续运行了三次agent执行器每次处理一个不同的输入。第二次和第三次测试了agent的记忆功能即agent能否利用之前交互中的信息来回答后续问题。最终的全部代码python 复制代码 import os os.environ[OPENAI_API_KEY] YOUR_OPENAI_API_KEY from langchain.agents import AgentExecutor, Tool, ZeroShotAgent from langchain.chains import LLMChain from langchain.memory import ConversationBufferMemory from langchain_openai import OpenAI from langchain_community.utilities import DuckDuckGoSearchAPIWrapper search DuckDuckGoSearchAPIWrapper() tools [ Tool( nameSearch, funcsearch.run, descriptionuseful for when you need to answer questions about current events, ) ] prefix Have a conversation with a human, answering the following questions as best you can. You have access to the following tools: suffix Begin! {chat_history} Question: {input} {agent_scratchpad} prompt ZeroShotAgent.create_prompt( tools, prefixprefix, suffixsuffix, input_variables[input, chat_history, agent_scratchpad], ) memory ConversationBufferMemory(memory_keychat_history) llm_chain LLMChain(llmOpenAI(temperature0), promptprompt) agent ZeroShotAgent(llm_chainllm_chain, toolstools, verboseTrue) agent_executor AgentExecutor.from_agent_and_tools( agentagent, toolstools, verboseTrue, memorymemory ) agent_executor.run(inputHow many people live in canada?) # To test the memory of this agent, we can ask a followup question that relies on information in the previous exchange to be answered correctly. agent_executor.run(inputwhat is their national anthem called?) agent_executor.run(inputwhat is their capital?)测试结果这里我用了个gpt-3.5的api输出如下sh 复制代码 Entering new AgentExecutor chain... Thought: I should use the Search tool to find the most recent population data for Canada. Action: Search Action Input: Population of Canada Observation: Canada population density map (2014) Top left: The Quebec City-Windsor Corridor is the most densely inhabited and heavily industrialized region accounting for nearly 50 percent of the total population Canada ranks 37th by population among countries of the world, comprising about 0.5% of the worlds total, with 40 million Canadians. Despite being the second-largest country by total area ... As of July 1, 2023, NPRs were estimated to represent 5.5% of the population of Canada. Among provinces, this proportion was highest in British Columbia (7.3%) and Ontario (6.3%) and lowest in Newfoundland and Labrador (2.4%) and Saskatchewan (2.5%). The 2.2 million NPRs now outnumber the 1.8 million Indigenous people enumerated during the 2021 ... Historical population of Canada. Statistics Canada conducts a country-wide census that collects demographic data every five years on the first and sixth year of each decade. The 2021 Canadian census enumerated a total population of 36,991,981, an increase of around 5.2 percent over the 2016 figure. It is estimated that Canadas population surpassed 40 million in 2023 and 41 million in 2024. Canadas population reaches 40 million. On June 16, 2023, Statistics Canada announced that Canadas population passed the 40 million mark according to the Canadas population clock (real-time model). Todays release of total demographic estimates and related data tables for a reference date of July 1, 2023, is the first since reaching that ... Canadas population was estimated at 40,528,396 on October 1, 2023, an increase of 430,635 people (1.1%) from July 1. This was the highest population growth rate in any quarter since the second quarter of 1957 (1.2%), when Canadas population grew by 198,000 people. At the time, Canadas population was 16.7 million people, and this rapid population growth resulted from the high number of ... Thought: Based on the data, I can see that the population of Canada is estimated to be around 40 million as of October 1, 2023. Final Answer: The estimated population of Canada as of October 1, 2023 is 40 million. Finished chain. Entering new AgentExecutor chain... Thought: I should use the search tool to find the answer. Action: Search Action Input: Canada national anthem Observation: O Canada, national anthem of Canada.It was proclaimed the official national anthem on July 1, 1980. God Save the Queen remains the royal anthem of Canada. The music, written by Calixa Lavallée (1842-91), a concert pianist and native of Verchères, Quebec, was commissioned in 1880 on the occasion of a visit to Quebec by John Douglas Sutherland Campbell, marquess of Lorne (later 9th ... Learn about the history and lyrics of Canadas national anthem O Canada, which has both French and English versions. The song was composed by Calixa Lavallée in 1880 and was proclaimed the official anthem in 1980. It replaced God Save the Queen, which is Canadas royal anthem. O Canada (French: Ô Canada) is the national anthem of Canada. The song was originally commissioned by Lieutenant Governor of Quebec Théodore Robitaille for t... National Anthem of Canada - O Canada (English only) - featuring new lyricsOther versions:Bilingual: https://www.youtube.com/watch?vwBCuyeoSURoFrench only: h... Enjoy this virtual choir rendition of O Canada arranged by George Alfred Grant-Shaefer . Make sure to subscribe for more virtual choir videos!After 100 yea... Thought: I now know the final answer. Final Answer: The national anthem of Canada is O Canada. Finished chain. Entering new AgentExecutor chain... Thought: I should use the Search tool to find the answer. Action: Search Action Input: Capital of Canada Observation: Ottawa is the capital city of Canada.It is located in the southern portion of the province of Ontario, at the confluence of the Ottawa River and the Rideau River.Ottawa borders Gatineau, Quebec, and forms the core of the Ottawa-Gatineau census metropolitan area (CMA) and the National Capital Region (NCR). As of 2021, Ottawa had a city population of 1,017,449 and a metropolitan population of ... Ottawa, city, capital of Canada, located in southeastern Ontario.In the eastern extreme of the province, Ottawa is situated on the south bank of the Ottawa River across from Gatineau, Quebec, at the confluence of the Ottawa (Outaouais), Gatineau, and Rideau rivers.The Ottawa River (some 790 miles [1,270 km] long), the principal tributary of the St. Lawrence River, was a key factor in the city ... Skyline of Toronto. The national capital is Ottawa, Canadas fourth largest city. It lies some 250 miles (400 km) northeast of Toronto and 125 miles (200 km) west of Montreal, respectively Canadas first and second cities in terms of population and economic, cultural, and educational importance. The third largest city is Vancouver, a centre ... Learn about Canadas location, climate, terrain, natural resources, and major lakes and rivers. Find out the population distribution, ethnic groups, languages, and religions of Canada. The national capital, Ottawa, is prominently marked in the province of Ontario. Where is Canada? Canada is the largest country in North America. Canada is bordered by non-contiguous US state of Alaska in the northwest and by 12 other US states in the south. The border of Canada with the US is the longest bi-national land border in the world. Thought: I now know the final answer. Final Answer: The capital of Canada is Ottawa. Finished chain.想入门 AI 大模型却找不到清晰方向备考大厂 AI 岗还在四处搜集零散资料别再浪费时间啦2025 年AI 大模型全套学习资料已整理完毕从学习路线到面试真题从工具教程到行业报告一站式覆盖你的所有需求现在全部免费分享扫码免费领取全部内容​一、学习必备100本大模型电子书26 份行业报告 600 套技术PPT帮你看透 AI 趋势想了解大模型的行业动态、商业落地案例大模型电子书这份资料帮你站在 “行业高度” 学 AI1. 100本大模型方向电子书2. 26 份行业研究报告覆盖多领域实践与趋势报告包含阿里、DeepSeek 等权威机构发布的核心内容涵盖职业趋势《AI 职业趋势报告》《中国 AI 人才粮仓模型解析》商业落地《生成式 AI 商业落地白皮书》《AI Agent 应用落地技术白皮书》领域细分《AGI 在金融领域的应用报告》《AI GC 实践案例集》行业监测《2024 年中国大模型季度监测报告》《2025 年中国技术市场发展趋势》。3. 600套技术大会 PPT听行业大咖讲实战PPT 整理自 2024-2025 年热门技术大会包含百度、腾讯、字节等企业的一线实践安全方向《端侧大模型的安全建设》《大模型驱动安全升级腾讯代码安全实践》产品与创新《大模型产品如何创新与创收》《AI 时代的新范式构建 AI 产品》多模态与 Agent《Step-Video 开源模型视频生成进展》《Agentic RAG 的现在与未来》工程落地《从原型到生产AgentOps 加速字节 AI 应用落地》《智能代码助手 CodeFuse 的架构设计》。二、求职必看大厂 AI 岗面试 “弹药库”300 真题 107 道面经直接抱走想冲字节、腾讯、阿里、蔚来等大厂 AI 岗这份面试资料帮你提前 “押题”拒绝临场慌1. 107 道大厂面经覆盖 Prompt、RAG、大模型应用工程师等热门岗位面经整理自 2021-2025 年真实面试场景包含 TPlink、字节、腾讯、蔚来、虾皮、中兴、科大讯飞、京东等企业的高频考题每道题都附带思路解析2. 102 道 AI 大模型真题直击大模型核心考点针对大模型专属考题从概念到实践全面覆盖帮你理清底层逻辑3. 97 道 LLMs 真题聚焦大型语言模型高频问题专门拆解 LLMs 的核心痛点与解决方案比如让很多人头疼的 “复读机问题”三、路线必明 AI 大模型学习路线图1 张图理清核心内容刚接触 AI 大模型不知道该从哪学起这份「AI大模型 学习路线图」直接帮你划重点不用再盲目摸索路线图涵盖 5 大核心板块从基础到进阶层层递进一步步带你从入门到进阶从理论到实战。L1阶段:启航篇丨极速破界AI新时代L1阶段了解大模型的基础知识以及大模型在各个行业的应用和分析学习理解大模型的核心原理、关键技术以及大模型应用场景。L2阶段攻坚篇丨RAG开发实战工坊L2阶段AI大模型RAG应用开发工程主要学习RAG检索增强生成包括Naive RAG、Advanced-RAG以及RAG性能评估还有GraphRAG在内的多个RAG热门项目的分析。L3阶段跃迁篇丨Agent智能体架构设计L3阶段大模型Agent应用架构进阶实现主要学习LangChain、 LIamaIndex框架也会学习到AutoGPT、 MetaGPT等多Agent系统打造Agent智能体。L4阶段精进篇丨模型微调与私有化部署L4阶段大模型的微调和私有化部署更加深入的探讨Transformer架构学习大模型的微调技术利用DeepSpeed、Lamam Factory等工具快速进行模型微调并通过Ollama、vLLM等推理部署框架实现模型的快速部署。L5阶段专题集丨特训篇 【录播课】四、资料领取全套内容免费抱走学 AI 不用再找第二份不管你是 0 基础想入门 AI 大模型还是有基础想冲刺大厂、了解行业趋势这份资料都能满足你现在只需按照提示操作就能免费领取扫码免费领取全部内容​2025 年想抓住 AI 大模型的风口别犹豫这份免费资料就是你的 “起跑线”

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询