当前位置: 首页 > news >正文

网站开发菜鸟教程红色 网站

网站开发菜鸟教程,红色 网站,网站版式分类,韩国购物网站模板大型语言模型#xff08;LLM#xff09;的出现带火了Agent。利用LLM理解人类意图、生成复杂计划并且能够自主行动的能力。Agent具有无与伦比的能力#xff0c;能够做出类似于人类复杂性的决策和完成一些复杂的工作。 目前市面上已经出现非常多得Agent框架#xff1a;XAgen…大型语言模型LLM的出现带火了Agent。利用LLM理解人类意图、生成复杂计划并且能够自主行动的能力。Agent具有无与伦比的能力能够做出类似于人类复杂性的决策和完成一些复杂的工作。 目前市面上已经出现非常多得Agent框架XAgent, AutoGPT、BabyAGI、CAMEL、MetaGPT、AutoGen、DSPy、AutoAgents、OpenAgents、Agents、AgentVerse、ChatDev。他们将LLM作为核心引擎给模型增加记忆装上工具去完成一些复杂的任务使得LLM更像一个人去工作不得不说Agent的威力还是很值得期待。 接下来我就使用一个 Agent 框架去介绍一下Agent到底是什么 如何进行优化以及如何使用 Agent 框架。 ModelScope-Agent框架 ModelScope-Agent是一个通用的、可定制的Agent框架以大语言模型作为核心驱动的应用开发框架通过Prompt去驱动模型进行计划和工具调用。 框架的好处将有记忆能力计划能力工具调用能力的Agent封装成了一个类用户只需要使用简单的接口就能实现将知识和工具注入到Agent类当中。整个Agent的运行会遵循下方流程准备好记忆和工具然后进行计划最终按照计划使用记忆调用工具返回结果。 通俗易懂讲解大模型系列 用通俗易懂的方式讲解使用 Mistral-7B 和 Langchain 搭建基于PDF文件的聊天机器人 用通俗易懂的方式讲解ChatGPT 开放的多模态的DALL-E 3功能好玩到停不下来 用通俗易懂的方式讲解结合检索和重排序模型改善大模型 RAG 效果明显 用通俗易懂的方式讲解基于扩散模型Diffusion,文生图 AnyText 的效果太棒了 用通俗易懂的方式讲解在 CPU 服务器上部署 ChatGLM3-6B 模型 用通俗易懂的方式讲解ChatGLM3-6B 功能原理解析 用通俗易懂的方式讲解使用 LangChain 和大模型生成海报文案 用通俗易懂的方式讲解一个强大的 LLM 微调工具 LLaMA Factory 用通俗易懂的方式讲解ChatGLM3-6B 部署指南 用通俗易懂的方式讲解LangChain Agent 原理解析 用通俗易懂的方式讲解HugggingFace 推理 API、推理端点和推理空间使用详解 用通俗易懂的方式讲解使用 LangChain 封装自定义的 LLM太棒了 用通俗易懂的方式讲解使用 FastChat 部署 LLM 的体验太爽了 用通俗易懂的方式讲解基于 Langchain 和 ChatChat 部署本地知识库问答系统 用通俗易懂的方式讲解使用 Docker 部署大模型的训练环境 用通俗易懂的方式讲解在 Ubuntu 22 上安装 CUDA、Nvidia 显卡驱动、PyTorch等大模型基础环境 用通俗易懂的方式讲解Llama2 部署讲解及试用方式 用通俗易懂的方式讲解LangChain 知识库检索常见问题及解决方案 用通俗易懂的方式讲解基于 LangChain 和 ChatGLM2 打造自有知识库问答系统 用通俗易懂的方式讲解代码大模型盘点及优劣分析 用通俗易懂的方式讲解Prompt 提示词在开发中的使用 用通俗易懂的方式讲解万字长文带你入门大模型 如何提升Agent的能力呢 之前一直知道大模型有计划推理能力但是做过一些实验有时候自定义的工具经常会调用失败而且有时候结果也不尽如人意。如何在特定的场景进行一些能力增强呢或者问题问大一点如何提升Agent的能力呢。主要有3个方面的工作可以做 1.使用更强大的LLM 2.设计更合理的Prompt和Agent Pipeline 3.使用特定数据进行微调 1.更强的大语言模型LLM使用gpt4 下方是XAgent框架的使用建议建议用gpt4来作为Agent的核心引擎不然效果会大打折扣。可以看出其实很多大模型的计划推理和反思能力其实不足以去完成一个复杂任务。 2.更优的Prompt和工作流程设计prompt工程和pipeline设计 下方是XAgent的流程设计包含了任务拆解结果验证与反思这一个循环更符合人类思维模式的进化习惯了。当然速度也会更慢如果是特定领域也可以设计特定领域的工作流程去将Agent打造成某一领域的专家也就是GPTS。 3.更多的推理决策计划反思类数据的训练。llm微调 下方是千问的为了让模型具备工具调用能力微调数据可以看出就是将模型推理过程数据化了。 [{conversations: [{from: user,value: Answer the following questions as best you can. You have access to the following APIs:\\n\\ngoogle_search: Call this tool to interact with the Google Search API. What is the Google Search API useful for? Google Search is a general search engine that can be used to access the internet, query encyclopedia knowledge, and stay informed about current events. Format the arguments as a JSON object. Parameters: [{\\name\\: \\search_query\\, \\description\\: \\Search keywords or phrases\\, \\required\\: true, \\schema\\: {\\type\\: \\string\\}}]\\n\\ncode_interpreter: Call this tool to interact with the Code Interpreter API. What is the Code Interpreter API useful for? Code interpreter that can execute Python code.Enclose the code within triple backticks () at the beginning and end of the code. Parameters: [{\\name\\: \\code\\, \\description\\: \\Code to be executed\\, \\required\\: true, \\schema\\: {\\type\\: \\string\\}}]\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [google_search, code_interpreter]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: Who is jay chou? And who is his wife?},{from: assistant,value: Thought: I need to google Jay Chou.\\nAction: google_search\\nAction Input: {\\search_query\\: \\Jay Chou\\}\\nObservation: Jay Chou is ...\\nThought: I need to google Jays wife.\\nAction: google_search\\nAction Input: {\\search_query\\: \\Jay Chous wife\\}\\nObservation: Jay Chous wife is ...\\nThought: I now know the final answer\\nFinal Answer: Jay Chou is ... His wife is ...}]},{conversations: [{from: user,value: Answer the following questions as best you can. You have access to the following APIs:\\n\\ngoogle_search: Call this tool to interact with the Google Search API. What is the Google Search API useful for? Google Search is a general search engine that can be used to access the internet, query encyclopedia knowledge, and stay informed about current events. Format the arguments as a JSON object. Parameters: [{\\name\\: \\search_query\\, \\description\\: \\Search keywords or phrases\\, \\required\\: true, \\schema\\: {\\type\\: \\string\\}}]\\n\\ncode_interpreter: Call this tool to interact with the Code Interpreter API. What is the Code Interpreter API useful for? Code interpreter that can execute Python code.Enclose the code within triple backticks () at the beginning and end of the code. Parameters: [{\\name\\: \\code\\, \\description\\: \\Code to be executed\\, \\required\\: true, \\schema\\: {\\type\\: \\string\\}}]\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [google_search, code_interpreter]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: 123456?},{from: assistant,value: Thought: I need to compute the result using Code Interpreter.\\nAction: code_interpreter\\nAction Input:\\npy\\n123 456\\n\\nObservation: 579\\nThought: I now know the final answer\\nFinal Answer: 579},{from: user,value: Multiply the result by 2.},{from: assistant,value: Thought: Code Interpreter is helpful for answering this question.\\nAction: code_interpreter\\nAction Input:\\npy\\n579 * 2\\n\\nObservation: 1158\\nThought: I now know the final answer\\nFinal Answer: 1158},{from: user,value: You are so smart, Qwen.},{from: assistant,value: Thought: I now know the final answer\\nFinal Answer: Thank you.},{from: user,value: Please re-execute the code for computing my first question again.},{from: assistant,value: Thought: I need to re-compute the result.\\nAction: code_interpreter\\nAction Input:\\npy\\n123 456\\n\\nObservation: 579\\nThought: I now know the final answer\\nFinal Answer: 579}]} ]ModelScope-Agent框架实战 下方实现了一个带记忆能够使用code interpreter工具的一个agent,用到的大模型就是qwen-max from modelscope_agent.agent import AgentExecutor from modelscope_agent.tools import CodeInterpreter from modelscope_agent.agent_types import AgentType from modelscope_agent.llm import LLMFactory from langchain.embeddings import ModelScopeEmbeddings, DashScopeEmbeddings from langchain.vectorstores import FAISS from modelscope_agent.retrieve import ToolRetrieval, KnowledgeRetrieval import faissfrom dotenv import load_dotenv import os from modelscope.utils.config import Config os.environ[DASHSCOPE_API_KEY] 你的千问key model_cfg Config.from_file(./config/cfg_model_template.json)model_name qwen-max llm LLMFactory.build_llm(model_name, model_cfg)# 额外工具列表这里只有一个code_interpreter additional_tool_list {CodeInterpreter.name: CodeInterpreter() }# 基于阿里云DashScope向量Embedding的配置 embeddings DashScopeEmbeddings(modeltext-embedding-v1) # 构建知识库 file_path qa.txt knowledge_retrieval KnowledgeRetrieval.from_file(file_path, embeddings, FAISS)# 构建Agent需要传入llm工具配置config以及工具检索 agent AgentExecutor(llm, agent_typeAgentType.MRKL, additional_tool_listadditional_tool_list,tool_retrievalFalse, knowledge_retrievalknowledge_retrieval) available_tool_list [code_interpreter] agent.set_available_tools(available_tool_list)# 接下来就可以进行agent.run了检索示例——知识库检索 code interpreter 读取excel并可视化 给定下方一个execl 文档希望agent使用python 帮我进行读取并可视化 namecounta1b2c3 结语 最后可以看看agent的历史聊天记录整个过程包括模型的计划推理和工具使用等还是大量使用了ReAct Prompt没有特别的设计。这样我们从这一个简单的Agent 流进一步认识到Agent是什么同时也可以了解到从哪些方面进行进一步优化。 [{content: Answer the following questions as best you can. You have access to the following tools: \\n\\ncode_interpreter: code_interpreter API. Executes code on the users machine, **in the users local environment**, and returns the output 输入参数: [{name: language, description: The programming language (required parameter to the execute function), required: true}, {name: code, description: The code to execute (required), required: true}]\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [code_interpreter]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\nQuestion: 读取一个文件./123.xlsx\\n,role: user},{content: Thought: 我需要使用代码来读取一个Excel文件。\\nAction: code_interpreter\\nAction Input:\\npy\\nimport pandas as pd\\n# 读取Excel文件\\ndf pd.read_excel(./123.xlsx)\\n# 显示数据框的前几行\\ndf.head()\\n\\nObservation: name count\\n\\n0 a 1\\n\\n1 b 2\\n\\n2 c 3\\n\\n\\nThought: 代码成功读取了Excel文件并显示了数据的前几行。\\nFinal Answer: 文件./123.xlsx的内容如下\\n\\n| name | count |\\n| ---- | ----- |\\n| a | 1 |\\n| b | 2 |\\n| c | 3 |\\n\\n请注意这只是一个示例实际文件内容可能会有所不同。,role: assistant},{content: Question: 然后帮我把结果可视化一下,并保存成./123.png\\n, role: user},{content: Thought: 我需要使用代码来创建一个数据的可视化并保存为PNG文件。\\nAction: code_interpreter\\nAction Input:\\npy\\nimport pandas as pd\\nimport matplotlib.pyplot as plt\\n\\n# 读取Excel文件\\ndf pd.read_excel(./123.xlsx)\\n\\n# 创建图表\\nplt.bar(df[name], df[count])\\nplt.xlabel(Name)\\nplt.ylabel(Count)\\nplt.title(Name vs Count)\\n\\n# 保存图表为PNG文件\\nplt.savefig(./123.png)\\n\\nObservation: BarContainer object of 3 artists\\n\\nText(0.5, 0, Name)\\n\\nText(0, 0.5, Count)\\n\\nText(0.5, 1.0, Name vs Count)\\n \\n\\nThought: 代码成功创建了一个条形图并保存为./123.png。\\nFinal Answer: 我已经将./123.xlsx文件中的数据可视化为一个条形图并将其保存为./123.png。这个图表显示了每个名字对应的计数。你可以查看./123.png文件来查看生成的图表。请注意由于这是一个文本环境我无法直接展示图像。但是在你的本地环境中你应该能在相同目录下看到生成的图像文件。,role: assistant}]参考 https://link.zhihu.com/?targethttps%3A//github.com/OpenBMB/XAgent/nt/ https://github.com/modelscope/modelscope-agent
http://www.zqtcl.cn/news/721581/

相关文章:

  • 如何建立电子商务网站网站制作地点
  • 网站建设设计目的memcached wordpress
  • 潍坊作风建设年网站上海到北京火车时刻表查询
  • 网站建设 项目要求手机软件app
  • 什么是做网站wordpress 七牛视频
  • 家乡网站建设策划书angular做的网站
  • 土豆网网站开发源代码thinkphp5做的网站
  • lng企业自建站wordpress 分页 美化
  • 手机版网站如何做新闻类网站怎么做百度推广
  • 网站开发工程师 上海合肥网站到首页排名
  • 商城网站后续费用请人代做谷歌外贸网站
  • 汽车网站有哪些3d家装效果图制作软件
  • 荆门做网站公众号的公司网站百度不收录的原因
  • 专门做羽毛球的网站福州seo网站排名
  • 网站返回503的含义是门户网站开发合同
  • 自己做网站的成本要哪些东西wordpress模板如何管理系统
  • 做一般的网站要多久wordpress写文章页面无法显示
  • 人和兽做的网站视频汽车建设网站开发流程
  • 长春市建设工程造价管理协会网站厦门网站建设费用
  • 广东建设信息公开网站怎样策划一个营销型网站
  • 魔兽做图下载网站如何经营一个购物网站
  • 深圳做网站哪个平台好一级消防工程师考试题型
  • 网站婚礼服务态网站建设论文网站设计有限公司是干嘛的
  • 邯郸网站建设效果好广西做网站的公司
  • 网站logo上传营销型网站制作方案
  • 小说网站静态模板站长工具seo综合查询adc
  • 北京响应式网站做logo那个网站
  • 如何申请免费网站空间刚察县wap网站建设公司
  • 哪里有网站推广软件免费推广seo策略方法
  • 阿里云备案网站 网站名称怎么写京icp备案查询