Update app.py
Browse files
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):
|
| 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 |
-
#
|
| 205 |
-
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
model=effective_model,
|
| 208 |
-
|
| 209 |
-
additional_authorized_imports=["PIL"],
|
| 210 |
max_steps=CONFIG.AGENT_MAX_STEPS,
|
| 211 |
-
|
| 212 |
-
)
|
| 213 |
|
| 214 |
-
logger.info(f"QuestionAnsweringAgent initialized with model: {CONFIG.OPENAI_MODEL_ID}.")
|
|
|
|
| 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."
|