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

保护动物网站建设策划书江苏五星建设网站

保护动物网站建设策划书,江苏五星建设网站,平面设计免费软件,怎么做才能使网站ip增多如下图所示#xff0c;LLM仍然是自治代理的backbone#xff0c;可以通过给LLM增加以下模块来增强LLM功能: Prompter AgentChecker ModuleMemory moduleToT controller 当解决具体问题时#xff0c;这些模块与LLM进行多轮对话。这是基于LLM的自治代理的典型情况#xff0c;…       如下图所示LLM仍然是自治代理的backbone可以通过给LLM增加以下模块来增强LLM功能: Prompter AgentChecker ModuleMemory moduleToT controller 当解决具体问题时这些模块与LLM进行多轮对话。这是基于LLM的自治代理的典型情况其中动态创建链并按顺序执行同时多次轮询LLM。 下图是LangSmith[1]的界面从图中可以看到使用的tokens总数以及两个延迟类别。 此图显示了Trace部分其中包含为该代理创建的完整链以及输入和输出。LangSmith在链的每一步都给出了详细的分解包括成本tokens和延迟。 会话和状态历史记录上下文存储在内存模块中这使代理可以参考思维过程的先前部分并可能从历史记忆采取不同的路线。 为了验证ToT技术的有效性本文实现了一个基于ToT的代理来解决数独难题。 论文[2]实验结果表明ToT框架可以显著提高数独解谜的成功率 论文指出的一个漏洞是LLM是基于前面的序列生成内容而忽略了向后编辑。然而当我们人类解决一个问题时如果派生的步骤不正确我们很可能会回溯到以前的迭代。这种回溯方法否定了LLM达到不确定或无答案场景的危险。 其次为了建立确保正确性我们人类的一种做法是在解决问题的每一步都进行测试这确保了最终解决方案的可信度。本文统计了自回归语言模型在基于以前的token生成新token时不会显式执行逻辑正确性检查这限制了LLM纠正自身错误的能力。随着模型生成更多的tokens一个小错误可能会被放大这通常被称为级联。因此这会导致生成质量下降并使其难以从错误中恢复。级联很早就被认为是手动创建提示链的一种危险。然而考虑到自主代理在运行中创建了一系列提示它仍然容易受到级联的影响。 该策略[2]通过LLM和提示器代理之间的多轮对话来解决问题。 上图显示了四种方法的成功率zero-shotzs、one-shotos、few-shotfs和Tree-of-Thoughttot。 以下是ToT代理的完整代码您可以将其复制并粘贴到笔记本中。您需要更新的只是OpenAI API密钥和LangSmith API密钥。 pip install langchainpip install langchain_experimentalpip install -U langsmithpip install openai​#######​import osfrom uuid import uuid4​unique_id uuid4().hex[0:8]os.environ[LANGCHAIN_TRACING_V2] trueos.environ[LANGCHAIN_PROJECT] fAgent Totos.environ[LANGCHAIN_ENDPOINT] https://api.smith.langchain.comos.environ[LANGCHAIN_API_KEY] xxxxxxxxxxxxxxxxxxxxxxxxos.environ[OPENAI_API_KEY] str(xxxxxxxxxxxxxxxxxxxxxxxx)​#######​from langchain.llms import OpenAIllm OpenAI(temperature1, max_tokens512, modeltext-davinci-003)​#######​sudoku_puzzle 3,*,*,2|1,*,3,*|*,1,*,3|4,*,*,1sudoku_solution 3,4,1,2|1,2,3,4|2,1,4,3|4,3,2,1problem_description f{sudoku_puzzle}​- This is a 4x4 Sudoku puzzle.- The * represents a cell to be filled.- The | character separates rows.- At each step, replace one or more * with digits 1-4.- There must be no duplicate digits in any row, column or 2x2 subgrid.- Keep the known digits from previous valid thoughts in place.- Each thought can be a partial or the final solution..strip()print(problem_description)​######## The following code implement a simple rule based checker for # a specific 4x4 sudoku puzzle.#######​from typing import Tuplefrom langchain_experimental.tot.checker import ToTCheckerfrom langchain_experimental.tot.thought import ThoughtValidityimport re​class MyChecker(ToTChecker): def evaluate(self, problem_description: str, thoughts: Tuple[str, ...] ()) - ThoughtValidity: last_thought thoughts[-1] clean_solution last_thought.replace( , ).replace(, ) regex_solution clean_solution.replace(*, .).replace(|, \\|) if sudoku_solution in clean_solution: return ThoughtValidity.VALID_FINAL elif re.search(regex_solution, sudoku_solution): return ThoughtValidity.VALID_INTERMEDIATE else: return ThoughtValidity.INVALID​######## Testing the MyChecker class above:#######​checker MyChecker()assert checker.evaluate(, (3,*,*,2|1,*,3,*|*,1,*,3|4,*,*,1,)) ThoughtValidity.VALID_INTERMEDIATEassert checker.evaluate(, (3,4,1,2|1,2,3,4|2,1,4,3|4,3,2,1,)) ThoughtValidity.VALID_FINALassert checker.evaluate(, (3,4,1,2|1,2,3,4|2,1,4,3|4,3,*,1,)) ThoughtValidity.VALID_INTERMEDIATEassert checker.evaluate(, (3,4,1,2|1,2,3,4|2,1,4,3|4,*,3,1,)) ThoughtValidity.INVALID​######## Initialize and run the ToT chain, # with maximum number of interactions k set to 30 and # the maximum number child thoughts c set to 8.#######​from langchain_experimental.tot.base import ToTChain​tot_chain ToTChain(llmllm, checkerMyChecker(), k30, c5, verboseTrue, verbose_llmFalse)tot_chain.run(problem_descriptionproblem_description)​####### 代理的输出、迭代和回溯可以在输出中看到 Entering new ToTChain chain...Starting the ToT solve procedure./usr/local/lib/python3.10/dist-packages/langchain/chains/llm.py:278: UserWarning: The predict_and_parse method is deprecated, instead pass an output parser directly to LLMChain. warnings.warn(Thought: 3,4,*,2|1,*,3,*|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,*,3,*|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,4|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|1,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,2,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,1,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,*,4|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,*,1|4,4,*,1 Thought: 3,4,1,2|1,2,3,*|1,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,2,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,*,3|4,1,*,1 Thought: 3,4,1,2|1,2,3,*|*,1,*,3|4,*,1,1 Thought: 3,4,1,2|1,*,3,4|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,4|*,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,4|2,1,*,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,*,*,1 Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,1,*,* Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,2,*,* Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,3,*,* Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,3,1,* Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,3,2,* Thought: 3,4,1,2|1,2,3,4|2,1,4,3|4,3,2,1​ Finished chain.3,4,1,2|1,2,3,4|2,1,4,3|4,3,2,1 在Colab笔记本中查看的输出如下所示 参考文献 [1] https://cobusgreyling.medium.com/langsmith-1dd01049c3fb [2] https://arxiv.org/pdf/2305.08291.pdf [3] https://cobusgreyling.medium.com/langchain-langsmith-llm-guided-tree-of-thought-47a2cd5bcfca
http://www.tj-hxxt.cn/news/140377.html

相关文章:

  • 网站的组织与风格设计怎么在阿里云建立网站
  • 怀安县网站建设怎么做ppt教程网站
  • 用织梦做的网站国家官方网站
  • 广州公司核名在哪个网站长沙移动网站建设哪家好
  • 网站性能容量的收集与分析怎么做站长综合查询工具
  • 学网站开发技术中英文网站建设费用
  • 网站正在建设中手机版wordpress tags
  • 网站刚建好怎么做能让百度收录哈尔滨模板建站平台
  • 网站建设都有那些费用网络规划设计师报名入口
  • 东莞网站排名优化公司江苏省建设工程地方标准网站
  • 公司想做个网站应该怎么做php做的一个网站
  • 工艺礼品东莞网站建设怎么做购物网站的分类目录
  • 重庆城乡住房建设厅网站网站开发 接个支付支付难吗
  • 17网做网站怎么建网站自己做赌场
  • 网站建设及维护价钱郑州做网站制作的公司
  • 成都建站网站模板sem代运营推广公司
  • 专业建设网站应该怎么做营销平台推广
  • 德宏企业网站建设公司微商城网站建设报价
  • 全球50个大网站开发语言抖音运营
  • 网络促销分类 网站促销模板网站建设公司
  • 恶意点击别人的网站erp网站建设
  • 申请网站域名wordpress 登录logo
  • 淮安做网站卓越凯欣做网站为什么需要购买域名
  • 网站正在建设中页面 英文dedecms5.7化妆品公司网站源码
  • 苏州网站建站推广网站开发的整体职业规划
  • 宁波网站建设流程wordpress 4.0 4.6
  • 长沙网站制作公司报价php网站是什么数据库文件
  • 有限公司网站入口网站登录页面模板
  • 江西锐安建设工程有限公司网站重庆没建网站的企业
  • 做购物网站怎么写开题报告专业团队值得信赖