llamasrock commited on
Commit
e490829
·
verified ·
1 Parent(s): 127e416

Create tools.py

Browse files
Files changed (1) hide show
  1. tools.py +16 -0
tools.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+
3
+ @tool
4
+ def get_file(task_id: str) -> IO:
5
+ '''
6
+ Downloads the file associated with the given task_id, if one exists and is mapped.
7
+ If the question mentions an attachment, use this function.
8
+ Args:
9
+ task_id: Id of the question.
10
+ Returns:
11
+ The file associated with the question.
12
+ '''
13
+ file_request = requests.get(url=f'https://agents-course-unit4-scoring.hf.space/files/{task_id}')
14
+ file_request.raise_for_status()
15
+
16
+ return file_request