Spaces:
Sleeping
Sleeping
Update query.py
Browse files
query.py
CHANGED
@@ -111,7 +111,7 @@ class VectaraQuery():
|
|
111 |
|
112 |
endpoint = f"https://api.vectara.io/v1/query"
|
113 |
body = self.get_body(query_str)
|
114 |
-
|
115 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=self.get_headers())
|
116 |
if response.status_code != 200:
|
117 |
print(f"Query failed with code {response.status_code}, reason {response.reason}, text {response.text}")
|
@@ -141,7 +141,9 @@ class VectaraQuery():
|
|
141 |
|
142 |
endpoint = f"https://api.vectara.io/v1/stream-query"
|
143 |
body = self.get_body(query_str)
|
144 |
-
|
|
|
|
|
145 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=self.get_headers(), stream=True)
|
146 |
if response.status_code != 200:
|
147 |
print(f"Query failed with code {response.status_code}, reason {response.reason}, text {response.text}")
|
@@ -154,6 +156,8 @@ class VectaraQuery():
|
|
154 |
if line: # filter out keep-alive new lines
|
155 |
data = json.loads(line.decode('utf-8'))
|
156 |
res = data['result']
|
|
|
|
|
157 |
|
158 |
# capture responses and docs if we get that first
|
159 |
response_set = res['responseSet']
|
|
|
111 |
|
112 |
endpoint = f"https://api.vectara.io/v1/query"
|
113 |
body = self.get_body(query_str)
|
114 |
+
|
115 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=self.get_headers())
|
116 |
if response.status_code != 200:
|
117 |
print(f"Query failed with code {response.status_code}, reason {response.reason}, text {response.text}")
|
|
|
141 |
|
142 |
endpoint = f"https://api.vectara.io/v1/stream-query"
|
143 |
body = self.get_body(query_str)
|
144 |
+
|
145 |
+
print(f"DEBUG body = {body}")
|
146 |
+
|
147 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=self.get_headers(), stream=True)
|
148 |
if response.status_code != 200:
|
149 |
print(f"Query failed with code {response.status_code}, reason {response.reason}, text {response.text}")
|
|
|
156 |
if line: # filter out keep-alive new lines
|
157 |
data = json.loads(line.decode('utf-8'))
|
158 |
res = data['result']
|
159 |
+
|
160 |
+
print(f"DEBUG conv_id = {self.conv_id}, res = {res}")
|
161 |
|
162 |
# capture responses and docs if we get that first
|
163 |
response_set = res['responseSet']
|