Update app.py
Browse files
app.py
CHANGED
|
@@ -183,7 +183,8 @@ class CalculatorTool(Tool):
|
|
| 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,15 +201,17 @@ class QuestionAnsweringAgent(CodeAgent):
|
|
| 200 |
api_key=openai_api_key
|
| 201 |
)
|
| 202 |
|
| 203 |
-
|
| 204 |
-
|
|
|
|
| 205 |
model=effective_model,
|
| 206 |
system_prompt=CONFIG.AGENT_SYSTEM_PROMPT,
|
| 207 |
additional_authorized_imports=["PIL"],
|
| 208 |
max_steps=CONFIG.AGENT_MAX_STEPS,
|
| 209 |
verbosity_level=CONFIG.AGENT_VERBOSITY_LEVEL
|
| 210 |
-
)
|
| 211 |
-
|
|
|
|
| 212 |
|
| 213 |
async def process_question(self, question_text: str) -> Tuple[str, str]:
|
| 214 |
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): # Level 1 indentation for method
|
| 187 |
+
# Level 2 indentation for lines inside the method
|
| 188 |
tools = [
|
| 189 |
WebSearchTool(session=http_session),
|
| 190 |
CalculatorTool(),
|
|
|
|
| 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."
|