File tree Expand file tree Collapse file tree 1 file changed +26
-11
lines changed Expand file tree Collapse file tree 1 file changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,16 @@ def test_retrieve_init_args(
175
175
)
176
176
start = time .time ()
177
177
while True :
178
- docs = retriever .invoke (input = "What are you?" )
179
- if len (docs ) == 2 :
180
- break
178
+ try :
179
+ docs = retriever .invoke (input = "What are you?" )
180
+ if len (docs ) == 2 :
181
+ break
182
+ except Exception as e :
183
+ logging .exception ("Error during retrieval: %s" , e )
184
+ if "503" in str (e ):
185
+ continue
186
+ raise e
187
+
181
188
if time .time () - start > 180 :
182
189
msg = "Docs not retrieved in time"
183
190
raise RuntimeError (msg )
@@ -193,15 +200,23 @@ def test_retrieve_invoke_args(
193
200
retriever = VectorizeRetriever (environment = environment , api_token = api_token )
194
201
start = time .time ()
195
202
while True :
196
- docs = retriever .invoke (
197
- input = "What are you?" ,
198
- organization = org_id ,
199
- pipeline_id = pipeline_id ,
200
- num_results = 2 ,
201
- )
202
- if len (docs ) == 2 :
203
- break
203
+ try :
204
+ docs = retriever .invoke (
205
+ input = "What are you?" ,
206
+ organization = org_id ,
207
+ pipeline_id = pipeline_id ,
208
+ num_results = 2 ,
209
+ )
210
+ if len (docs ) == 2 :
211
+ break
212
+
213
+ except Exception as e :
214
+ logging .exception ("Error during retrieval: %s" , e )
215
+ if "503" in str (e ):
216
+ continue
217
+ raise e
204
218
if time .time () - start > 180 :
205
219
msg = "Docs not retrieved in time"
206
220
raise RuntimeError (msg )
221
+
207
222
time .sleep (1 )
You can’t perform that action at this time.
0 commit comments