SergeyO7 commited on
Commit
62ad819
·
verified ·
1 Parent(s): 5a88daf

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +19 -18
agent.py CHANGED
@@ -1,4 +1,5 @@
1
- from smolagents import CodeAgent, LiteLLMModel, tool, Tool, load_tool, DuckDuckGoSearchTool, WikipediaSearchTool
 
2
  import asyncio
3
  import os
4
  import re
@@ -168,20 +169,20 @@ class MagAgent:
168
  max_tokens=8192
169
  )
170
 
171
- self.imports = [
172
- "pandas",
173
- "numpy",
174
- "os",
175
- "requests",
176
- "tempfile",
177
- "datetime",
178
- "json",
179
- "time",
180
- "re",
181
- "openpyxl",
182
- "pathlib",
183
- "sys",
184
- ]
185
 
186
  self.tools = [
187
  RetryDuckDuckGoSearchTool(),
@@ -200,12 +201,12 @@ class MagAgent:
200
  Follow these principles:
201
  - Be precise and concise. The final answer must strictly match the required format with no extra commentary.
202
  - Use tools intelligently. If a question involves external information, structured data, images, or audio, call the appropriate tool to retrieve or process it.
203
- - If the question includes direct speech or quoted text (e.g., "Isn't that hot?"), treat it as a precise query and preserve the quoted structure in your response, including quotation marks for direct quotes (e.g., final_answer('"Extremely."')).
204
  - If the question references an attachment, the file path is provided in the FILE section. Use the appropriate tool based on the file extension to process it.
205
  - When processing external data (e.g., YouTube transcripts, web searches), expect potential issues like missing punctuation, inconsistent formatting, or conversational text.
206
  - If the input is ambiguous, prioritize extracting key information relevant to the question.
207
  - Provide answers that are concise, accurate, and properly punctuated according to standard English grammar.
208
- - Use quotation marks for direct quotes (e.g., "Extremely.") and appropriate punctuation for lists, sentences, or clarifications.
209
  - If asked about the name of a place or city, use the full complete name without abbreviations (e.g., use Saint Petersburg instead of St.Petersburg).
210
  - If you cannot retrieve or process data (e.g., due to blocked requests), return a clear error message: "Unable to retrieve data. Please refine the question or check external sources."
211
  - Reason step-by-step. Think through the solution logically and plan your actions carefully before answering.
@@ -225,7 +226,7 @@ class MagAgent:
225
  tools=self.tools,
226
  add_base_tools=True,
227
  additional_authorized_imports=self.imports,
228
- verbosity_level=2,
229
  max_steps=20
230
  )
231
  print("MagAgent initialized.")
 
1
+ from smolagents import CodeAgent, LiteLLMModel, tool, Tool, load_tool, DuckDuckGoSearchTool
2
+ , WikipediaSearchTool
3
  import asyncio
4
  import os
5
  import re
 
169
  max_tokens=8192
170
  )
171
 
172
+ # self.imports = [
173
+ # "pandas",
174
+ # "numpy",
175
+ # "os",
176
+ # "requests",
177
+ # "tempfile",
178
+ # "datetime",
179
+ # "json",
180
+ # "time",
181
+ # "re",
182
+ # "openpyxl",
183
+ # "pathlib",
184
+ # "sys",
185
+ # ]
186
 
187
  self.tools = [
188
  RetryDuckDuckGoSearchTool(),
 
201
  Follow these principles:
202
  - Be precise and concise. The final answer must strictly match the required format with no extra commentary.
203
  - Use tools intelligently. If a question involves external information, structured data, images, or audio, call the appropriate tool to retrieve or process it.
204
+ - If the question includes direct speech or quoted text (e.g., "Isn't that hot?"), treat it as a precise query and preserve the quoted structure in your response, including quotation marks for direct quotes (e.g., final_answer('"Extremely"')).
205
  - If the question references an attachment, the file path is provided in the FILE section. Use the appropriate tool based on the file extension to process it.
206
  - When processing external data (e.g., YouTube transcripts, web searches), expect potential issues like missing punctuation, inconsistent formatting, or conversational text.
207
  - If the input is ambiguous, prioritize extracting key information relevant to the question.
208
  - Provide answers that are concise, accurate, and properly punctuated according to standard English grammar.
209
+ - Use quotation marks for direct quotes (e.g., "Extremely") and appropriate punctuation for lists, sentences, or clarifications.
210
  - If asked about the name of a place or city, use the full complete name without abbreviations (e.g., use Saint Petersburg instead of St.Petersburg).
211
  - If you cannot retrieve or process data (e.g., due to blocked requests), return a clear error message: "Unable to retrieve data. Please refine the question or check external sources."
212
  - Reason step-by-step. Think through the solution logically and plan your actions carefully before answering.
 
226
  tools=self.tools,
227
  add_base_tools=True,
228
  additional_authorized_imports=self.imports,
229
+ verbosity_level=1,
230
  max_steps=20
231
  )
232
  print("MagAgent initialized.")