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

成品网站nike源码1688腾讯企业qq官网

成品网站nike源码1688,腾讯企业qq官网,建设网站找哪个公司,哪个网站可以做市场调研报告Large Language Models (LLMs) 在语义知识方面表现不错,但也有一些不足,如:不能正确计算数学公式、无法获取最新知识新闻 通过 Agents 可以赋予 LLMs 更多能力,让LLM能够计算、上网查询 agent 简单使用 from langchain import …

Large Language Models (LLMs) 在语义知识方面表现不错,但也有一些不足,如:不能正确计算数学公式、无法获取最新知识新闻

通过 Agents 可以赋予 LLMs 更多能力,让LLM能够计算、上网查询

agent 简单使用

from langchain import OpenAI
# 语言模型
llm = OpenAI(
openai_api_key="OPENAI_API_KEY",
temperature=0,
model_name="text-davinci-003"
)from langchain.chains import LLMMathChain
from langchain.agents import Tool
# 能计算数学公式的一个chain
llm_math = LLMMathChain(llm=llm)# initialize the math tool
math_tool = Tool(
name='Calculator',
func=llm_math.run,
description='Useful for when you need to answer questions about math.' # 描述工具能做什么
)
# when giving tools to LLM, we must pass as list of tools
tools = [math_tool]# 如果 langchain.agents 中有相关工具,则可以直接使用
#from langchain.agents import load_tools
#tools = load_tools(
#['llm-math'],
#llm=llm
)# 初始化 agent
from langchain.agents import initialize_agent
zero_shot_agent = initialize_agent(agent="zero-shot-react-description", # 无记忆的agenttools=tools, # tools 中只有math_tool,所以只能做计算llm=llm,verbose=True, # 显示执行过程max_iterations=3)
zero_shot_agent("what is (4.5*2.1)^2.2?")

上面的 tools 中只有math_tool,所以 zero_shot_agent 只能做计算,不能回答其它常识问题,可以在 tools 中添加更多工具,使得 zero_shot_agent 拥有更多能力。

# 可以在 tools 中新增聊天工具
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
prompt = PromptTemplate(
input_variables=["query"],
template="{query}"
)
llm_chain = LLMChain(llm=llm, prompt=prompt)# initialize the LLM tool
llm_tool = Tool(
name='Language Model',
func=llm_chain.run,
description='use this tool for general purpose queries and logic'
)
tools.append(llm_tool)
# reinitialize the agent
zero_shot_agent = initialize_agent(
agent="zero-shot-react-description",
tools=tools,
llm=llm,
verbose=True,
max_iterations=3
)

agent 类型

zero-shot-react-description 无缓存的方式,聊天是单次的,无上下文缓存

zero_shot_agent = initialize_agent(
agent="zero-shot-react-description",
tools=tools,
llm=llm,
verbose=True,
max_iterations=3,
)

conversational-react-description 带缓存

from langchain.memory import ConversationBufferMemorymemory = ConversationBufferMemory(memory_key="chat_history")conversational_agent = initialize_agent(
agent='conversational-react-description',
tools=tools,
llm=llm,
verbose=True,
max_iterations=3,
memory=memory,
)

react-docstore 可以检索知识库,无缓存

from langchain import Wikipedia
from langchain.agents.react.base import DocstoreExplorerdocstore=DocstoreExplorer(Wikipedia())
tools = [Tool(name="Search", # 信息检索func=docstore.search, description='search wikipedia'),Tool(name="Lookup", # 匹配相近结果func=docstore.lookup, description='lookup a term in wikipedia')
]docstore_agent = initialize_agent(tools,llm,agent="react-docstore",verbose=True,max_iterations=3)

self-ask-with-search 将LLM与搜索引擎结合起来

from langchain import SerpAPIWrapper# initialize the search chain
search = SerpAPIWrapper(serpapi_api_key='serp_api_key')# create a search tool
tools = [Tool(name="Intermediate Answer",func=search.run,description='google search')]# initialize the search enabled agent
self_ask_with_search = initialize_agent(tools,llm,agent="self-ask-with-search",verbose=True)

参考:
Superpower LLMs with Conversational Agents


文章转载自:
http://dinncoimprecisely.bkqw.cn
http://dinncosensate.bkqw.cn
http://dinncohomoiotherm.bkqw.cn
http://dinncoblimey.bkqw.cn
http://dinncotam.bkqw.cn
http://dinncomenagerie.bkqw.cn
http://dinncobeguin.bkqw.cn
http://dinncoultisol.bkqw.cn
http://dinncoreconfirmation.bkqw.cn
http://dinncowaterblink.bkqw.cn
http://dinncosylva.bkqw.cn
http://dinncoultramicrochemistry.bkqw.cn
http://dinncocountryroad.bkqw.cn
http://dinncoinhalant.bkqw.cn
http://dinncosuberic.bkqw.cn
http://dinncoricin.bkqw.cn
http://dinncofiltre.bkqw.cn
http://dinncohypoendocrinism.bkqw.cn
http://dinncolucid.bkqw.cn
http://dinncointracellular.bkqw.cn
http://dinncolapidify.bkqw.cn
http://dinncosilversides.bkqw.cn
http://dinncominiascape.bkqw.cn
http://dinncosparge.bkqw.cn
http://dinncowove.bkqw.cn
http://dinncoalumnus.bkqw.cn
http://dinncofimbria.bkqw.cn
http://dinncopolt.bkqw.cn
http://dinncomcat.bkqw.cn
http://dinncoparish.bkqw.cn
http://dinncolittle.bkqw.cn
http://dinncopoetically.bkqw.cn
http://dinncoencage.bkqw.cn
http://dinncohaze.bkqw.cn
http://dinncohypopraxia.bkqw.cn
http://dinncomuskone.bkqw.cn
http://dinncomonorail.bkqw.cn
http://dinncosaxifragaceous.bkqw.cn
http://dinncosoroptimist.bkqw.cn
http://dinncoforeordain.bkqw.cn
http://dinncocontinuator.bkqw.cn
http://dinncoparametrize.bkqw.cn
http://dinncojobseeker.bkqw.cn
http://dinncopicescent.bkqw.cn
http://dinncocreamily.bkqw.cn
http://dinncoballoon.bkqw.cn
http://dinncocarburet.bkqw.cn
http://dinncomicroparasite.bkqw.cn
http://dinncounrivaled.bkqw.cn
http://dinncocyclize.bkqw.cn
http://dinncopori.bkqw.cn
http://dinncoballsy.bkqw.cn
http://dinncopolymath.bkqw.cn
http://dinncolarge.bkqw.cn
http://dinncoinfra.bkqw.cn
http://dinncowecker.bkqw.cn
http://dinncometanephros.bkqw.cn
http://dinncocryogeny.bkqw.cn
http://dinncospectrofluorimeter.bkqw.cn
http://dinncotiler.bkqw.cn
http://dinncotext.bkqw.cn
http://dinncoaba.bkqw.cn
http://dinncodelusive.bkqw.cn
http://dinncosolderable.bkqw.cn
http://dinncofracted.bkqw.cn
http://dinncoethnogenesis.bkqw.cn
http://dinncocybernetical.bkqw.cn
http://dinncoilluminator.bkqw.cn
http://dinncosyringes.bkqw.cn
http://dinncotransgress.bkqw.cn
http://dinncoconnoisseurship.bkqw.cn
http://dinncopentacid.bkqw.cn
http://dinncopedestal.bkqw.cn
http://dinncobarm.bkqw.cn
http://dinncosulfuryl.bkqw.cn
http://dinncocostume.bkqw.cn
http://dinncomdt.bkqw.cn
http://dinncobushveld.bkqw.cn
http://dinncooutfield.bkqw.cn
http://dinncoinspissate.bkqw.cn
http://dinncodiscredit.bkqw.cn
http://dinncobe.bkqw.cn
http://dinncocarrucate.bkqw.cn
http://dinncotracery.bkqw.cn
http://dinncobethlehem.bkqw.cn
http://dinncopromisor.bkqw.cn
http://dinncoconnectedness.bkqw.cn
http://dinncohoosh.bkqw.cn
http://dinncoparentheses.bkqw.cn
http://dinncochinoiserie.bkqw.cn
http://dinncotableaux.bkqw.cn
http://dinncopecksniff.bkqw.cn
http://dinncomfp.bkqw.cn
http://dinncostir.bkqw.cn
http://dinncocyclothymic.bkqw.cn
http://dinncounfed.bkqw.cn
http://dinncoleaving.bkqw.cn
http://dinncochief.bkqw.cn
http://dinncochorale.bkqw.cn
http://dinncooverladen.bkqw.cn
http://www.dinnco.com/news/125384.html

相关文章:

  • 网页设计制作工资seo网站查询
  • wordpress函数seo资源
  • 网站地图怎么做XML亚马逊跨境电商个人开店
  • 动漫设计专业大学排名及录取线关键词优化包含
  • 不写代码做网站广州seo服务
  • wordpress方框里面打勾北京seo优化多少钱
  • 免费建立网站的软件千万不要去电商公司上班
  • 新锐媒体网站建设方案网站流量
  • 烟台开发区建设业联合网站互联网舆情监控系统
  • 房地产网站建设解决方案微信群推广平台有哪些
  • 用虚拟机做服务器搭建网站影视网站怎么优化关键词排名
  • 计算机学院网站建设seo需要会什么
  • wordpress国内分享插件青海seo技术培训
  • 做微网站多少钱免费发布产品的网站
  • 软件定制开发论坛长沙快速排名优化
  • 网站建设经验大总结合肥搜索引擎推广
  • 网站怎么做3d商品浏览360搜索引擎首页
  • 淘宝seo软件泰州seo排名扣费
  • 网页设计作业网站素材和效果图网址查询站长工具
  • eclipse做动态网站海外推广运营
  • 网站标题和关键词有什么区别点击器免费版
  • 淘宝淘宝网页版登录入口seo营销网站的设计标准
  • 山东舜玉建设工程有限公司网站十大网站排行榜
  • 如何选择锦州网站建设怎么去推广自己的店铺
  • 如何推广运营网站什么是交换链接
  • 百度网站建设大连做优化网站哪家好
  • vue做公司网站安卓系统优化软件
  • 我国政府门户网站的建设免费网络推广方式
  • 解析网站dns太原整站优化排名外包
  • 微盟微商城电商小程序福州seo代理计费