cowrycode commited on
Commit
fe197e5
·
verified ·
1 Parent(s): 5e1dddb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -39,6 +39,30 @@ class BasicAgent:
39
  # llm=self.llm
40
  # )
41
  OpenAI_key = os.getenv("OPEN_AI_TOKEN")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  self.llm = OpenAI(model="gpt-4o-mini", temperature=0.2, api_key=OpenAI_key)
43
  self.agent = AgentWorkflow.from_tools_or_functions(
44
  [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
 
39
  # llm=self.llm
40
  # )
41
  OpenAI_key = os.getenv("OPEN_AI_TOKEN")
42
+ agent_kwargs = {
43
+ "prefix": (
44
+ "You are a helpful AI assistant completing GAIA benchmark tasks.\n"
45
+ "You MUST use the tools provided to answer the user's question. Do not answer from your own knowledge.\n"
46
+ "Carefully analyze the question to determine the most appropriate tool to use.\n"
47
+ "Here are guidelines for using the tools:\n"
48
+ "- Use 'wikipedia_search' to find factual information about topics, events, people, etc. (e.g., 'Use wikipedia_search to find the population of France').\n"
49
+ "- Use 'youtube_transcript' 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"
50
+ "- Use 'audio_transcriber' to transcribe uploaded audio files. (e.g., 'Use audio_transcriber to get the text from this audio recording').\n"
51
+ "- Use 'chess_image_solver' to analyze and solve chess puzzles from images. (e.g., 'Use chess_image_solver to determine the best move in this chess position').\n"
52
+ "- Use 'file_parser' to parse and analyze data from Excel or CSV files. (e.g., 'Use file_parser to calculate the average sales from this data').\n"
53
+ "- Use 'vegetable_classifier_2022' 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"
54
+ "- Use 'excel_food_sales_sum' to extract total food sales from excel files. (e.g., 'Use excel_food_sales_sum to calculate the total food sales').\n"
55
+ "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"
56
+ ),
57
+ "suffix": (
58
+ "Use the tools to research or calculate the answer.\n"
59
+ "If a tool fails, explain the reason for the failure instead of hallucinating an answer.\n"
60
+ "Provide concise and direct answers as requested in the questions. Do not add extra information unless explicitly asked for.\n"
61
+ "For example, if asked for a number, return only the number. If asked for a list, return only the list.\n"
62
+ ),
63
+ "max_iterations": 100,
64
+ "verbose": false
65
+ }
66
  self.llm = OpenAI(model="gpt-4o-mini", temperature=0.2, api_key=OpenAI_key)
67
  self.agent = AgentWorkflow.from_tools_or_functions(
68
  [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],