Spaces:
Sleeping
Sleeping
Update query.py
Browse files
query.py
CHANGED
|
@@ -85,15 +85,17 @@ class VectaraQuery():
|
|
| 85 |
text = result['text']
|
| 86 |
print(f"Processing text: {text}") # Debugging line
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
| 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"
|
| 94 |
notes = notes_match.group(1).strip() if notes_match else "Not available"
|
| 95 |
|
| 96 |
response = f"Reason: {reason}\nAlternative: {alternative}\nNotes: {notes}"
|
|
|
|
| 97 |
return response
|
| 98 |
|
| 99 |
return "No relevant information found."
|
|
|
|
| 85 |
text = result['text']
|
| 86 |
print(f"Processing text: {text}") # Debugging line
|
| 87 |
|
| 88 |
+
# Adjusting regex patterns to be more flexible
|
| 89 |
+
reason_match = re.search(r"Reason Why it Can't be Used:\s*(.*?)(?=\n|$)", text, re.DOTALL)
|
| 90 |
+
alternative_match = re.search(r"Alternative:\s*(.*?)(?=\n|$)", text, re.DOTALL)
|
| 91 |
+
notes_match = re.search(r"Notes:\s*(.*?)(?=\n|$)", text, re.DOTALL)
|
| 92 |
|
| 93 |
reason = reason_match.group(1).strip() if reason_match else "Not available"
|
| 94 |
alternative = alternative_match.group(1).strip() if alternative_match else "Not available"
|
| 95 |
notes = notes_match.group(1).strip() if notes_match else "Not available"
|
| 96 |
|
| 97 |
response = f"Reason: {reason}\nAlternative: {alternative}\nNotes: {notes}"
|
| 98 |
+
print(f"Generated response: {response}") # Debugging line
|
| 99 |
return response
|
| 100 |
|
| 101 |
return "No relevant information found."
|