Update query.py
Browse files
query.py
CHANGED
@@ -76,6 +76,15 @@ class VectaraQuery():
|
|
76 |
print(f"DEBUG request body = {body}")
|
77 |
print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
top_k = 10
|
80 |
summary = res['responseSet'][0]['summary'][0]['text']
|
81 |
responses = res['responseSet'][0]['response'][:top_k]
|
|
|
76 |
print(f"DEBUG request body = {body}")
|
77 |
print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
|
78 |
|
79 |
+
ecode = res['responseSet'][0]['status'].get('code','')
|
80 |
+
if ecode != '':
|
81 |
+
print(f"Chat query failed with code {ecode}")
|
82 |
+
if ecode == 'RESOURCE_EXHAUSTED':
|
83 |
+
self.conv_id = None
|
84 |
+
return 'Sorry, Vectara chat turns exceeds plan limit.'
|
85 |
+
return 'Sorry, something went wrong in my brain. Please try again later.'
|
86 |
+
|
87 |
+
|
88 |
top_k = 10
|
89 |
summary = res['responseSet'][0]['summary'][0]['text']
|
90 |
responses = res['responseSet'][0]['response'][:top_k]
|