Spaces:
Runtime error
Runtime error
Mike Jay
commited on
Commit
·
7f1778f
1
Parent(s):
4bea841
tweaking prompt
Browse files- agents/manager_agent.py +15 -0
- app.py +4 -2
- prompts.py +12 -1
- questions.py +2 -2
agents/manager_agent.py
CHANGED
@@ -21,3 +21,18 @@ def manager_agent_factory() -> CodeAgent:
|
|
21 |
planning_interval=3,
|
22 |
max_steps=20,
|
23 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
planning_interval=3,
|
22 |
max_steps=20,
|
23 |
)
|
24 |
+
|
25 |
+
|
26 |
+
# managed template task / report
|
27 |
+
|
28 |
+
# additional_authorized_imports=["requests"]
|
29 |
+
|
30 |
+
|
31 |
+
# "tools": self.tools,
|
32 |
+
# "managed_agents": self.managed_agents,
|
33 |
+
# "authorized_imports": (
|
34 |
+
# "You can import from any package you want."
|
35 |
+
# if "*" in self.authorized_imports
|
36 |
+
# else str(self.authorized_imports)
|
37 |
+
# ),
|
38 |
+
# "custom_instructions": self.instructions,
|
app.py
CHANGED
@@ -12,7 +12,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
12 |
API_URL = DEFAULT_API_URL
|
13 |
QUESTIONS_URL = f"{API_URL}/questions"
|
14 |
SUBMIT_URL = f"{API_URL}/submit"
|
15 |
-
FILES_URL =
|
16 |
|
17 |
SPACE_ID = os.getenv("SPACE_ID")
|
18 |
if SPACE_ID:
|
@@ -52,7 +52,9 @@ def run_and_submit_all(
|
|
52 |
if error_message:
|
53 |
return error_message, None
|
54 |
|
55 |
-
questions_data = get_questions_data(
|
|
|
|
|
56 |
if not questions_data:
|
57 |
print("Questions list is empty.")
|
58 |
return "Questions list is empty or invalid format.", None
|
|
|
12 |
API_URL = DEFAULT_API_URL
|
13 |
QUESTIONS_URL = f"{API_URL}/questions"
|
14 |
SUBMIT_URL = f"{API_URL}/submit"
|
15 |
+
FILES_URL = f"{API_URL}/files"
|
16 |
|
17 |
SPACE_ID = os.getenv("SPACE_ID")
|
18 |
if SPACE_ID:
|
|
|
52 |
if error_message:
|
53 |
return error_message, None
|
54 |
|
55 |
+
questions_data = get_questions_data(
|
56 |
+
questions_url=QUESTIONS_URL, files_url=FILES_URL
|
57 |
+
)
|
58 |
if not questions_data:
|
59 |
print("Questions list is empty.")
|
60 |
return "Questions list is empty or invalid format.", None
|
prompts.py
CHANGED
@@ -5,4 +5,15 @@ def get_better_task_statement(question_text: str, file_name: str = None) -> str:
|
|
5 |
"""Get Task Satement"""
|
6 |
task_statement = question_text
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
"""Get Task Satement"""
|
6 |
task_statement = question_text
|
7 |
|
8 |
+
if file_name:
|
9 |
+
local_file_name = "/".join(["data", file_name])
|
10 |
+
file_info = f"File {local_file_name} related to task is stored locally on disk."
|
11 |
+
task_statement = " ".join([question_text, file_info])
|
12 |
+
|
13 |
+
agent_run_statement = f"""Your are providing answers on GAIA test questions which
|
14 |
+
require prescribed and precise answers for GAIA scoring.
|
15 |
+
Your answers should satisfy the General AI Assistant(GAIA): AI Agents Evaluation Benchmark.
|
16 |
+
|
17 |
+
{task_statement}
|
18 |
+
"""
|
19 |
+
return agent_run_statement
|
questions.py
CHANGED
@@ -13,8 +13,8 @@ def _get_task_files(files_url: str, questions_data: dict):
|
|
13 |
file_name = item.get("file_name")
|
14 |
local_file = "/".join(["data", file_name])
|
15 |
if task_id and file_name:
|
16 |
-
file_url = "/".join([files_url,
|
17 |
-
response = requests.get(file_url, stream=True)
|
18 |
response.raise_for_status()
|
19 |
with open(local_file, "wb") as f:
|
20 |
f.write(response.content)
|
|
|
13 |
file_name = item.get("file_name")
|
14 |
local_file = "/".join(["data", file_name])
|
15 |
if task_id and file_name:
|
16 |
+
file_url = "/".join([files_url, task_id])
|
17 |
+
response = requests.get(file_url, stream=True, timeout=120)
|
18 |
response.raise_for_status()
|
19 |
with open(local_file, "wb") as f:
|
20 |
f.write(response.content)
|