Ashhar
commited on
Commit
·
f97efd9
1
Parent(s):
59488ed
improved validation
Browse files
app.py
CHANGED
@@ -153,7 +153,11 @@ def __isInvalidResponse(response: str):
|
|
153 |
return True
|
154 |
|
155 |
# lot of repeating words
|
156 |
-
if re.findall(r'\b(\w+)(\s+\1){2,}\b', response)
|
|
|
|
|
|
|
|
|
157 |
return True
|
158 |
|
159 |
# json response without json separator
|
|
|
153 |
return True
|
154 |
|
155 |
# lot of repeating words
|
156 |
+
if len(re.findall(r'\b(\w+)(\s+\1){2,}\b', response)) > 1:
|
157 |
+
return True
|
158 |
+
|
159 |
+
# lots of paragraphs
|
160 |
+
if len(re.findall(r'\n\n', response)) > 15:
|
161 |
return True
|
162 |
|
163 |
# json response without json separator
|