Spaces:
Sleeping
Sleeping
José Ángel González
commited on
Commit
·
1665a27
1
Parent(s):
1008015
fix when empty file_name
Browse files- README.md +1 -1
- agents/react_agent.py +6 -2
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🕵🏻♂️
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: indigo
|
|
|
|
| 1 |
---
|
| 2 |
+
title: SmolAgents submission
|
| 3 |
emoji: 🕵🏻♂️
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: indigo
|
agents/react_agent.py
CHANGED
|
@@ -110,7 +110,6 @@ class ReactAgent:
|
|
| 110 |
parsed_content = file_info["parser"](content)
|
| 111 |
user_question = question["question"]
|
| 112 |
if file_info["type"] == "image":
|
| 113 |
-
parsed_content.save("image.png")
|
| 114 |
return self.agent.run(user_question, images=[parsed_content])
|
| 115 |
|
| 116 |
user_question = (
|
|
@@ -120,7 +119,7 @@ class ReactAgent:
|
|
| 120 |
)
|
| 121 |
return self.agent.run(user_question)
|
| 122 |
|
| 123 |
-
return self.agent.run(question)
|
| 124 |
|
| 125 |
def steer_system_prompt(self):
|
| 126 |
prev_system_prompt = self.agent.system_prompt
|
|
@@ -129,3 +128,8 @@ class ReactAgent:
|
|
| 129 |
gaia_answer_rules = """It is crucial that you wrap your final answer in the ```code``` block by using the `final_answer` tool or your mom will die."""
|
| 130 |
system_prompt = prompt_prefix + gaia_answer_rules + "\n\nNow Begin!"
|
| 131 |
self.agent.system_prompt = system_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
parsed_content = file_info["parser"](content)
|
| 111 |
user_question = question["question"]
|
| 112 |
if file_info["type"] == "image":
|
|
|
|
| 113 |
return self.agent.run(user_question, images=[parsed_content])
|
| 114 |
|
| 115 |
user_question = (
|
|
|
|
| 119 |
)
|
| 120 |
return self.agent.run(user_question)
|
| 121 |
|
| 122 |
+
return self.agent.run(question["question"])
|
| 123 |
|
| 124 |
def steer_system_prompt(self):
|
| 125 |
prev_system_prompt = self.agent.system_prompt
|
|
|
|
| 128 |
gaia_answer_rules = """It is crucial that you wrap your final answer in the ```code``` block by using the `final_answer` tool or your mom will die."""
|
| 129 |
system_prompt = prompt_prefix + gaia_answer_rules + "\n\nNow Begin!"
|
| 130 |
self.agent.system_prompt = system_prompt
|
| 131 |
+
|
| 132 |
+
if __name__ == "__main__":
|
| 133 |
+
question = {'task_id': '8e867cd7-cff9-4e6c-867a-ff5ddc2550be', 'question': 'How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.', 'Level': '1', 'file_name': ''}
|
| 134 |
+
agent = ReactAgent()
|
| 135 |
+
response = agent(question)
|