SergeyO7 commited on
Commit
1a73bd2
·
verified ·
1 Parent(s): ab5793d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +7 -1
agent.py CHANGED
@@ -90,7 +90,8 @@ class VisitWebpageTool(Tool):
90
  try:
91
  import requests
92
  from markdownify import markdownify
93
- from requests.exceptions import RequestException
 
94
 
95
  from smolagents.utils import truncate_content
96
  except ImportError as e:
@@ -126,6 +127,7 @@ class DownloadTaskAttachmentTool(Tool):
126
  inputs = {'task_id': {'type': 'string', 'description': 'The task id to download attachment from.'}}
127
  output_type = "string"
128
 
 
129
  def forward(self, task_id: str) -> str:
130
  """
131
  Downloads a file associated with the given task ID.
@@ -136,6 +138,10 @@ class DownloadTaskAttachmentTool(Tool):
136
 
137
  print(f"Downloading file for task ID {task_id} from {file_url}...")
138
  try:
 
 
 
 
139
  response = requests.get(file_url, stream=True, timeout=15)
140
  response.raise_for_status()
141
 
 
90
  try:
91
  import requests
92
  from markdownify import markdownify
93
+ from requests.exceptions
94
+ import RequestException
95
 
96
  from smolagents.utils import truncate_content
97
  except ImportError as e:
 
127
  inputs = {'task_id': {'type': 'string', 'description': 'The task id to download attachment from.'}}
128
  output_type = "string"
129
 
130
+
131
  def forward(self, task_id: str) -> str:
132
  """
133
  Downloads a file associated with the given task ID.
 
138
 
139
  print(f"Downloading file for task ID {task_id} from {file_url}...")
140
  try:
141
+
142
+ file_url = f"{DEFAULT_API_URL}/files/{task_id}"
143
+ local_path = f"downloads/{task_id}.xlsx"
144
+
145
  response = requests.get(file_url, stream=True, timeout=15)
146
  response.raise_for_status()
147