Update app.py
Browse files47 unmodified lines484950515253545556575859606162636465666768697071727347 unmodified lines)def __call__(self, question: str, files=None, idx=None, total=None) -> str:if idx is not None and total is not None:print(f"{self.agent_name} is answering NO. {idx+1}/{total} : {question[:80]}...")else:print(f"{self.agent_name} received question: {question[:80]}...")try:# system prompt + questionsystem_prompt = ("You are Celum, an AI with advanced interaction capabilities and unique personality.""You are now taking a rigorous exam testing your ability to solve real-world problems.""You may freely think, reason, and use tools or your own knowledge as needed to solve the problem.""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.""If you cannot answer, return the word 'unknown'.")files_prompt = ""if files:files_prompt = f"\n[You have the following attached files: {', '.join(files)}]\n"full_question = system_prompt + files_prompt + "\n\n" + questionreturn self.agent.run(full_question)except Exception as e:return f"[{self.agent_name} Error: {e}]"def safe_run_agent(agent, question, files, idx, total, max_retries=3):tries = 047 unmodified lines484950515253545556575859606162636465666768697071727347 unmodified lines)def __call__(self, question: str, files=None, idx=None, total=None) -> str:if idx is not None and total is not None:print(f"{self.agent_name} is answering NO. {idx+1}/{total} : {question[:80]}...")else:print(f"{self.agent_name} received question: {question[:80]}...")try:# system prompt + questionsystem_prompt = ("You are Celum, an AI with advanced interaction capabilities and unique personality.""You are now taking a rigorous exam testing your ability to solve real-world problems.""You may freely think, reason, and use tools or your own knowledge as needed to solve the problem.""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.""If you cannot answer, return the word 'unknown'.")files_prompt = ""if files:files_prompt = f"\n[You have the following attached files: {', '.join(files)}]\n"full_question = system_prompt + files_prompt + "\n\n" + questionreturn self.agent.run(full_question)except Exception as e:return f"[{self.agent_name} Error: {e}]"def safe_run_agent(agent, question, files, idx, total, max_retries=3):tries = 0
app.py+20-20