@@ -403,7 +403,10 @@ def patched_create(self, *args, **kwargs):
403403 ):
404404 # TODO figure out how to get the model from the tool resources
405405 vector_store_id = assistant .tool_resources .file_search .vector_store_ids [0 ]
406- file_list_paginator = client .beta .vector_stores .files .list (vector_store_id = vector_store_id )
406+ try :
407+ file_list_paginator = client .beta .vector_stores .files .list (vector_store_id = vector_store_id )
408+ except Exception as e :
409+ file_list_paginator = client .vector_stores .files .list (vector_store_id = vector_store_id )
407410 vs_file = async_helper .run_async (fetch_first_page (file_list_paginator ))
408411 if vs_file is not None :
409412 # use the first file
@@ -453,7 +456,10 @@ def patched_create(self, *args, **kwargs):
453456 ):
454457 # TODO figure out how to get the model from the tool resources
455458 vector_store_id = assistant .tool_resources .file_search .vector_store_ids [0 ]
456- vs_files = client .beta .vector_stores .files .list (vector_store_id = vector_store_id ).data
459+ try :
460+ vs_files = client .beta .vector_stores .files .list (vector_store_id = vector_store_id ).data
461+ except Exception as e :
462+ vs_files = client .vector_stores .files .list (vector_store_id = vector_store_id ).data
457463 if len (vs_files ) > 0 :
458464 # use the first file
459465 vs_file : VectorStoreFile = vs_files [0 ]
@@ -503,7 +509,10 @@ async def patched_create(self, *args, **kwargs):
503509 ):
504510 # TODO figure out how to get the model from the tool resources
505511 vector_store_id = assistant .tool_resources .file_search .vector_store_ids [0 ]
506- vs_files = await client .beta .vector_stores .files .list (vector_store_id = vector_store_id ).data
512+ try :
513+ vs_files = await client .beta .vector_stores .files .list (vector_store_id = vector_store_id ).data
514+ except Exception as e :
515+ vs_files = await client .vector_stores .files .list (vector_store_id = vector_store_id ).data
507516 if len (vs_files ) > 0 :
508517 # use the first file
509518 vs_file : VectorStoreFile = vs_files [0 ]
0 commit comments