Update agent.py
Browse files
agent.py
CHANGED
|
@@ -3,7 +3,6 @@ from typing import Dict
|
|
| 3 |
from langchain.agents import initialize_agent, AgentType
|
| 4 |
from langchain_community.tools import Tool, WikipediaQueryRun
|
| 5 |
from langchain_community.utilities import WikipediaAPIWrapper
|
| 6 |
-
from langchain_community.tools import DuckDuckGoSearchRun
|
| 7 |
from langchain_experimental.tools.python.tool import PythonREPLTool
|
| 8 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 9 |
|
|
@@ -19,16 +18,10 @@ class Agent:
|
|
| 19 |
convert_system_message_to_human=True
|
| 20 |
)
|
| 21 |
|
| 22 |
-
search = DuckDuckGoSearchRun()
|
| 23 |
wiki = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
|
| 24 |
python_tool = PythonREPLTool()
|
| 25 |
|
| 26 |
tools = [
|
| 27 |
-
Tool(
|
| 28 |
-
name="DuckDuckGo Search",
|
| 29 |
-
func=search.run,
|
| 30 |
-
description="Useful for answering factual, current event, or open-domain questions."
|
| 31 |
-
),
|
| 32 |
Tool(
|
| 33 |
name="Wikipedia",
|
| 34 |
func=wiki.run,
|
|
@@ -58,3 +51,4 @@ class Agent:
|
|
| 58 |
return result.strip()
|
| 59 |
except Exception as e:
|
| 60 |
return f"AGENT ERROR: {str(e)}"
|
|
|
|
|
|
| 3 |
from langchain.agents import initialize_agent, AgentType
|
| 4 |
from langchain_community.tools import Tool, WikipediaQueryRun
|
| 5 |
from langchain_community.utilities import WikipediaAPIWrapper
|
|
|
|
| 6 |
from langchain_experimental.tools.python.tool import PythonREPLTool
|
| 7 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 8 |
|
|
|
|
| 18 |
convert_system_message_to_human=True
|
| 19 |
)
|
| 20 |
|
|
|
|
| 21 |
wiki = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
|
| 22 |
python_tool = PythonREPLTool()
|
| 23 |
|
| 24 |
tools = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
Tool(
|
| 26 |
name="Wikipedia",
|
| 27 |
func=wiki.run,
|
|
|
|
| 51 |
return result.strip()
|
| 52 |
except Exception as e:
|
| 53 |
return f"AGENT ERROR: {str(e)}"
|
| 54 |
+
|