@@ -340,149 +340,6 @@ async def test_assistants_messages_crud(self, client_async, api_type, api_versio
340340 delete_file = await client_async .files .delete (file .id )
341341 assert delete_file .deleted is True
342342
343- @configure_async
344- @pytest .mark .asyncio
345- @pytest .mark .parametrize ("api_type, api_version" , [(ASST_AZURE , PREVIEW ), (GPT_4_OPENAI , "v1" )])
346- async def test_assistants_vector_stores_crud (self , client_async , api_type , api_version , ** kwargs ):
347- file_name = f"test{ uuid .uuid4 ()} .txt"
348- with open (file_name , "w" ) as f :
349- f .write ("test" )
350-
351- path = pathlib .Path (file_name )
352-
353- file = await client_async .files .create (
354- file = open (path , "rb" ),
355- purpose = "assistants"
356- )
357-
358- try :
359- vector_store = await client_async .beta .vector_stores .create (
360- name = "Support FAQ"
361- )
362- assert vector_store .name == "Support FAQ"
363- assert vector_store .id
364- assert vector_store .object == "vector_store"
365- assert vector_store .created_at
366- assert vector_store .file_counts .total == 0
367-
368- vectors = client_async .beta .vector_stores .list ()
369- async for vector in vectors :
370- assert vector .id
371- assert vector_store .object == "vector_store"
372- assert vector_store .created_at
373-
374- vector_store = await client_async .beta .vector_stores .update (
375- vector_store_id = vector_store .id ,
376- name = "Support FAQ and more" ,
377- metadata = {"Q" : "A" }
378- )
379- retrieved_vector = await client_async .beta .vector_stores .retrieve (
380- vector_store_id = vector_store .id
381- )
382- assert retrieved_vector .id == vector_store .id
383- assert retrieved_vector .name == "Support FAQ and more"
384- assert retrieved_vector .metadata == {"Q" : "A" }
385-
386- vector_store_file = await client_async .beta .vector_stores .files .create (
387- vector_store_id = vector_store .id ,
388- file_id = file .id
389- )
390- assert vector_store_file .id
391- assert vector_store_file .object == "vector_store.file"
392- assert vector_store_file .created_at
393- assert vector_store_file .vector_store_id == vector_store .id
394-
395- vector_store_files = client_async .beta .vector_stores .files .list (
396- vector_store_id = vector_store .id
397- )
398- async for vector_file in vector_store_files :
399- assert vector_file .id
400- assert vector_file .object == "vector_store.file"
401- assert vector_store_file .created_at
402- assert vector_store_file .vector_store_id == vector_store .id
403-
404- vector_store_file_2 = await client_async .beta .vector_stores .files .retrieve (
405- vector_store_id = vector_store .id ,
406- file_id = file .id
407- )
408- assert vector_store_file_2 .id == vector_store_file .id
409- assert vector_store_file .vector_store_id == vector_store .id
410-
411- finally :
412- os .remove (path )
413- deleted_vector_store_file = await client_async .beta .vector_stores .files .delete (
414- vector_store_id = vector_store .id ,
415- file_id = file .id
416- )
417- assert deleted_vector_store_file .deleted is True
418- deleted_vector_store = await client_async .beta .vector_stores .delete (
419- vector_store_id = vector_store .id
420- )
421- assert deleted_vector_store .deleted is True
422-
423- @configure_async
424- @pytest .mark .asyncio
425- @pytest .mark .parametrize ("api_type, api_version" , [(ASST_AZURE , PREVIEW ), (GPT_4_OPENAI , "v1" )])
426- async def test_assistants_vector_stores_batch_crud (self , client_async , api_type , api_version , ** kwargs ):
427- file_name = f"test{ uuid .uuid4 ()} .txt"
428- file_name_2 = f"test{ uuid .uuid4 ()} .txt"
429- with open (file_name , "w" ) as f :
430- f .write ("test" )
431-
432- path = pathlib .Path (file_name )
433-
434- file = await client_async .files .create (
435- file = open (path , "rb" ),
436- purpose = "assistants"
437- )
438- with open (file_name_2 , "w" ) as f :
439- f .write ("test" )
440- path_2 = pathlib .Path (file_name_2 )
441-
442- file_2 = await client_async .files .create (
443- file = open (path_2 , "rb" ),
444- purpose = "assistants"
445- )
446- try :
447- vector_store = await client_async .beta .vector_stores .create (
448- name = "Support FAQ"
449- )
450- vector_store_file_batch = await client_async .beta .vector_stores .file_batches .create (
451- vector_store_id = vector_store .id ,
452- file_ids = [file .id , file_2 .id ]
453- )
454- assert vector_store_file_batch .id
455- assert vector_store_file_batch .object == "vector_store.file_batch"
456- assert vector_store_file_batch .created_at is not None
457- assert vector_store_file_batch .status
458-
459- vectors = await client_async .beta .vector_stores .file_batches .list_files (
460- vector_store_id = vector_store .id ,
461- batch_id = vector_store_file_batch .id
462- )
463- async for vector in vectors :
464- assert vector .id
465- assert vector .object == "vector_store.file"
466- assert vector .created_at is not None
467-
468- retrieved_vector_store_file_batch = await client_async .beta .vector_stores .file_batches .retrieve (
469- vector_store_id = vector_store .id ,
470- batch_id = vector_store_file_batch .id
471- )
472- assert retrieved_vector_store_file_batch .id == vector_store_file_batch .id
473-
474- finally :
475- os .remove (path )
476- os .remove (path_2 )
477- delete_file = await client_async .files .delete (file .id )
478- assert delete_file .deleted is True
479- delete_file = await client_async .files .delete (file_2 .id )
480- assert delete_file .deleted is True
481- deleted_vector_store = await client_async .beta .vector_stores .delete (
482- vector_store_id = vector_store .id
483- )
484- assert deleted_vector_store .deleted is True
485-
486343 @configure_async
487344 @pytest .mark .asyncio
488345 @pytest .mark .parametrize ("api_type, api_version" , [(ASST_AZURE , PREVIEW ), (GPT_4_OPENAI , "v1" )])
@@ -547,10 +404,10 @@ async def test_assistants_runs_file_search(self, client_async, api_type, api_ver
547404 path = pathlib .Path (file_name )
548405
549406 try :
550- vector_store = await client_async .beta . vector_stores .create (
407+ vector_store = await client_async .vector_stores .create (
551408 name = "Support FAQ" ,
552409 )
553- await client_async .beta . vector_stores .files .upload_and_poll (
410+ await client_async .vector_stores .files .upload_and_poll (
554411 vector_store_id = vector_store .id ,
555412 file = path
556413 )
@@ -607,7 +464,7 @@ async def test_assistants_runs_file_search(self, client_async, api_type, api_ver
607464 )
608465 assert delete_thread .id
609466 assert delete_thread .deleted is True
610- deleted_vector_store = await client_async .beta . vector_stores .delete (
467+ deleted_vector_store = await client_async .vector_stores .delete (
611468 vector_store_id = vector_store .id
612469 )
613470 assert deleted_vector_store .deleted is True
0 commit comments