add tool for bing search

This commit is contained in:
Hardik Shah 2024-09-08 17:25:52 -07:00
parent 741310f78e
commit 640c5f8ab9
5 changed files with 79 additions and 10 deletions

View file

@ -18,6 +18,7 @@ from llama_toolchain.tools.builtin import (
BraveSearchTool,
CodeInterpreterTool,
PhotogenTool,
RemoteSearchTool,
WolframAlphaTool,
)
from llama_toolchain.tools.safety import with_safety
@ -63,10 +64,13 @@ class MetaReferenceAgenticSystemImpl(AgenticSystem):
raise ValueError("Wolfram API key not defined in config")
tool = WolframAlphaTool(key)
elif isinstance(tool_defn, BraveSearchToolDefinition):
key = self.config.brave_search_api_key
if not key:
raise ValueError("Brave API key not defined in config")
tool = BraveSearchTool(key)
if tool_defn.remote_execution is not None:
tool = RemoteSearchTool(tool_defn.remote_execution)
else:
key = self.config.brave_search_api_key
if not key:
raise ValueError("Brave API key not defined in config")
tool = BraveSearchTool(key)
elif isinstance(tool_defn, CodeInterpreterToolDefinition):
tool = CodeInterpreterTool()
elif isinstance(tool_defn, PhotogenToolDefinition):