Spaces:
Runtime error
Runtime error
Commit
·
1ddf125
1
Parent(s):
5747f52
update name
Browse files
app.py
CHANGED
|
@@ -94,21 +94,21 @@ class GPTRemote(LLM):
|
|
| 94 |
# output = "test custom llm"
|
| 95 |
print(type(output))
|
| 96 |
print(output)
|
| 97 |
-
|
| 98 |
|
| 99 |
-
return
|
| 100 |
|
| 101 |
@property
|
| 102 |
def _identifying_params(self) -> Mapping[str, Any]:
|
| 103 |
return [("n", self.n)]
|
| 104 |
|
| 105 |
-
def treat_output(
|
| 106 |
keywords = ['Action:', 'Action Input:', 'Observation:', 'Thought:', 'Final Answer:']
|
| 107 |
for item in keywords:
|
| 108 |
-
if item in
|
| 109 |
-
|
| 110 |
-
print("treat output: ",
|
| 111 |
-
return
|
| 112 |
# def _generate(
|
| 113 |
# self,
|
| 114 |
# prompts: List[str],
|
|
|
|
| 94 |
# output = "test custom llm"
|
| 95 |
print(type(output))
|
| 96 |
print(output)
|
| 97 |
+
output2 = self.treat_output(output)
|
| 98 |
|
| 99 |
+
return output2
|
| 100 |
|
| 101 |
@property
|
| 102 |
def _identifying_params(self) -> Mapping[str, Any]:
|
| 103 |
return [("n", self.n)]
|
| 104 |
|
| 105 |
+
def treat_output(text: str):
|
| 106 |
keywords = ['Action:', 'Action Input:', 'Observation:', 'Thought:', 'Final Answer:']
|
| 107 |
for item in keywords:
|
| 108 |
+
if item in text:
|
| 109 |
+
text.replace(item, '\n'+item)
|
| 110 |
+
print("treat output: ", text)
|
| 111 |
+
return text
|
| 112 |
# def _generate(
|
| 113 |
# self,
|
| 114 |
# prompts: List[str],
|