cowrycode commited on
Commit
df42f38
·
verified ·
1 Parent(s): 98508a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -36,11 +36,36 @@ 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 = AgentWorkflow.from_tools_or_functions(
40
  [
41
  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
42
  ],
43
- llm=self.llm
 
44
  )
45
  async def run(self, question: str) -> str:
46
  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
+ self.agent_kwargs = {
40
+ "prefix": (
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
+ ),
55
+ "suffix": (
56
+ "Use the tools to research or calculate the answer.\n"
57
+ "If a tool fails, explain the reason for the failure instead of hallucinating an answer.\n"
58
+ "Provide concise and direct answers as requested in the questions. Do not add extra information unless explicitly asked for.\n"
59
+ "For example, if asked for a number, return only the number. If asked for a list, return only the list.\n"
60
+ ),
61
+ "input_variables": ["input", "agent_scratchpad"]
62
+ }
63
  self.agent = AgentWorkflow.from_tools_or_functions(
64
  [
65
  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
66
  ],
67
+ llm=self.llm,
68
+ **self.agent_kwargs,
69
  )
70
  async def run(self, question: str) -> str:
71
  print(f"Agent received question (first 50 chars): {question[:50]}...")