Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,9 +75,9 @@ class BasicAgent:
|
|
| 75 |
raise e
|
| 76 |
|
| 77 |
|
| 78 |
-
|
| 79 |
"""Run either local HF pipeline or remote API chat."""
|
| 80 |
-
|
| 81 |
print(f"\n➡️ Agent received question: {question[:80]}")
|
| 82 |
|
| 83 |
if getattr(self, "model_type", None) == "local":
|
|
@@ -99,7 +99,7 @@ class BasicAgent:
|
|
| 99 |
print(f"✅ Agent returning answer: {answer[:100]}...")
|
| 100 |
return answer
|
| 101 |
|
| 102 |
-
|
| 103 |
print(f"❌ Agent encountered an error: {e}")
|
| 104 |
traceback.print_exc()
|
| 105 |
return f"Error generating answer: {e}"
|
|
|
|
| 75 |
raise e
|
| 76 |
|
| 77 |
|
| 78 |
+
def __call__(self, question: str) -> str:
|
| 79 |
"""Run either local HF pipeline or remote API chat."""
|
| 80 |
+
try:
|
| 81 |
print(f"\n➡️ Agent received question: {question[:80]}")
|
| 82 |
|
| 83 |
if getattr(self, "model_type", None) == "local":
|
|
|
|
| 99 |
print(f"✅ Agent returning answer: {answer[:100]}...")
|
| 100 |
return answer
|
| 101 |
|
| 102 |
+
except Exception as e:
|
| 103 |
print(f"❌ Agent encountered an error: {e}")
|
| 104 |
traceback.print_exc()
|
| 105 |
return f"Error generating answer: {e}"
|