iamrobotbear commited on
Commit
b326e89
·
verified ·
1 Parent(s): 4fcd3a3

Update query.py

Browse files
Files changed (1) hide show
  1. query.py +4 -4
query.py CHANGED
@@ -79,15 +79,15 @@ class VectaraQuery():
79
  response_set = res['responseSet']
80
 
81
  if response_set:
82
- for result in response_set:
83
  if 'text' not in result:
84
  continue
85
  text = result['text']
86
  print(f"Processing text: {text}") # Debugging line
87
 
88
- reason_match = re.search(r"Reason Why it Can't be Used: (.*?)\n", text, re.DOTALL)
89
- alternative_match = re.search(r"Alternative: (.*?)\n", text, re.DOTALL)
90
- notes_match = re.search(r"Notes: (.*?)\n", text, re.DOTALL)
91
 
92
  reason = reason_match.group(1).strip() if reason_match else "Not available"
93
  alternative = alternative_match.group(1).strip() if alternative_match else "Not available"
 
79
  response_set = res['responseSet']
80
 
81
  if response_set:
82
+ for result in response_set['response']:
83
  if 'text' not in result:
84
  continue
85
  text = result['text']
86
  print(f"Processing text: {text}") # Debugging line
87
 
88
+ reason_match = re.search(r"Reason Why it Can't be Used:\s*(.*?)(?:\n|$)", text, re.DOTALL)
89
+ alternative_match = re.search(r"Alternative:\s*(.*?)(?:\n|$)", text, re.DOTALL)
90
+ notes_match = re.search(r"Notes:\s*(.*?)(?:\n|$)", text, re.DOTALL)
91
 
92
  reason = reason_match.group(1).strip() if reason_match else "Not available"
93
  alternative = alternative_match.group(1).strip() if alternative_match else "Not available"