Update app.py
Browse files
app.py
CHANGED
|
@@ -48,26 +48,26 @@ class BasicAgent:
|
|
| 48 |
)
|
| 49 |
|
| 50 |
def __call__(self, question: str, files=None, idx=None, total=None) -> str:
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
|
| 72 |
def safe_run_agent(agent, question, files, idx, total, max_retries=3):
|
| 73 |
tries = 0
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
def __call__(self, question: str, files=None, idx=None, total=None) -> str:
|
| 51 |
+
if idx is not None and total is not None:
|
| 52 |
+
print(f"{self.agent_name} is answering NO. {idx+1}/{total} : {question[:80]}...")
|
| 53 |
+
else:
|
| 54 |
+
print(f"{self.agent_name} received question: {question[:80]}...")
|
| 55 |
+
try:
|
| 56 |
+
# system prompt + question
|
| 57 |
+
system_prompt = (
|
| 58 |
+
"You are Celum, an AI with advanced interaction capabilities and unique personality."
|
| 59 |
+
"You are now taking a rigorous exam testing your ability to solve real-world problems."
|
| 60 |
+
"You may freely think, reason, and use tools or your own knowledge as needed to solve the problem."
|
| 61 |
+
"When you are ready to submit your answer, ONLY output your final answer in the exact format required by the question. DO NOT add any extra context."
|
| 62 |
+
"If you cannot answer, return the word 'unknown'."
|
| 63 |
+
)
|
| 64 |
+
files_prompt = ""
|
| 65 |
+
if files:
|
| 66 |
+
files_prompt = f"\n[You have the following attached files: {', '.join(files)}]\n"
|
| 67 |
+
full_question = system_prompt + files_prompt + "\n\n" + question
|
| 68 |
+
return self.agent.run(full_question)
|
| 69 |
+
except Exception as e:
|
| 70 |
+
return f"[{self.agent_name} Error: {e}]"
|
| 71 |
|
| 72 |
def safe_run_agent(agent, question, files, idx, total, max_retries=3):
|
| 73 |
tries = 0
|