Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,15 +143,15 @@ system_prompt = SystemMessage(
|
|
| 143 |
)
|
| 144 |
|
| 145 |
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
|
| 157 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
@@ -175,7 +175,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 175 |
|
| 176 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 177 |
try:
|
| 178 |
-
agent =
|
| 179 |
except Exception as e:
|
| 180 |
print(f"Error instantiating agent: {e}")
|
| 181 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 143 |
)
|
| 144 |
|
| 145 |
|
| 146 |
+
class BasicAgent:
|
| 147 |
+
def __init__(self):
|
| 148 |
+
print("BasicAgent initialized.")
|
| 149 |
|
| 150 |
+
def __call__(self, question: str) -> str:
|
| 151 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 152 |
+
fixed_answer = alfred.invoke({"messages": [system_prompt, question]},{"recursion_limit": 3})
|
| 153 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 154 |
+
return fixed_answer
|
| 155 |
|
| 156 |
|
| 157 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
|
|
| 175 |
|
| 176 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 177 |
try:
|
| 178 |
+
agent = BasicAgent()
|
| 179 |
except Exception as e:
|
| 180 |
print(f"Error instantiating agent: {e}")
|
| 181 |
return f"Error initializing agent: {e}", None
|