@@ -39,7 +39,12 @@ Stream text with GPT-4o, transcribe and translate audio with Whisper, or create
3939 - [ Embeddings] ( #embeddings )
4040 - [ Batches] ( #batches )
4141 - [ Files] ( #files )
42+ - [ For fine-tuning purposes] ( #for-fine-tuning-purposes )
43+ - [ For assistant purposes] ( #for-assistant-purposes )
4244 - [ Finetunes] ( #finetunes )
45+ - [ Vector Stores] ( #vector-stores )
46+ - [ Vector Store Files] ( #vector-store-files )
47+ - [ Vector Store File Batches] ( #vector-store-file-batches )
4348 - [ Assistants] ( #assistants )
4449 - [ Threads and Messages] ( #threads-and-messages )
4550 - [ Runs] ( #runs )
@@ -609,7 +614,7 @@ These files are in JSONL format, with each line representing the output or error
609614If a request fails with a non-HTTP error, the error object will contain more information about the cause of the failure.
610615
611616### Files
612-
617+ #### For fine-tuning purposes
613618Put your data in a ` .jsonl ` file like this:
614619
615620``` json
@@ -627,6 +632,24 @@ client.files.content(id: "file-123")
627632client.files.delete(id: " file-123" )
628633```
629634
635+ #### For assistant purposes
636+
637+ You can send a file path:
638+
639+ ``` ruby
640+ client.files.upload(parameters: { file: " path/to/file.pdf" , purpose: " assistants" })
641+ ```
642+
643+ or a File object
644+
645+ ``` ruby
646+ my_file = File .open (" path/to/file.pdf" , " rb" )
647+ client.files.upload(parameters: { file: my_file, purpose: " assistants" })
648+ ```
649+
650+
651+ See supported file types on [ API documentation] ( https://platform.openai.com/docs/assistants/tools/file-search/supported-files ) .
652+
630653### Finetunes
631654
632655Upload your fine-tuning data in a ` .jsonl ` file as above and get its ID:
@@ -679,6 +702,135 @@ You can also capture the events for a job:
679702client.finetunes.list_events(id: fine_tune_id)
680703```
681704
705+ ### Vector Stores
706+ Vector Store objects give the File Search tool the ability to search your files.
707+
708+ You can create a new vector store:
709+
710+ ``` ruby
711+ response = client.vector_stores.create(
712+ parameters: {
713+ name: " my vector store" ,
714+ file_ids: [" file-abc123" , " file-def456" ]
715+ }
716+ )
717+
718+ vector_store_id = response[" id" ]
719+ ```
720+
721+ Given a ` vector_store_id ` you can ` retrieve ` the current field values:
722+
723+ ``` ruby
724+ client.vector_stores.retrieve(id: vector_store_id)
725+ ```
726+
727+ You can get a ` list ` of all vector stores currently available under the organization:
728+
729+ ``` ruby
730+ client.vector_stores.list
731+ ```
732+
733+ You can modify an existing vector store, except for the ` file_ids ` :
734+
735+ ``` ruby
736+ response = client.vector_stores.modify(
737+ id: vector_store_id,
738+ parameters: {
739+ name: " Modified Test Vector Store" ,
740+ }
741+ )
742+ ```
743+
744+ You can delete vector stores:
745+
746+ ``` ruby
747+ client.vector_stores.delete(id: vector_store_id)
748+ ```
749+
750+ ### Vector Store Files
751+ Vector store files represent files inside a vector store.
752+
753+ You can create a new vector store file by attaching a File to a vector store.
754+
755+ ``` ruby
756+ response = client.vector_store_files.create(
757+ vector_store_id: " vector-store-abc123" ,
758+ parameters: {
759+ file_id: " file-abc123"
760+ }
761+ )
762+
763+ vector_store_file_id = response[" id" ]
764+ ```
765+
766+ Given a ` vector_store_file_id ` you can ` retrieve ` the current field values:
767+
768+ ``` ruby
769+ client.vector_store_files.retrieve(
770+ vector_store_id: " vector-store-abc123" ,
771+ id: vector_store_file_id
772+ )
773+ ```
774+
775+ You can get a ` list ` of all vector store files currently available under the vector store:
776+
777+ ``` ruby
778+ client.vector_store_files.list(vector_store_id: " vector-store-abc123" )
779+ ```
780+
781+ You can delete a vector store file:
782+
783+ ``` ruby
784+ client.vector_store_files.delete(
785+ vector_store_id: " vector-store-abc123" ,
786+ id: vector_store_file_id
787+ )
788+ ```
789+ Note: This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
790+
791+ ### Vector Store File Batches
792+ Vector store file batches represent operations to add multiple files to a vector store.
793+
794+ You can create a new vector store file batch by attaching multiple Files to a vector store.
795+
796+ ``` ruby
797+ response = client.vector_store_file_batches.create(
798+ vector_store_id: " vector-store-abc123" ,
799+ parameters: {
800+ file_ids: [" file-abc123" , " file-def456" ]
801+ }
802+ )
803+
804+ file_batch_id = response[" id" ]
805+ ```
806+
807+ Given a ` file_batch_id ` you can ` retrieve ` the current field values:
808+
809+ ``` ruby
810+ client.vector_store_file_batches.retrieve(
811+ vector_store_id: " vector-store-abc123" ,
812+ id: file_batch_id
813+ )
814+ ```
815+
816+ You can get a ` list ` of all vector store files in a batch currently available under the vector store:
817+
818+ ``` ruby
819+ client.vector_store_file_batches.list(
820+ vector_store_id: " vector-store-abc123" ,
821+ id: file_batch_id
822+ )
823+ ```
824+
825+ You can cancel a vector store file batch (This attempts to cancel the processing of files in this batch as soon as possible):
826+
827+ ``` ruby
828+ client.vector_store_file_batches.cancel(
829+ vector_store_id: " vector-store-abc123" ,
830+ id: file_batch_id
831+ )
832+ ```
833+
682834### Assistants
683835
684836Assistants are stateful actors that can have many conversations and use tools to perform tasks (see [ Assistant Overview] ( https://platform.openai.com/docs/assistants/overview ) ).
@@ -694,10 +846,14 @@ response = client.assistants.create(
694846 instructions: " You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question" ,
695847 tools: [
696848 { type: " code_interpreter" },
849+ { type: " file_search" }
697850 ],
698851 tool_resources: {
699- " code_interpreter" : {
700- " file_ids" : [] # See Files section above for how to upload files
852+ code_interpreter: {
853+ file_ids: [] # See Files section above for how to upload files
854+ },
855+ file_search: {
856+ vector_store_ids: [] # See Vector Stores section above for how to add vector stores
701857 }
702858 },
703859 " metadata" : { my_internal_version_id: " 1.0.0" }
0 commit comments