SergeyO7 commited on
Commit
115b71b
·
verified ·
1 Parent(s): 7ee92e4

Rename agent14.py to agent.py

Browse files
Files changed (1) hide show
  1. agent14.py → agent.py +5 -4
agent14.py → agent.py RENAMED
@@ -217,7 +217,7 @@ class MagAgent:
217
  - Use the name of the file ONLY FROM the "FILE:" section. THIS IS ALWAYS A FILE.
218
  IMPORTANT: When giving the final answer, output only the direct required result without any extra text like "Final Answer:" or explanations. YOU MUST RESPOND IN THE EXACT FORMAT AS THE QUESTION.
219
  QUESTION: {question}
220
- FILE: {context}
221
  ANSWER:
222
  """
223
  )
@@ -240,10 +240,11 @@ class MagAgent:
240
  while not self.rate_limiter.consume(1):
241
  print(f"Rate limit reached. Waiting...")
242
  await asyncio.sleep(4)
243
- # Format the prompt with question and file_path as context
244
- task = self.prompt.format(
 
245
  question=question,
246
- context=file_path if file_path else ""
247
  )
248
  print(f"Calling agent.run...")
249
  response = await asyncio.to_thread(self.agent.run, task=task)
 
217
  - Use the name of the file ONLY FROM the "FILE:" section. THIS IS ALWAYS A FILE.
218
  IMPORTANT: When giving the final answer, output only the direct required result without any extra text like "Final Answer:" or explanations. YOU MUST RESPOND IN THE EXACT FORMAT AS THE QUESTION.
219
  QUESTION: {question}
220
+ {file_section}
221
  ANSWER:
222
  """
223
  )
 
240
  while not self.rate_limiter.consume(1):
241
  print(f"Rate limit reached. Waiting...")
242
  await asyncio.sleep(4)
243
+ # Conditionally include FILE: section only if file_path is provided
244
+ file_section = f"FILE: {file_path}" if file_path else ""
245
+ task = self.prompt_template.format(
246
  question=question,
247
+ file_section=file_section
248
  )
249
  print(f"Calling agent.run...")
250
  response = await asyncio.to_thread(self.agent.run, task=task)