GoodLuckChuck commited on
Commit
f24fa86
·
verified ·
1 Parent(s): 72e43a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -10
app.py CHANGED
@@ -183,8 +183,7 @@ class CalculatorTool(Tool):
183
 
184
  # --- Agent Definition ---
185
  class QuestionAnsweringAgent(CodeAgent):
186
- def __init__(self, http_session: aiohttp.ClientSession, model: Optional[OpenAIServerModel] = None): # Level 1 indentation for method
187
- # Level 2 indentation for lines inside the method
188
  tools = [
189
  WebSearchTool(session=http_session),
190
  CalculatorTool(),
@@ -201,17 +200,28 @@ class QuestionAnsweringAgent(CodeAgent):
201
  api_key=openai_api_key
202
  )
203
 
204
- # This is the super().__init__() call
205
- super().__init__( # Level 2 indentation
206
- tools=tools, # Level 3 indentation (or aligned with 'tools=')
 
 
 
 
 
 
 
 
 
 
 
207
  model=effective_model,
208
- system_prompt=CONFIG.AGENT_SYSTEM_PROMPT,
209
- additional_authorized_imports=["PIL"],
210
  max_steps=CONFIG.AGENT_MAX_STEPS,
211
- verbosity_level=CONFIG.AGENT_VERBOSITY_LEVEL
212
- ) # Closing parenthesis might be aligned with super() or the last argument
213
 
214
- logger.info(f"QuestionAnsweringAgent initialized with model: {CONFIG.OPENAI_MODEL_ID}.") # Level 2 indentation
 
215
 
216
  async def process_question(self, question_text: str) -> Tuple[str, str]:
217
  reasoning_trace = "Agent execution started."
 
183
 
184
  # --- Agent Definition ---
185
  class QuestionAnsweringAgent(CodeAgent):
186
+ def __init__(self, http_session: aiohttp.ClientSession, model: Optional[OpenAIServerModel] = None):
 
187
  tools = [
188
  WebSearchTool(session=http_session),
189
  CalculatorTool(),
 
200
  api_key=openai_api_key
201
  )
202
 
203
+ # Explicitly list arguments intended for CodeAgent's own __init__ logic
204
+ # These are parameters that CodeAgent handles itself.
205
+ code_agent_specific_kwargs = {
206
+ "system_prompt": CONFIG.AGENT_SYSTEM_PROMPT,
207
+ "additional_authorized_imports": ["PIL"],
208
+ "verbosity_level": CONFIG.AGENT_VERBOSITY_LEVEL
209
+ # "code_writer": None, # If you were using a custom one
210
+ }
211
+
212
+ # Call super() with arguments known/expected by CodeAgent's direct signature
213
+ # and that it then passes appropriately (or not) to MultiStepAgent.
214
+ # This assumes CodeAgent correctly filters what it passes to super()
215
+ # or that these specific ones are indeed handled before the super() call.
216
+ super().__init__(
217
  model=effective_model,
218
+ tools=tools,
 
219
  max_steps=CONFIG.AGENT_MAX_STEPS,
220
+ **code_agent_specific_kwargs
221
+ )
222
 
223
+ logger.info(f"QuestionAnsweringAgent initialized with model: {CONFIG.OPENAI_MODEL_ID}.")
224
+
225
 
226
  async def process_question(self, question_text: str) -> Tuple[str, str]:
227
  reasoning_trace = "Agent execution started."