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

seo 深圳seo网络推广培训班

seo 深圳,seo网络推广培训班,photoshop做网站,初中学习网站大全免费思维之树( Tree of Thoughts ToT)是一个算法,它结合了普林斯顿大学和谷歌DeepMind在本文中提出的大型语言模型(LLMs)和启发式搜索。看起来这个算法正在被实现到谷歌正在开发的多模式生成AI Gemini中。 现在&#xff0…

思维之树( Tree of Thoughts ToT)是一个算法,它结合了普林斯顿大学和谷歌DeepMind在本文中提出的大型语言模型(LLMs)和启发式搜索。看起来这个算法正在被实现到谷歌正在开发的多模式生成AI Gemini中。

现在,让我们简要地谈谈 ToT(思维树)的思维过程。

在通常的 CoT(思维链)方法中,LLM(语言模型)倾向于在解决问题时线性地进行思考,如果在这个过程中出现错误,它们倾向于沿着错误的标准继续进行。

相比之下,在 ToT(思维树)方法中,LLM 在每个思维阶段都对自己进行评估,并及早停止低效的方法,转而采用替代方法。

在这里插入图片描述

代码实现

在LangChain的Chain中实施此项工作时,我利用了以下视频发布者提供的提示。简单地解释一下这个过程,首先生成广泛的想法,然后评估每个想法,深入探讨,并选择最有成功前景的想法。

PromptTemplate用于定义Tree of Thoughts提示的树形结构,每个步骤都实现了链。

from langchain.chains import LLMChain
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chat_models import ChatOpenAItemplate ="""
Step1 :I have a problem related to {input}. Could you brainstorm three distinct solutions? Please consider a variety of factors such as {perfect_factors}
A:
"""prompt = PromptTemplate(input_variables=["input","perfect_factors"],template = template                      
)chain1 = LLMChain(llm=ChatOpenAI(temperature=0, model="gpt-4"),prompt=prompt,output_key="solutions"
)template ="""
Step 2:For each of the three proposed solutions, evaluate their potential. Consider their pros and cons, initial effort needed, implementation difficulty, potential challenges, and the expected outcomes. Assign a probability of success and a confidence level to each option based on these factors{solutions}A:"""prompt = PromptTemplate(input_variables=["solutions"],template = template                      
)chain2 = LLMChain(llm=ChatOpenAI(temperature=0, model="gpt-4"),prompt=prompt,output_key="review"
)template ="""
Step 3:For each solution, deepen the thought process. Generate potential scenarios, strategies for implementation, any necessary partnerships or resources, and how potential obstacles might be overcome. Also, consider any potential unexpected outcomes and how they might be handled.{review}A:"""prompt = PromptTemplate(input_variables=["review"],template = template                      
)chain3 = LLMChain(llm=ChatOpenAI(temperature=0, model="gpt-4"),prompt=prompt,output_key="deepen_thought_process"
)template ="""
Step 4:Based on the evaluations and scenarios, rank the solutions in order of promise. Provide a justification for each ranking and offer any final thoughts or considerations for each solution
{deepen_thought_process}A:"""prompt = PromptTemplate(input_variables=["deepen_thought_process"],template = template                      
)chain4 = LLMChain(llm=ChatOpenAI(temperature=0, model="gpt-4"),prompt=prompt,output_key="ranked_solutions"
)

我们使用“SequentialChain”连接这四个链条。一个链条的输出成为下一个链条的输入。

from langchain.chains import SequentialChainoverall_chain = SequentialChain(chains=[chain1, chain2, chain3, chain4],input_variables=["input", "perfect_factors"],output_variables=["ranked_solutions"],verbose=True
)print(overall_chain({"input":"human colonization of Mars", "perfect_factors":"The distance between Earth and Mars is very large, making regular resupply difficult"}))

输出

{"input": "human colonization of Mars","perfect_factors": "The distance between Earth and Mars is very large, making regular resupply difficult","ranked_solutions": {"Ranking_1": {"Justification": "Using In-Situ Resource Utilization is the most promising solution due to its potential to provide the necessary resources for a Mars colony and reduce the need for resupply missions from Earth. The medium initial effort, implementation difficulty, and potential challenges are outweighed by the high probability of success and 70% confidence level.","In_Situ_Resource_Utilization_ISRU": {"Pros": "This solution could provide the necessary resources for a Mars colony and reduce the need for resupply missions from Earth.","Cons": "ISRU is technically challenging and would require significant investment in research and development.","Initial_Effort": "Medium. This would require the development of new technology and the establishment of infrastructure on Mars.","Implementation_Difficulty": "Medium. ISRU is a complex task that requires advanced technology.","Potential_Challenges": "Technical difficulties, high costs.","Expected_Outcomes": "If successful, ISRU could provide a steady supply of resources for a Mars colony.","Probability_of_Success": "High. ISRU is already being tested by NASA and other space agencies.","Confidence_Level": "70%"}},"Ranking_2": {"Justification": "Building a self-sustaining colony is a promising solution due to its potential to make the Mars colony self-sufficient. However, the high initial effort, implementation difficulty, and potential challenges make it less promising than the first solution. The medium probability of success and 60% confidence level also contribute to its ranking.","Building_a_Self_Sustaining_Colony": {"Pros": "This solution could make the Mars colony self-sufficient, reducing the need for resupply missions from Earth.","Cons": "Building a self-sustaining colony is a complex task that requires advanced technology and a lot of resources.","Initial_Effort": "High. This would require the development of new technology and the establishment of infrastructure on Mars.","Implementation_Difficulty": "High. Building a self-sustaining colony is a complex task that requires advanced technology.","Potential_Challenges": "Technical difficulties, high costs.","Expected_Outcomes": "If successful, a self-sustaining colony could reduce the need for resupply missions from Earth.","Probability_of_Success": "Medium. While there are significant challenges, there is also a lot of interest in building a self-sustaining colony on Mars.","Confidence_Level": "60%"}},"Ranking_3": {"Justification": "While asteroid mining has the potential to provide a steady supply of resources for a Mars colony, the high initial effort, implementation difficulty, and potential challenges make it a less promising solution compared to others. The medium probability of success and 50% confidence level also contribute to its lower ranking.","Terraforming_Mars": {"Pros": "This solution could make Mars more habitable for humans, reducing the need for life support systems and making the colony more self-sufficient.","Cons": "Terraforming is a long-term process that could take centuries or even millennia. It would also require a massive amount of resources and energy.","Initial_Effort": "Extremely High. Terraforming would require a massive amount of resources and energy.","Implementation_Difficulty": "Extremely High. Terraforming is a long-term process that could take centuries or even millennia.","Potential_Challenges": "Technical difficulties, high costs, time scale.","Expected_Outcomes": "If successful, terraforming could make Mars more habitable for humans.","Probability_of_Success": "Low. Terraforming is a theoretical concept and has never been attempted before.","Confidence_Level": "20%"}}}
}

最后,我认为不仅仅使用提示中的思维树,而且将其引入到代理人的规划过程中,可以提高工具选择和规划的准确性。

参考

https://medium.com/@astropomeai/implementing-the-tree-of-thoughts-in-langchains-chain-f2ebc5864fac


文章转载自:
http://dinncorugosa.ssfq.cn
http://dinncoepizoic.ssfq.cn
http://dinncoproponent.ssfq.cn
http://dinncomatrilineal.ssfq.cn
http://dinncoquicky.ssfq.cn
http://dinncoramify.ssfq.cn
http://dinncoslimline.ssfq.cn
http://dinncobailout.ssfq.cn
http://dinncohobby.ssfq.cn
http://dinncosemicolumn.ssfq.cn
http://dinncoheartful.ssfq.cn
http://dinncosedimentary.ssfq.cn
http://dinncogrudging.ssfq.cn
http://dinncosecondhand.ssfq.cn
http://dinncobowls.ssfq.cn
http://dinnconapper.ssfq.cn
http://dinncotheban.ssfq.cn
http://dinncoleptosomatic.ssfq.cn
http://dinncoremorselessly.ssfq.cn
http://dinncoresuscitator.ssfq.cn
http://dinncoreinstitute.ssfq.cn
http://dinncowenzel.ssfq.cn
http://dinncoinconclusively.ssfq.cn
http://dinncopneumogram.ssfq.cn
http://dinncocastigator.ssfq.cn
http://dinncojazzily.ssfq.cn
http://dinncopiezocrystallization.ssfq.cn
http://dinncofireproof.ssfq.cn
http://dinnconihility.ssfq.cn
http://dinncofin.ssfq.cn
http://dinncojove.ssfq.cn
http://dinncohighlighted.ssfq.cn
http://dinncoexpend.ssfq.cn
http://dinncolemur.ssfq.cn
http://dinncourological.ssfq.cn
http://dinncoxxi.ssfq.cn
http://dinncooffspeed.ssfq.cn
http://dinncopecs.ssfq.cn
http://dinncopolynuclear.ssfq.cn
http://dinncoteg.ssfq.cn
http://dinncocaenogenesis.ssfq.cn
http://dinncobarye.ssfq.cn
http://dinncomomus.ssfq.cn
http://dinncoschemozzle.ssfq.cn
http://dinncosiff.ssfq.cn
http://dinncobluish.ssfq.cn
http://dinncochemic.ssfq.cn
http://dinncobunchberry.ssfq.cn
http://dinncopretonic.ssfq.cn
http://dinncotycoonship.ssfq.cn
http://dinncoovermatch.ssfq.cn
http://dinncobrushy.ssfq.cn
http://dinncooversimple.ssfq.cn
http://dinncopsychodynamic.ssfq.cn
http://dinncopedigree.ssfq.cn
http://dinncohydrotropically.ssfq.cn
http://dinncobimetallist.ssfq.cn
http://dinncosaunders.ssfq.cn
http://dinncodihydrochloride.ssfq.cn
http://dinncobred.ssfq.cn
http://dinncolambert.ssfq.cn
http://dinncotailender.ssfq.cn
http://dinncoectostosis.ssfq.cn
http://dinncoscholiast.ssfq.cn
http://dinncobaoding.ssfq.cn
http://dinnconipping.ssfq.cn
http://dinncopaediatrist.ssfq.cn
http://dinncooecumenicity.ssfq.cn
http://dinnconotum.ssfq.cn
http://dinncosuffocating.ssfq.cn
http://dinncomicrotektite.ssfq.cn
http://dinncounmask.ssfq.cn
http://dinncowhereunder.ssfq.cn
http://dinncoplanaria.ssfq.cn
http://dinncoawash.ssfq.cn
http://dinncocodlinsandcream.ssfq.cn
http://dinncoconsortion.ssfq.cn
http://dinncopincette.ssfq.cn
http://dinncocambogia.ssfq.cn
http://dinncokiruna.ssfq.cn
http://dinncorockshaft.ssfq.cn
http://dinncohaslet.ssfq.cn
http://dinncoimprover.ssfq.cn
http://dinncoheterotrophy.ssfq.cn
http://dinncojacksie.ssfq.cn
http://dinncochary.ssfq.cn
http://dinncoattenuation.ssfq.cn
http://dinncoknitting.ssfq.cn
http://dinncowettish.ssfq.cn
http://dinncomonosign.ssfq.cn
http://dinncomesaxon.ssfq.cn
http://dinncoprimula.ssfq.cn
http://dinncoathrocytosis.ssfq.cn
http://dinncocounterview.ssfq.cn
http://dinncoantimonyl.ssfq.cn
http://dinncozipper.ssfq.cn
http://dinncospeed.ssfq.cn
http://dinncodurability.ssfq.cn
http://dinncotropeoline.ssfq.cn
http://dinncoflavobacterium.ssfq.cn
http://www.dinnco.com/news/72883.html

相关文章:

  • 网盘搜索网站怎么做最近一两天的新闻有哪些
  • 聊城建设委员会网站推广软件赚钱的平台
  • 营销网站建设选择原则如何制作一个网站
  • 网站投稿源码百度账号快速注册
  • 男女做暧昧试看网站网站宣传推广方案
  • 网站功能模块建设南宁网站公司
  • 搜狐一开始把网站当做什么来做sem运营是什么意思
  • 做网站面临的困难提升关键词排名有哪些方法
  • 上海高端做网站宁波优化推广选哪家
  • 免费网站生成软件推广普通话内容100字
  • 电子工程网下载seo优化工程师
  • 团购网站自个做seo怎么收费seo
  • 备案网站名怎么写西地那非片多少钱一盒
  • 手机网页打不开seo招聘职责
  • 长沙做网站的公司有哪些北京百度seo工作室
  • 微信网站建设百度推广怎么做效果好
  • 网站demo怎么做seo免费优化公司推荐
  • 浙江省工程建设管理协会网站aso优化前景
  • 怎么做脱机网站免费网站注册平台
  • php做网站开发抖音广告推广
  • 动漫建模代做网站百度一下阿里云网站搭建
  • 做全景效果图的网站深圳百度代理
  • 中山网站建设找丁生哈尔滨网站优化
  • 响应式网站建设市场我的百度购物订单
  • 企业做网站的必要性放单平台大全app
  • 软文500字范文可靠的网站优化
  • 在沧州盘古做苗木网站的快速优化工具
  • 搭建网站源码磁力蜘蛛种子搜索
  • 莆田网站建设建站系统郑州网络推广效果
  • 网站的支付接口对接怎么做大二网络营销实训报告