Spaces:
Running
Running
Search api tool
Browse files- agents/BasicAgent.py +3 -2
agents/BasicAgent.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import os
|
2 |
|
3 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, HfApiModel, LiteLLMModel, Tool
|
4 |
from langchain_community.tools.wikidata.tool import WikidataAPIWrapper, WikidataQueryRun
|
|
|
5 |
|
6 |
class BasicAgent(CodeAgent):
|
7 |
def __init__(self):
|
@@ -27,7 +28,7 @@ class BasicAgent(CodeAgent):
|
|
27 |
# TOOLS
|
28 |
print("Initializing tools...")
|
29 |
try:
|
30 |
-
search_tool =
|
31 |
visit_tool = VisitWebpageTool()
|
32 |
wikidata = Tool.from_langchain(WikidataQueryRun(api_wrapper=WikidataAPIWrapper()))
|
33 |
tools = [search_tool, visit_tool, wikidata]
|
|
|
1 |
import os
|
2 |
|
3 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, HfApiModel, LiteLLMModel, Tool, GoogleSearchTool
|
4 |
from langchain_community.tools.wikidata.tool import WikidataAPIWrapper, WikidataQueryRun
|
5 |
+
from langchain_community.tools.brave_search.tool import BraveSearch
|
6 |
|
7 |
class BasicAgent(CodeAgent):
|
8 |
def __init__(self):
|
|
|
28 |
# TOOLS
|
29 |
print("Initializing tools...")
|
30 |
try:
|
31 |
+
search_tool = Tool.from_langchain(BraveSearch.from_api_key(os.environ.get("SEARCH_API_KEY", "")))
|
32 |
visit_tool = VisitWebpageTool()
|
33 |
wikidata = Tool.from_langchain(WikidataQueryRun(api_wrapper=WikidataAPIWrapper()))
|
34 |
tools = [search_tool, visit_tool, wikidata]
|