Update agent.py
Browse files
agent.py
CHANGED
@@ -77,9 +77,9 @@ def extract_excel_total_food_sales(file_path: str) -> str:
|
|
77 |
|
78 |
# Assemble tools with proper descriptions
|
79 |
TOOLS = [
|
80 |
-
FunctionTool.from_defaults(search_wikipedia, name="search_wikipedia", description="Search Wikipedia for facts and lists."
|
81 |
-
FunctionTool.from_defaults(run_python_code, name="run_python", description="Run Python code for logic, math, or set processing."
|
82 |
-
FunctionTool.from_defaults(get_youtube_transcript, name="get_youtube_transcript", description="Fetch transcript from YouTube video by URL."
|
83 |
FunctionTool.from_defaults(transcribe_audio, name="transcribe_audio", description="Transcribe MP3 audio file using Whisper."),
|
84 |
FunctionTool.from_defaults(extract_excel_total_food_sales, name="extract_excel_total_food_sales", description="Sum total sales from Excel where category is 'food'.")
|
85 |
]
|
@@ -90,8 +90,6 @@ llm = OpenAI(model="gpt-4")
|
|
90 |
agent = FunctionAgent(
|
91 |
tools=TOOLS,
|
92 |
llm=llm,
|
93 |
-
system_prompt="...",
|
94 |
-
max_iterations=5,
|
95 |
verbose=True,
|
96 |
system_prompt="""
|
97 |
You are a highly capable AI agent taking the GAIA benchmark test.
|
@@ -106,17 +104,12 @@ You have access to the following tools:
|
|
106 |
Rules:
|
107 |
1. Always try to use a tool if relevant.
|
108 |
2. Return ONLY the final answer in the requested format.
|
109 |
-
3. Do not guess. If a tool fails, say "Tool not available".
|
110 |
4. Follow formats strictly: comma-separated lists, numeric values, chess notation, names only, etc.
|
111 |
5. Avoid all explanation unless requested.
|
112 |
-
"""
|
113 |
-
)
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
return str(result).strip()
|
120 |
-
except Exception as e:
|
121 |
-
print("❌ Agent error:", e)
|
122 |
-
return "[ERROR] " + str(e)
|
|
|
77 |
|
78 |
# Assemble tools with proper descriptions
|
79 |
TOOLS = [
|
80 |
+
FunctionTool.from_defaults(search_wikipedia, name="search_wikipedia", description="Search Wikipedia for facts and lists."),
|
81 |
+
FunctionTool.from_defaults(run_python_code, name="run_python", description="Run Python code for logic, math, or set processing."),
|
82 |
+
FunctionTool.from_defaults(get_youtube_transcript, name="get_youtube_transcript", description="Fetch transcript from YouTube video by URL."),
|
83 |
FunctionTool.from_defaults(transcribe_audio, name="transcribe_audio", description="Transcribe MP3 audio file using Whisper."),
|
84 |
FunctionTool.from_defaults(extract_excel_total_food_sales, name="extract_excel_total_food_sales", description="Sum total sales from Excel where category is 'food'.")
|
85 |
]
|
|
|
90 |
agent = FunctionAgent(
|
91 |
tools=TOOLS,
|
92 |
llm=llm,
|
|
|
|
|
93 |
verbose=True,
|
94 |
system_prompt="""
|
95 |
You are a highly capable AI agent taking the GAIA benchmark test.
|
|
|
104 |
Rules:
|
105 |
1. Always try to use a tool if relevant.
|
106 |
2. Return ONLY the final answer in the requested format.
|
107 |
+
3. Do not guess. If a tool fails, say \"Tool not available\".
|
108 |
4. Follow formats strictly: comma-separated lists, numeric values, chess notation, names only, etc.
|
109 |
5. Avoid all explanation unless requested.
|
110 |
+
""",
|
|
|
111 |
|
112 |
+
tools=TOOLS,
|
113 |
+
llm=llm,
|
114 |
+
verbose=True,
|
115 |
+
|
|
|
|
|
|
|
|