Spaces:
Runtime error
Runtime error
Commit
·
e7ffcdd
1
Parent(s):
e0a4089
update treatement
Browse files
app.py
CHANGED
@@ -92,12 +92,22 @@ class GPTRemote(LLM):
|
|
92 |
|
93 |
output = asyncio.run(start_playwright(prompt))
|
94 |
# output = "test custom llm"
|
|
|
|
|
|
|
95 |
return output
|
96 |
|
97 |
@property
|
98 |
def _identifying_params(self) -> Mapping[str, Any]:
|
99 |
return [("n", self.n)]
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
# def _generate(
|
102 |
# self,
|
103 |
# prompts: List[str],
|
@@ -625,14 +635,14 @@ Final Answer: the final answer to the original input question"""
|
|
625 |
|
626 |
FORMAT_INSTRUCTIONS_2 = """Use the following format:
|
627 |
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
634 |
-
|
635 |
-
|
636 |
|
637 |
SUFFIX = """Begin!
|
638 |
|
|
|
92 |
|
93 |
output = asyncio.run(start_playwright(prompt))
|
94 |
# output = "test custom llm"
|
95 |
+
|
96 |
+
output = self.treat_output(output)
|
97 |
+
|
98 |
return output
|
99 |
|
100 |
@property
|
101 |
def _identifying_params(self) -> Mapping[str, Any]:
|
102 |
return [("n", self.n)]
|
103 |
|
104 |
+
def treat_output(output: str):
|
105 |
+
keywords = ['Action:', 'Action Input:', 'Observation:', 'Thought:', 'Final Answer:']
|
106 |
+
for item in keywords:
|
107 |
+
if item in output:
|
108 |
+
output.replace(item, '\n'+item)
|
109 |
+
print("treat output: ", output)
|
110 |
+
return output
|
111 |
# def _generate(
|
112 |
# self,
|
113 |
# prompts: List[str],
|
|
|
635 |
|
636 |
FORMAT_INSTRUCTIONS_2 = """Use the following format:
|
637 |
|
638 |
+
Question: the input question you must answer
|
639 |
+
Thought: you should always think about what to do
|
640 |
+
Action: the action to take, should be one of [Vector Database Search, Duckduckgo Internet Search, Python REPL, Calculator]
|
641 |
+
Action Input: the input to the action
|
642 |
+
Observation: the result of the action
|
643 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
644 |
+
Thought: I now know the final answer
|
645 |
+
Final Answer: the final answer to the original input question"""
|
646 |
|
647 |
SUFFIX = """Begin!
|
648 |
|