Kackle commited on
Commit
f04f125
·
verified ·
1 Parent(s): e8a32b8
Files changed (1) hide show
  1. app.py +32 -28
app.py CHANGED
@@ -371,25 +371,25 @@ class SlpMultiAgent:
371
  )
372
  print("Using OpenAI model (Gemini not available)")
373
 
374
- # Create comprehensive agents with multiple tools
375
  research_agent = CodeAgent(
376
- tools=[GoogleSearchTool(), WikipediaSearchTool(), WebScrapeTool(), KnowledgeBaseTool()],
377
  model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
378
- additional_authorized_imports=["re", "datetime", "math", "json", "requests", "pandas", "numpy", "time", "os", "tempfile", "uuid"],
379
- max_steps=3,
380
  name="ResearchAgent",
381
  verbosity_level=0,
382
- description="Research agent with Google Search, Wikipedia, web scraping, and knowledge lookup."
383
  )
384
 
385
  solver_agent = CodeAgent(
386
- tools=[MathTool(), CodeExecutorTool(), FileProcessorTool(), GoogleSearchTool()],
387
  model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
388
- additional_authorized_imports=["math", "re", "collections", "itertools", "pandas", "numpy", "json", "time", "os", "tempfile", "uuid", "requests"],
389
- max_steps=3,
390
  name="SolverAgent",
391
  verbosity_level=0,
392
- description="Problem solving with math, code execution, file processing, and search capabilities."
393
  )
394
 
395
  manager_agent = CodeAgent(
@@ -405,7 +405,7 @@ class SlpMultiAgent:
405
  additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
406
  planning_interval=1,
407
  verbosity_level=0,
408
- max_steps=4,
409
  final_answer_checks=[check_reasoning]
410
  )
411
 
@@ -421,31 +421,35 @@ class SlpMultiAgent:
421
  lambda: manager_agent.run(f"""
422
  Question: {short_question}
423
 
424
- IMPORTANT: Use ONLY the available tool functions, do NOT try to call functions directly in code.
 
 
 
 
 
425
 
426
- Available tools (call these as functions):
427
- - google_search(query="your search"): Web search (PRIMARY for factual questions)
428
- - math_calculator(expression="your math"): Mathematical calculations
429
- - file_processor(action="download/save/analyze_csv/analyze_excel", data="url/content/path"): File operations
430
- - knowledge_base(topic="your topic"): Structured knowledge lookup
431
 
432
- Managed agents (delegate to these):
433
- - ResearchAgent: For complex research tasks
434
- - SolverAgent: For complex problem solving
 
435
 
436
- Strategy:
437
- 1. For factual questions: Call google_search() directly
438
- 2. For calculations: Call math_calculator() directly
439
- 3. For complex tasks: Delegate to appropriate agent
440
 
441
- DO NOT write code that calls undefined functions like wikipedia_search().
442
 
443
- IMPORTANT: Always end with exactly this format:
444
  <code>
445
- final_answer("your direct answer")
446
  </code>
447
-
448
- Be concise and direct.
449
  """)
450
  )
451
  break # Success, exit retry loop
 
371
  )
372
  print("Using OpenAI model (Gemini not available)")
373
 
374
+ # Simplified research agent
375
  research_agent = CodeAgent(
376
+ tools=[GoogleSearchTool(), KnowledgeBaseTool()],
377
  model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
378
+ additional_authorized_imports=["re", "json"],
379
+ max_steps=2,
380
  name="ResearchAgent",
381
  verbosity_level=0,
382
+ description="Simple research with Google Search."
383
  )
384
 
385
  solver_agent = CodeAgent(
386
+ tools=[MathTool(), GoogleSearchTool()],
387
  model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
388
+ additional_authorized_imports=["math", "re"],
389
+ max_steps=2,
390
  name="SolverAgent",
391
  verbosity_level=0,
392
+ description="Simple problem solving with math and search."
393
  )
394
 
395
  manager_agent = CodeAgent(
 
405
  additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
406
  planning_interval=1,
407
  verbosity_level=0,
408
+ max_steps=2,
409
  final_answer_checks=[check_reasoning]
410
  )
411
 
 
421
  lambda: manager_agent.run(f"""
422
  Question: {short_question}
423
 
424
+ CRITICAL INSTRUCTIONS:
425
+ 1. Use tools DIRECTLY, not in code execution
426
+ 2. For factual questions: Use google_search() tool immediately
427
+ 3. For math: Use math_calculator() tool directly
428
+ 4. DO NOT write complex code - use tools instead
429
+ 5. DO NOT call ResearchAgent() or SolverAgent() in code
430
 
431
+ Available tools:
432
+ - google_search(query): Search the web
433
+ - math_calculator(expression): Calculate math
434
+ - file_processor(action, data): Handle files
435
+ - knowledge_base(topic): Get knowledge
436
 
437
+ SIMPLE APPROACH:
438
+ - Call the appropriate tool
439
+ - Get the result
440
+ - Provide final_answer()
441
 
442
+ Example for factual question:
443
+ 1. Call google_search("your query")
444
+ 2. Extract answer from results
445
+ 3. Call final_answer("the answer")
446
 
447
+ NO complex code execution. Use tools directly.
448
 
449
+ ALWAYS end with:
450
  <code>
451
+ final_answer("your answer here")
452
  </code>
 
 
453
  """)
454
  )
455
  break # Success, exit retry loop