Spaces:
Sleeping
Sleeping
Update multiple_tools.py
Browse files- multiple_tools.py +5 -0
multiple_tools.py
CHANGED
|
@@ -3,6 +3,7 @@ import json
|
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from llama_index.core.tools import FunctionTool
|
| 5 |
from llama_index.tools.google import GoogleSearchToolSpec
|
|
|
|
| 6 |
|
| 7 |
load_dotenv()
|
| 8 |
google_key = os.getenv("GOOGLE_SECRET_KEY")
|
|
@@ -10,6 +11,10 @@ my_search_engine = os.getenv("Google_WebSearch_Engine")
|
|
| 10 |
|
| 11 |
g_search = GoogleSearchToolSpec(key=google_key, engine=my_search_engine, num=3)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def google_web_search(query : str) -> str:
|
| 14 |
"""
|
| 15 |
Searches the web and returns the most accurate response for a user query.
|
|
|
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from llama_index.core.tools import FunctionTool
|
| 5 |
from llama_index.tools.google import GoogleSearchToolSpec
|
| 6 |
+
from llama_index.tools.wikipedia import WikipediaToolSpec
|
| 7 |
|
| 8 |
load_dotenv()
|
| 9 |
google_key = os.getenv("GOOGLE_SECRET_KEY")
|
|
|
|
| 11 |
|
| 12 |
g_search = GoogleSearchToolSpec(key=google_key, engine=my_search_engine, num=3)
|
| 13 |
|
| 14 |
+
#Wikipedia Search Tool
|
| 15 |
+
wikipedia_tool = WikipediaToolSpec()
|
| 16 |
+
wikipedia_search_tool = FunctionTool.from_defaults(wikipedia_tool.search_data)
|
| 17 |
+
|
| 18 |
def google_web_search(query : str) -> str:
|
| 19 |
"""
|
| 20 |
Searches the web and returns the most accurate response for a user query.
|