Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -208,24 +208,23 @@ class BasicAgent:
|
|
| 208 |
wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
|
| 209 |
while not answer or answer in wrong_answers or answer.lower().startswith("error"):
|
| 210 |
try:
|
| 211 |
-
alfred = build_agent(
|
| 212 |
answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
|
| 213 |
except Exception as e:
|
| 214 |
print(e)
|
| 215 |
-
alfred = build_agent(
|
| 216 |
answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
|
| 217 |
if answer:
|
| 218 |
-
alfred_super = build_agent(
|
| 219 |
answer_fin = alfred_super.invoke(
|
| 220 |
input={"messages": [
|
| 221 |
SystemMessage(
|
| 222 |
-
content="Verify the answer to the following question. If the answer is correct, return
|
| 223 |
If it's incorrect, return just the corrected answer. \
|
| 224 |
-
Do not add any comments or characters, you should return just the final answer
|
| 225 |
-
either a string, or a number, or a comma separated list."
|
| 226 |
),
|
| 227 |
HumanMessage(
|
| 228 |
-
content=f"
|
| 229 |
)
|
| 230 |
]},
|
| 231 |
config={"recursion_limit": 6}
|
|
|
|
| 208 |
wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
|
| 209 |
while not answer or answer in wrong_answers or answer.lower().startswith("error"):
|
| 210 |
try:
|
| 211 |
+
alfred = build_agent(chat1)
|
| 212 |
answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
|
| 213 |
except Exception as e:
|
| 214 |
print(e)
|
| 215 |
+
alfred = build_agent(chat3)
|
| 216 |
answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
|
| 217 |
if answer:
|
| 218 |
+
alfred_super = build_agent(chat3)
|
| 219 |
answer_fin = alfred_super.invoke(
|
| 220 |
input={"messages": [
|
| 221 |
SystemMessage(
|
| 222 |
+
content="Verify the answer to the following question. If the answer is correct, return the same answer unchanged.\
|
| 223 |
If it's incorrect, return just the corrected answer. \
|
| 224 |
+
Do not add any comments or characters, you should return just the final answer."
|
|
|
|
| 225 |
),
|
| 226 |
HumanMessage(
|
| 227 |
+
content=f"QUESTION: {message.content}, ANSWER: {answer}"
|
| 228 |
)
|
| 229 |
]},
|
| 230 |
config={"recursion_limit": 6}
|