SergeyO7 commited on
Commit
4ec0db1
·
verified ·
1 Parent(s): b27c2d4

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +5 -2
agent.py CHANGED
@@ -50,6 +50,7 @@ import whisper
50
  # """
51
  # # Extract URL from question using regex
52
  # url_pattern = r'https?://\S+'
 
53
  # match = re.search(url_pattern, question)
54
  # if not match:
55
  # return "No image URL found in the question."
@@ -280,9 +281,9 @@ class MagAgent:
280
  )
281
  print("MagAgent initialized.")
282
 
283
- async def __call__(self, question: str) -> str:
284
  """Process a question asynchronously using the MagAgent."""
285
- print(f"MagAgent received question (first 50 chars): {question[:50]}...")
286
 
287
  try:
288
  if self.rate_limiter:
@@ -291,6 +292,8 @@ class MagAgent:
291
  # Define a task with fallback search logic
292
  task = (
293
  f"Answer the following question accurately and concisely: {question}\n"
 
 
294
  )
295
  response = await asyncio.to_thread(
296
  self.agent.run,
 
50
  # """
51
  # # Extract URL from question using regex
52
  # url_pattern = r'https?://\S+'
53
+
54
  # match = re.search(url_pattern, question)
55
  # if not match:
56
  # return "No image URL found in the question."
 
281
  )
282
  print("MagAgent initialized.")
283
 
284
+ async def __call__(self, question: str, tast_id) -> str:
285
  """Process a question asynchronously using the MagAgent."""
286
+ print(f"MagAgent received question (first 50 chars): {question[:50]}... Task ID: {task_id}"")
287
 
288
  try:
289
  if self.rate_limiter:
 
292
  # Define a task with fallback search logic
293
  task = (
294
  f"Answer the following question accurately and concisely: {question}\n"
295
+ f"If the question references an attachment, use the download_file tool with task_id: {task_id}\n"
296
+ f"Return the answer as a string."
297
  )
298
  response = await asyncio.to_thread(
299
  self.agent.run,