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

黑龙江生产建设兵团各连网站最近做网站开发有前途没

黑龙江生产建设兵团各连网站,最近做网站开发有前途没,网络营销技巧和营销方法,微信公众平台开发实例教程一、基于LangChain源码react来解析prompt engineering 在LangChain源码中一个特别重要的部分就是react#xff0c;它的基本概念是#xff0c;LLM在推理时会产生很多中间步骤而不是直接产生结果#xff0c;这些中间步骤可以被用来与外界进行交互#xff0c;然后产生new con… 一、基于LangChain源码react来解析prompt engineering 在LangChain源码中一个特别重要的部分就是react它的基本概念是LLM在推理时会产生很多中间步骤而不是直接产生结果这些中间步骤可以被用来与外界进行交互然后产生new context 我们先看下textworld_prompt这个文件按照前面提到的“thought”“action”“observation”的结构给出了如下样例其中observation部分以文字的形式提供了一种类似于解题的思路来说明如何完成具体的action 另外看一下wiki_prompt这个文件在所给的例子中首先也是给出一个question然后针对问题给出thought也就是如何进行推理 Question: What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into? Thought: I need to search Colorado orogeny, find the area that the eastern sector of the Colorado orogeny extends into, then find the elevation range of the area. Action: Search[Colorado orogeny] 在这里执行action的不是LLM而是agent执行wiki搜索之后返回结果 Observation: The Colorado orogeny was an episode of mountain building (an orogeny) in Colorado and surrounding areas. Thought: It does not mention the eastern sector. So I need to look up eastern sector. Action: Lookup[eastern sector] 从上面的返回结果看并没有提到关键信息“eastern sector”因此上面的thought提示需要查找这部分信息 Observation: (Result 1 / 1) The eastern sector extends into the High Plains and is called the Central Plains orogeny. Thought: The eastern sector of Colorado orogeny extends into the High Plains. So I need to search High Plains and find its elevation range. Action: Search[High Plains] 根据上面查询“eastern sector”的结果接下来需要搜索关于“High Plains”的信息 Observation: High Plains refers to one of two distinct land regions Thought: I need to instead search High Plains (United States). Action: Search[High Plains (United States)] 由于上面的搜索结果提到了“two distinct land regions”所以接下来的步骤就是搜索关于“High Plains (United States)”的信息 Observation: The High Plains are a subregion of the Great Plains. From east to west, the High Plains rise in elevation from around 1,800 to 7,000 ft (550 to 2,130 m).[3] Thought: High Plains rise in elevation from around 1,800 to 7,000 ft, so the answer is 1,800 to 7,000 ft. Action: Finish[1,800 to 7,000 ft] 基于上面的搜索结果进行推理最后获得了我们想要的数据1,800 to 7,000 ft。 上面重复迭代多次的observationthoughtaction就构成了一个链式的过程。 二、结合Chain of Thought(COT)经典案例剖析prompt 接下来我们针对这样一个链式的过程来看一个应用案例。在这个例子中我们使用了OpenAI的API来调用GPT-3.5模型并没有使用LangChain的方式 我们来看下关于“Chain-of-Thought Prompting”是如何进行构造的这个prompt是跟客户查询有关的定义了多个步骤来回答客户的问题 Step 1是检查用户的问题是否针对一个具体的产品或者一组产品来说的 Step 2是检查用户问题涉及到的产品是否是以下列出的这些产品这里可能是为了演示的方便所以直接以文本的形式呈现出来当然这些产品信息可以存储在数据库里 Step 3判断如果用户问题涉及以上产品那么列出用户针对产品会提什么问题的任意假设 Step 4基于现有的产品信息来判断用户提出的问题是否有匹配的答案 Step 5提示应该以对用户友好的方式来修正用户提到的不正确的问题假设也就是说用户只能针对5个可用的产品来提相关问题 以上部分都可以看做是基本的上下文信息system message接下来设定user_message的内容调用方法get_completion_from_messages获得结果 打印的结果如下由于用户问题提到了具体产品和价格所以step 2给出了每一种产品的价格并对用户的假设进行了判断 设定用户的问题如下 do you sell tvs 这次给出的结果如下推理步骤1和2共同判断了用户提到的TVs不在当前可用产品列表中所以模型在运行时会按照之前的系统设定来给出恰当的回复给用户 Step 1:#### The user is asking about a specific product category, TVs. Step 2:#### The list of available products does not include any TVs. Response to user:#### Im sorry, but we do not sell TVs at this time. Our store specializes in computers and laptops. However, if you are interested in purchasing a computer or laptop, please let me know and I would be happy to assist you. 这个例子看上去不复杂但是它的意义重大因为上面所列的系统信息都是私有数据如果已经告诉模型只能从私有数据中去查询那么模型就不会从其它地方去获取数据譬如针对上面step 2所列的信息可以修改为从数据库或者vector store中进行查询也就是使用具体的工具如果使用LangChain那么它可以帮我们封装这个过程如果不使用LangChain那么可以自己来封装。 If the user is asking about \ specific products, identify whether \ the products are in the following list. 接下来设定用户信息如下 推理过程如下step1 是针对用户问题的理解因此step 2列出了当前可用的产品信息由于用户问题中并没有给出明确的假设所以step 4的内容是基于LLM的理解给出的然后与本地的私有数据进行匹配之后基于这些信息来回复给用户所以整个过程都是LLM来驱动的 Step 1:#### The user is asking for a recommendation for a laptop based on their profession. Step 2:#### The available laptops are: 1. TechPro Ultrabook 2. BlueWave Gaming Laptop 3. PowerLite Convertible 4. TechPro Desktop 5. BlueWave Chromebook Step 3:#### There are no assumptions made by the user in this message. Step 4:#### Based on the users profession as an iOS developer, they would require a laptop with a powerful processor and sufficient RAM to handle development tasks. The TechPro Ultrabook and the BlueWave Gaming Laptop would be suitable options for an iOS developer due to their powerful processors and high RAM capacity. Response to user:#### As an iOS developer, I would recommend either the TechPro Ultrabook or the BlueWave Gaming Laptop. Both laptops have powerful processors and high RAM capacity, which are essential for development tasks. 通过以上经典案例展示了用LLM来驱动一切驱动的关键在于你自己的prompt要写得很清楚。
http://www.w-s-a.com/news/979495/

相关文章:

  • 苏州网站设计kgwl建设网站需要用到哪些技术人员
  • 万户网络做网站如何亚马逊网站建设
  • 门户网站制作费用暴雪公司最新消息
  • 深圳专业建网站公司济南公司做网站的价格
  • 怎么运行自己做的网站网上申请平台怎么申请
  • 旅游公司网站 优帮云新闻近期大事件
  • 电商网站后台报价营销软文小短文
  • 网站建设项目售后服务承诺公司名称邮箱大全
  • 湖南网站建设哪里好做ppt的网站叫什么名字
  • 容城县建设银行网站电子商务网站建设子项目
  • 网站管理助手3.0做淘宝网站用什么软件做
  • 贵阳做网站的公司wordpress趣味插件
  • 自己设置免费网站设计平台南京哪里有做公司网站的
  • 建设公司内网网站的意义自助建站网站的宣传手册
  • 手机建设中网站建立个人网站服务器
  • 网站开发工程师岗位概要网站怎么制作教程
  • 城乡建设主管部门官方网站公司简介模板ppt范文
  • 网站认证必须做么cc0图片素材网站
  • net域名 著名网站国外设计案例网站
  • 淘宝客网站哪里可以做app地推网
  • 宜昌建设厅网站中国最新时事新闻
  • 微网站怎么开发wordpress 发表评论
  • 山东网站建设是什么一页网站首页图如何做
  • 游戏开发与网站开发哪个难万网影
  • 做网站编程语言建筑施工特种证书查询
  • 找人做网站内容自己编辑吗修改wordpress登陆界面
  • 登陆建设银行wap网站湖南网站建设磐石网络答疑
  • 58网站怎么做浏览度才高论坛网站怎么做排名
  • wordpress 手机网站支付京东网站建设的经费预算
  • 自己怎么样做游戏网站做海外贸易网站