Spaces:
Runtime error
Runtime error
Commit
·
46f4c4b
1
Parent(s):
f10bbaf
update filtering
Browse files
app.py
CHANGED
|
@@ -93,7 +93,8 @@ class GPTRemote(LLM):
|
|
| 93 |
output = asyncio.run(start_playwright(prompt))
|
| 94 |
# output = "test custom llm"
|
| 95 |
# print(type(output))
|
| 96 |
-
print(
|
|
|
|
| 97 |
keywords = ['Action:', 'Action Input:', 'Observation:', 'Thought:', 'Final Answer:']
|
| 98 |
# print("Judge 1: ", 'Action:' in output)
|
| 99 |
# print("Judge 2: ", 'Action Input:' in output)
|
|
@@ -104,7 +105,15 @@ class GPTRemote(LLM):
|
|
| 104 |
for item in keywords:
|
| 105 |
if item in output:
|
| 106 |
output = output.replace(item, '\n'+item)
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
return output
|
| 109 |
|
| 110 |
@property
|
|
|
|
| 93 |
output = asyncio.run(start_playwright(prompt))
|
| 94 |
# output = "test custom llm"
|
| 95 |
# print(type(output))
|
| 96 |
+
print("-" * 20)
|
| 97 |
+
print('Raw: \n', output)
|
| 98 |
keywords = ['Action:', 'Action Input:', 'Observation:', 'Thought:', 'Final Answer:']
|
| 99 |
# print("Judge 1: ", 'Action:' in output)
|
| 100 |
# print("Judge 2: ", 'Action Input:' in output)
|
|
|
|
| 105 |
for item in keywords:
|
| 106 |
if item in output:
|
| 107 |
output = output.replace(item, '\n'+item)
|
| 108 |
+
|
| 109 |
+
if 'Thought:' not in output:
|
| 110 |
+
output = 'Thought:'+ output
|
| 111 |
+
|
| 112 |
+
if 'Action Input:' in output and 'Observation:' in output:
|
| 113 |
+
output = output.split('Observation:')[0]
|
| 114 |
+
|
| 115 |
+
print("-" * 20)
|
| 116 |
+
print("Treated output: \n", output)
|
| 117 |
return output
|
| 118 |
|
| 119 |
@property
|