Spaces:
Runtime error
Runtime error
Update tools.py
Browse files
tools.py
CHANGED
@@ -1,8 +1,21 @@
|
|
|
|
|
|
1 |
from langchain.tools import Tool
|
2 |
-
from langchain_community.tools import DuckDuckGoSearchRun
|
|
|
3 |
from langchain_experimental.utilities import PythonREPL
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
python_repl = PythonREPL()
|
8 |
repl_tool = Tool(
|
|
|
1 |
+
import getpass
|
2 |
+
import os
|
3 |
from langchain.tools import Tool
|
4 |
+
# from langchain_community.tools import DuckDuckGoSearchRun
|
5 |
+
from langchain_tavily import TavilySearch
|
6 |
from langchain_experimental.utilities import PythonREPL
|
7 |
|
8 |
+
|
9 |
+
if not os.environ.get("TAVILY_API_KEY"):
|
10 |
+
os.environ["TAVILY_API_KEY"] = getpass.getpass("Tavily API key:\n")
|
11 |
+
|
12 |
+
# web_search_tool = DuckDuckGoSearchRun()
|
13 |
+
|
14 |
+
# Initialize Tavily Search Tool
|
15 |
+
tavily_search_tool = TavilySearch(
|
16 |
+
max_results=5,
|
17 |
+
topic="general",
|
18 |
+
)
|
19 |
|
20 |
python_repl = PythonREPL()
|
21 |
repl_tool = Tool(
|