Spaces:
Runtime error
Runtime error
Update query.py
Browse files
query.py
CHANGED
@@ -57,7 +57,7 @@ class VectaraQuery():
|
|
57 |
'maxSummarizedResults': 5,
|
58 |
'summarizerPromptName': 'vectara-experimental-summary-ext-2023-12-11-sml',
|
59 |
'chat': {
|
60 |
-
'store':
|
61 |
# 'conversationId': self.conv_id
|
62 |
},
|
63 |
'debug': True,
|
@@ -88,41 +88,11 @@ class VectaraQuery():
|
|
88 |
# self.conv_id = None
|
89 |
# return 'Sorry, chat turns exceeds plan limit.'
|
90 |
# return 'Sorry, something went wrong in my brain. Please try again later.'
|
91 |
-
|
92 |
-
#Another Bard patch for diagnostics
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
if res is not None and 'responseSet' in res:
|
97 |
-
print("BIG 1")
|
98 |
-
|
99 |
-
# Step 1b: Check for 'summary' within the first item
|
100 |
-
if len(responseSet) > 0 and 'summary' in responseSet[0]:
|
101 |
-
print("BIG 2")
|
102 |
-
|
103 |
-
# Step 1c: Check for 'chat' within the first summary
|
104 |
-
if len(summary) > 0 and 'chat' in summary[0]:
|
105 |
-
print("BIG 3")
|
106 |
-
|
107 |
-
#Removed: Step 1d: Finally, access 'conversationId'
|
108 |
-
self.conv_id = res['responseSet'][0]['summary'][0]['chat'] # ['conversationId']
|
109 |
-
print("BIG CHANGE")
|
110 |
-
else:
|
111 |
-
# Handle missing 'chat' in summary
|
112 |
-
print("Chat data not found in response summary")
|
113 |
-
else:
|
114 |
-
# Handle missing or empty 'summary'
|
115 |
-
print("Response summary missing or empty")
|
116 |
-
else:
|
117 |
-
# Handle missing or empty 'responseSet'
|
118 |
-
print("Response data unavailable")
|
119 |
-
except (TypeError):
|
120 |
-
# Handle TypeError if any of the access attempts fail
|
121 |
-
print('Sorry, something went wrong. Please try again later.')
|
122 |
|
123 |
|
124 |
-
#End diagnostics
|
125 |
-
|
126 |
pattern = r'\[\d{1,2}\]'
|
127 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
128 |
|
|
|
57 |
'maxSummarizedResults': 5,
|
58 |
'summarizerPromptName': 'vectara-experimental-summary-ext-2023-12-11-sml',
|
59 |
'chat': {
|
60 |
+
'store': False,
|
61 |
# 'conversationId': self.conv_id
|
62 |
},
|
63 |
'debug': True,
|
|
|
88 |
# self.conv_id = None
|
89 |
# return 'Sorry, chat turns exceeds plan limit.'
|
90 |
# return 'Sorry, something went wrong in my brain. Please try again later.'
|
|
|
|
|
91 |
|
92 |
+
self.conv_id = res['responseSet'][0]['summary'][0]['chat'] # ['conversationId']
|
93 |
+
# print("BIG CHANGE")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
|
|
|
|
|
96 |
pattern = r'\[\d{1,2}\]'
|
97 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
98 |
|