diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index caf15f410519..1413df3aaf37 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -197,6 +197,7 @@ com.azure:azure-verticals-agrifood-farming;1.0.0-beta.3;1.0.0-beta.4
com.azure:azure-xml;1.0.0-beta.2;1.0.0-beta.3
com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-ai-vision-imageanalysis;1.0.0-beta.1;1.0.0-beta.1
+com.azure:azure-ai-openai-assistants;1.0.0-beta.1;1.0.0-beta.1
com.azure.spring:azure-monitor-spring-native;1.0.0-beta.1;1.0.0-beta.1
com.azure.spring:azure-monitor-spring-native-test;1.0.0-beta.1;1.0.0-beta.1
com.azure.spring:spring-cloud-azure-appconfiguration-config-web;4.14.0;4.15.0-beta.1
diff --git a/pom.xml b/pom.xml
index 6a9a2a7fe762..1352ff365fc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,6 +140,7 @@
sdk/notificationhubs
sdk/oep
sdk/openai
+ sdk/openai/assistants
sdk/operationsmanagement
sdk/orbital
sdk/paloaltonetworks
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/CHANGELOG.md b/sdk/openai/assistants/azure-ai-openai-assistants/CHANGELOG.md
new file mode 100644
index 000000000000..38dcaecf14bd
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/CHANGELOG.md
@@ -0,0 +1,13 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+- Azure Assistants client library for Java. This package contains Microsoft Azure Assistants client library.
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/README.md b/sdk/openai/assistants/azure-ai-openai-assistants/README.md
new file mode 100644
index 000000000000..c556eee9c1dc
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/README.md
@@ -0,0 +1,65 @@
+# Azure Assistants client library for Java
+
+Azure Assistants client library for Java.
+
+This package contains Microsoft Azure Assistants client library.
+
+## Documentation
+
+Various documentation is available to help you get started
+
+- [API reference documentation][docs]
+- [Product documentation][product_documentation]
+
+## Getting started
+
+### Prerequisites
+
+- [Java Development Kit (JDK)][jdk] with version 8 or above
+- [Azure Subscription][azure_subscription]
+
+### Adding the package to your product
+
+[//]: # ({x-version-update-start;com.azure:azure-ai-openai-assistants;current})
+```xml
+
+ com.azure
+ azure-ai-openai-assistants
+ 1.0.0-beta.1
+
+```
+[//]: # ({x-version-update-end})
+
+### Authentication
+
+[Azure Identity][azure_identity] package provides the default implementation for authenticating the client.
+
+## Key concepts
+
+## Examples
+
+```java com.azure.ai.openai.assistants.readme
+```
+
+## Troubleshooting
+
+## Next steps
+
+## Contributing
+
+For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
+
+1. Fork it
+1. Create your feature branch (`git checkout -b my-new-feature`)
+1. Commit your changes (`git commit -am 'Add some feature'`)
+1. Push to the branch (`git push origin my-new-feature`)
+1. Create new Pull Request
+
+
+[product_documentation]: https://azure.microsoft.com/services/
+[docs]: https://azure.github.io/azure-sdk-for-java/
+[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
+[azure_subscription]: https://azure.microsoft.com/free/
+[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
+
+
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/assets.json b/sdk/openai/assistants/azure-ai-openai-assistants/assets.json
new file mode 100644
index 000000000000..3322e4cf9cf5
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/assets.json
@@ -0,0 +1,6 @@
+{
+ "AssetsRepo" : "Azure/azure-sdk-assets",
+ "AssetsRepoPrefixPath" : "java",
+ "TagPrefix" : "java/assistants/azure-ai-openai-assistants",
+ "Tag" : ""
+}
\ No newline at end of file
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/pom.xml b/sdk/openai/assistants/azure-ai-openai-assistants/pom.xml
new file mode 100644
index 000000000000..905b5a2bf966
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/pom.xml
@@ -0,0 +1,89 @@
+
+
+ 4.0.0
+
+ com.azure
+ azure-client-sdk-parent
+ 1.7.0
+ ../../parents/azure-client-sdk-parent
+
+
+ com.azure
+ azure-ai-openai-assistants
+ 1.0.0-beta.1
+ jar
+
+ Microsoft Azure SDK for Assistants
+ This package contains Microsoft Azure Assistants client library.
+ https://github.com/Azure/azure-sdk-for-java
+
+
+
+ The MIT License (MIT)
+ http://opensource.org/licenses/MIT
+ repo
+
+
+
+
+ https://github.com/Azure/azure-sdk-for-java
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ HEAD
+
+
+
+ microsoft
+ Microsoft
+
+
+
+ UTF-8
+
+
+
+ com.azure
+ azure-core
+ 1.45.1
+
+
+ com.azure
+ azure-core-http-netty
+ 1.13.11
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.9.3
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.9.3
+ test
+
+
+ com.azure
+ azure-core-test
+ 1.22.1
+ test
+
+
+ com.azure
+ azure-identity
+ 1.11.1
+ test
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.36
+ test
+
+
+
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsAsyncClient.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsAsyncClient.java
new file mode 100644
index 000000000000..74733a3859a0
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsAsyncClient.java
@@ -0,0 +1,3083 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.openai.assistants;
+
+import com.azure.ai.openai.assistants.implementation.AssistantsClientImpl;
+import com.azure.ai.openai.assistants.models.Assistant;
+import com.azure.ai.openai.assistants.models.AssistantCreationOptions;
+import com.azure.ai.openai.assistants.models.AssistantDeletionStatus;
+import com.azure.ai.openai.assistants.models.AssistantFile;
+import com.azure.ai.openai.assistants.models.AssistantFileDeletionStatus;
+import com.azure.ai.openai.assistants.models.AssistantThread;
+import com.azure.ai.openai.assistants.models.AssistantThreadCreationOptions;
+import com.azure.ai.openai.assistants.models.CreateAndRunThreadOptions;
+import com.azure.ai.openai.assistants.models.FileDeletionStatus;
+import com.azure.ai.openai.assistants.models.FileListResponse;
+import com.azure.ai.openai.assistants.models.FilePurpose;
+import com.azure.ai.openai.assistants.models.ListSortOrder;
+import com.azure.ai.openai.assistants.models.MessageFile;
+import com.azure.ai.openai.assistants.models.MessageRole;
+import com.azure.ai.openai.assistants.models.OpenAIFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfAssistant;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfAssistantFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfMessageFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfRunStep;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfThreadMessage;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfThreadRun;
+import com.azure.ai.openai.assistants.models.RunStep;
+import com.azure.ai.openai.assistants.models.ThreadDeletionStatus;
+import com.azure.ai.openai.assistants.models.ThreadMessage;
+import com.azure.ai.openai.assistants.models.ThreadRun;
+import com.azure.ai.openai.assistants.models.ToolDefinition;
+import com.azure.ai.openai.assistants.models.ToolOutput;
+import com.azure.ai.openai.assistants.models.UpdateAssistantOptions;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.FluxUtil;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous AssistantsClient type.
+ */
+@ServiceClient(builder = AssistantsClientBuilder.class, isAsync = true)
+public final class AssistantsAsyncClient {
+ @Generated
+ private final AssistantsClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of AssistantsAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ AssistantsAsyncClient(AssistantsClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createAssistantWithResponse(BinaryData assistantCreationOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createAssistantWithResponseAsync(assistantCreationOptions, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of assistants that were previously created along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAssistantsWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAssistantsWithResponseAsync(requestOptions);
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ return this.serviceClient.getAssistantWithResponseAsync(assistantId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateAssistantWithResponse(String assistantId, BinaryData updateAssistantOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateAssistantWithResponseAsync(assistantId, updateAssistantOptions, requestOptions);
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant deletion operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteAssistantWithResponseAsync(assistantId, requestOptions);
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file_id: String (Required)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createAssistantFileWithResponse(String assistantId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createAssistantFileWithResponseAsync(assistantId, request, requestOptions);
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAssistantFilesWithResponse(String assistantId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listAssistantFilesWithResponseAsync(assistantId, requestOptions);
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getAssistantFileWithResponseAsync(assistantId, fileId, requestOptions);
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant file deletion operation along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.deleteAssistantFileWithResponseAsync(assistantId, fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createThreadWithResponse(BinaryData assistantThreadCreationOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createThreadWithResponseAsync(assistantThreadCreationOptions, requestOptions);
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about an existing thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.getThreadWithResponseAsync(threadId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateThreadWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateThreadWithResponseAsync(threadId, request, requestOptions);
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of a thread deletion operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteThreadWithResponseAsync(threadId, requestOptions);
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * role: String(user/assistant) (Required)
+ * content: String (Required)
+ * file_ids (Optional): [
+ * String (Optional)
+ * ]
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single, existing message within an assistant thread along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createMessageWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createMessageWithResponseAsync(threadId, request, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of messages that exist on a thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listMessagesWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.listMessagesWithResponseAsync(threadId, requestOptions);
+ }
+
+ /**
+ * Gets an existing message from an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve the specified message from.
+ * @param messageId The ID of the message to retrieve from the specified thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return an existing message from an existing thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getMessageWithResponse(String threadId, String messageId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getMessageWithResponseAsync(threadId, messageId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single, existing message within an assistant thread along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateMessageWithResponse(String threadId, String messageId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateMessageWithResponseAsync(threadId, messageId, request, requestOptions);
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * message_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of previously uploaded files associated with a message from a thread along with {@link Response}
+ * on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listMessageFilesWithResponse(String threadId, String messageId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listMessageFilesWithResponseAsync(threadId, messageId, requestOptions);
+ }
+
+ /**
+ * Gets information about a file attachment to a message within a thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * message_id: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the message to get information from.
+ * @param messageId The ID of the message to get information from.
+ * @param fileId The ID of the file to get information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attachment to a message within a thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getMessageFileWithResponse(String threadId, String messageId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getMessageFileWithResponseAsync(threadId, messageId, fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * assistant_id: String (Required)
+ * model: String (Optional)
+ * instructions: String (Optional)
+ * tools (Optional): [
+ * (Optional){
+ * }
+ * ]
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to run.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createRunWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createRunWithResponseAsync(threadId, request, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of runs for a specified thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listRunsWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.listRunsWithResponseAsync(threadId, requestOptions);
+ }
+
+ /**
+ * Gets an existing run from an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve run information from.
+ * @param runId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return an existing run from an existing thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getRunWithResponse(String threadId, String runId, RequestOptions requestOptions) {
+ return this.serviceClient.getRunWithResponseAsync(threadId, runId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateRunWithResponse(String threadId, String runId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateRunWithResponseAsync(threadId, runId, request, 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
+ *
+ * {@code
+ * {
+ * tool_outputs (Required): [
+ * (Required){
+ * tool_call_id: String (Optional)
+ * output: String (Optional)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run that requires tool outputs.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> submitToolOutputsToRunWithResponse(String threadId, String runId,
+ BinaryData request, RequestOptions requestOptions) {
+ return this.serviceClient.submitToolOutputsToRunWithResponseAsync(threadId, runId, request, requestOptions);
+ }
+
+ /**
+ * Cancels a run of an in progress thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread being run.
+ * @param runId The ID of the run to cancel.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> cancelRunWithResponse(String threadId, String runId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.cancelRunWithResponseAsync(threadId, runId, requestOptions);
+ }
+
+ /**
+ * Creates a new assistant thread and immediately starts a run using that new thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param createAndRunThreadOptions The details used when creating and immediately running a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createThreadAndRunWithResponse(BinaryData createAndRunThreadOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createThreadAndRunWithResponseAsync(createAndRunThreadOptions, requestOptions);
+ }
+
+ /**
+ * Gets a single run step from a thread run.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the specific run to retrieve the step from.
+ * @param stepId The ID of the step to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single run step from a thread run along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getRunStepWithResponse(String threadId, String runId, String stepId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getRunStepWithResponseAsync(threadId, runId, stepId, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of run steps from a thread run along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listRunStepsWithResponse(String threadId, String runId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listRunStepsWithResponseAsync(threadId, runId, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of previously uploaded files along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listFilesWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listFilesWithResponseAsync(requestOptions);
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: BinaryData (Required)
+ * file: String (Optional)
+ * purpose: String(fine-tune/fine-tune-results/assistants/assistants_output) (Required)
+ * filename: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono> uploadFileWithResponse(BinaryData request, RequestOptions requestOptions) {
+ // Protocol API requires serialization of parts with content-disposition and data, as operation 'uploadFile' is
+ // 'multipart/form-data'
+ return this.serviceClient.uploadFileWithResponseAsync(request, requestOptions);
+ }
+
+ /**
+ * Delete a previously uploaded file.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param fileId The ID of the file to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a status response from a file deletion operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteFileWithResponse(String fileId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteFileWithResponseAsync(fileId, requestOptions);
+ }
+
+ /**
+ * Returns information about a specific file. Does not retrieve file content.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getFileWithResponse(String fileId, RequestOptions requestOptions) {
+ return this.serviceClient.getFileWithResponseAsync(fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createAssistant(AssistantCreationOptions assistantCreationOptions) {
+ // Generated convenience method for createAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAssistantWithResponse(BinaryData.fromObject(assistantCreationOptions), requestOptions)
+ .flatMap(FluxUtil::toMono).map(protocolMethodData -> protocolMethodData.toObject(Assistant.class));
+ }
+
+ /**
+ * Gets a list of assistants that were previously created.
+ *
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of assistants that were previously created on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAssistants(Integer limit, ListSortOrder order, String after,
+ String before) {
+ // Generated convenience method for listAssistantsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listAssistantsWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAssistant.class));
+ }
+
+ /**
+ * Gets a list of assistants that were previously created.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of assistants that were previously created on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAssistants() {
+ // Generated convenience method for listAssistantsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAssistantsWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAssistant.class));
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getAssistant(String assistantId) {
+ // Generated convenience method for getAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAssistantWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(Assistant.class));
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateAssistant(String assistantId, UpdateAssistantOptions updateAssistantOptions) {
+ // Generated convenience method for updateAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return updateAssistantWithResponse(assistantId, BinaryData.fromObject(updateAssistantOptions), requestOptions)
+ .flatMap(FluxUtil::toMono).map(protocolMethodData -> protocolMethodData.toObject(Assistant.class));
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of an assistant deletion operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteAssistant(String assistantId) {
+ // Generated convenience method for deleteAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteAssistantWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantDeletionStatus.class));
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param fileId The ID of the previously uploaded file to attach.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attached to an assistant, as used by tools that can read files on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for createAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file_id", fileId);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createAssistantFileWithResponse(assistantId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantFile.class));
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAssistantFiles(String assistantId, Integer limit,
+ ListSortOrder order, String after, String before) {
+ // Generated convenience method for listAssistantFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listAssistantFilesWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAssistantFile.class));
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAssistantFiles(String assistantId) {
+ // Generated convenience method for listAssistantFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAssistantFilesWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAssistantFile.class));
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attached to an assistant, as used by tools that can read files on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for getAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAssistantFileWithResponse(assistantId, fileId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantFile.class));
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of an assistant file deletion operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for deleteAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteAssistantFileWithResponse(assistantId, fileId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantFileDeletionStatus.class));
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createThread(AssistantThreadCreationOptions assistantThreadCreationOptions) {
+ // Generated convenience method for createThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createThreadWithResponse(BinaryData.fromObject(assistantThreadCreationOptions), requestOptions)
+ .flatMap(FluxUtil::toMono).map(protocolMethodData -> protocolMethodData.toObject(AssistantThread.class));
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about an existing thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getThread(String threadId) {
+ // Generated convenience method for getThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getThreadWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantThread.class));
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateThread(String threadId, Map metadata) {
+ // Generated convenience method for updateThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateThreadWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantThread.class));
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * @param threadId The ID of the thread to modify.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateThread(String threadId) {
+ // Generated convenience method for updateThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateThreadWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AssistantThread.class));
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * @param threadId The ID of the thread to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a thread deletion operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteThread(String threadId) {
+ // Generated convenience method for deleteThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteThreadWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadDeletionStatus.class));
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param role The role to associate with the new message.
+ * @param content The textual content for the new message.
+ * @param fileIds A list of up to 10 file IDs to associate with the message, as used by tools like
+ * 'code_interpreter' or 'retrieval' that can read files.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createMessage(String threadId, MessageRole role, String content, List fileIds,
+ Map metadata) {
+ // Generated convenience method for createMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("role", (role == null ? null : role.toString()));
+ requestObj.put("content", content);
+ requestObj.put("file_ids", fileIds);
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createMessageWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class));
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param role The role to associate with the new message.
+ * @param content The textual content for the new message.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createMessage(String threadId, MessageRole role, String content) {
+ // Generated convenience method for createMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("role", (role == null ? null : role.toString()));
+ requestObj.put("content", content);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createMessageWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class));
+ }
+
+ /**
+ * Gets a list of messages that exist on a thread.
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of messages that exist on a thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listMessages(String threadId, Integer limit, ListSortOrder order,
+ String after, String before) {
+ // Generated convenience method for listMessagesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listMessagesWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfThreadMessage.class));
+ }
+
+ /**
+ * Gets a list of messages that exist on a thread.
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of messages that exist on a thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listMessages(String threadId) {
+ // Generated convenience method for listMessagesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listMessagesWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfThreadMessage.class));
+ }
+
+ /**
+ * Gets an existing message from an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve the specified message from.
+ * @param messageId The ID of the message to retrieve from the specified thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return an existing message from an existing thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getMessage(String threadId, String messageId) {
+ // Generated convenience method for getMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getMessageWithResponse(threadId, messageId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class));
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateMessage(String threadId, String messageId, Map metadata) {
+ // Generated convenience method for updateMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateMessageWithResponse(threadId, messageId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class));
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateMessage(String threadId, String messageId) {
+ // Generated convenience method for updateMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateMessageWithResponse(threadId, messageId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class));
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from a thread.
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files associated with a message from a thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listMessageFiles(String threadId, String messageId, Integer limit,
+ ListSortOrder order, String after, String before) {
+ // Generated convenience method for listMessageFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listMessageFilesWithResponse(threadId, messageId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfMessageFile.class));
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from a thread.
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files associated with a message from a thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listMessageFiles(String threadId, String messageId) {
+ // Generated convenience method for listMessageFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listMessageFilesWithResponse(threadId, messageId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfMessageFile.class));
+ }
+
+ /**
+ * Gets information about a file attachment to a message within a thread.
+ *
+ * @param threadId The ID of the thread containing the message to get information from.
+ * @param messageId The ID of the message to get information from.
+ * @param fileId The ID of the file to get information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attachment to a message within a thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getMessageFile(String threadId, String messageId, String fileId) {
+ // Generated convenience method for getMessageFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getMessageFileWithResponse(threadId, messageId, fileId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(MessageFile.class));
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * @param threadId The ID of the thread to run.
+ * @param assistantId The ID of the assistant that should run the thread.
+ * @param model The overridden model name that the assistant should use to run the thread.
+ * @param instructions The overridden system instructions that the assistant should use to run the thread.
+ * @param tools The overridden list of enabled tools that the assistant should use to run the thread.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createRun(String threadId, String assistantId, String model, String instructions,
+ List tools, Map metadata) {
+ // Generated convenience method for createRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("assistant_id", assistantId);
+ requestObj.put("model", model);
+ requestObj.put("instructions", instructions);
+ requestObj.put("tools", tools);
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createRunWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * @param threadId The ID of the thread to run.
+ * @param assistantId The ID of the assistant that should run the thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createRun(String threadId, String assistantId) {
+ // Generated convenience method for createRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("assistant_id", assistantId);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createRunWithResponse(threadId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Gets a list of runs for a specified thread.
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of runs for a specified thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listRuns(String threadId, Integer limit, ListSortOrder order,
+ String after, String before) {
+ // Generated convenience method for listRunsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listRunsWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfThreadRun.class));
+ }
+
+ /**
+ * Gets a list of runs for a specified thread.
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of runs for a specified thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listRuns(String threadId) {
+ // Generated convenience method for listRunsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listRunsWithResponse(threadId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfThreadRun.class));
+ }
+
+ /**
+ * Gets an existing run from an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve run information from.
+ * @param runId The ID of the thread to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return an existing run from an existing thread on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getRun(String threadId, String runId) {
+ // Generated convenience method for getRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getRunWithResponse(threadId, runId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateRun(String threadId, String runId, Map metadata) {
+ // Generated convenience method for updateRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateRunWithResponse(threadId, runId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateRun(String threadId, String runId) {
+ // Generated convenience method for updateRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateRunWithResponse(threadId, runId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * 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'.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run that requires tool outputs.
+ * @param toolOutputs The list of tool outputs requested by tool calls from the specified run.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono submitToolOutputsToRun(String threadId, String runId, List toolOutputs) {
+ // Generated convenience method for submitToolOutputsToRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("tool_outputs", toolOutputs);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return submitToolOutputsToRunWithResponse(threadId, runId, request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Cancels a run of an in progress thread.
+ *
+ * @param threadId The ID of the thread being run.
+ * @param runId The ID of the run to cancel.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono cancelRun(String threadId, String runId) {
+ // Generated convenience method for cancelRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return cancelRunWithResponse(threadId, runId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Creates a new assistant thread and immediately starts a run using that new thread.
+ *
+ * @param createAndRunThreadOptions The details used when creating and immediately running a new assistant thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createThreadAndRun(CreateAndRunThreadOptions createAndRunThreadOptions) {
+ // Generated convenience method for createThreadAndRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createThreadAndRunWithResponse(BinaryData.fromObject(createAndRunThreadOptions), requestOptions)
+ .flatMap(FluxUtil::toMono).map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class));
+ }
+
+ /**
+ * Gets a single run step from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the specific run to retrieve the step from.
+ * @param stepId The ID of the step to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single run step from a thread run on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getRunStep(String threadId, String runId, String stepId) {
+ // Generated convenience method for getRunStepWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getRunStepWithResponse(threadId, runId, stepId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(RunStep.class));
+ }
+
+ /**
+ * Gets a list of run steps from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of run steps from a thread run on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listRunSteps(String threadId, String runId, Integer limit,
+ ListSortOrder order, String after, String before) {
+ // Generated convenience method for listRunStepsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listRunStepsWithResponse(threadId, runId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfRunStep.class));
+ }
+
+ /**
+ * Gets a list of run steps from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of run steps from a thread run on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listRunSteps(String threadId, String runId) {
+ // Generated convenience method for listRunStepsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listRunStepsWithResponse(threadId, runId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfRunStep.class));
+ }
+
+ /**
+ * Gets a list of previously uploaded files.
+ *
+ * @param purpose A value that, when provided, limits list results to files matching the corresponding purpose.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listFiles(FilePurpose purpose) {
+ // Generated convenience method for listFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (purpose != null) {
+ requestOptions.addQueryParam("purpose", purpose.toString(), false);
+ }
+ return listFilesWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(FileListResponse.class));
+ }
+
+ /**
+ * Gets a list of previously uploaded files.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listFiles() {
+ // Generated convenience method for listFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listFilesWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(FileListResponse.class));
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * @param file The file data (not filename) to upload.
+ * @param purpose The intended purpose of the file.
+ * @param filename A filename to associate with the uploaded data.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono uploadFile(byte[] file, FilePurpose purpose, String filename) {
+ // Generated convenience method for uploadFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file", file);
+ requestObj.put("purpose", (purpose == null ? null : purpose.toString()));
+ requestObj.put("filename", filename);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return uploadFileWithResponse(request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIFile.class));
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * @param file The file data (not filename) to upload.
+ * @param purpose The intended purpose of the file.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono uploadFile(byte[] file, FilePurpose purpose) {
+ // Generated convenience method for uploadFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file", file);
+ requestObj.put("purpose", (purpose == null ? null : purpose.toString()));
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return uploadFileWithResponse(request, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIFile.class));
+ }
+
+ /**
+ * Delete a previously uploaded file.
+ *
+ * @param fileId The ID of the file to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a status response from a file deletion operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteFile(String fileId) {
+ // Generated convenience method for deleteFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteFileWithResponse(fileId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(FileDeletionStatus.class));
+ }
+
+ /**
+ * Returns information about a specific file. Does not retrieve file content.
+ *
+ * @param fileId The ID of the file to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getFile(String fileId) {
+ // Generated convenience method for getFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getFileWithResponse(fileId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OpenAIFile.class));
+ }
+}
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClient.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClient.java
new file mode 100644
index 000000000000..e9614eba6cb6
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClient.java
@@ -0,0 +1,3012 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.openai.assistants;
+
+import com.azure.ai.openai.assistants.implementation.AssistantsClientImpl;
+import com.azure.ai.openai.assistants.models.Assistant;
+import com.azure.ai.openai.assistants.models.AssistantCreationOptions;
+import com.azure.ai.openai.assistants.models.AssistantDeletionStatus;
+import com.azure.ai.openai.assistants.models.AssistantFile;
+import com.azure.ai.openai.assistants.models.AssistantFileDeletionStatus;
+import com.azure.ai.openai.assistants.models.AssistantThread;
+import com.azure.ai.openai.assistants.models.AssistantThreadCreationOptions;
+import com.azure.ai.openai.assistants.models.CreateAndRunThreadOptions;
+import com.azure.ai.openai.assistants.models.FileDeletionStatus;
+import com.azure.ai.openai.assistants.models.FileListResponse;
+import com.azure.ai.openai.assistants.models.FilePurpose;
+import com.azure.ai.openai.assistants.models.ListSortOrder;
+import com.azure.ai.openai.assistants.models.MessageFile;
+import com.azure.ai.openai.assistants.models.MessageRole;
+import com.azure.ai.openai.assistants.models.OpenAIFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfAssistant;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfAssistantFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfMessageFile;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfRunStep;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfThreadMessage;
+import com.azure.ai.openai.assistants.models.OpenAIPageableListOfThreadRun;
+import com.azure.ai.openai.assistants.models.RunStep;
+import com.azure.ai.openai.assistants.models.ThreadDeletionStatus;
+import com.azure.ai.openai.assistants.models.ThreadMessage;
+import com.azure.ai.openai.assistants.models.ThreadRun;
+import com.azure.ai.openai.assistants.models.ToolDefinition;
+import com.azure.ai.openai.assistants.models.ToolOutput;
+import com.azure.ai.openai.assistants.models.UpdateAssistantOptions;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Initializes a new instance of the synchronous AssistantsClient type.
+ */
+@ServiceClient(builder = AssistantsClientBuilder.class)
+public final class AssistantsClient {
+ @Generated
+ private final AssistantsClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of AssistantsClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ AssistantsClient(AssistantsClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createAssistantWithResponse(BinaryData assistantCreationOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createAssistantWithResponse(assistantCreationOptions, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of assistants that were previously created along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAssistantsWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAssistantsWithResponse(requestOptions);
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ return this.serviceClient.getAssistantWithResponse(assistantId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateAssistantWithResponse(String assistantId, BinaryData updateAssistantOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateAssistantWithResponse(assistantId, updateAssistantOptions, requestOptions);
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant deletion operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteAssistantWithResponse(assistantId, requestOptions);
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file_id: String (Required)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createAssistantFileWithResponse(String assistantId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createAssistantFileWithResponse(assistantId, request, requestOptions);
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAssistantFilesWithResponse(String assistantId, RequestOptions requestOptions) {
+ return this.serviceClient.listAssistantFilesWithResponse(assistantId, requestOptions);
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getAssistantFileWithResponse(assistantId, fileId, requestOptions);
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant file deletion operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.deleteAssistantFileWithResponse(assistantId, fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createThreadWithResponse(BinaryData assistantThreadCreationOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createThreadWithResponse(assistantThreadCreationOptions, requestOptions);
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about an existing thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.getThreadWithResponse(threadId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateThreadWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateThreadWithResponse(threadId, request, requestOptions);
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of a thread deletion operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteThreadWithResponse(threadId, requestOptions);
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * role: String(user/assistant) (Required)
+ * content: String (Required)
+ * file_ids (Optional): [
+ * String (Optional)
+ * ]
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single, existing message within an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createMessageWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createMessageWithResponse(threadId, request, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of messages that exist on a thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listMessagesWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.listMessagesWithResponse(threadId, requestOptions);
+ }
+
+ /**
+ * Gets an existing message from an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve the specified message from.
+ * @param messageId The ID of the message to retrieve from the specified thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return an existing message from an existing thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getMessageWithResponse(String threadId, String messageId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getMessageWithResponse(threadId, messageId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single, existing message within an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateMessageWithResponse(String threadId, String messageId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateMessageWithResponse(threadId, messageId, request, requestOptions);
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * message_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of previously uploaded files associated with a message from a thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listMessageFilesWithResponse(String threadId, String messageId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listMessageFilesWithResponse(threadId, messageId, requestOptions);
+ }
+
+ /**
+ * Gets information about a file attachment to a message within a thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * message_id: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread containing the message to get information from.
+ * @param messageId The ID of the message to get information from.
+ * @param fileId The ID of the file to get information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attachment to a message within a thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getMessageFileWithResponse(String threadId, String messageId, String fileId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getMessageFileWithResponse(threadId, messageId, fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * assistant_id: String (Required)
+ * model: String (Optional)
+ * instructions: String (Optional)
+ * tools (Optional): [
+ * (Optional){
+ * }
+ * ]
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to run.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createRunWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createRunWithResponse(threadId, request, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of runs for a specified thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listRunsWithResponse(String threadId, RequestOptions requestOptions) {
+ return this.serviceClient.listRunsWithResponse(threadId, requestOptions);
+ }
+
+ /**
+ * Gets an existing run from an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve run information from.
+ * @param runId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return an existing run from an existing thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getRunWithResponse(String threadId, String runId, RequestOptions requestOptions) {
+ return this.serviceClient.getRunWithResponse(threadId, runId, requestOptions);
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateRunWithResponse(String threadId, String runId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateRunWithResponse(threadId, runId, request, 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
+ *
+ * {@code
+ * {
+ * tool_outputs (Required): [
+ * (Required){
+ * tool_call_id: String (Optional)
+ * output: String (Optional)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run that requires tool outputs.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response submitToolOutputsToRunWithResponse(String threadId, String runId, BinaryData request,
+ RequestOptions requestOptions) {
+ return this.serviceClient.submitToolOutputsToRunWithResponse(threadId, runId, request, requestOptions);
+ }
+
+ /**
+ * Cancels a run of an in progress thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread being run.
+ * @param runId The ID of the run to cancel.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response cancelRunWithResponse(String threadId, String runId, RequestOptions requestOptions) {
+ return this.serviceClient.cancelRunWithResponse(threadId, runId, requestOptions);
+ }
+
+ /**
+ * Creates a new assistant thread and immediately starts a run using that new thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param createAndRunThreadOptions The details used when creating and immediately running a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return data representing a single evaluation run of an assistant thread along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createThreadAndRunWithResponse(BinaryData createAndRunThreadOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createThreadAndRunWithResponse(createAndRunThreadOptions, requestOptions);
+ }
+
+ /**
+ * Gets a single run step from a thread run.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the specific run to retrieve the step from.
+ * @param stepId The ID of the step to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single run step from a thread run along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getRunStepWithResponse(String threadId, String runId, String stepId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getRunStepWithResponse(threadId, runId, stepId, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of run steps from a thread run along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listRunStepsWithResponse(String threadId, String runId, RequestOptions requestOptions) {
+ return this.serviceClient.listRunStepsWithResponse(threadId, runId, 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of previously uploaded files along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listFilesWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listFilesWithResponse(requestOptions);
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: BinaryData (Required)
+ * file: String (Optional)
+ * purpose: String(fine-tune/fine-tune-results/assistants/assistants_output) (Required)
+ * filename: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response uploadFileWithResponse(BinaryData request, RequestOptions requestOptions) {
+ // Protocol API requires serialization of parts with content-disposition and data, as operation 'uploadFile' is
+ // 'multipart/form-data'
+ return this.serviceClient.uploadFileWithResponse(request, requestOptions);
+ }
+
+ /**
+ * Delete a previously uploaded file.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param fileId The ID of the file to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a status response from a file deletion operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteFileWithResponse(String fileId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteFileWithResponse(fileId, requestOptions);
+ }
+
+ /**
+ * Returns information about a specific file. Does not retrieve file content.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getFileWithResponse(String fileId, RequestOptions requestOptions) {
+ return this.serviceClient.getFileWithResponse(fileId, requestOptions);
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Assistant createAssistant(AssistantCreationOptions assistantCreationOptions) {
+ // Generated convenience method for createAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAssistantWithResponse(BinaryData.fromObject(assistantCreationOptions), requestOptions).getValue()
+ .toObject(Assistant.class);
+ }
+
+ /**
+ * Gets a list of assistants that were previously created.
+ *
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of assistants that were previously created.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfAssistant listAssistants(Integer limit, ListSortOrder order, String after,
+ String before) {
+ // Generated convenience method for listAssistantsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listAssistantsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAssistant.class);
+ }
+
+ /**
+ * Gets a list of assistants that were previously created.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of assistants that were previously created.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfAssistant listAssistants() {
+ // Generated convenience method for listAssistantsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAssistantsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAssistant.class);
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Assistant getAssistant(String assistantId) {
+ // Generated convenience method for getAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAssistantWithResponse(assistantId, requestOptions).getValue().toObject(Assistant.class);
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Assistant updateAssistant(String assistantId, UpdateAssistantOptions updateAssistantOptions) {
+ // Generated convenience method for updateAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return updateAssistantWithResponse(assistantId, BinaryData.fromObject(updateAssistantOptions), requestOptions)
+ .getValue().toObject(Assistant.class);
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of an assistant deletion operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantDeletionStatus deleteAssistant(String assistantId) {
+ // Generated convenience method for deleteAssistantWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteAssistantWithResponse(assistantId, requestOptions).getValue()
+ .toObject(AssistantDeletionStatus.class);
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param fileId The ID of the previously uploaded file to attach.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attached to an assistant, as used by tools that can read files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantFile createAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for createAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file_id", fileId);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createAssistantFileWithResponse(assistantId, request, requestOptions).getValue()
+ .toObject(AssistantFile.class);
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfAssistantFile listAssistantFiles(String assistantId, Integer limit, ListSortOrder order,
+ String after, String before) {
+ // Generated convenience method for listAssistantFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listAssistantFilesWithResponse(assistantId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfAssistantFile.class);
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfAssistantFile listAssistantFiles(String assistantId) {
+ // Generated convenience method for listAssistantFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAssistantFilesWithResponse(assistantId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfAssistantFile.class);
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attached to an assistant, as used by tools that can read files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantFile getAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for getAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAssistantFileWithResponse(assistantId, fileId, requestOptions).getValue()
+ .toObject(AssistantFile.class);
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of an assistant file deletion operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantFileDeletionStatus deleteAssistantFile(String assistantId, String fileId) {
+ // Generated convenience method for deleteAssistantFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteAssistantFileWithResponse(assistantId, fileId, requestOptions).getValue()
+ .toObject(AssistantFileDeletionStatus.class);
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantThread createThread(AssistantThreadCreationOptions assistantThreadCreationOptions) {
+ // Generated convenience method for createThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createThreadWithResponse(BinaryData.fromObject(assistantThreadCreationOptions), requestOptions)
+ .getValue().toObject(AssistantThread.class);
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about an existing thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantThread getThread(String threadId) {
+ // Generated convenience method for getThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getThreadWithResponse(threadId, requestOptions).getValue().toObject(AssistantThread.class);
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantThread updateThread(String threadId, Map metadata) {
+ // Generated convenience method for updateThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateThreadWithResponse(threadId, request, requestOptions).getValue().toObject(AssistantThread.class);
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * @param threadId The ID of the thread to modify.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a single thread associated with an assistant.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AssistantThread updateThread(String threadId) {
+ // Generated convenience method for updateThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateThreadWithResponse(threadId, request, requestOptions).getValue().toObject(AssistantThread.class);
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * @param threadId The ID of the thread to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a thread deletion operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadDeletionStatus deleteThread(String threadId) {
+ // Generated convenience method for deleteThreadWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteThreadWithResponse(threadId, requestOptions).getValue().toObject(ThreadDeletionStatus.class);
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param role The role to associate with the new message.
+ * @param content The textual content for the new message.
+ * @param fileIds A list of up to 10 file IDs to associate with the message, as used by tools like
+ * 'code_interpreter' or 'retrieval' that can read files.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadMessage createMessage(String threadId, MessageRole role, String content, List fileIds,
+ Map metadata) {
+ // Generated convenience method for createMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("role", (role == null ? null : role.toString()));
+ requestObj.put("content", content);
+ requestObj.put("file_ids", fileIds);
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createMessageWithResponse(threadId, request, requestOptions).getValue().toObject(ThreadMessage.class);
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param role The role to associate with the new message.
+ * @param content The textual content for the new message.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadMessage createMessage(String threadId, MessageRole role, String content) {
+ // Generated convenience method for createMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("role", (role == null ? null : role.toString()));
+ requestObj.put("content", content);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createMessageWithResponse(threadId, request, requestOptions).getValue().toObject(ThreadMessage.class);
+ }
+
+ /**
+ * Gets a list of messages that exist on a thread.
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of messages that exist on a thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfThreadMessage listMessages(String threadId, Integer limit, ListSortOrder order,
+ String after, String before) {
+ // Generated convenience method for listMessagesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listMessagesWithResponse(threadId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfThreadMessage.class);
+ }
+
+ /**
+ * Gets a list of messages that exist on a thread.
+ *
+ * @param threadId The ID of the thread to list messages from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of messages that exist on a thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfThreadMessage listMessages(String threadId) {
+ // Generated convenience method for listMessagesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listMessagesWithResponse(threadId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfThreadMessage.class);
+ }
+
+ /**
+ * Gets an existing message from an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve the specified message from.
+ * @param messageId The ID of the message to retrieve from the specified thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return an existing message from an existing thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadMessage getMessage(String threadId, String messageId) {
+ // Generated convenience method for getMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getMessageWithResponse(threadId, messageId, requestOptions).getValue().toObject(ThreadMessage.class);
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadMessage updateMessage(String threadId, String messageId, Map metadata) {
+ // Generated convenience method for updateMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateMessageWithResponse(threadId, messageId, request, requestOptions).getValue()
+ .toObject(ThreadMessage.class);
+ }
+
+ /**
+ * Modifies an existing message on an existing thread.
+ *
+ * @param threadId The ID of the thread containing the specified message to modify.
+ * @param messageId The ID of the message to modify on the specified thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single, existing message within an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadMessage updateMessage(String threadId, String messageId) {
+ // Generated convenience method for updateMessageWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateMessageWithResponse(threadId, messageId, request, requestOptions).getValue()
+ .toObject(ThreadMessage.class);
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from a thread.
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files associated with a message from a thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfMessageFile listMessageFiles(String threadId, String messageId, Integer limit,
+ ListSortOrder order, String after, String before) {
+ // Generated convenience method for listMessageFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listMessageFilesWithResponse(threadId, messageId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfMessageFile.class);
+ }
+
+ /**
+ * Gets a list of previously uploaded files associated with a message from a thread.
+ *
+ * @param threadId The ID of the thread containing the message to list files from.
+ * @param messageId The ID of the message to list files from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files associated with a message from a thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfMessageFile listMessageFiles(String threadId, String messageId) {
+ // Generated convenience method for listMessageFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listMessageFilesWithResponse(threadId, messageId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfMessageFile.class);
+ }
+
+ /**
+ * Gets information about a file attachment to a message within a thread.
+ *
+ * @param threadId The ID of the thread containing the message to get information from.
+ * @param messageId The ID of the message to get information from.
+ * @param fileId The ID of the file to get information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return information about a file attachment to a message within a thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public MessageFile getMessageFile(String threadId, String messageId, String fileId) {
+ // Generated convenience method for getMessageFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getMessageFileWithResponse(threadId, messageId, fileId, requestOptions).getValue()
+ .toObject(MessageFile.class);
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * @param threadId The ID of the thread to run.
+ * @param assistantId The ID of the assistant that should run the thread.
+ * @param model The overridden model name that the assistant should use to run the thread.
+ * @param instructions The overridden system instructions that the assistant should use to run the thread.
+ * @param tools The overridden list of enabled tools that the assistant should use to run the thread.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun createRun(String threadId, String assistantId, String model, String instructions,
+ List tools, Map metadata) {
+ // Generated convenience method for createRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("assistant_id", assistantId);
+ requestObj.put("model", model);
+ requestObj.put("instructions", instructions);
+ requestObj.put("tools", tools);
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createRunWithResponse(threadId, request, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Creates a new run for an assistant thread.
+ *
+ * @param threadId The ID of the thread to run.
+ * @param assistantId The ID of the assistant that should run the thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun createRun(String threadId, String assistantId) {
+ // Generated convenience method for createRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("assistant_id", assistantId);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return createRunWithResponse(threadId, request, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Gets a list of runs for a specified thread.
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of runs for a specified thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfThreadRun listRuns(String threadId, Integer limit, ListSortOrder order, String after,
+ String before) {
+ // Generated convenience method for listRunsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listRunsWithResponse(threadId, requestOptions).getValue().toObject(OpenAIPageableListOfThreadRun.class);
+ }
+
+ /**
+ * Gets a list of runs for a specified thread.
+ *
+ * @param threadId The ID of the thread to list runs from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of runs for a specified thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfThreadRun listRuns(String threadId) {
+ // Generated convenience method for listRunsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listRunsWithResponse(threadId, requestOptions).getValue().toObject(OpenAIPageableListOfThreadRun.class);
+ }
+
+ /**
+ * Gets an existing run from an existing thread.
+ *
+ * @param threadId The ID of the thread to retrieve run information from.
+ * @param runId The ID of the thread to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return an existing run from an existing thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun getRun(String threadId, String runId) {
+ // Generated convenience method for getRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getRunWithResponse(threadId, runId, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun updateRun(String threadId, String runId, Map metadata) {
+ // Generated convenience method for updateRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("metadata", metadata);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateRunWithResponse(threadId, runId, request, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Modifies an existing thread run.
+ *
+ * @param threadId The ID of the thread associated with the specified run.
+ * @param runId The ID of the run to modify.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun updateRun(String threadId, String runId) {
+ // Generated convenience method for updateRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return updateRunWithResponse(threadId, runId, request, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * 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'.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run that requires tool outputs.
+ * @param toolOutputs The list of tool outputs requested by tool calls from the specified run.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun submitToolOutputsToRun(String threadId, String runId, List toolOutputs) {
+ // Generated convenience method for submitToolOutputsToRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("tool_outputs", toolOutputs);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return submitToolOutputsToRunWithResponse(threadId, runId, request, requestOptions).getValue()
+ .toObject(ThreadRun.class);
+ }
+
+ /**
+ * Cancels a run of an in progress thread.
+ *
+ * @param threadId The ID of the thread being run.
+ * @param runId The ID of the run to cancel.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun cancelRun(String threadId, String runId) {
+ // Generated convenience method for cancelRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return cancelRunWithResponse(threadId, runId, requestOptions).getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Creates a new assistant thread and immediately starts a run using that new thread.
+ *
+ * @param createAndRunThreadOptions The details used when creating and immediately running a new assistant thread.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return data representing a single evaluation run of an assistant thread.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ThreadRun createThreadAndRun(CreateAndRunThreadOptions createAndRunThreadOptions) {
+ // Generated convenience method for createThreadAndRunWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createThreadAndRunWithResponse(BinaryData.fromObject(createAndRunThreadOptions), requestOptions)
+ .getValue().toObject(ThreadRun.class);
+ }
+
+ /**
+ * Gets a single run step from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the specific run to retrieve the step from.
+ * @param stepId The ID of the step to retrieve information about.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a single run step from a thread run.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public RunStep getRunStep(String threadId, String runId, String stepId) {
+ // Generated convenience method for getRunStepWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getRunStepWithResponse(threadId, runId, stepId, requestOptions).getValue().toObject(RunStep.class);
+ }
+
+ /**
+ * Gets a list of run steps from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default
+ * is 20.
+ * @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for
+ * descending order.
+ * @param 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.
+ * @param 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.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of run steps from a thread run.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfRunStep listRunSteps(String threadId, String runId, Integer limit, ListSortOrder order,
+ String after, String before) {
+ // Generated convenience method for listRunStepsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return listRunStepsWithResponse(threadId, runId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfRunStep.class);
+ }
+
+ /**
+ * Gets a list of run steps from a thread run.
+ *
+ * @param threadId The ID of the thread that was run.
+ * @param runId The ID of the run to list steps from.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of run steps from a thread run.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIPageableListOfRunStep listRunSteps(String threadId, String runId) {
+ // Generated convenience method for listRunStepsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listRunStepsWithResponse(threadId, runId, requestOptions).getValue()
+ .toObject(OpenAIPageableListOfRunStep.class);
+ }
+
+ /**
+ * Gets a list of previously uploaded files.
+ *
+ * @param purpose A value that, when provided, limits list results to files matching the corresponding purpose.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public FileListResponse listFiles(FilePurpose purpose) {
+ // Generated convenience method for listFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (purpose != null) {
+ requestOptions.addQueryParam("purpose", purpose.toString(), false);
+ }
+ return listFilesWithResponse(requestOptions).getValue().toObject(FileListResponse.class);
+ }
+
+ /**
+ * Gets a list of previously uploaded files.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of previously uploaded files.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public FileListResponse listFiles() {
+ // Generated convenience method for listFilesWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listFilesWithResponse(requestOptions).getValue().toObject(FileListResponse.class);
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * @param file The file data (not filename) to upload.
+ * @param purpose The intended purpose of the file.
+ * @param filename A filename to associate with the uploaded data.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIFile uploadFile(byte[] file, FilePurpose purpose, String filename) {
+ // Generated convenience method for uploadFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file", file);
+ requestObj.put("purpose", (purpose == null ? null : purpose.toString()));
+ requestObj.put("filename", filename);
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return uploadFileWithResponse(request, requestOptions).getValue().toObject(OpenAIFile.class);
+ }
+
+ /**
+ * Uploads a file for use by other operations.
+ *
+ * @param file The file data (not filename) to upload.
+ * @param purpose The intended purpose of the file.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIFile uploadFile(byte[] file, FilePurpose purpose) {
+ // Generated convenience method for uploadFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ Map requestObj = new HashMap<>();
+ requestObj.put("file", file);
+ requestObj.put("purpose", (purpose == null ? null : purpose.toString()));
+ BinaryData request = BinaryData.fromObject(requestObj);
+ return uploadFileWithResponse(request, requestOptions).getValue().toObject(OpenAIFile.class);
+ }
+
+ /**
+ * Delete a previously uploaded file.
+ *
+ * @param fileId The ID of the file to delete.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a status response from a file deletion operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public FileDeletionStatus deleteFile(String fileId) {
+ // Generated convenience method for deleteFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteFileWithResponse(fileId, requestOptions).getValue().toObject(FileDeletionStatus.class);
+ }
+
+ /**
+ * Returns information about a specific file. Does not retrieve file content.
+ *
+ * @param fileId The ID of the file to retrieve.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return represents an assistant that can call the model and use tools.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OpenAIFile getFile(String fileId) {
+ // Generated convenience method for getFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getFileWithResponse(fileId, requestOptions).getValue().toObject(OpenAIFile.class);
+ }
+}
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClientBuilder.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClientBuilder.java
new file mode 100644
index 000000000000..a3179cf3c272
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/AssistantsClientBuilder.java
@@ -0,0 +1,327 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.openai.assistants;
+
+import com.azure.ai.openai.assistants.implementation.AssistantsClientImpl;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.client.traits.ConfigurationTrait;
+import com.azure.core.client.traits.EndpointTrait;
+import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.client.traits.KeyCredentialTrait;
+import com.azure.core.client.traits.TokenCredentialTrait;
+import com.azure.core.credential.KeyCredential;
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.HttpPipelinePosition;
+import com.azure.core.http.policy.AddDatePolicy;
+import com.azure.core.http.policy.AddHeadersFromContextPolicy;
+import com.azure.core.http.policy.AddHeadersPolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.http.policy.HttpLoggingPolicy;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.KeyCredentialPolicy;
+import com.azure.core.http.policy.RequestIdPolicy;
+import com.azure.core.http.policy.RetryOptions;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.util.ClientOptions;
+import com.azure.core.util.Configuration;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.builder.ClientBuilderUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.JacksonAdapter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * A builder for creating a new instance of the AssistantsClient type.
+ */
+@ServiceClientBuilder(serviceClients = { AssistantsClient.class, AssistantsAsyncClient.class })
+public final class AssistantsClientBuilder implements HttpTrait,
+ ConfigurationTrait, TokenCredentialTrait,
+ KeyCredentialTrait, EndpointTrait {
+ @Generated
+ private static final String SDK_NAME = "name";
+
+ @Generated
+ private static final String SDK_VERSION = "version";
+
+ @Generated
+ private static final String[] DEFAULT_SCOPES = new String[] { "https://cognitiveservices.azure.com/.default" };
+
+ @Generated
+ private static final Map PROPERTIES
+ = CoreUtils.getProperties("azure-ai-openai-assistants.properties");
+
+ @Generated
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the AssistantsClientBuilder.
+ */
+ @Generated
+ public AssistantsClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Generated
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder pipeline(HttpPipeline pipeline) {
+ if (this.pipeline != null && pipeline == null) {
+ LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
+ }
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The HTTP client used to send the request.
+ */
+ @Generated
+ private HttpClient httpClient;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Generated
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The client options such as application ID and custom headers to set on a request.
+ */
+ @Generated
+ private ClientOptions clientOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
+ /*
+ * The retry options to configure retry policy for failed requests.
+ */
+ @Generated
+ private RetryOptions retryOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder retryOptions(RetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
+ Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null.");
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service client.
+ */
+ @Generated
+ private Configuration configuration;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ @Generated
+ private TokenCredential tokenCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * The KeyCredential used for authentication.
+ */
+ @Generated
+ private KeyCredential keyCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder credential(KeyCredential keyCredential) {
+ this.keyCredential = keyCredential;
+ return this;
+ }
+
+ /*
+ * The service endpoint
+ */
+ @Generated
+ private String endpoint;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public AssistantsClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /*
+ * The retry policy that will attempt to retry failed requests, if applicable.
+ */
+ @Generated
+ private RetryPolicy retryPolicy;
+
+ /**
+ * Sets The retry policy that will attempt to retry failed requests, if applicable.
+ *
+ * @param retryPolicy the retryPolicy value.
+ * @return the AssistantsClientBuilder.
+ */
+ @Generated
+ public AssistantsClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /**
+ * Builds an instance of AssistantsClientImpl with the provided parameters.
+ *
+ * @return an instance of AssistantsClientImpl.
+ */
+ @Generated
+ private AssistantsClientImpl buildInnerClient() {
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ AssistantsClientImpl client
+ = new AssistantsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint);
+ return client;
+ }
+
+ @Generated
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions;
+ List policies = new ArrayList<>();
+ String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName");
+ String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
+ String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions);
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
+ policies.add(new RequestIdPolicy());
+ policies.add(new AddHeadersFromContextPolicy());
+ HttpHeaders headers = new HttpHeaders();
+ localClientOptions.getHeaders()
+ .forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue()));
+ if (headers.getSize() > 0) {
+ policies.add(new AddHeadersPolicy(headers));
+ }
+ this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
+ policies.add(new AddDatePolicy());
+ if (keyCredential != null) {
+ policies.add(new KeyCredentialPolicy("api-key", keyCredential));
+ }
+ if (tokenCredential != null) {
+ policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
+ }
+ this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(localHttpLogOptions));
+ HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient).clientOptions(localClientOptions).build();
+ return httpPipeline;
+ }
+
+ /**
+ * Builds an instance of AssistantsAsyncClient class.
+ *
+ * @return an instance of AssistantsAsyncClient.
+ */
+ @Generated
+ public AssistantsAsyncClient buildAsyncClient() {
+ return new AssistantsAsyncClient(buildInnerClient());
+ }
+
+ /**
+ * Builds an instance of AssistantsClient class.
+ *
+ * @return an instance of AssistantsClient.
+ */
+ @Generated
+ public AssistantsClient buildClient() {
+ return new AssistantsClient(buildInnerClient());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(AssistantsClientBuilder.class);
+}
diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/AssistantsClientImpl.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/AssistantsClientImpl.java
new file mode 100644
index 000000000000..344ad5f9e07e
--- /dev/null
+++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/AssistantsClientImpl.java
@@ -0,0 +1,4421 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.openai.assistants.implementation;
+
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Post;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.serializer.JacksonAdapter;
+import com.azure.core.util.serializer.SerializerAdapter;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the AssistantsClient type.
+ */
+public final class AssistantsClientImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final AssistantsClientService service;
+
+ /**
+ * An OpenAI endpoint supporting assistants functionality.
+ */
+ private final String endpoint;
+
+ /**
+ * Gets An OpenAI endpoint supporting assistants functionality.
+ *
+ * @return the endpoint value.
+ */
+ public String getEndpoint() {
+ return this.endpoint;
+ }
+
+ /**
+ * The HTTP pipeline to send requests through.
+ */
+ private final HttpPipeline httpPipeline;
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ public HttpPipeline getHttpPipeline() {
+ return this.httpPipeline;
+ }
+
+ /**
+ * The serializer to serialize an object into a string.
+ */
+ private final SerializerAdapter serializerAdapter;
+
+ /**
+ * Gets The serializer to serialize an object into a string.
+ *
+ * @return the serializerAdapter value.
+ */
+ public SerializerAdapter getSerializerAdapter() {
+ return this.serializerAdapter;
+ }
+
+ /**
+ * Initializes an instance of AssistantsClient client.
+ *
+ * @param endpoint An OpenAI endpoint supporting assistants functionality.
+ */
+ public AssistantsClientImpl(String endpoint) {
+ this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
+ JacksonAdapter.createDefaultSerializerAdapter(), endpoint);
+ }
+
+ /**
+ * Initializes an instance of AssistantsClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param endpoint An OpenAI endpoint supporting assistants functionality.
+ */
+ public AssistantsClientImpl(HttpPipeline httpPipeline, String endpoint) {
+ this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint);
+ }
+
+ /**
+ * Initializes an instance of AssistantsClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param endpoint An OpenAI endpoint supporting assistants functionality.
+ */
+ public AssistantsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.endpoint = endpoint;
+ this.service = RestProxy.create(AssistantsClientService.class, this.httpPipeline, this.getSerializerAdapter());
+ }
+
+ /**
+ * The interface defining all the services for AssistantsClient to be used by the proxy service to perform REST
+ * calls.
+ */
+ @Host("{endpoint}")
+ @ServiceInterface(name = "AssistantsClient")
+ public interface AssistantsClientService {
+ @Post("/assistants")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createAssistant(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData assistantCreationOptions,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/assistants")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createAssistantSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData assistantCreationOptions,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/assistants")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listAssistants(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/assistants")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listAssistantsSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getAssistant(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getAssistantSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateAssistant(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData updateAssistantOptions, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateAssistantSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData updateAssistantOptions, RequestOptions requestOptions,
+ Context context);
+
+ @Delete("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteAssistant(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Delete("/assistants/{assistantId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteAssistantSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/assistants/{assistantId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createAssistantFile(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Post("/assistants/{assistantId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createAssistantFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listAssistantFiles(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listAssistantFilesSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getAssistantFile(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/assistants/{assistantId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getAssistantFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Delete("/assistants/{assistantId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteAssistantFile(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Delete("/assistants/{assistantId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteAssistantFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("assistantId") String assistantId, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/threads")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createThread(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData assistantThreadCreationOptions, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/threads")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createThreadSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData assistantThreadCreationOptions, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getThread(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getThreadSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateThread(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateThreadSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Delete("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteThread(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Delete("/threads/{threadId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteThreadSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/threads/{threadId}/messages")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createMessage(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/messages")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createMessageSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/messages")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listMessages(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/messages")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listMessagesSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getMessage(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getMessageSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/messages/{messageId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateMessage(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/messages/{messageId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateMessageSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listMessageFiles(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listMessageFilesSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getMessageFile(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @PathParam("fileId") String fileId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/messages/{messageId}/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getMessageFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("messageId") String messageId,
+ @PathParam("fileId") String fileId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/threads/{threadId}/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createRun(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createRunSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listRuns(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listRunsSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getRun(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getRunSync(@HostParam("endpoint") String endpoint, @PathParam("threadId") String threadId,
+ @PathParam("runId") String runId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateRun(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateRunSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}/submit_tool_outputs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> submitToolOutputsToRun(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}/submit_tool_outputs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response submitToolOutputsToRunSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData request,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}/cancel")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> cancelRun(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/{threadId}/runs/{runId}/cancel")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response cancelRunSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/threads/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createThreadAndRun(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData createAndRunThreadOptions,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/threads/runs")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createThreadAndRunSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData createAndRunThreadOptions,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}/steps/{stepId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getRunStep(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @PathParam("stepId") String stepId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}/steps/{stepId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getRunStepSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @PathParam("stepId") String stepId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}/steps")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listRunSteps(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/threads/{threadId}/runs/{runId}/steps")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listRunStepsSync(@HostParam("endpoint") String endpoint,
+ @PathParam("threadId") String threadId, @PathParam("runId") String runId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listFiles(@HostParam("endpoint") String endpoint,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listFilesSync(@HostParam("endpoint") String endpoint, @HeaderParam("accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> uploadFile(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response uploadFileSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context);
+
+ @Delete("/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteFile(@HostParam("endpoint") String endpoint,
+ @PathParam("fileId") String fileId, @HeaderParam("accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Delete("/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteFileSync(@HostParam("endpoint") String endpoint, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getFile(@HostParam("endpoint") String endpoint, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/files/{fileId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getFileSync(@HostParam("endpoint") String endpoint, @PathParam("fileId") String fileId,
+ @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createAssistantWithResponseAsync(BinaryData assistantCreationOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.createAssistant(this.getEndpoint(), accept,
+ assistantCreationOptions, requestOptions, context));
+ }
+
+ /**
+ * Creates a new assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantCreationOptions The request details to use when creating a new assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createAssistantWithResponse(BinaryData assistantCreationOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.createAssistantSync(this.getEndpoint(), accept, assistantCreationOptions, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of assistants that were previously created along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAssistantsWithResponseAsync(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listAssistants(this.getEndpoint(), accept, requestOptions, context));
+ }
+
+ /**
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of assistants that were previously created along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAssistantsWithResponse(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.listAssistantsSync(this.getEndpoint(), accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAssistantWithResponseAsync(String assistantId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.getAssistant(this.getEndpoint(), assistantId, accept, requestOptions, context));
+ }
+
+ /**
+ * Retrieves an existing assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getAssistantSync(this.getEndpoint(), assistantId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateAssistantWithResponseAsync(String assistantId,
+ BinaryData updateAssistantOptions, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.updateAssistant(this.getEndpoint(), assistantId, accept,
+ updateAssistantOptions, requestOptions, context));
+ }
+
+ /**
+ * Modifies an existing assistant.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to modify.
+ * @param updateAssistantOptions The request details to use when modifying an existing assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return represents an assistant that can call the model and use tools along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateAssistantWithResponse(String assistantId, BinaryData updateAssistantOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.updateAssistantSync(this.getEndpoint(), assistantId, accept, updateAssistantOptions,
+ requestOptions, Context.NONE);
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant deletion operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteAssistantWithResponseAsync(String assistantId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.deleteAssistant(this.getEndpoint(), assistantId, accept, requestOptions, context));
+ }
+
+ /**
+ * Deletes an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant deletion operation along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteAssistantWithResponse(String assistantId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.deleteAssistantSync(this.getEndpoint(), assistantId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file_id: String (Required)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createAssistantFileWithResponseAsync(String assistantId, BinaryData request,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.createAssistantFile(this.getEndpoint(), assistantId, accept,
+ request, requestOptions, context));
+ }
+
+ /**
+ * Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file_id: String (Required)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to attach the file to.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createAssistantFileWithResponse(String assistantId, BinaryData request,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.createAssistantFileSync(this.getEndpoint(), assistantId, accept, request, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAssistantFilesWithResponseAsync(String assistantId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.listAssistantFiles(this.getEndpoint(), assistantId, accept, requestOptions, context));
+ }
+
+ /**
+ * Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ *
+ * 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 {@link RequestOptions#addQueryParam}
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * object: String (Required)
+ * data (Required): [
+ * (Required){
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * ]
+ * first_id: String (Required)
+ * last_id: String (Required)
+ * has_more: boolean (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant to retrieve the list of attached files for.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a list of files attached to a specific assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAssistantFilesWithResponse(String assistantId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.listAssistantFilesSync(this.getEndpoint(), assistantId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAssistantFileWithResponseAsync(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getAssistantFile(this.getEndpoint(), assistantId, fileId, accept,
+ requestOptions, context));
+ }
+
+ /**
+ * Retrieves a file attached to an assistant.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * assistant_id: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant associated with the attached file.
+ * @param fileId The ID of the file to retrieve.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a file attached to an assistant, as used by tools that can read files along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getAssistantFileSync(this.getEndpoint(), assistantId, fileId, accept, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant file deletion operation along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteAssistantFileWithResponseAsync(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.deleteAssistantFile(this.getEndpoint(), assistantId, fileId,
+ accept, requestOptions, context));
+ }
+
+ /**
+ * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ * files.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param assistantId The ID of the assistant from which the specified file should be unlinked.
+ * @param fileId The ID of the file to unlink from the specified assistant.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of an assistant file deletion operation along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteAssistantFileWithResponse(String assistantId, String fileId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.deleteAssistantFileSync(this.getEndpoint(), assistantId, fileId, accept, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createThreadWithResponseAsync(BinaryData assistantThreadCreationOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.createThread(this.getEndpoint(), accept,
+ assistantThreadCreationOptions, requestOptions, context));
+ }
+
+ /**
+ * Creates a new thread. Threads contain messages and can be run by assistants.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * 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
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param assistantThreadCreationOptions The details used to create a new assistant thread.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createThreadWithResponse(BinaryData assistantThreadCreationOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.createThreadSync(this.getEndpoint(), accept, assistantThreadCreationOptions, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about an existing thread along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getThreadWithResponseAsync(String threadId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.getThread(this.getEndpoint(), threadId, accept, requestOptions, context));
+ }
+
+ /**
+ * Gets information about an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to retrieve information about.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about an existing thread along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getThreadSync(this.getEndpoint(), threadId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateThreadWithResponseAsync(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.updateThread(this.getEndpoint(), threadId, accept, request, requestOptions, context));
+ }
+
+ /**
+ * Modifies an existing thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * object: String (Required)
+ * created_at: long (Required)
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to modify.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return information about a single thread associated with an assistant along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateThreadWithResponse(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.updateThreadSync(this.getEndpoint(), threadId, accept, request, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of a thread deletion operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteThreadWithResponseAsync(String threadId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.deleteThread(this.getEndpoint(), threadId, accept, requestOptions, context));
+ }
+
+ /**
+ * Deletes an existing thread.
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * deleted: boolean (Required)
+ * object: String (Required)
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to delete.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the status of a thread deletion operation along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteThreadWithResponse(String threadId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.deleteThreadSync(this.getEndpoint(), threadId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * role: String(user/assistant) (Required)
+ * content: String (Required)
+ * file_ids (Optional): [
+ * String (Optional)
+ * ]
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * 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)
+ * }
+ * }
+ * }
+ *
+ * @param threadId The ID of the thread to create the new message on.
+ * @param request The request parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a single, existing message within an assistant thread along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createMessageWithResponseAsync(String threadId, BinaryData request,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.createMessage(this.getEndpoint(), threadId, accept, request, requestOptions, context));
+ }
+
+ /**
+ * Creates a new message on a specified thread.
+ *
+ *