wt002 commited on
Commit
54ac85e
·
verified ·
1 Parent(s): 22ce37a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -37
app.py CHANGED
@@ -434,13 +434,13 @@ class BasicAgent:
434
 
435
  try:
436
  # Initialize all tool instances
437
- self.search_tool = DuckDuckGoSearchTool()
438
- self.wiki_search_tool = WikiSearchTool() # Ensure this class is defined/imported
439
- self.str_reverse_tool = StringReverseTool() # Ensure this class is defined/imported
440
- self.keywords_extract_tool = KeywordsExtractorTool() # Ensure this class is defined/imported
441
- self.speech_to_text_tool = SpeechToTextTool() # Ensure this class is defined/imported
442
- self.visit_webpage_tool = VisitWebpageTool() # Ensure this class is defined/imported
443
- self.final_answer_tool = FinalAnswerTool()
444
  except Exception as e:
445
  raise RuntimeError(f"Error initializing tools: {e}")
446
 
@@ -452,7 +452,6 @@ class BasicAgent:
452
  self.code_llama_tool = CodeLlamaTool() # Ensure this class is defined/imported
453
  self.parse_excel_to_json_tool = ParseExcelToJsonTool()
454
 
455
-
456
 
457
  system_prompt_template = """
458
  You are my general AI assistant. Your task is to answer the question I asked.
@@ -466,40 +465,40 @@ If the answer is a comma-separated list, apply the above rules for each element
466
 
467
  # Create web agent with image analysis capability
468
  try:
469
- self.web_agent = ToolCallingAgent(
470
- tools=[
471
- self.search_tool, # Use the initialized DuckDuckGoSearchTool instance
472
- self.visit_webpage_tool,
473
- self.image_analysis_tool
474
- ],
475
- model=self.model, # Use self.model
476
- max_steps=10,
477
- name="web_search_agent",
478
- description="Runs web searches and analyzes images",
479
- )
480
  except Exception as e:
481
  raise RuntimeError(f"Error initializing web agent: {e}")
482
 
483
  # Create main agent with all capabilities
484
  try:
485
- self.agent = CodeAgent(
486
- model=self.model, # Use self.model
487
- tools=[
488
- self.search_tool,
489
- self.wiki_search_tool,
490
- self.str_reverse_tool,
491
- self.keywords_extract_tool,
492
- self.speech_to_text_tool,
493
- self.visit_webpage_tool,
494
- self.final_answer_tool,
495
- self.video_transcription_tool,
496
- self.code_llama_tool,
497
- self.parse_excel_to_json_tool,
498
- self.image_analysis_tool, # Use the initialized instance
499
- self.analyse_attachment_tool # Add the initialized attachment analysis tool
500
- ],
501
- add_base_tools=True # Consider what this adds, ensure it doesn't duplicate.
502
- )
503
  except Exception as e:
504
  raise RuntimeError(f"Error initializing web agent: {e}")
505
 
 
434
 
435
  try:
436
  # Initialize all tool instances
437
+ self.search_tool = DuckDuckGoSearchTool()
438
+ self.wiki_search_tool = WikiSearchTool() # Ensure this class is defined/imported
439
+ self.str_reverse_tool = StringReverseTool() # Ensure this class is defined/imported
440
+ self.keywords_extract_tool = KeywordsExtractorTool() # Ensure this class is defined/imported
441
+ self.speech_to_text_tool = SpeechToTextTool() # Ensure this class is defined/imported
442
+ self.visit_webpage_tool = VisitWebpageTool() # Ensure this class is defined/imported
443
+ self.final_answer_tool = FinalAnswerTool()
444
  except Exception as e:
445
  raise RuntimeError(f"Error initializing tools: {e}")
446
 
 
452
  self.code_llama_tool = CodeLlamaTool() # Ensure this class is defined/imported
453
  self.parse_excel_to_json_tool = ParseExcelToJsonTool()
454
 
 
455
 
456
  system_prompt_template = """
457
  You are my general AI assistant. Your task is to answer the question I asked.
 
465
 
466
  # Create web agent with image analysis capability
467
  try:
468
+ self.web_agent = ToolCallingAgent(
469
+ tools=[
470
+ self.search_tool, # Use the initialized DuckDuckGoSearchTool instance
471
+ self.visit_webpage_tool,
472
+ self.image_analysis_tool
473
+ ],
474
+ model=self.model, # Use self.model
475
+ max_steps=10,
476
+ name="web_search_agent",
477
+ description="Runs web searches and analyzes images",
478
+ )
479
  except Exception as e:
480
  raise RuntimeError(f"Error initializing web agent: {e}")
481
 
482
  # Create main agent with all capabilities
483
  try:
484
+ self.agent = CodeAgent(
485
+ model=self.model, # Use self.model
486
+ tools=[
487
+ self.search_tool,
488
+ self.wiki_search_tool,
489
+ self.str_reverse_tool,
490
+ self.keywords_extract_tool,
491
+ self.speech_to_text_tool,
492
+ self.visit_webpage_tool,
493
+ self.final_answer_tool,
494
+ self.video_transcription_tool,
495
+ self.code_llama_tool,
496
+ self.parse_excel_to_json_tool,
497
+ self.image_analysis_tool, # Use the initialized instance
498
+ self.analyse_attachment_tool # Add the initialized attachment analysis tool
499
+ ],
500
+ add_base_tools=True # Consider what this adds, ensure it doesn't duplicate.
501
+ )
502
  except Exception as e:
503
  raise RuntimeError(f"Error initializing web agent: {e}")
504