cowrycode commited on
Commit
326e25c
·
verified ·
1 Parent(s): 461780e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -23
app.py CHANGED
@@ -36,34 +36,32 @@ class BasicAgent:
36
  # [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
37
  # llm=self.llm,
38
  # )
39
- self.agent_kwargs = {
40
- "template": (
41
- "You are a helpful AI assistant completing GAIA benchmark tasks.\n"
42
- "You MUST use the tools provided to answer the user's question. Do not answer from your own knowledge.\n"
43
- "Carefully analyze the question to determine the most appropriate tool to use.\n"
44
- "Here are guidelines for using the tools:\n"
45
- "- Use 'wikipedia_search_tool' to find factual information about topics, events, people, etc. (e.g., 'Use wikipedia_search to find the population of France').\n"
46
- "- Use 'youtube_transcript_tool' to extract transcripts from YouTube videos when the question requires understanding the video content. (e.g., 'Use youtube_transcript to summarize the key points of this video').\n"
47
- "- Use 'transcribe_audio_tool' to transcribe uploaded audio files. (e.g., 'Use audio_transcriber to get the text from this audio recording').\n"
48
- "- Use 'solve_chess_image_tool' to analyze and solve chess puzzles from images. (e.g., 'Use chess_image_solver to determine the best move in this chess position').\n"
49
- "- Use 'parse_file_and_summarize_tool' to parse and analyze data from Excel or CSV files. (e.g., 'Use file_parser to calculate the average sales from this data').\n"
50
- "- Use 'vegetable_classifier_tool' to classify a list of food items and extract only the vegetables. (e.g., 'Use vegetable_classifier_2022 to get a list of the vegetables in this grocery list').\n"
51
- "- Use 'excel_food_sales_sum_tool' to extract total food sales from excel files. (e.g., 'Use excel_food_sales_sum to calculate the total food sales').\n"
52
- "- Use 'google_web_search_tool' to find factual information about topics, events, people, from the web if not spificied to be fund in wikipedia etc. (e.g., 'find the population of France').\n"
53
- "Do NOT guess or make up answers. If a tool cannot provide the answer, truthfully respond that you were unable to find the information.\n"
54
- "Use the tools to research or calculate the answer.\n"
55
- "If a tool fails, explain the reason for the failure instead of hallucinating an answer.\n"
56
- "Provide concise and direct answers as requested in the questions. Do not add extra information unless explicitly asked for.\n"
57
- "For example, if asked for a number, return only the number. If asked for a list, return only the list.\n"
58
- ),
59
- "input_variables": ["input", "agent_scratchpad"]
60
- }
61
  self.agent = AgentWorkflow.from_tools_or_functions(
62
  [
63
  wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool,transcribe_audio_tool, excel_food_sales_sum_tool, parse_file_and_summarize_tool, solve_chess_image_tool, vegetable_classifier_tool
64
  ],
65
  llm=self.llm,
66
- **self.agent_kwargs,
 
67
  )
68
  async def run(self, question: str) -> str:
69
  print(f"Agent received question (first 50 chars): {question[:50]}...")
 
36
  # [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
37
  # llm=self.llm,
38
  # )
39
+ system_prompt = (
40
+ "You are a helpful AI assistant completing GAIA benchmark tasks.\n"
41
+ "You MUST use the tools provided to answer the user's question. Do not answer from your own knowledge.\n"
42
+ "Carefully analyze the question to determine the most appropriate tool to use.\n"
43
+ "Here are guidelines for using the tools:\n"
44
+ "- Use 'wikipedia_search_tool' to find factual information about topics, events, people, etc. (e.g., 'Use wikipedia_search to find the population of France').\n"
45
+ "- Use 'youtube_transcript_tool' to extract transcripts from YouTube videos when the question requires understanding the video content. (e.g., 'Use youtube_transcript to summarize the key points of this video').\n"
46
+ "- Use 'transcribe_audio_tool' to transcribe uploaded audio files. (e.g., 'Use audio_transcriber to get the text from this audio recording').\n"
47
+ "- Use 'solve_chess_image_tool' to analyze and solve chess puzzles from images. (e.g., 'Use chess_image_solver to determine the best move in this chess position').\n"
48
+ "- Use 'parse_file_and_summarize_tool' to parse and analyze data from Excel or CSV files. (e.g., 'Use file_parser to calculate the average sales from this data').\n"
49
+ "- Use 'vegetable_classifier_tool' to classify a list of food items and extract only the vegetables. (e.g., 'Use vegetable_classifier_2022 to get a list of the vegetables in this grocery list').\n"
50
+ "- Use 'excel_food_sales_sum_tool' to extract total food sales from excel files. (e.g., 'Use excel_food_sales_sum to calculate the total food sales').\n"
51
+ "- Use 'google_web_search_tool' to find factual information about topics, events, people, from the web if not spificied to be fund in wikipedia etc. (e.g., 'find the population of France').\n"
52
+ "Do NOT guess or make up answers. If a tool cannot provide the answer, truthfully respond that you were unable to find the information.\n"
53
+ "Use the tools to research or calculate the answer.\n"
54
+ "If a tool fails, explain the reason for the failure instead of hallucinating an answer.\n"
55
+ "Provide concise and direct answers as requested in the questions. Do not add extra information unless explicitly asked for.\n"
56
+ "For example, if asked for a number, return only the number. If asked for a list, return only the list.\n"
57
+ )
 
 
 
58
  self.agent = AgentWorkflow.from_tools_or_functions(
59
  [
60
  wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool,transcribe_audio_tool, excel_food_sales_sum_tool, parse_file_and_summarize_tool, solve_chess_image_tool, vegetable_classifier_tool
61
  ],
62
  llm=self.llm,
63
+ system_prompt=system_prompt,
64
+ verbose=True,
65
  )
66
  async def run(self, question: str) -> str:
67
  print(f"Agent received question (first 50 chars): {question[:50]}...")