Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -149,7 +149,11 @@ class BasicAgent:
|
|
| 149 |
|
| 150 |
def __call__(self, question: str) -> str:
|
| 151 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 154 |
return fixed_answer
|
| 155 |
|
|
|
|
| 149 |
|
| 150 |
def __call__(self, question: str) -> str:
|
| 151 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 152 |
+
answer = alfred.invoke({"messages": [system_prompt, question]},{"recursion_limit": 3})['messages'][-1].content
|
| 153 |
+
answer = "".join(re.findall(r'(FINAL ANSWER:.*)', answer, flags=re.M))
|
| 154 |
+
answer = answer.replace('FINAL ANSWER: ', '')
|
| 155 |
+
answer = answer.replace('[', '')
|
| 156 |
+
fixed_answer = answer.replace(']', '')
|
| 157 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 158 |
return fixed_answer
|
| 159 |
|