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

德语网站制作网站建设与网页设计期末考试

德语网站制作,网站建设与网页设计期末考试,个人网站模板 php,wordpress 变慢背景 楼主决定提升与LLM交互的质量#xff0c;之前是直接prompt-answer的范式#xff0c;现在我希望能用上ReAct策略和能够检索StackOverflow#xff0c;让同一款LLM发挥出更大的作用。 难点 1. 怎样调用StackOverflow step1 pip install stackspi step 2 from la… 背景 楼主决定提升与LLM交互的质量之前是直接prompt-answer的范式现在我希望能用上ReAct策略和能够检索StackOverflow让同一款LLM发挥出更大的作用。 难点 1. 怎样调用StackOverflow step1 pip install stackspi step 2 from langchain.agents import load_toolstools load_tools([stackexchange],llmllm ) 注stackoverflow是stackexchange的子网站  2. 交互次数太多token输入超出了llm限制 approach 1 使用ConversationSummaryBufferMemory 这种记忆方式会把之前的对话内容总结一下限制在设定的token个数内 from langchain.memory import ConversationSummaryBufferMemorymemory ConversationSummaryBufferMemory(llm llm, # 这里的llm的作用是总结max_token_limit4097,memory_keychat_history ) approach 2 设置参数max_iterations agent ZeroShotAgent(llm_chainllm_chain, toolstools, max_iterations4, # 限制最大交互次数防止token超过上限verboseTrue ) 3. llm总是回复无法回答 很多教程把温度设置成0说是为了得到最准确的答案但是我发现这样设置agent会变得特别谨慎直接说它不知道温度调高以后问题解决了。 测试问题 What parts does a JUnit4 unit test case consist of? 代码 from constants import PROXY_URL,KEYimport warnings warnings.filterwarnings(ignore)import langchain langchain.debug Truefrom langchain.agents import load_tools from langchain.chat_models import ChatOpenAIfrom langchain.agents import AgentExecutor, ZeroShotAgent from langchain.chains import LLMChain from langchain.memory import ConversationSummaryBufferMemoryllm ChatOpenAI(temperature0.7, # 如果参数调得很低会导致LLM特别谨慎最后不给答案model_namegpt-3.5-turbo-0613, openai_api_keyKEY,openai_api_basePROXY_URL )memory ConversationSummaryBufferMemory(llm llm, # 这里的llm的作用是总结max_token_limit4097,memory_keychat_history )prefix You should be a proficient and helpful assistant in java unit testing with JUnit4 framework. You have access to the following tools: suffix Begin!{chat_history} Question: {input} {agent_scratchpad}tools load_tools([stackexchange],llmllm )prompt ZeroShotAgent.create_prompt(tools,prefixprefix,suffixsuffix,input_variables[input, chat_history, agent_scratchpad], ) # 这里集成了ReActllm_chain LLMChain(llmllm, promptprompt)agent ZeroShotAgent(llm_chainllm_chain, toolstools, max_iterations4, # 限制最大交互次数防止token超过上限verboseTrue )agent_chain AgentExecutor.from_agent_and_tools(agentagent, toolstools, verboseTrue, memorymemory )def ask_agent(question):answer agent_chain.run(inputquestion)return answerdef main():test_question What parts does a JUnit4 unit test case consist of?test_answer ask_agent(test_question)return test_answerif __name__ __main__:main()最后输出 [chain/end] [1:chain:AgentExecutor] [75.12s] Exiting Chain run with output: {   output: A JUnit4 unit test case consists of the following parts:\n1.  Test class: This is a class that contains the test methods.\n2. Test methods: These are the methods that contain the actual test code. They are annotated with the Test annotation.\n3. Assertions: These are used to verify  the expected behavior of the code being tested. JUnit provides various assertion methods for this purpose.\n4. Annotations: JUnit provides several annotations that can be used to configure the test case, such as Before, After, BeforeClass, and AfterClass.\n\nOverall, a JUnit4 unit test case  is a class that contains test methods with assertions, and can be configured using annotations. }
http://www.dnsts.com.cn/news/19433.html

相关文章:

  • 网站设计的思想编程做网站容易还是做软件
  • 新乡企业建网站免费建立个人网站官网
  • 58同城一样的网站怎样建设个人养老金制度9月底前亮相
  • 制作网站步骤兴宁房产网
  • 做网站要坚持qq空间网站根目录
  • 建设内部网站目的让网站快速收录
  • jsp网站服务建设是什么国外美容院网站
  • 做网站主播要什么条件广州网站制作一般多少钱
  • 湛江怎么做网站关键词优化做网站怎么兼职
  • 广州网站设计首选刻腾讯有做淘宝客网站吗
  • 做搜索引擎的网站北京公司网站
  • 烟台哪个公司做网站好wordpress防止cc
  • dw网站log怎么做微信做单网站
  • 德州哪家网站优化好南京做网站找哪家好
  • 网站开发主流语言多多鱼网页模板
  • 建设淘宝网站需要多少钱做100个网站挂广告联盟
  • 桂林网站制作找志合网络公司做旅游网站教程
  • 海北公司网站建设哪家快沂源网站开发
  • 滨州哪里做网站郑州上市企业网站建设
  • 建一个公司网站多少钱?优化大师网页版
  • 建站属于什么行业盐城做网站哪家公司好
  • 网上商城网站模板网站建设报价购物
  • 网站建设代理哪个好免费建网站程序
  • 大连好的网站建设公司郑州自助建站软件
  • 17做网站广州沙河地址广东省建设工程金匠奖公布网站
  • 网页设计好的网站企业微信crm
  • 网站搭建多少钱购物平台排行榜2021
  • 北京朝阳网站设计做ps的素材哪个网站
  • 承接做网站的网站南京网站设计网站建设
  • 天眼查官网入口网页版百度关键词优化企业