notsakeeb commited on
Commit
5c280cb
·
verified ·
1 Parent(s): e96192c

Update ToolSet.py

Browse files
Files changed (1) hide show
  1. ToolSet.py +22 -0
ToolSet.py CHANGED
@@ -12,6 +12,27 @@ from langchain_community.tools.tavily_search import TavilySearchResults
12
  from langchain_community.document_loaders import WikipediaLoader
13
  from langchain_community.document_loaders import ArxivLoader
14
  from langchain.tools import Tool, tool
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  @tool
17
  def multiply(a: float, b: float) -> float:
@@ -368,6 +389,7 @@ def transcription_generation_tool() -> Tool:
368
  )
369
 
370
  toolset = [
 
371
  get_web_search_result,
372
  wiki_search,
373
  arxiv_search,
 
12
  from langchain_community.document_loaders import WikipediaLoader
13
  from langchain_community.document_loaders import ArxivLoader
14
  from langchain.tools import Tool, tool
15
+ from utils import GaiaClient
16
+
17
+
18
+ DOWNLOAD_PATH = Path("questions")
19
+ DOWNLOAD_PATH.mkdir(exist_ok=True)
20
+
21
+
22
+ @tool
23
+ def download_file(task_id: str, filename: str) -> str:
24
+ """
25
+ Download the file for the given task id.
26
+ Args:
27
+ task_id: The id of the task to download a related file.
28
+ filename: Path to store the file to.
29
+ """
30
+ client = GaiaClient(DOWNLOAD_PATH, None, None, api_url="https://agents-course-unit4-scoring.hf.space")
31
+ result = client.download_file_for_task(task_id, filename)
32
+
33
+ return (
34
+ f"File downloaded at {result}. You can read this file to process its contents."
35
+ )
36
 
37
  @tool
38
  def multiply(a: float, b: float) -> float:
 
389
  )
390
 
391
  toolset = [
392
+ download_file,
393
  get_web_search_result,
394
  wiki_search,
395
  arxiv_search,