Update app.py
Browse files47 unmodified lines4849505152535455565758596061626364656667686970515253545556575859606162636465666768697071727347 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 + question system_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" + question return self.agent.run(full_question) except Exception as e: return f"[{self.agent_name} Error: {e}]" 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 + question system_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" + question return 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 = 0app.py+20-20