Update agent.py
Browse files
agent.py
CHANGED
@@ -77,7 +77,7 @@ 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."),
|
@@ -88,6 +88,7 @@ TOOLS = [
|
|
88 |
llm = OpenAI(model="gpt-4")
|
89 |
|
90 |
agent = FunctionAgent(
|
|
|
91 |
tools=TOOLS,
|
92 |
llm=llm,
|
93 |
verbose=True,
|
@@ -101,6 +102,24 @@ You have access to the following tools:
|
|
101 |
- Audio transcriber (Whisper, MP3)
|
102 |
- Excel food sales analyzer
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
Rules:
|
105 |
1. Always try to use a tool if relevant.
|
106 |
2. Return ONLY the final answer in the requested format.
|
@@ -112,4 +131,4 @@ Rules:
|
|
112 |
tools=TOOLS,
|
113 |
llm=llm,
|
114 |
verbose=True,
|
115 |
-
|
|
|
77 |
|
78 |
# Assemble tools with proper descriptions
|
79 |
TOOLS = [
|
80 |
+
FunctionTool.from_defaults(search_wikipedia, return_direct=True, 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."),
|
|
|
88 |
llm = OpenAI(model="gpt-4")
|
89 |
|
90 |
agent = FunctionAgent(
|
91 |
+
max_iterations=5,
|
92 |
tools=TOOLS,
|
93 |
llm=llm,
|
94 |
verbose=True,
|
|
|
102 |
- Audio transcriber (Whisper, MP3)
|
103 |
- Excel food sales analyzer
|
104 |
|
105 |
+
Rules:
|
106 |
+
1. Always try to use a tool if relevant.
|
107 |
+
2. Return ONLY the final answer in the requested format.
|
108 |
+
3. Do not guess. If a tool fails, say \"Tool not available\".
|
109 |
+
4. Follow formats strictly: comma-separated lists, numeric values, chess notation, names only, etc.
|
110 |
+
5. Avoid all explanation unless requested.
|
111 |
+
"""
|
112 |
+
|
113 |
+
system_prompt="""
|
114 |
+
You are a highly capable AI agent taking the GAIA benchmark test.
|
115 |
+
|
116 |
+
You have access to the following tools:
|
117 |
+
- Wikipedia search for factual lookups
|
118 |
+
- Python runner for math, logic, or text analysis
|
119 |
+
- YouTube transcript fetcher (via URL)
|
120 |
+
- Audio transcriber (Whisper, MP3)
|
121 |
+
- Excel food sales analyzer
|
122 |
+
|
123 |
Rules:
|
124 |
1. Always try to use a tool if relevant.
|
125 |
2. Return ONLY the final answer in the requested format.
|
|
|
131 |
tools=TOOLS,
|
132 |
llm=llm,
|
133 |
verbose=True,
|
134 |
+
|