Class AssistantsClient

java.lang.Object
com.azure.ai.openai.assistants.AssistantsClient

public final class AssistantsClient extends Object
Initializes a new instance of the synchronous AssistantsClient type.
  • Method Details

    • createAssistantWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createAssistantWithResponse(com.azure.core.util.BinaryData assistantCreationOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new assistant.

      Request Body Schema

       
       {
           model: String (Required)
           name: String (Optional)
           description: String (Optional)
           instructions: String (Optional)
           tools (Optional): [
                (Optional){
               }
           ]
           file_ids (Optional): [
               String (Optional)
           ]
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           description: String (Required)
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      assistantCreationOptions - The request details to use when creating a new assistant.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      represents an assistant that can call the model and use tools along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listAssistantsWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listAssistantsWithResponse(com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of assistants that were previously created.

      Query Parameters

      Query Parameters
      Name Type Required Description
      limit Integer No A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order String No Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      after String No A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before String No A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   created_at: long (Required)
                   name: String (Required)
                   description: String (Required)
                   model: String (Required)
                   instructions: String (Required)
                   tools (Required): [
                        (Required){
                       }
                   ]
                   file_ids (Required): [
                       String (Required)
                   ]
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of assistants that were previously created along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • deleteAssistantWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> deleteAssistantWithResponse(String assistantId, com.azure.core.http.rest.RequestOptions requestOptions)
      Deletes an assistant.

      Response Body Schema

       
       {
           id: String (Required)
           deleted: boolean (Required)
           object: String (Required)
       }
       
       
      Parameters:
      assistantId - The ID of the assistant to delete.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the status of an assistant deletion operation along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createAssistant

      public Assistant createAssistant(AssistantCreationOptions assistantCreationOptions)
      Creates a new assistant.
      Parameters:
      assistantCreationOptions - The request details to use when creating a new assistant.
      Returns:
      represents an assistant that can call the model and use tools.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listAssistants

      public PageableList<Assistant> listAssistants(Integer limit, ListSortOrder order, String after, String before)
      Gets a list of assistants that were previously created.
      Parameters:
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      a list of assistants that were previously created.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listAssistants

      public PageableList<Assistant> listAssistants()
      Gets a list of assistants that were previously created.
      Returns:
      a list of assistants that were previously created.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • deleteAssistant

      public AssistantDeletionStatus deleteAssistant(String assistantId)
      Deletes an assistant.
      Parameters:
      assistantId - The ID of the assistant to delete.
      Returns:
      the status of an assistant deletion operation.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getAssistantWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getAssistantWithResponse(String assistantId, com.azure.core.http.rest.RequestOptions requestOptions)
      Retrieves an existing assistant.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           description: String (Required)
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      assistantId - The ID of the assistant to retrieve.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      represents an assistant that can call the model and use tools along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createThreadWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createThreadWithResponse(com.azure.core.util.BinaryData assistantThreadCreationOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new thread. Threads contain messages and can be run by assistants.

      Request Body Schema

       
       {
           messages (Optional): [
                (Optional){
                   role: String(user/assistant) (Required)
                   content: String (Required)
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   metadata (Optional): {
                       String: String (Required)
                   }
               }
           ]
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      assistantThreadCreationOptions - The details used to create a new assistant thread.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      information about a single thread associated with an assistant along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getThreadWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getThreadWithResponse(String threadId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets information about an existing thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to retrieve information about.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      information about an existing thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • deleteThreadWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> deleteThreadWithResponse(String threadId, com.azure.core.http.rest.RequestOptions requestOptions)
      Deletes an existing thread.

      Response Body Schema

       
       {
           id: String (Required)
           deleted: boolean (Required)
           object: String (Required)
       }
       
       
      Parameters:
      threadId - The ID of the thread to delete.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the status of a thread deletion operation along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createMessageWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createMessageWithResponse(String threadId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new message on a specified thread.

      Request Body Schema

       
       {
           role: String(user/assistant) (Required)
           content: String (Required)
           file_ids (Optional): [
               String (Optional)
           ]
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           thread_id: String (Required)
           role: String(user/assistant) (Required)
           content (Required): [
                (Required){
               }
           ]
           assistant_id: String (Optional)
           run_id: String (Optional)
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to create the new message on.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a single, existing message within an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listMessagesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listMessagesWithResponse(String threadId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of messages that exist on a thread.

      Query Parameters

      Query Parameters
      Name Type Required Description
      limit Integer No A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order String No Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      after String No A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before String No A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   created_at: long (Required)
                   thread_id: String (Required)
                   role: String(user/assistant) (Required)
                   content (Required): [
                        (Required){
                       }
                   ]
                   assistant_id: String (Optional)
                   run_id: String (Optional)
                   file_ids (Required): [
                       String (Required)
                   ]
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      threadId - The ID of the thread to list messages from.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of messages that exist on a thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getMessageWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getMessageWithResponse(String threadId, String messageId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets an existing message from an existing thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           thread_id: String (Required)
           role: String(user/assistant) (Required)
           content (Required): [
                (Required){
               }
           ]
           assistant_id: String (Optional)
           run_id: String (Optional)
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to retrieve the specified message from.
      messageId - The ID of the message to retrieve from the specified thread.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      an existing message from an existing thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createRunWithResponse(String threadId, com.azure.core.util.BinaryData createRunOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new run for an assistant thread.

      Request Body Schema

       
       {
           assistant_id: String (Required)
           model: String (Optional)
           instructions: String (Optional)
           additional_instructions: String (Optional)
           additional_messages (Optional): [
                (Optional){
                   id: String (Required)
                   object: String (Required)
                   created_at: long (Required)
                   thread_id: String (Required)
                   status: String(in_progress/incomplete/completed) (Required)
                   incomplete_details (Required): {
                       reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
                   }
                   completed_at: Long (Required)
                   incomplete_at: Long (Required)
                   role: String(user/assistant) (Required)
                   content (Required): [
                        (Required){
                           type: String (Required)
                       }
                   ]
                   assistant_id: String (Required)
                   run_id: String (Required)
                   attachments (Required): [
                        (Required){
                           file_id: String (Required)
                           tools (Required): [
                               BinaryData (Required)
                           ]
                       }
                   ]
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           tools (Optional): [
                (Optional){
                   type: String (Required)
               }
           ]
           stream: Boolean (Optional)
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Optional)
           max_completion_tokens: Integer (Optional)
           truncation_strategy (Optional): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Optional)
           response_format: BinaryData (Optional)
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details: String(max_completion_tokens/max_prompt_tokens) (Required)
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to run.
      createRunOptions - The details for the run to create.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listRunsWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listRunsWithResponse(String threadId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of runs for a specified thread.

      Query Parameters

      Query Parameters
      Name Type Required Description
      limit Integer No A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order String No Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      after String No A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before String No A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   thread_id: String (Required)
                   assistant_id: String (Required)
                   status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
                   required_action (Optional): {
                   }
                   last_error (Required): {
                       code: String (Required)
                       message: String (Required)
                   }
                   model: String (Required)
                   instructions: String (Required)
                   tools (Required): [
                        (Required){
                       }
                   ]
                   file_ids (Required): [
                       String (Required)
                   ]
                   created_at: long (Required)
                   expires_at: OffsetDateTime (Required)
                   started_at: OffsetDateTime (Required)
                   completed_at: OffsetDateTime (Required)
                   cancelled_at: OffsetDateTime (Required)
                   failed_at: OffsetDateTime (Required)
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      threadId - The ID of the thread to list runs from.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of runs for a specified thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getRunWithResponse(String threadId, String runId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets an existing run from an existing thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           created_at: long (Required)
           expires_at: OffsetDateTime (Required)
           started_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to retrieve run information from.
      runId - The ID of the thread to retrieve information about.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      an existing run from an existing thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • submitToolOutputsToRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> submitToolOutputsToRunWithResponse(String threadId, String runId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.

      Request Body Schema

       
       {
           tool_outputs (Required): [
                (Required){
                   tool_call_id: String (Optional)
                   output: String (Optional)
               }
           ]
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           created_at: long (Required)
           expires_at: OffsetDateTime (Required)
           started_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run that requires tool outputs.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • cancelRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> cancelRunWithResponse(String threadId, String runId, com.azure.core.http.rest.RequestOptions requestOptions)
      Cancels a run of an in progress thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           created_at: long (Required)
           expires_at: OffsetDateTime (Required)
           started_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread being run.
      runId - The ID of the run to cancel.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createThreadAndRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createThreadAndRunWithResponse(com.azure.core.util.BinaryData createAndRunThreadOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new assistant thread and immediately starts a run using that new thread.

      Request Body Schema

       
       {
           assistant_id: String (Required)
           thread (Optional): {
               messages (Optional): [
                    (Optional){
                       role: String(user/assistant) (Required)
                       content: String (Required)
                       file_ids (Optional): [
                           String (Optional)
                       ]
                       metadata (Optional): {
                           String: String (Required)
                       }
                   }
               ]
               metadata (Optional): {
                   String: String (Required)
               }
           }
           model: String (Optional)
           instructions: String (Optional)
           tools (Optional): [
                (Optional){
               }
           ]
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           created_at: long (Required)
           expires_at: OffsetDateTime (Required)
           started_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      createAndRunThreadOptions - The details used when creating and immediately running a new assistant thread.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getRunStepWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getRunStepWithResponse(String threadId, String runId, String stepId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a single run step from a thread run.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           type: String(message_creation/tool_calls) (Required)
           assistant_id: String (Required)
           thread_id: String (Required)
           run_id: String (Required)
           status: String(in_progress/cancelled/failed/completed/expired) (Required)
           step_details (Required): {
           }
           last_error (Required): {
               code: String(server_error/rate_limit_exceeded) (Required)
               message: String (Required)
           }
           created_at: long (Required)
           expired_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the specific run to retrieve the step from.
      stepId - The ID of the step to retrieve information about.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a single run step from a thread run along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listRunStepsWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listRunStepsWithResponse(String threadId, String runId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of run steps from a thread run.

      Query Parameters

      Query Parameters
      Name Type Required Description
      limit Integer No A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order String No Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      after String No A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before String No A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   type: String(message_creation/tool_calls) (Required)
                   assistant_id: String (Required)
                   thread_id: String (Required)
                   run_id: String (Required)
                   status: String(in_progress/cancelled/failed/completed/expired) (Required)
                   step_details (Required): {
                   }
                   last_error (Required): {
                       code: String(server_error/rate_limit_exceeded) (Required)
                       message: String (Required)
                   }
                   created_at: long (Required)
                   expired_at: OffsetDateTime (Required)
                   completed_at: OffsetDateTime (Required)
                   cancelled_at: OffsetDateTime (Required)
                   failed_at: OffsetDateTime (Required)
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run to list steps from.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of run steps from a thread run along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listFilesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listFilesWithResponse(com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of previously uploaded files.

      Query Parameters

      Query Parameters
      Name Type Required Description
      purpose String No A value that, when provided, limits list results to files matching the corresponding purpose. Allowed values: "fine-tune", "fine-tune-results", "assistants", "assistants_output".
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   object: String (Required)
                   id: String (Required)
                   bytes: int (Required)
                   filename: String (Required)
                   created_at: long (Required)
                   purpose: String(fine-tune/fine-tune-results/assistants/assistants_output) (Required)
               }
           ]
       }
       
       
      Parameters:
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of previously uploaded files along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • deleteFileWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> deleteFileWithResponse(String fileId, com.azure.core.http.rest.RequestOptions requestOptions)
      Delete a previously uploaded file.

      Response Body Schema

       
       {
           id: String (Required)
           deleted: boolean (Required)
           object: String (Required)
       }
       
       
      Parameters:
      fileId - The ID of the file to delete.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a status response from a file deletion operation along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getAssistant

      public Assistant getAssistant(String assistantId)
      Retrieves an existing assistant.
      Parameters:
      assistantId - The ID of the assistant to retrieve.
      Returns:
      represents an assistant that can call the model and use tools.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createThread

      public AssistantThread createThread(AssistantThreadCreationOptions assistantThreadCreationOptions)
      Creates a new thread. Threads contain messages and can be run by assistants.
      Parameters:
      assistantThreadCreationOptions - The details used to create a new assistant thread.
      Returns:
      information about a single thread associated with an assistant.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getThread

      public AssistantThread getThread(String threadId)
      Gets information about an existing thread.
      Parameters:
      threadId - The ID of the thread to retrieve information about.
      Returns:
      information about an existing thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • deleteThread

      public ThreadDeletionStatus deleteThread(String threadId)
      Deletes an existing thread.
      Parameters:
      threadId - The ID of the thread to delete.
      Returns:
      the status of a thread deletion operation.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listMessages

      public PageableList<ThreadMessage> listMessages(String threadId, Integer limit, ListSortOrder order, String after, String before)
      Gets a list of messages that exist on a thread.
      Parameters:
      threadId - The ID of the thread to list messages from.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      a list of messages that exist on a thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listMessages

      public PageableList<ThreadMessage> listMessages(String threadId)
      Gets a list of messages that exist on a thread.
      Parameters:
      threadId - The ID of the thread to list messages from.
      Returns:
      a list of messages that exist on a thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getMessage

      public ThreadMessage getMessage(String threadId, String messageId)
      Gets an existing message from an existing thread.
      Parameters:
      threadId - The ID of the thread to retrieve the specified message from.
      messageId - The ID of the message to retrieve from the specified thread.
      Returns:
      an existing message from an existing thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRuns

      public PageableList<ThreadRun> listRuns(String threadId, Integer limit, ListSortOrder order, String after, String before)
      Gets a list of runs for a specified thread.
      Parameters:
      threadId - The ID of the thread to list runs from.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      a list of runs for a specified thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRuns

      public PageableList<ThreadRun> listRuns(String threadId)
      Gets a list of runs for a specified thread.
      Parameters:
      threadId - The ID of the thread to list runs from.
      Returns:
      a list of runs for a specified thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRun

      public ThreadRun getRun(String threadId, String runId)
      Gets an existing run from an existing thread.
      Parameters:
      threadId - The ID of the thread to retrieve run information from.
      runId - The ID of the thread to retrieve information about.
      Returns:
      an existing run from an existing thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • cancelRun

      public ThreadRun cancelRun(String threadId, String runId)
      Cancels a run of an in progress thread.
      Parameters:
      threadId - The ID of the thread being run.
      runId - The ID of the run to cancel.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createThreadAndRun

      public ThreadRun createThreadAndRun(CreateAndRunThreadOptions createAndRunThreadOptions)
      Creates a new assistant thread and immediately starts a run using that new thread.
      Parameters:
      createAndRunThreadOptions - The details used when creating and immediately running a new assistant thread.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createThreadAndRunStream

      public com.azure.core.util.IterableStream<StreamUpdate> createThreadAndRunStream(CreateAndRunThreadOptions createAndRunThreadOptions)
      Creates a new assistant thread and immediately starts a run using that new thread. Updates are returned as a stream.
      Parameters:
      createAndRunThreadOptions - The details used when creating and immediately running a new assistant thread.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRunStep

      public RunStep getRunStep(String threadId, String runId, String stepId)
      Gets a single run step from a thread run.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the specific run to retrieve the step from.
      stepId - The ID of the step to retrieve information about.
      Returns:
      a single run step from a thread run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRunSteps

      public PageableList<RunStep> listRunSteps(String threadId, String runId, Integer limit, ListSortOrder order, String after, String before)
      Gets a list of run steps from a thread run.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run to list steps from.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      a list of run steps from a thread run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRunSteps

      public PageableList<RunStep> listRunSteps(String threadId, String runId)
      Gets a list of run steps from a thread run.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run to list steps from.
      Returns:
      a list of run steps from a thread run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRunSteps

      public PageableList<RunStep> listRunSteps(String threadId, String runId, List<RunIncludes> runInclude)
      Gets a list of run steps from a thread run with additional run include parameters.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run from which to list steps.
      runInclude - A list of extra fields to include in the response.
      Returns:
      a PageableList of RunStep from the thread run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by the server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by the server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by the server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by the server on status code 409.
    • listFiles

      public List<OpenAIFile> listFiles(FilePurpose purpose)
      Gets a list of previously uploaded files.
      Parameters:
      purpose - A value that, when provided, limits list results to files matching the corresponding purpose.
      Returns:
      a list of previously uploaded files.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listFiles

      public List<OpenAIFile> listFiles()
      Gets a list of previously uploaded files.
      Returns:
      a list of previously uploaded files.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • deleteFile

      public FileDeletionStatus deleteFile(String fileId)
      Delete a previously uploaded file.
      Parameters:
      fileId - The ID of the file to delete.
      Returns:
      a status response from a file deletion operation.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateAssistantWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> updateAssistantWithResponse(String assistantId, com.azure.core.util.BinaryData updateAssistantOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Modifies an existing assistant.

      Request Body Schema

       
       {
           model: String (Optional)
           name: String (Optional)
           description: String (Optional)
           instructions: String (Optional)
           tools (Optional): [
                (Optional){
               }
           ]
           file_ids (Optional): [
               String (Optional)
           ]
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           description: String (Required)
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      assistantId - The ID of the assistant to modify.
      updateAssistantOptions - The request details to use when modifying an existing assistant.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      represents an assistant that can call the model and use tools along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateThreadWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> updateThreadWithResponse(String threadId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Modifies an existing thread.

      Request Body Schema

       
       {
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread to modify.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      information about a single thread associated with an assistant along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateMessageWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> updateMessageWithResponse(String threadId, String messageId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Modifies an existing message on an existing thread.

      Request Body Schema

       
       {
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           thread_id: String (Required)
           role: String(user/assistant) (Required)
           content (Required): [
                (Required){
               }
           ]
           assistant_id: String (Optional)
           run_id: String (Optional)
           file_ids (Required): [
               String (Required)
           ]
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread containing the specified message to modify.
      messageId - The ID of the message to modify on the specified thread.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a single, existing message within an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateRunWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> updateRunWithResponse(String threadId, String runId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Modifies an existing thread run.

      Request Body Schema

       
       {
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
               }
           ]
           file_ids (Required): [
               String (Required)
           ]
           created_at: long (Required)
           expires_at: OffsetDateTime (Required)
           started_at: OffsetDateTime (Required)
           completed_at: OffsetDateTime (Required)
           cancelled_at: OffsetDateTime (Required)
           failed_at: OffsetDateTime (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      threadId - The ID of the thread associated with the specified run.
      runId - The ID of the run to modify.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an assistant thread along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getFileWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getFileWithResponse(String fileId, com.azure.core.http.rest.RequestOptions requestOptions)
      Returns information about a specific file. Does not retrieve file content.

      Response Body Schema

       
       {
           object: String (Required)
           id: String (Required)
           bytes: int (Required)
           filename: String (Required)
           created_at: long (Required)
           purpose: String(fine-tune/fine-tune-results/assistants/assistants_output) (Required)
       }
       
       
      Parameters:
      fileId - The ID of the file to retrieve.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      represents an assistant that can call the model and use tools along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateAssistant

      public Assistant updateAssistant(String assistantId, UpdateAssistantOptions updateAssistantOptions)
      Modifies an existing assistant.
      Parameters:
      assistantId - The ID of the assistant to modify.
      updateAssistantOptions - The request details to use when modifying an existing assistant.
      Returns:
      represents an assistant that can call the model and use tools.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateMessage

      public ThreadMessage updateMessage(String threadId, String messageId, Map<String,String> metadata)
      Modifies an existing message on an existing thread.
      Parameters:
      threadId - The ID of the thread containing the specified message to modify.
      messageId - The ID of the message to modify on the specified thread.
      metadata - A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
      Returns:
      a single, existing message within an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateMessage

      public ThreadMessage updateMessage(String threadId, String messageId)
      Modifies an existing message on an existing thread.
      Parameters:
      threadId - The ID of the thread containing the specified message to modify.
      messageId - The ID of the message to modify on the specified thread.
      Returns:
      a single, existing message within an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRun

      public ThreadRun createRun(String threadId, CreateRunOptions createRunOptions)
      Creates a new run for an assistant thread.
      Parameters:
      threadId - The ID of the thread to run.
      createRunOptions - The details used when creating a new run of an assistant thread.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRun

      public ThreadRun createRun(AssistantThread thread, Assistant assistant)
      Creates a new run for an assistant thread.
      Parameters:
      thread - The thread to run.
      assistant - The assistant that will run the thread.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRunStream

      public com.azure.core.util.IterableStream<StreamUpdate> createRunStream(String threadId, CreateRunOptions createRunOptions)
      Creates a new run for an assistant thread returning a stream of updates.
      Parameters:
      threadId - The ID of the thread to run.
      createRunOptions - The details for the run to create.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRunStream

      public com.azure.core.util.IterableStream<StreamUpdate> createRunStream(String threadId, String assistantId)
      Creates a new run for an assistant thread returning a stream of updates.
      Parameters:
      threadId - The thread to run.
      assistantId - The assistant that will run the thread.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRun

      public ThreadRun createRun(String threadId, CreateRunOptions createRunOptions, List<RunIncludes> runInclude)
      Creates a new run for an assistant thread with additional run include parameters.
      Parameters:
      threadId - The ID of the thread to run.
      createRunOptions - The details for creating a new run.
      runInclude - A list of extra fields to include in the response.
      Returns:
      a ThreadRun representing the created run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by the server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by the server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by the server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by the server on status code 409.
    • createRunStream

      public com.azure.core.util.IterableStream<StreamUpdate> createRunStream(String threadId, CreateRunOptions createRunOptions, List<RunIncludes> runInclude)
      Creates a new run for an assistant thread returning a stream of updates with additional run include parameters.
      Parameters:
      threadId - The ID of the thread to run.
      createRunOptions - The details for creating the run.
      runInclude - A list of extra fields to include in the response.
      Returns:
      an IterableStream of StreamUpdate representing the response stream.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by the server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by the server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by the server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by the server on status code 409.
    • updateRun

      public ThreadRun updateRun(String threadId, String runId, Map<String,String> metadata)
      Modifies an existing thread run.
      Parameters:
      threadId - The ID of the thread associated with the specified run.
      runId - The ID of the run to modify.
      metadata - A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateRun

      public ThreadRun updateRun(String threadId, String runId)
      Modifies an existing thread run.
      Parameters:
      threadId - The ID of the thread associated with the specified run.
      runId - The ID of the run to modify.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getFile

      public OpenAIFile getFile(String fileId)
      Returns information about a specific file. Does not retrieve file content.
      Parameters:
      fileId - The ID of the file to retrieve.
      Returns:
      represents an assistant that can call the model and use tools.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • uploadFile

      public OpenAIFile uploadFile(FileDetails file, FilePurpose purpose)
      Uploads a file for use by other operations.
      Parameters:
      file - The file data (not filename) to upload.
      purpose - The intended purpose of the file.
      Returns:
      represents an assistant that can call the model and use tools.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getFileContentWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getFileContentWithResponse(String fileId, com.azure.core.http.rest.RequestOptions requestOptions)
      Returns information about a specific file. Does not retrieve file content.

      Response Body Schema

       
       byte[]
       
       
      Parameters:
      fileId - The ID of the file to retrieve.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      represent a byte array along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getFileContent

      public byte[] getFileContent(String fileId)
      Returns information about a specific file. Does not retrieve file content.
      Parameters:
      fileId - The ID of the file to retrieve.
      Returns:
      represent a byte array.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • submitToolOutputsToRunStream

      public com.azure.core.util.IterableStream<StreamUpdate> submitToolOutputsToRunStream(String threadId, String runId, List<ToolOutput> toolOutputs)
      Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run that requires tool outputs.
      toolOutputs - The list of tool outputs requested by tool calls from the specified run. when the Run enters a terminal state with a `data: [DONE]` message.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • submitToolOutputsToRun

      public ThreadRun submitToolOutputsToRun(String threadId, String runId, List<ToolOutput> toolOutputs)
      Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the run that requires tool outputs.
      toolOutputs - A list of tools for which the outputs are being submitted.
      Returns:
      data representing a single evaluation run of an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStoresWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listVectorStoresWithResponse(com.azure.core.http.rest.RequestOptions requestOptions)
      Returns a list of vector stores.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   created_at: long (Required)
                   name: String (Required)
                   usage_bytes: int (Required)
                   file_counts (Required): {
                       in_progress: int (Required)
                       completed: int (Required)
                       failed: int (Required)
                       cancelled: int (Required)
                       total: int (Required)
                   }
                   status: String(expired/in_progress/completed) (Required)
                   expires_after (Optional): {
                       anchor: String(last_active_at) (Required)
                       days: int (Required)
                   }
                   expires_at: Long (Optional)
                   last_active_at: Long (Required)
                   metadata (Required): {
                       String: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response data for a requested list of items along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createVectorStoreWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createVectorStoreWithResponse(com.azure.core.util.BinaryData vectorStoreOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a vector store.

      Request Body Schema

       
       {
           file_ids (Optional): [
               String (Optional)
           ]
           name: String (Optional)
           expires_after (Optional): {
               anchor: String(last_active_at) (Required)
               days: int (Required)
           }
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           usage_bytes: int (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
           status: String(expired/in_progress/completed) (Required)
           expires_after (Optional): {
               anchor: String(last_active_at) (Required)
               days: int (Required)
           }
           expires_at: Long (Optional)
           last_active_at: Long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      vectorStoreOptions - Request object for creating a vector store.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getVectorStoreWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getVectorStoreWithResponse(String vectorStoreId, com.azure.core.http.rest.RequestOptions requestOptions)
      Returns the vector store object matching the specified ID.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           usage_bytes: int (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
           status: String(expired/in_progress/completed) (Required)
           expires_after (Optional): {
               anchor: String(last_active_at) (Required)
               days: int (Required)
           }
           expires_at: Long (Optional)
           last_active_at: Long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store to retrieve.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • modifyVectorStoreWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> modifyVectorStoreWithResponse(String vectorStoreId, com.azure.core.util.BinaryData vectorStoreUpdateOptions, com.azure.core.http.rest.RequestOptions requestOptions)
      The ID of the vector store to modify.

      Request Body Schema

       
       {
           name: String (Optional)
           expires_after (Optional): {
               anchor: String(last_active_at) (Required)
               days: int (Required)
           }
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           name: String (Required)
           usage_bytes: int (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
           status: String(expired/in_progress/completed) (Required)
           expires_after (Optional): {
               anchor: String(last_active_at) (Required)
               days: int (Required)
           }
           expires_at: Long (Optional)
           last_active_at: Long (Required)
           metadata (Required): {
               String: String (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store to modify.
      vectorStoreUpdateOptions - Request object for updating a vector store.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • deleteVectorStoreWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> deleteVectorStoreWithResponse(String vectorStoreId, com.azure.core.http.rest.RequestOptions requestOptions)
      Deletes the vector store object matching the specified ID.

      Response Body Schema

       
       {
           id: String (Required)
           deleted: boolean (Required)
           object: String (Required)
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store to delete.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      response object for deleting a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listVectorStoreFilesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listVectorStoreFilesWithResponse(String vectorStoreId, com.azure.core.http.rest.RequestOptions requestOptions)
      Returns a list of vector store files.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      filterStringNoFilter by file status. Allowed values: "in_progress", "completed", "failed", "cancelled".
      limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   usage_bytes: int (Required)
                   created_at: long (Required)
                   vector_store_id: String (Required)
                   status: String(in_progress/completed/failed/cancelled) (Required)
                   last_error (Required): {
                       code: String(internal_error/file_not_found/parsing_error/unhandled_mime_type) (Required)
                       message: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the files belong to.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response data for a requested list of items along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createVectorStoreFileWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createVectorStoreFileWithResponse(String vectorStoreId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Create a vector store file by attaching a file to a vector store.

      Request Body Schema

       
       {
           file_id: String (Required)
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           usage_bytes: int (Required)
           created_at: long (Required)
           vector_store_id: String (Required)
           status: String(in_progress/completed/failed/cancelled) (Required)
           last_error (Required): {
               code: String(internal_error/file_not_found/parsing_error/unhandled_mime_type) (Required)
               message: String (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      description of a file attached to a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getVectorStoreFileWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getVectorStoreFileWithResponse(String vectorStoreId, String fileId, com.azure.core.http.rest.RequestOptions requestOptions)
      Retrieves a vector store file.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           usage_bytes: int (Required)
           created_at: long (Required)
           vector_store_id: String (Required)
           status: String(in_progress/completed/failed/cancelled) (Required)
           last_error (Required): {
               code: String(internal_error/file_not_found/parsing_error/unhandled_mime_type) (Required)
               message: String (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the file belongs to.
      fileId - The ID of the file being retrieved.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      description of a file attached to a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • deleteVectorStoreFileWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> deleteVectorStoreFileWithResponse(String vectorStoreId, String fileId, com.azure.core.http.rest.RequestOptions requestOptions)
      Delete a vector store file. 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.

      Response Body Schema

       
       {
           id: String (Required)
           deleted: boolean (Required)
           object: String (Required)
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the file belongs to.
      fileId - The ID of the file to delete its relationship to the vector store.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      response object for deleting a vector store file relationship along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createVectorStoreFileBatchWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> createVectorStoreFileBatchWithResponse(String vectorStoreId, com.azure.core.util.BinaryData request, com.azure.core.http.rest.RequestOptions requestOptions)
      Create a vector store file batch.

      Request Body Schema

       
       {
           file_ids (Required): [
               String (Required)
           ]
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           vector_store_id: String (Required)
           status: String(in_progress/completed/cancelled/failed) (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File Batch.
      request - The request parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a batch of files attached to a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getVectorStoreFileBatchWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, com.azure.core.http.rest.RequestOptions requestOptions)
      Retrieve a vector store file batch.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           vector_store_id: String (Required)
           status: String(in_progress/completed/cancelled/failed) (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch being retrieved.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a batch of files attached to a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • cancelVectorStoreFileBatchWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> cancelVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, com.azure.core.http.rest.RequestOptions requestOptions)
      Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           created_at: long (Required)
           vector_store_id: String (Required)
           status: String(in_progress/completed/cancelled/failed) (Required)
           file_counts (Required): {
               in_progress: int (Required)
               completed: int (Required)
               failed: int (Required)
               cancelled: int (Required)
               total: int (Required)
           }
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch to cancel.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a batch of files attached to a vector store along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • listVectorStoreFileBatchFilesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> listVectorStoreFileBatchFilesWithResponse(String vectorStoreId, String batchId, com.azure.core.http.rest.RequestOptions requestOptions)
      Returns a list of vector store files in a batch.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      filterStringNoFilter by file status. Allowed values: "in_progress", "completed", "failed", "cancelled".
      limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           object: String (Required)
           data (Required): [
                (Required){
                   id: String (Required)
                   object: String (Required)
                   usage_bytes: int (Required)
                   created_at: long (Required)
                   vector_store_id: String (Required)
                   status: String(in_progress/completed/failed/cancelled) (Required)
                   last_error (Required): {
                       code: String(internal_error/file_not_found/parsing_error/unhandled_mime_type) (Required)
                       message: String (Required)
                   }
               }
           ]
           first_id: String (Required)
           last_id: String (Required)
           has_more: boolean (Required)
       }
       
       
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch that the files belong to.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response data for a requested list of items along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateThread

      public AssistantThread updateThread(String threadId, UpdateAssistantThreadOptions updateAssistantThreadOptions)
      Modifies an existing thread.
      Parameters:
      threadId - The ID of the thread to modify.
      updateAssistantThreadOptions - The details used to update an existing assistant thread.
      Returns:
      information about a single thread associated with an assistant.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createMessage

      public ThreadMessage createMessage(String threadId, ThreadMessageOptions threadMessageOptions)
      Creates a new message on a specified thread.
      Parameters:
      threadId - The ID of the thread to create the new message on.
      threadMessageOptions - A single message within an assistant thread, as provided during that thread's creation for its initial state.
      Returns:
      a single, existing message within an assistant thread.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStores

      public PageableList<VectorStore> listVectorStores(Integer limit, ListSortOrder order, String after, String before)
      Returns a list of vector stores.
      Parameters:
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      the response data for a requested list of items.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStores

      public PageableList<VectorStore> listVectorStores()
      Returns a list of vector stores.
      Returns:
      the response data for a requested list of items.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createVectorStore

      public VectorStore createVectorStore(VectorStoreOptions vectorStoreOptions)
      Creates a vector store.
      Parameters:
      vectorStoreOptions - Request object for creating a vector store.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getVectorStore

      public VectorStore getVectorStore(String vectorStoreId)
      Returns the vector store object matching the specified ID.
      Parameters:
      vectorStoreId - The ID of the vector store to retrieve.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • modifyVectorStore

      public VectorStore modifyVectorStore(String vectorStoreId, VectorStoreUpdateOptions vectorStoreUpdateOptions)
      The ID of the vector store to modify.
      Parameters:
      vectorStoreId - The ID of the vector store to modify.
      vectorStoreUpdateOptions - Request object for updating a vector store.
      Returns:
      a vector store is a collection of processed files can be used by the `file_search` tool.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • deleteVectorStore

      public VectorStoreDeletionStatus deleteVectorStore(String vectorStoreId)
      Deletes the vector store object matching the specified ID.
      Parameters:
      vectorStoreId - The ID of the vector store to delete.
      Returns:
      response object for deleting a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStoreFiles

      public PageableList<VectorStoreFile> listVectorStoreFiles(String vectorStoreId, VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before)
      Returns a list of vector store files.
      Parameters:
      vectorStoreId - The ID of the vector store that the files belong to.
      filter - Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      the response data for a requested list of items.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStoreFiles

      public PageableList<VectorStoreFile> listVectorStoreFiles(String vectorStoreId)
      Returns a list of vector store files.
      Parameters:
      vectorStoreId - The ID of the vector store that the files belong to.
      Returns:
      the response data for a requested list of items.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createVectorStoreFile

      public VectorStoreFile createVectorStoreFile(String vectorStoreId, String fileId)
      Create a vector store file by attaching a file to a vector store.
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File.
      fileId - A File ID that the vector store should use. Useful for tools like `file_search` that can access files.
      Returns:
      description of a file attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getVectorStoreFile

      public VectorStoreFile getVectorStoreFile(String vectorStoreId, String fileId)
      Retrieves a vector store file.
      Parameters:
      vectorStoreId - The ID of the vector store that the file belongs to.
      fileId - The ID of the file being retrieved.
      Returns:
      description of a file attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • deleteVectorStoreFile

      public VectorStoreFileDeletionStatus deleteVectorStoreFile(String vectorStoreId, String fileId)
      Delete a vector store file. 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.
      Parameters:
      vectorStoreId - The ID of the vector store that the file belongs to.
      fileId - The ID of the file to delete its relationship to the vector store.
      Returns:
      response object for deleting a vector store file relationship.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createVectorStoreFileBatch

      public VectorStoreFileBatch createVectorStoreFileBatch(String vectorStoreId, List<String> fileIds)
      Create a vector store file batch.
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File Batch.
      fileIds - A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files.
      Returns:
      a batch of files attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getVectorStoreFileBatch

      public VectorStoreFileBatch getVectorStoreFileBatch(String vectorStoreId, String batchId)
      Retrieve a vector store file batch.
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch being retrieved.
      Returns:
      a batch of files attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • cancelVectorStoreFileBatch

      public VectorStoreFileBatch cancelVectorStoreFileBatch(String vectorStoreId, String batchId)
      Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch to cancel.
      Returns:
      a batch of files attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStoreFileBatchFiles

      public PageableList<VectorStoreFile> listVectorStoreFileBatchFiles(String vectorStoreId, String batchId, VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before)
      Returns a list of vector store files in a batch.
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch that the files belong to.
      filter - Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      the response data for a requested list of items.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listVectorStoreFileBatchFiles

      public PageableList<VectorStoreFile> listVectorStoreFileBatchFiles(String vectorStoreId, String batchId)
      Returns a list of vector store files in a batch.
      Parameters:
      vectorStoreId - The ID of the vector store that the file batch belongs to.
      batchId - The ID of the file batch that the files belong to.
      Returns:
      the response data for a requested list of items.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createVectorStoreFile

      public VectorStoreFile createVectorStoreFile(String vectorStoreId, String fileId, VectorStoreChunkingStrategyRequest chunkingStrategy)
      Create a vector store file by attaching a file to a vector store.
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File.
      fileId - A File ID that the vector store should use. Useful for tools like `file_search` that can access files.
      chunkingStrategy - The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.
      Returns:
      description of a file attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createVectorStoreFileBatch

      public VectorStoreFileBatch createVectorStoreFileBatch(String vectorStoreId, List<String> fileIds, VectorStoreChunkingStrategyRequest chunkingStrategy)
      Create a vector store file batch.
      Parameters:
      vectorStoreId - The ID of the vector store for which to create a File Batch.
      fileIds - A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files.
      chunkingStrategy - The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.
      Returns:
      a batch of files attached to a vector store.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRunStep

      public RunStep getRunStep(String threadId, String runId, String stepId, List<RunIncludes> runInclude)
      Gets a single run step from a thread run.
      Parameters:
      threadId - The ID of the thread that was run.
      runId - The ID of the specific run to retrieve the step from.
      stepId - The ID of the step to retrieve information about.
      runInclude - A list of additional fields to include in the response.
      Returns:
      a single run step from a thread run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.