Spaces:
Runtime error
Runtime error
Commit
·
8cc4d36
1
Parent(s):
45e0238
update llm
Browse files
app.py
CHANGED
|
@@ -121,11 +121,11 @@ async def start_playwright(question: str):
|
|
| 121 |
|
| 122 |
# note all methods are async (use the "await" keyword)
|
| 123 |
await page.goto("https://basicchatbot.azurewebsites.net/")
|
| 124 |
-
print("Title of Web: ", await page.title())
|
| 125 |
await page.wait_for_timeout(200)
|
| 126 |
# print("Content of Web: ", await page.content())
|
| 127 |
# print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_html())
|
| 128 |
-
print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_text())
|
| 129 |
|
| 130 |
await page.locator("//textarea").fill(question)
|
| 131 |
await page.wait_for_timeout(200)
|
|
@@ -142,7 +142,7 @@ async def start_playwright(question: str):
|
|
| 142 |
output_text = await page.locator("//div[@aria-label='Chat message from assistant']").last.inner_text()
|
| 143 |
print("output_text... :")
|
| 144 |
|
| 145 |
-
if output_text == output_history and '▌' not in output_text:
|
| 146 |
return output_text
|
| 147 |
else:
|
| 148 |
await page.wait_for_timeout(500)
|
|
@@ -623,6 +623,17 @@ Observation: the result of the action
|
|
| 623 |
Thought: I now know the final answer
|
| 624 |
Final Answer: the final answer to the original input question"""
|
| 625 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
SUFFIX = """Begin!
|
| 627 |
|
| 628 |
Request: {input}
|
|
@@ -701,7 +712,7 @@ agent_ZEROSHOT_REACT_2 = initialize_agent(tools2, GPTfake,
|
|
| 701 |
early_stopping_method="generate",
|
| 702 |
agent_kwargs={
|
| 703 |
'prefix': PREFIX,
|
| 704 |
-
'format_instructions':
|
| 705 |
'suffix': SUFFIX,
|
| 706 |
# 'input_variables': input_variables,
|
| 707 |
},
|
|
|
|
| 121 |
|
| 122 |
# note all methods are async (use the "await" keyword)
|
| 123 |
await page.goto("https://basicchatbot.azurewebsites.net/")
|
| 124 |
+
# print("Title of Web: ", await page.title())
|
| 125 |
await page.wait_for_timeout(200)
|
| 126 |
# print("Content of Web: ", await page.content())
|
| 127 |
# print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_html())
|
| 128 |
+
# print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_text())
|
| 129 |
|
| 130 |
await page.locator("//textarea").fill(question)
|
| 131 |
await page.wait_for_timeout(200)
|
|
|
|
| 142 |
output_text = await page.locator("//div[@aria-label='Chat message from assistant']").last.inner_text()
|
| 143 |
print("output_text... :")
|
| 144 |
|
| 145 |
+
if output_text == output_history and '▌' not in output_text and output_text != "":
|
| 146 |
return output_text
|
| 147 |
else:
|
| 148 |
await page.wait_for_timeout(500)
|
|
|
|
| 623 |
Thought: I now know the final answer
|
| 624 |
Final Answer: the final answer to the original input question"""
|
| 625 |
|
| 626 |
+
FORMAT_INSTRUCTIONS_2 = """Use the following format:
|
| 627 |
+
|
| 628 |
+
# Question: the input question you must answer
|
| 629 |
+
# Thought: you should always think about what to do
|
| 630 |
+
# Action: the action to take, should be one of [Vector Database Search, Duckduckgo Internet Search, Python REPL, Calculator]
|
| 631 |
+
# Action Input: the input to the action
|
| 632 |
+
# Observation: the result of the action
|
| 633 |
+
... (this Thought/Action/Action Input/Observation can repeat N times)
|
| 634 |
+
# Thought: I now know the final answer
|
| 635 |
+
# Final Answer: the final answer to the original input question"""
|
| 636 |
+
|
| 637 |
SUFFIX = """Begin!
|
| 638 |
|
| 639 |
Request: {input}
|
|
|
|
| 712 |
early_stopping_method="generate",
|
| 713 |
agent_kwargs={
|
| 714 |
'prefix': PREFIX,
|
| 715 |
+
'format_instructions': FORMAT_INSTRUCTIONS_2,
|
| 716 |
'suffix': SUFFIX,
|
| 717 |
# 'input_variables': input_variables,
|
| 718 |
},
|