Skip to content

Latest commit

 

History

History
1598 lines (1249 loc) · 63 KB

AssistantsApi.md

File metadata and controls

1598 lines (1249 loc) · 63 KB

AssistantsApi

All URIs are relative to https://api.openai.com/v1

Method HTTP request Description
cancelRun POST /threads/{thread_id}/runs/{run_id}/cancel Cancels a run that is `in_progress`.
createAssistant POST /assistants Create an assistant with a model and instructions.
createMessage POST /threads/{thread_id}/messages Create a message.
createRun POST /threads/{thread_id}/runs Create a run.
createThread POST /threads Create a thread.
createThreadAndRun POST /threads/runs Create a thread and run it in one request.
deleteAssistant DELETE /assistants/{assistant_id} Delete an assistant.
deleteMessage DELETE /threads/{thread_id}/messages/{message_id} Deletes a message.
deleteThread DELETE /threads/{thread_id} Delete a thread.
getAssistant GET /assistants/{assistant_id} Retrieves an assistant.
getMessage GET /threads/{thread_id}/messages/{message_id} Retrieve a message.
getRun GET /threads/{thread_id}/runs/{run_id} Retrieves a run.
getRunStep GET /threads/{thread_id}/runs/{run_id}/steps/{step_id} Retrieves a run step.
getThread GET /threads/{thread_id} Retrieves a thread.
listAssistants GET /assistants Returns a list of assistants.
listMessages GET /threads/{thread_id}/messages Returns a list of messages for a given thread.
listRunSteps GET /threads/{thread_id}/runs/{run_id}/steps Returns a list of run steps belonging to a run.
listRuns GET /threads/{thread_id}/runs Returns a list of runs belonging to a thread.
modifyAssistant POST /assistants/{assistant_id} Modifies an assistant.
modifyMessage POST /threads/{thread_id}/messages/{message_id} Modifies a message.
modifyRun POST /threads/{thread_id}/runs/{run_id} Modifies a run.
modifyThread POST /threads/{thread_id} Modifies a thread.
submitToolOuputsToRun POST /threads/{thread_id}/runs/{run_id}/submit_tool_outputs When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

cancelRun

RunObject cancelRun(threadId, runId)

Cancels a run that is `in_progress`.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to which this run belongs.
    String runId = "runId_example"; // String | The ID of the run to cancel.
    try {
      RunObject result = apiInstance.cancelRun(threadId, runId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#cancelRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which this run belongs.
runId String The ID of the run to cancel.

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

createAssistant

AssistantObject createAssistant(createAssistantRequest)

Create an assistant with a model and instructions.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    CreateAssistantRequest createAssistantRequest = new CreateAssistantRequest(); // CreateAssistantRequest | 
    try {
      AssistantObject result = apiInstance.createAssistant(createAssistantRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#createAssistant");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createAssistantRequest CreateAssistantRequest

Return type

AssistantObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

createMessage

MessageObject createMessage(threadId, createMessageRequest)

Create a message.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) to create a message for.
    CreateMessageRequest createMessageRequest = new CreateMessageRequest(); // CreateMessageRequest | 
    try {
      MessageObject result = apiInstance.createMessage(threadId, createMessageRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#createMessage");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to create a message for.
createMessageRequest CreateMessageRequest

Return type

MessageObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

createRun

RunObject createRun(threadId, createRunRequest, include)

Create a run.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to run.
    CreateRunRequest createRunRequest = new CreateRunRequest(); // CreateRunRequest | 
    List<String> include = Arrays.asList(); // List<String> | A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.  See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. 
    try {
      RunObject result = apiInstance.createRun(threadId, createRunRequest, include);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#createRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to run.
createRunRequest CreateRunRequest
include List<String> A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[].file_search.results[].content` to fetch the file search result content. See the file search tool documentation for more information. [optional] [enum: step_details.tool_calls[].file_search.results[].content]

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

createThread

ThreadObject createThread(createThreadRequest)

Create a thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    CreateThreadRequest createThreadRequest = new CreateThreadRequest(); // CreateThreadRequest | 
    try {
      ThreadObject result = apiInstance.createThread(createThreadRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#createThread");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createThreadRequest CreateThreadRequest [optional]

Return type

ThreadObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

createThreadAndRun

RunObject createThreadAndRun(createThreadAndRunRequest)

Create a thread and run it in one request.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest(); // CreateThreadAndRunRequest | 
    try {
      RunObject result = apiInstance.createThreadAndRun(createThreadAndRunRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#createThreadAndRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createThreadAndRunRequest CreateThreadAndRunRequest

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

deleteAssistant

DeleteAssistantResponse deleteAssistant(assistantId)

Delete an assistant.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String assistantId = "assistantId_example"; // String | The ID of the assistant to delete.
    try {
      DeleteAssistantResponse result = apiInstance.deleteAssistant(assistantId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#deleteAssistant");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
assistantId String The ID of the assistant to delete.

Return type

DeleteAssistantResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

deleteMessage

DeleteMessageResponse deleteMessage(threadId, messageId)

Deletes a message.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to which this message belongs.
    String messageId = "messageId_example"; // String | The ID of the message to delete.
    try {
      DeleteMessageResponse result = apiInstance.deleteMessage(threadId, messageId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#deleteMessage");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which this message belongs.
messageId String The ID of the message to delete.

Return type

DeleteMessageResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

deleteThread

DeleteThreadResponse deleteThread(threadId)

Delete a thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to delete.
    try {
      DeleteThreadResponse result = apiInstance.deleteThread(threadId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#deleteThread");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to delete.

Return type

DeleteThreadResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getAssistant

AssistantObject getAssistant(assistantId)

Retrieves an assistant.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String assistantId = "assistantId_example"; // String | The ID of the assistant to retrieve.
    try {
      AssistantObject result = apiInstance.getAssistant(assistantId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#getAssistant");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
assistantId String The ID of the assistant to retrieve.

Return type

AssistantObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getMessage

MessageObject getMessage(threadId, messageId)

Retrieve a message.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) to which this message belongs.
    String messageId = "messageId_example"; // String | The ID of the message to retrieve.
    try {
      MessageObject result = apiInstance.getMessage(threadId, messageId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#getMessage");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which this message belongs.
messageId String The ID of the message to retrieve.

Return type

MessageObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getRun

RunObject getRun(threadId, runId)

Retrieves a run.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) that was run.
    String runId = "runId_example"; // String | The ID of the run to retrieve.
    try {
      RunObject result = apiInstance.getRun(threadId, runId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#getRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread that was run.
runId String The ID of the run to retrieve.

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getRunStep

RunStepObject getRunStep(threadId, runId, stepId, include)

Retrieves a run step.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to which the run and run step belongs.
    String runId = "runId_example"; // String | The ID of the run to which the run step belongs.
    String stepId = "stepId_example"; // String | The ID of the run step to retrieve.
    List<String> include = Arrays.asList(); // List<String> | A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.  See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. 
    try {
      RunStepObject result = apiInstance.getRunStep(threadId, runId, stepId, include);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#getRunStep");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which the run and run step belongs.
runId String The ID of the run to which the run step belongs.
stepId String The ID of the run step to retrieve.
include List<String> A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[].file_search.results[].content` to fetch the file search result content. See the file search tool documentation for more information. [optional] [enum: step_details.tool_calls[].file_search.results[].content]

Return type

RunStepObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getThread

ThreadObject getThread(threadId)

Retrieves a thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to retrieve.
    try {
      ThreadObject result = apiInstance.getThread(threadId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#getThread");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to retrieve.

Return type

ThreadObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

listAssistants

ListAssistantsResponse listAssistants(limit, order, after, before)

Returns a list of assistants.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    Integer limit = 20; // Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. 
    String order = "asc"; // String | Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. 
    String after = "after_example"; // String | 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. 
    String before = "before_example"; // String | 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. 
    try {
      ListAssistantsResponse result = apiInstance.listAssistants(limit, order, after, before);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#listAssistants");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. [optional] [default to 20]
order String Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. [optional] [default to desc] [enum: asc, desc]
after String 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. [optional]
before String 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. [optional]

Return type

ListAssistantsResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

listMessages

ListMessagesResponse listMessages(threadId, limit, order, after, before, runId)

Returns a list of messages for a given thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) the messages belong to.
    Integer limit = 20; // Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. 
    String order = "asc"; // String | Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. 
    String after = "after_example"; // String | 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. 
    String before = "before_example"; // String | 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. 
    String runId = "runId_example"; // String | Filter messages by the run ID that generated them. 
    try {
      ListMessagesResponse result = apiInstance.listMessages(threadId, limit, order, after, before, runId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#listMessages");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread the messages belong to.
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. [optional] [default to 20]
order String Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. [optional] [default to desc] [enum: asc, desc]
after String 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. [optional]
before String 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. [optional]
runId String Filter messages by the run ID that generated them. [optional]

Return type

ListMessagesResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

listRunSteps

ListRunStepsResponse listRunSteps(threadId, runId, limit, order, after, before, include)

Returns a list of run steps belonging to a run.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread the run and run steps belong to.
    String runId = "runId_example"; // String | The ID of the run the run steps belong to.
    Integer limit = 20; // Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. 
    String order = "asc"; // String | Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. 
    String after = "after_example"; // String | 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. 
    String before = "before_example"; // String | 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. 
    List<String> include = Arrays.asList(); // List<String> | A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.  See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. 
    try {
      ListRunStepsResponse result = apiInstance.listRunSteps(threadId, runId, limit, order, after, before, include);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#listRunSteps");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread the run and run steps belong to.
runId String The ID of the run the run steps belong to.
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. [optional] [default to 20]
order String Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. [optional] [default to desc] [enum: asc, desc]
after String 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. [optional]
before String 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. [optional]
include List<String> A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[].file_search.results[].content` to fetch the file search result content. See the file search tool documentation for more information. [optional] [enum: step_details.tool_calls[].file_search.results[].content]

Return type

ListRunStepsResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

listRuns

ListRunsResponse listRuns(threadId, limit, order, after, before)

Returns a list of runs belonging to a thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread the run belongs to.
    Integer limit = 20; // Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. 
    String order = "asc"; // String | Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. 
    String after = "after_example"; // String | 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. 
    String before = "before_example"; // String | 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. 
    try {
      ListRunsResponse result = apiInstance.listRuns(threadId, limit, order, after, before);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#listRuns");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread the run belongs to.
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. [optional] [default to 20]
order String Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. [optional] [default to desc] [enum: asc, desc]
after String 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. [optional]
before String 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. [optional]

Return type

ListRunsResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

modifyAssistant

AssistantObject modifyAssistant(assistantId, modifyAssistantRequest)

Modifies an assistant.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String assistantId = "assistantId_example"; // String | The ID of the assistant to modify.
    ModifyAssistantRequest modifyAssistantRequest = new ModifyAssistantRequest(); // ModifyAssistantRequest | 
    try {
      AssistantObject result = apiInstance.modifyAssistant(assistantId, modifyAssistantRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#modifyAssistant");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
assistantId String The ID of the assistant to modify.
modifyAssistantRequest ModifyAssistantRequest

Return type

AssistantObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

modifyMessage

MessageObject modifyMessage(threadId, messageId, modifyMessageRequest)

Modifies a message.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to which this message belongs.
    String messageId = "messageId_example"; // String | The ID of the message to modify.
    ModifyMessageRequest modifyMessageRequest = new ModifyMessageRequest(); // ModifyMessageRequest | 
    try {
      MessageObject result = apiInstance.modifyMessage(threadId, messageId, modifyMessageRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#modifyMessage");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which this message belongs.
messageId String The ID of the message to modify.
modifyMessageRequest ModifyMessageRequest

Return type

MessageObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

modifyRun

RunObject modifyRun(threadId, runId, modifyRunRequest)

Modifies a run.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) that was run.
    String runId = "runId_example"; // String | The ID of the run to modify.
    ModifyRunRequest modifyRunRequest = new ModifyRunRequest(); // ModifyRunRequest | 
    try {
      RunObject result = apiInstance.modifyRun(threadId, runId, modifyRunRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#modifyRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread that was run.
runId String The ID of the run to modify.
modifyRunRequest ModifyRunRequest

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

modifyThread

ThreadObject modifyThread(threadId, modifyThreadRequest)

Modifies a thread.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the thread to modify. Only the `metadata` can be modified.
    ModifyThreadRequest modifyThreadRequest = new ModifyThreadRequest(); // ModifyThreadRequest | 
    try {
      ThreadObject result = apiInstance.modifyThread(threadId, modifyThreadRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#modifyThread");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to modify. Only the `metadata` can be modified.
modifyThreadRequest ModifyThreadRequest

Return type

ThreadObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

submitToolOuputsToRun

RunObject submitToolOuputsToRun(threadId, runId, submitToolOutputsRunRequest)

When a run has the `status: &quot;requires_action&quot;` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

Example

// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.AssistantsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.openai.com/v1");
    
    // Configure HTTP bearer authorization: ApiKeyAuth
    HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
    ApiKeyAuth.setBearerToken("BEARER TOKEN");

    AssistantsApi apiInstance = new AssistantsApi(defaultClient);
    String threadId = "threadId_example"; // String | The ID of the [thread](/docs/api-reference/threads) to which this run belongs.
    String runId = "runId_example"; // String | The ID of the run that requires the tool output submission.
    SubmitToolOutputsRunRequest submitToolOutputsRunRequest = new SubmitToolOutputsRunRequest(); // SubmitToolOutputsRunRequest | 
    try {
      RunObject result = apiInstance.submitToolOuputsToRun(threadId, runId, submitToolOutputsRunRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssistantsApi#submitToolOuputsToRun");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
threadId String The ID of the thread to which this run belongs.
runId String The ID of the run that requires the tool output submission.
submitToolOutputsRunRequest SubmitToolOutputsRunRequest

Return type

RunObject

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -