Scott Cogan
commited on
Commit
·
292d225
1
Parent(s):
7f23189
latest requirements
Browse files- utilities.py +5 -3
utilities.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
from typing import IO
|
|
|
|
| 3 |
|
| 4 |
@tool
|
| 5 |
def get_file(task_id: str) -> IO:
|
|
@@ -9,9 +11,9 @@ def get_file(task_id: str) -> IO:
|
|
| 9 |
Args:
|
| 10 |
task_id: Id of the question.
|
| 11 |
Returns:
|
| 12 |
-
The file associated with the question.
|
| 13 |
'''
|
| 14 |
file_request = requests.get(url=f'https://agents-course-unit4-scoring.hf.space/files/{task_id}')
|
| 15 |
file_request.raise_for_status()
|
| 16 |
|
| 17 |
-
return file_request
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
from langchain_core.tools import tool
|
| 3 |
from typing import IO
|
| 4 |
+
from io import BytesIO
|
| 5 |
|
| 6 |
@tool
|
| 7 |
def get_file(task_id: str) -> IO:
|
|
|
|
| 11 |
Args:
|
| 12 |
task_id: Id of the question.
|
| 13 |
Returns:
|
| 14 |
+
The file associated with the question as a BytesIO object.
|
| 15 |
'''
|
| 16 |
file_request = requests.get(url=f'https://agents-course-unit4-scoring.hf.space/files/{task_id}')
|
| 17 |
file_request.raise_for_status()
|
| 18 |
|
| 19 |
+
return BytesIO(file_request.content)
|