kylea's picture
added tools for downloading, files, wikipedia search
afb4047
raw
history blame contribute delete
972 Bytes
from typing import Any, Callable, List, Optional, cast
from langchain_tavily import TavilySearch # type: ignore[import-not-found]
from src.config import Configuration
from src.custom_tools import wikipedia, files, downloads
def search(query: str) -> Optional[dict[str, Any]]:
"""Search for general web results.
This function performs a search using the Tavily search engine, which is designed
to provide comprehensive, accurate, and trusted results. It's particularly useful
for answering questions about current events.
"""
configuration = Configuration.from_context()
wrapped = TavilySearch(max_results=configuration.max_search_results)
return cast(dict[str, Any], wrapped.invoke({"query": query}))
TOOLS: List[Callable[..., Any]] = [
search,
wikipedia.get_wiki_page_sections,
wikipedia.get_wiki_page_by_section,
downloads.download_file,
files.read_python,
files.read_excel,
files.transcribe_audio,
]