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

公司手机网站效果图网站建设远程培训

公司手机网站效果图,网站建设远程培训,网络科技公司名称,网站企业建设libraryIO的链接#xff1a;https://libraries.io/pypi/langchain-decorators 来colab玩玩它的demo 感觉这确实是个挺好用的库 想到之前纯调prompt来控制输出格式的痛苦#xff0c;这个可太有效了 cool~ 最下面这个react的多智能体例子很好玩#xff0c;来看看… libraryIO的链接https://libraries.io/pypi/langchain-decorators 来colab玩玩它的demo 感觉这确实是个挺好用的库 想到之前纯调prompt来控制输出格式的痛苦这个可太有效了 cool~ 最下面这个react的多智能体例子很好玩来看看 from typing import List from langchain_decorators import llm_prompt from langchain.agents import load_tools from langchain.tools.base import BaseTool from textwrap import dedent from langchain_decorators import PromptTypes from langchain_decorators.output_parsers import JsonOutputParser import jsontools load_tools([ llm-math], llmGlobalSettings.get_current_settings().default_llm)# you may, or may not use pydantic as your base class... totally up to you class MultilingualAgent:def __init__(self, tools:List[BaseTool],result_language:strNone) - None:self.tools tools# we can refer to our field in all out promptsself.result_language result_languageself.agent_scratchpad # we initialize our scratchpadself.feedback # we initialize our feedback if we get some error# other settingsself.iterations10self.agent_format_instructions dedent(\# Reasoning... write your reasoning here ...# Tooljson{{tool: name of the tool to use,tool_input: the input for the tool}}# Observationoutput from the tool... repeat this # Reasoning, # Tool, # Observation sequence multiple times until you know the final answer, when you write:# Final answer... write the final answer )propertydef tools_description(self)-str: # we can refer to properties in out prompts tooreturn \n.join([f - {tool.name}: {tool.description} for tool in self.tools])# we defined prompt type here, which will make llm_prompt(prompt_typePromptTypes.AGENT_REASONING, output_parsermarkdown, stop_tokens[Observation], verboseTrue)def reason(self)-dict:The system prompt:prompt:systemYou are an assistant that uses reasoning and tools to help user. You use tools for the task the tool is designed to. Before answering the question and/or using the tool, you should write down the explanation. Here is the list of tools available:{tools_description}Use this format:{agent_format_instructions}{? in {result_language}?} here ...{?Make sure to write the final answer in in {result_language}!?} User question:prompt:user{question}Scratchpad:prompt:assistant{agent_scratchpad}prompt:user{feedback}returndef act(self, tool_name:str, tool_input:str)-str:tool next((tool for tool in self.tools if tool.name.lower()tool_name.lower()tool_name.lower()))if tool is None:self.feedback fTool {tool_name} is not available. Available tools are: {self.tools_description}returnelse:try:result tool.run(tool_input)except Exception as e:if self.feedback is not None:# weve already experienced an error, so we are not going to try forever... lets raise this oneraise eself.feedback fTool {tool_name} failed with error: {e}.\nLets fix it and try again.tool_instructions json.dumps({tool:tool.name, tool_input:tool_input})self.agent_scratchpad f# Tool\njson\n{tool_instructions}\n\n# Observation\n\nResult from tool {tool_name}:\n\t{result}\ndef run(self, question):for i in range(self.iterations):reasoning self.reason(questionquestion)if reasoning.get(Final answer) is not None:return reasoning.get(Final answer)else:tool_info reasoning.get(Tool)tool_name, tool_input (None, None)if tool_info:tool_info_parsed JsonOutputParser().parse(tool_info)tool_name tool_info_parsed.get(tool)tool_input tool_info_parsed.get(tool_input)if tool_name is None or tool_input is None:self.feedback Your response was not in the expected format. Please make sure to response in correct format:\n self.agent_format_instructions continueself.act(tool_name, tool_input)raise Exception(fFailed to answer the question after {self.iterations} iterations. Last result: {reasoning})agent MultilingualAgent(toolstools, result_languageGerman )result agent.run(What is the surface of a sphere with radius with diameter of 100km?)print(\n\nHere is the agents answer:, result)下面是输出 这个包确实能带来不少方便~
http://www.zqtcl.cn/news/146612/

相关文章:

  • 建设企业网站官网下载中心游戏网站开发设计报告
  • 外贸网站导航栏建设技巧专做奢侈品品牌的网站
  • 网站开发工程师资格证网站建设代理都有哪些
  • 汕头网站建设技术托管wordpress faq
  • 外贸网站建设系统能联系做仿瓷的网站
  • 阿里云网站域名绑定做网站的需要哪些职位
  • cnnic网站备案dnf网站上怎么做商人
  • 怎么做微拍网站代理记账公司注册
  • 长宁深圳网站建设公司建材公司网站建设方案
  • 做网站哪些软件比较好wordpress的留言功能
  • 域名申请好了怎么做网站山西手机版建站系统信息
  • 维度网络网站建设广东水利建设与管理信息网站
  • 浏阳市商务局网站溪江农贸市场建设做关于车的网站有哪些
  • 网站建设教程资源网站网站制作网站的
  • 公司网页是什么被公司优化掉是什么意思
  • 酒店网站建设方案结束语慈溪企业排名网站
  • 做行业网站广告能赚多少钱百度搜索下载安装
  • 寺院网站建设网页搭建
  • 网站设计报价是多少wordpress登录接口
  • 灵宝网站建设建h5网站费用
  • 泊头做网站的有哪些深圳网页制作与网站建设服务器
  • 网站设计的思路网页无法访问百度
  • 简述你对于网站建设的认识网络工程就业岗位有哪些
  • 征婚网站上教人做恒指期货做网站颜色黑色代码多少
  • 海南省建设工程质量监督网站如何做搞笑原创视频网站
  • 网页游戏人气排行榜百度seo插件
  • 免费申请论坛网站更改域名代理商对网站有影响吗
  • 河南做网站公司报价工商做年报网站
  • 用狐狸做logo的网站现在网站开发技术有哪些
  • html 网站添加悬浮二维码瑜伽网站设计