Ashhar commited on
Commit
f97efd9
·
1 Parent(s): 59488ed

improved validation

Browse files
Files changed (1) hide show
  1. app.py +5 -1
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) == 0:
 
 
 
 
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