APRG commited on
Commit
7a81e9f
·
verified ·
1 Parent(s): 4e8d51c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,7 +4,7 @@ import requests
4
  import inspect
5
  import pandas as pd
6
  from langchain_google_genai import ChatGoogleGenerativeAI
7
- from tools import InternetSearchTool, WebscraperTool, ExcelTool, WikipediaTool
8
  from smolagents import CodeAgent, InferenceClientModel
9
 
10
  # (Keep Constants as is)
@@ -23,12 +23,12 @@ class BasicAgent:
23
  search_tool = InternetSearchTool()
24
  webscraper_tool = WebscraperTool()
25
  excel_tool = ExcelTool()
26
- python_tool = PythonTool()
27
  wikipedia_tool = WikipediaTool()
28
 
29
  # Create agent
30
  self.agent= CodeAgent(
31
- tools=[search_tool, webscraper_tool, excel_tool, python_tool, wikipedia_tool],
32
  model=InferenceClientModel(token=os.getenv("HF_TOKEN"), provider="together"),
33
  add_base_tools=True, # Add any additional base tools
34
  planning_interval=3, # Enable planning every 3 steps
@@ -49,7 +49,7 @@ class BasicAgent:
49
  return summary
50
 
51
  def __call__(self, question: str) -> str:
52
- prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
53
 
54
  QUESTION:
55
  """
 
4
  import inspect
5
  import pandas as pd
6
  from langchain_google_genai import ChatGoogleGenerativeAI
7
+ from tools import InternetSearchTool, WebscraperTool, ExcelTool, WikipediaTool, MediaTool
8
  from smolagents import CodeAgent, InferenceClientModel
9
 
10
  # (Keep Constants as is)
 
23
  search_tool = InternetSearchTool()
24
  webscraper_tool = WebscraperTool()
25
  excel_tool = ExcelTool()
26
+ media_tool = MediaTool()
27
  wikipedia_tool = WikipediaTool()
28
 
29
  # Create agent
30
  self.agent= CodeAgent(
31
+ tools=[search_tool, webscraper_tool, excel_tool, media_tool, wikipedia_tool],
32
  model=InferenceClientModel(token=os.getenv("HF_TOKEN"), provider="together"),
33
  add_base_tools=True, # Add any additional base tools
34
  planning_interval=3, # Enable planning every 3 steps
 
49
  return summary
50
 
51
  def __call__(self, question: str) -> str:
52
+ prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string. If a tool required for task completion is unavailable after multiple tries, return 0.
53
 
54
  QUESTION:
55
  """