Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -545,13 +545,9 @@ You are an advanced, helpful, and highly analytical research assistant. Your goa
|
|
545 |
agent.prompt_templates["system_prompt"] = system_prompt
|
546 |
return agent
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
print(f"Agent returning answer: {answer}")
|
552 |
-
return answer
|
553 |
-
|
554 |
-
logger.info(f"Agent received question (first 50 chars): {question[:50]}...")
|
555 |
global vectorstore
|
556 |
if embeddings:
|
557 |
vectorstore = DocArrayInMemorySearch(embedding_function=embeddings)
|
@@ -583,7 +579,6 @@ You are an advanced, helpful, and highly analytical research assistant. Your goa
|
|
583 |
# This outer catch is for issues before agent.run is called or unhandled by the ThreadPoolExecutor
|
584 |
logger.error(f"Agent setup or execution failed (outer catch) for question '{question[:100]}': {str(e)}", exc_info=True)
|
585 |
return f"Error processing your request: {str(e)}. Please try again or rephrase your question."
|
586 |
-
|
587 |
|
588 |
|
589 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
545 |
agent.prompt_templates["system_prompt"] = system_prompt
|
546 |
return agent
|
547 |
|
548 |
+
def __call__(self, question: str) -> str:
|
549 |
+
logger.info(f"Received question: {question[:200]}...")
|
550 |
+
try:
|
|
|
|
|
|
|
|
|
551 |
global vectorstore
|
552 |
if embeddings:
|
553 |
vectorstore = DocArrayInMemorySearch(embedding_function=embeddings)
|
|
|
579 |
# This outer catch is for issues before agent.run is called or unhandled by the ThreadPoolExecutor
|
580 |
logger.error(f"Agent setup or execution failed (outer catch) for question '{question[:100]}': {str(e)}", exc_info=True)
|
581 |
return f"Error processing your request: {str(e)}. Please try again or rephrase your question."
|
|
|
582 |
|
583 |
|
584 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|