diff --git a/xiaogpt/langchain/chain.py b/xiaogpt/langchain/chain.py index a7ffe094..e9bcbd3e 100644 --- a/xiaogpt/langchain/chain.py +++ b/xiaogpt/langchain/chain.py @@ -2,8 +2,7 @@ from langchain.agents import AgentType from langchain.tools import BaseTool from langchain.llms import OpenAI - -# from langchain.chains import LLMMathChain +from langchain.chains import LLMMathChain from langchain.utilities import SerpAPIWrapper from langchain.chat_models import ChatOpenAI from langchain.memory import ChatMessageHistory @@ -25,13 +24,13 @@ def agent_search(query): # Initialization: search chain, mathematical calculation chain, custom summary email chain search = SerpAPIWrapper() - # llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=False) + llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=False) mail_summary = MailSummaryTool() # Tool list: search, mathematical calculations, custom summary emails tools = [ Tool(name="Search", func=search.run, description="如果你不知道或不确定答案,可以使用这个搜索引擎检索答案"), - # Tool(name="Calculator", func=llm_math_chain.run, description="在需要回答数学问题时非常有用"), + Tool(name="Calculator", func=llm_math_chain.run, description="在需要回答数学问题时非常有用"), Tool( name="MailSummary", func=mail_summary.run,