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 + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fopenai%2Fassistants%2Fazure-ai-openai-assistants%2FREADME.png) 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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
purposeStringNoA 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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
purposeStringNoA 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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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. + *

+ * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createMessageWithResponse(String threadId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.createMessageSync(this.getEndpoint(), threadId, accept, request, requestOptions, Context.NONE); + } + + /** + * Gets a list of messages that exist on a thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMessagesWithResponseAsync(String threadId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listMessages(this.getEndpoint(), threadId, accept, requestOptions, context)); + } + + /** + * Gets a list of messages that exist on a thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listMessagesWithResponse(String threadId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listMessagesSync(this.getEndpoint(), threadId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMessageWithResponseAsync(String threadId, String messageId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMessage(this.getEndpoint(), threadId, messageId, accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMessageWithResponse(String threadId, String messageId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getMessageSync(this.getEndpoint(), threadId, messageId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateMessageWithResponseAsync(String threadId, String messageId, + BinaryData request, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateMessage(this.getEndpoint(), threadId, messageId, accept, + request, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateMessageWithResponse(String threadId, String messageId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.updateMessageSync(this.getEndpoint(), threadId, messageId, accept, request, requestOptions, + Context.NONE); + } + + /** + * Gets a list of previously uploaded files associated with a message from a thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMessageFilesWithResponseAsync(String threadId, String messageId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listMessageFiles(this.getEndpoint(), threadId, messageId, accept, + requestOptions, context)); + } + + /** + * Gets a list of previously uploaded files associated with a message from a thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listMessageFilesWithResponse(String threadId, String messageId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listMessageFilesSync(this.getEndpoint(), threadId, messageId, accept, requestOptions, + Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMessageFileWithResponseAsync(String threadId, String messageId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getMessageFile(this.getEndpoint(), threadId, messageId, fileId, + accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMessageFileWithResponse(String threadId, String messageId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getMessageFileSync(this.getEndpoint(), threadId, messageId, fileId, accept, requestOptions, + Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createRunWithResponseAsync(String threadId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createRun(this.getEndpoint(), threadId, accept, request, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createRunWithResponse(String threadId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.createRunSync(this.getEndpoint(), threadId, accept, request, requestOptions, Context.NONE); + } + + /** + * Gets a list of runs for a specified thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listRunsWithResponseAsync(String threadId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRuns(this.getEndpoint(), threadId, accept, requestOptions, context)); + } + + /** + * Gets a list of runs for a specified thread. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listRunsWithResponse(String threadId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listRunsSync(this.getEndpoint(), threadId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunWithResponseAsync(String threadId, String runId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getRun(this.getEndpoint(), threadId, runId, accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunWithResponse(String threadId, String runId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRunSync(this.getEndpoint(), threadId, runId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateRunWithResponseAsync(String threadId, String runId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateRun(this.getEndpoint(), threadId, runId, accept, request, + requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateRunWithResponse(String threadId, String runId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.updateRunSync(this.getEndpoint(), threadId, runId, accept, request, requestOptions, + Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> submitToolOutputsToRunWithResponseAsync(String threadId, String runId, + BinaryData request, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.submitToolOutputsToRun(this.getEndpoint(), threadId, runId, + accept, request, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response submitToolOutputsToRunWithResponse(String threadId, String runId, BinaryData request, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.submitToolOutputsToRunSync(this.getEndpoint(), threadId, runId, accept, request, requestOptions, + Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelRunWithResponseAsync(String threadId, String runId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.cancelRun(this.getEndpoint(), threadId, runId, accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelRunWithResponse(String threadId, String runId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.cancelRunSync(this.getEndpoint(), threadId, runId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createThreadAndRunWithResponseAsync(BinaryData createAndRunThreadOptions, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createThreadAndRun(this.getEndpoint(), accept, + createAndRunThreadOptions, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createThreadAndRunWithResponse(BinaryData createAndRunThreadOptions, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.createThreadAndRunSync(this.getEndpoint(), accept, createAndRunThreadOptions, requestOptions, + Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunStepWithResponseAsync(String threadId, String runId, String stepId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getRunStep(this.getEndpoint(), threadId, runId, stepId, accept, + requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunStepWithResponse(String threadId, String runId, String stepId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRunStepSync(this.getEndpoint(), threadId, runId, stepId, accept, requestOptions, + Context.NONE); + } + + /** + * Gets a list of run steps from a thread run. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listRunStepsWithResponseAsync(String threadId, String runId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listRunSteps(this.getEndpoint(), threadId, runId, accept, requestOptions, context)); + } + + /** + * Gets a list of run steps from a thread run. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is + * 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + * Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if + * you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list.
+ * You can add these to a request with {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listRunStepsWithResponse(String threadId, String runId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listRunStepsSync(this.getEndpoint(), threadId, runId, accept, requestOptions, Context.NONE); + } + + /** + * Gets a list of previously uploaded files. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
purposeStringNoA 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listFilesWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listFiles(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Gets a list of previously uploaded files. + *

+ * Query Parameters + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
purposeStringNoA 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listFilesWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listFilesSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadFileWithResponseAsync(BinaryData request, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.uploadFile(this.getEndpoint(), contentType, accept, request, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadFileWithResponse(BinaryData request, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return service.uploadFileSync(this.getEndpoint(), contentType, accept, request, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFileWithResponseAsync(String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.deleteFile(this.getEndpoint(), fileId, accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFileWithResponse(String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteFileSync(this.getEndpoint(), fileId, accept, requestOptions, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFileWithResponseAsync(String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getFile(this.getEndpoint(), fileId, accept, requestOptions, context)); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFileWithResponse(String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFileSync(this.getEndpoint(), fileId, accept, requestOptions, Context.NONE); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/package-info.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/package-info.java new file mode 100644 index 000000000000..c5bd1c74d56c --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Assistants. + * Azure OpenAI APIs for Assistants. + * + */ +package com.azure.ai.openai.assistants.implementation; diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/Assistant.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/Assistant.java new file mode 100644 index 000000000000..0f0a6e157032 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/Assistant.java @@ -0,0 +1,234 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +/** + * Represents an assistant that can call the model and use tools. + */ +@Immutable +public final class Assistant { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always assistant. + */ + @Generated + @JsonProperty(value = "object") + private String object = "assistant"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The name of the assistant. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The description of the assistant. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The ID of the model to use. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The system instructions for the assistant to use. + */ + @Generated + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The collection of tools enabled for the assistant. + */ + @Generated + @JsonProperty(value = "tools") + private List tools; + + /* + * A list of attached file IDs, ordered by creation date in ascending order. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of Assistant class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param name the name value to set. + * @param description the description value to set. + * @param model the model value to set. + * @param instructions the instructions value to set. + * @param tools the tools value to set. + * @param fileIds the fileIds value to set. + * @param metadata the metadata value to set. + */ + @Generated + private Assistant(String id, OffsetDateTime createdAt, String name, String description, String model, + String instructions, List tools, List fileIds, Map metadata) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.name = name; + this.description = description; + this.model = model; + this.instructions = instructions; + this.tools = tools; + this.fileIds = fileIds; + this.metadata = metadata; + } + + @Generated + @JsonCreator + private Assistant(@JsonProperty(value = "id") String id, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "name") String name, @JsonProperty(value = "description") String description, + @JsonProperty(value = "model") String model, @JsonProperty(value = "instructions") String instructions, + @JsonProperty(value = "tools") List tools, + @JsonProperty(value = "file_ids") List fileIds, + @JsonProperty(value = "metadata") Map metadata) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), name, description, model, + instructions, tools, fileIds, metadata); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always assistant. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the name property: The name of the assistant. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description of the assistant. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the model property: The ID of the model to use. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Get the instructions property: The system instructions for the assistant to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Get the tools property: The collection of tools enabled for the assistant. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Get the fileIds property: A list of attached file IDs, ordered by creation date in ascending order. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantCreationOptions.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantCreationOptions.java new file mode 100644 index 000000000000..15b1ea12ab73 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantCreationOptions.java @@ -0,0 +1,226 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * The request details to use when creating a new assistant. + */ +@Fluent +public final class AssistantCreationOptions { + /* + * The ID of the model to use. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The name of the new assistant. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The description of the new assistant. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The system instructions for the new assistant to use. + */ + @Generated + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The collection of tools to enable for the new assistant. + */ + @Generated + @JsonProperty(value = "tools") + private List tools; + + /* + * A list of previously uploaded file IDs to attach to the assistant. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of AssistantCreationOptions class. + * + * @param model the model value to set. + */ + @Generated + @JsonCreator + public AssistantCreationOptions(@JsonProperty(value = "model") String model) { + this.model = model; + } + + /** + * Get the model property: The ID of the model to use. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Get the name property: The name of the new assistant. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the new assistant. + * + * @param name the name value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the new assistant. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the new assistant. + * + * @param description the description value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The system instructions for the new assistant to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The system instructions for the new assistant to use. + * + * @param instructions the instructions value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The collection of tools to enable for the new assistant. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The collection of tools to enable for the new assistant. + * + * @param tools the tools value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the fileIds property: A list of previously uploaded file IDs to attach to the assistant. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: A list of previously uploaded file IDs to attach to the assistant. + * + * @param fileIds the fileIds value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: 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. + * + * @param metadata the metadata value to set. + * @return the AssistantCreationOptions object itself. + */ + @Generated + public AssistantCreationOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantDeletionStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantDeletionStatus.java new file mode 100644 index 000000000000..5cf1a538cc80 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantDeletionStatus.java @@ -0,0 +1,81 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of an assistant deletion operation. + */ +@Immutable +public final class AssistantDeletionStatus { + /* + * The ID of the resource specified for deletion. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + @JsonProperty(value = "deleted") + private boolean deleted; + + /* + * The object type, which is always 'assistant.deleted'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "assistant.deleted"; + + /** + * Creates an instance of AssistantDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + @JsonCreator + private AssistantDeletionStatus(@JsonProperty(value = "id") String id, + @JsonProperty(value = "deleted") boolean deleted) { + this.id = id; + this.deleted = deleted; + } + + /** + * Get the id property: The ID of the resource specified for deletion. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the deleted property: A value indicating whether deletion was successful. + * + * @return the deleted value. + */ + @Generated + public boolean isDeleted() { + return this.deleted; + } + + /** + * Get the object property: The object type, which is always 'assistant.deleted'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFile.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFile.java new file mode 100644 index 000000000000..3b6370d6aedf --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFile.java @@ -0,0 +1,108 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Information about a file attached to an assistant, as used by tools that can read files. + */ +@Immutable +public final class AssistantFile { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'assistant.file'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "assistant.file"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The assistant ID that the file is attached to. + */ + @Generated + @JsonProperty(value = "assistant_id") + private String assistantId; + + /** + * Creates an instance of AssistantFile class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param assistantId the assistantId value to set. + */ + @Generated + private AssistantFile(String id, OffsetDateTime createdAt, String assistantId) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.assistantId = assistantId; + } + + @Generated + @JsonCreator + private AssistantFile(@JsonProperty(value = "id") String id, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "assistant_id") String assistantId) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), assistantId); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'assistant.file'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the assistantId property: The assistant ID that the file is attached to. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFileDeletionStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFileDeletionStatus.java new file mode 100644 index 000000000000..7d96c7ca6dad --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantFileDeletionStatus.java @@ -0,0 +1,81 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of an assistant file deletion operation. + */ +@Immutable +public final class AssistantFileDeletionStatus { + /* + * The ID of the resource specified for deletion. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + @JsonProperty(value = "deleted") + private boolean deleted; + + /* + * The object type, which is always 'assistant.file.deleted'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "assistant.file.deleted"; + + /** + * Creates an instance of AssistantFileDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + @JsonCreator + private AssistantFileDeletionStatus(@JsonProperty(value = "id") String id, + @JsonProperty(value = "deleted") boolean deleted) { + this.id = id; + this.deleted = deleted; + } + + /** + * Get the id property: The ID of the resource specified for deletion. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the deleted property: A value indicating whether deletion was successful. + * + * @return the deleted value. + */ + @Generated + public boolean isDeleted() { + return this.deleted; + } + + /** + * Get the object property: The object type, which is always 'assistant.file.deleted'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThread.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThread.java new file mode 100644 index 000000000000..13f18e776407 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThread.java @@ -0,0 +1,113 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Information about a single thread associated with an assistant. + */ +@Immutable +public final class AssistantThread { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'thread'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of AssistantThread class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param metadata the metadata value to set. + */ + @Generated + private AssistantThread(String id, OffsetDateTime createdAt, Map metadata) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.metadata = metadata; + } + + @Generated + @JsonCreator + private AssistantThread(@JsonProperty(value = "id") String id, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "metadata") Map metadata) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), metadata); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'thread'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThreadCreationOptions.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThreadCreationOptions.java new file mode 100644 index 000000000000..d1b56ed3d763 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/AssistantThreadCreationOptions.java @@ -0,0 +1,88 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * The details used to create a new assistant thread. + */ +@Fluent +public final class AssistantThreadCreationOptions { + /* + * The initial messages to associate with the new thread. + */ + @Generated + @JsonProperty(value = "messages") + private List messages; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of AssistantThreadCreationOptions class. + */ + @Generated + public AssistantThreadCreationOptions() { + } + + /** + * Get the messages property: The initial messages to associate with the new thread. + * + * @return the messages value. + */ + @Generated + public List getMessages() { + return this.messages; + } + + /** + * Set the messages property: The initial messages to associate with the new thread. + * + * @param messages the messages value to set. + * @return the AssistantThreadCreationOptions object itself. + */ + @Generated + public AssistantThreadCreationOptions setMessages(List messages) { + this.messages = messages; + return this; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: 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. + * + * @param metadata the metadata value to set. + * @return the AssistantThreadCreationOptions object itself. + */ + @Generated + public AssistantThreadCreationOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageOutput.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageOutput.java new file mode 100644 index 000000000000..41e4fcd23c34 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageOutput.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("image") +@Immutable +public final class CodeInterpreterImageOutput extends CodeInterpreterToolCallOutput { + /* + * Referential information for the image associated with this output. + */ + @Generated + @JsonProperty(value = "image") + private CodeInterpreterImageReference image; + + /** + * Creates an instance of CodeInterpreterImageOutput class. + * + * @param image the image value to set. + */ + @Generated + @JsonCreator + private CodeInterpreterImageOutput(@JsonProperty(value = "image") CodeInterpreterImageReference image) { + this.image = image; + } + + /** + * Get the image property: Referential information for the image associated with this output. + * + * @return the image value. + */ + @Generated + public CodeInterpreterImageReference getImage() { + return this.image; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageReference.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageReference.java new file mode 100644 index 000000000000..412faa8e8572 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterImageReference.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An image reference emitted by a code interpreter tool in response to a tool call by the model. + */ +@Immutable +public final class CodeInterpreterImageReference { + /* + * The ID of the file associated with this image. + */ + @Generated + @JsonProperty(value = "file_id") + private String fileId; + + /** + * Creates an instance of CodeInterpreterImageReference class. + * + * @param fileId the fileId value to set. + */ + @Generated + @JsonCreator + private CodeInterpreterImageReference(@JsonProperty(value = "file_id") String fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID of the file associated with this image. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterLogOutput.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterLogOutput.java new file mode 100644 index 000000000000..6e9c4d4f7b15 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterLogOutput.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("logs") +@Immutable +public final class CodeInterpreterLogOutput extends CodeInterpreterToolCallOutput { + /* + * The serialized log output emitted by the code interpreter. + */ + @Generated + @JsonProperty(value = "logs") + private String logs; + + /** + * Creates an instance of CodeInterpreterLogOutput class. + * + * @param logs the logs value to set. + */ + @Generated + @JsonCreator + private CodeInterpreterLogOutput(@JsonProperty(value = "logs") String logs) { + this.logs = logs; + } + + /** + * Get the logs property: The serialized log output emitted by the code interpreter. + * + * @return the logs value. + */ + @Generated + public String getLogs() { + return this.logs; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCall.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCall.java new file mode 100644 index 000000000000..8fd39a4e1634 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCall.java @@ -0,0 +1,53 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A tool call to a code interpreter tool, issued by the model in evaluation of a configured code interpreter tool, + * that + * represents submitted output needed or already fulfilled by the tool for the model to continue. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("code_interpreter") +@Immutable +public final class CodeInterpreterToolCall extends ToolCall { + /* + * The details of the tool call to the code interpreter tool. + */ + @Generated + @JsonProperty(value = "code_interpreter") + private CodeInterpreterToolCallDetails codeInterpreter; + + /** + * Creates an instance of CodeInterpreterToolCall class. + * + * @param id the id value to set. + * @param codeInterpreter the codeInterpreter value to set. + */ + @Generated + @JsonCreator + private CodeInterpreterToolCall(@JsonProperty(value = "id") String id, + @JsonProperty(value = "code_interpreter") CodeInterpreterToolCallDetails codeInterpreter) { + super(id); + this.codeInterpreter = codeInterpreter; + } + + /** + * Get the codeInterpreter property: The details of the tool call to the code interpreter tool. + * + * @return the codeInterpreter value. + */ + @Generated + public CodeInterpreterToolCallDetails getCodeInterpreter() { + return this.codeInterpreter; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallDetails.java new file mode 100644 index 000000000000..f3efda837654 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallDetails.java @@ -0,0 +1,66 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The detailed information about a code interpreter invocation by the model. + */ +@Immutable +public final class CodeInterpreterToolCallDetails { + /* + * The input provided by the model to the code interpreter tool. + */ + @Generated + @JsonProperty(value = "input") + private String input; + + /* + * The outputs produced by the code interpreter tool back to the model in response to the tool call. + */ + @Generated + @JsonProperty(value = "outputs") + private List outputs; + + /** + * Creates an instance of CodeInterpreterToolCallDetails class. + * + * @param input the input value to set. + * @param outputs the outputs value to set. + */ + @Generated + @JsonCreator + private CodeInterpreterToolCallDetails(@JsonProperty(value = "input") String input, + @JsonProperty(value = "outputs") List outputs) { + this.input = input; + this.outputs = outputs; + } + + /** + * Get the input property: The input provided by the model to the code interpreter tool. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the outputs property: The outputs produced by the code interpreter tool back to the model in response to the + * tool call. + * + * @return the outputs value. + */ + @Generated + public List getOutputs() { + return this.outputs; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallOutput.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallOutput.java new file mode 100644 index 000000000000..69a4b21b003c --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolCallOutput.java @@ -0,0 +1,33 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of an emitted output from a code interpreter tool. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = CodeInterpreterToolCallOutput.class) +@JsonTypeName("CodeInterpreterToolCallOutput") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "logs", value = CodeInterpreterLogOutput.class), + @JsonSubTypes.Type(name = "image", value = CodeInterpreterImageOutput.class) }) +@Immutable +public class CodeInterpreterToolCallOutput { + /** + * Creates an instance of CodeInterpreterToolCallOutput class. + */ + @Generated + protected CodeInterpreterToolCallOutput() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolDefinition.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolDefinition.java new file mode 100644 index 000000000000..d318791427c0 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CodeInterpreterToolDefinition.java @@ -0,0 +1,25 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The input definition information for a code interpreter tool as used to configure an assistant. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("code_interpreter") +@Immutable +public final class CodeInterpreterToolDefinition extends ToolDefinition { + /** + * Creates an instance of CodeInterpreterToolDefinition class. + */ + @Generated + public CodeInterpreterToolDefinition() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CreateAndRunThreadOptions.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CreateAndRunThreadOptions.java new file mode 100644 index 000000000000..05c560210f94 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/CreateAndRunThreadOptions.java @@ -0,0 +1,197 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * The details used when creating and immediately running a new assistant thread. + */ +@Fluent +public final class CreateAndRunThreadOptions { + /* + * The ID of the assistant for which the thread should be created. + */ + @Generated + @JsonProperty(value = "assistant_id") + private String assistantId; + + /* + * The details used to create the new thread. + */ + @Generated + @JsonProperty(value = "thread") + private AssistantThreadCreationOptions thread; + + /* + * The overridden model that the assistant should use to run the thread. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The overridden system instructions the assistant should use to run the thread. + */ + @Generated + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The overridden list of enabled tools the assistant should use to run the thread. + */ + @Generated + @JsonProperty(value = "tools") + private List tools; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of CreateAndRunThreadOptions class. + * + * @param assistantId the assistantId value to set. + */ + @Generated + @JsonCreator + public CreateAndRunThreadOptions(@JsonProperty(value = "assistant_id") String assistantId) { + this.assistantId = assistantId; + } + + /** + * Get the assistantId property: The ID of the assistant for which the thread should be created. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the thread property: The details used to create the new thread. + * + * @return the thread value. + */ + @Generated + public AssistantThreadCreationOptions getThread() { + return this.thread; + } + + /** + * Set the thread property: The details used to create the new thread. + * + * @param thread the thread value to set. + * @return the CreateAndRunThreadOptions object itself. + */ + @Generated + public CreateAndRunThreadOptions setThread(AssistantThreadCreationOptions thread) { + this.thread = thread; + return this; + } + + /** + * Get the model property: The overridden model that the assistant should use to run the thread. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The overridden model that the assistant should use to run the thread. + * + * @param model the model value to set. + * @return the CreateAndRunThreadOptions object itself. + */ + @Generated + public CreateAndRunThreadOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the instructions property: The overridden system instructions the assistant should use to run the thread. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The overridden system instructions the assistant should use to run the thread. + * + * @param instructions the instructions value to set. + * @return the CreateAndRunThreadOptions object itself. + */ + @Generated + public CreateAndRunThreadOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The overridden list of enabled tools the assistant should use to run the thread. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The overridden list of enabled tools the assistant should use to run the thread. + * + * @param tools the tools value to set. + * @return the CreateAndRunThreadOptions object itself. + */ + @Generated + public CreateAndRunThreadOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: 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. + * + * @param metadata the metadata value to set. + * @return the CreateAndRunThreadOptions object itself. + */ + @Generated + public CreateAndRunThreadOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileDeletionStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileDeletionStatus.java new file mode 100644 index 000000000000..379e65b10ab3 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileDeletionStatus.java @@ -0,0 +1,81 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A status response from a file deletion operation. + */ +@Immutable +public final class FileDeletionStatus { + /* + * The ID of the resource specified for deletion. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + @JsonProperty(value = "deleted") + private boolean deleted; + + /* + * The object type, which is always 'file'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "file"; + + /** + * Creates an instance of FileDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + @JsonCreator + private FileDeletionStatus(@JsonProperty(value = "id") String id, + @JsonProperty(value = "deleted") boolean deleted) { + this.id = id; + this.deleted = deleted; + } + + /** + * Get the id property: The ID of the resource specified for deletion. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the deleted property: A value indicating whether deletion was successful. + * + * @return the deleted value. + */ + @Generated + public boolean isDeleted() { + return this.deleted; + } + + /** + * Get the object property: The object type, which is always 'file'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileListResponse.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileListResponse.java new file mode 100644 index 000000000000..598cff729fad --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FileListResponse.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data from a file list operation. + */ +@Immutable +public final class FileListResponse { + /* + * The object type, which is always 'list'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The files returned for the request. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /** + * Creates an instance of FileListResponse class. + * + * @param data the data value to set. + */ + @Generated + @JsonCreator + private FileListResponse(@JsonProperty(value = "data") List data) { + this.data = data; + } + + /** + * Get the object property: The object type, which is always 'list'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The files returned for the request. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FilePurpose.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FilePurpose.java new file mode 100644 index 000000000000..a18352d5bb22 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FilePurpose.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The possible values denoting the intended usage of a file. + */ +public final class FilePurpose extends ExpandableStringEnum { + /** + * Indicates a file is used for fine tuning input. + */ + @Generated + public static final FilePurpose FINE_TUNE = fromString("fine-tune"); + + /** + * Indicates a file is used for fine tuning results. + */ + @Generated + public static final FilePurpose FINE_TUNE_RESULTS = fromString("fine-tune-results"); + + /** + * Indicates a file is used as input to assistants. + */ + @Generated + public static final FilePurpose ASSISTANTS = fromString("assistants"); + + /** + * Indicates a file is used as output by assistants. + */ + @Generated + public static final FilePurpose ASSISTANTS_OUTPUT = fromString("assistants_output"); + + /** + * Creates a new instance of FilePurpose value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FilePurpose() { + } + + /** + * Creates or finds a FilePurpose from its string representation. + * + * @param name a name to look for. + * @return the corresponding FilePurpose. + */ + @Generated + @JsonCreator + public static FilePurpose fromString(String name) { + return fromString(name, FilePurpose.class); + } + + /** + * Gets known FilePurpose values. + * + * @return known FilePurpose values. + */ + @Generated + public static Collection values() { + return values(FilePurpose.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionDefinition.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionDefinition.java new file mode 100644 index 000000000000..06e1b0fc035e --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionDefinition.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The input definition information for a function. + */ +@Fluent +public final class FunctionDefinition { + /* + * The name of the function to be called. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * A description of what the function does, used by the model to choose when and how to call the function. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The parameters the functions accepts, described as a JSON Schema object. + */ + @Generated + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Creates an instance of FunctionDefinition class. + * + * @param name the name value to set. + * @param parameters the parameters value to set. + */ + @Generated + @JsonCreator + public FunctionDefinition(@JsonProperty(value = "name") String name, + @JsonProperty(value = "parameters") Object parameters) { + this.name = name; + this.parameters = parameters; + } + + /** + * Get the name property: The name of the function to be called. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: A description of what the function does, used by the model to choose when and how + * to call the function. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A description of what the function does, used by the model to choose when and how + * to call the function. + * + * @param description the description value to set. + * @return the FunctionDefinition object itself. + */ + @Generated + public FunctionDefinition setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the parameters property: The parameters the functions accepts, described as a JSON Schema object. + * + * @return the parameters value. + */ + @Generated + public Object getParameters() { + return this.parameters; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCall.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCall.java new file mode 100644 index 000000000000..ab0e71918ae8 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCall.java @@ -0,0 +1,53 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A tool call to a function tool, issued by the model in evaluation of a configured function tool, that represents + * given function inputs and submitted function outputs needed or already fulfilled by the tool for the model to + * continue. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("function") +@Immutable +public final class FunctionToolCall extends ToolCall { + /* + * The detailed information about the function called by the model. + */ + @Generated + @JsonProperty(value = "function") + private FunctionToolCallDetails function; + + /** + * Creates an instance of FunctionToolCall class. + * + * @param id the id value to set. + * @param function the function value to set. + */ + @Generated + @JsonCreator + private FunctionToolCall(@JsonProperty(value = "id") String id, + @JsonProperty(value = "function") FunctionToolCallDetails function) { + super(id); + this.function = function; + } + + /** + * Get the function property: The detailed information about the function called by the model. + * + * @return the function value. + */ + @Generated + public FunctionToolCallDetails getFunction() { + return this.function; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCallDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCallDetails.java new file mode 100644 index 000000000000..0e7dd3b73064 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolCallDetails.java @@ -0,0 +1,85 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The detailed information about the function called by the model. + */ +@Immutable +public final class FunctionToolCallDetails { + /* + * The name of the function. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The arguments that the model requires are provided to the named function. + */ + @Generated + @JsonProperty(value = "arguments") + private String arguments; + + /* + * The output of the function, only populated for function calls that have already have had their outputs + * submitted. + */ + @Generated + @JsonProperty(value = "output") + private String output; + + /** + * Creates an instance of FunctionToolCallDetails class. + * + * @param name the name value to set. + * @param arguments the arguments value to set. + * @param output the output value to set. + */ + @Generated + @JsonCreator + private FunctionToolCallDetails(@JsonProperty(value = "name") String name, + @JsonProperty(value = "arguments") String arguments, @JsonProperty(value = "output") String output) { + this.name = name; + this.arguments = arguments; + this.output = output; + } + + /** + * Get the name property: The name of the function. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the arguments property: The arguments that the model requires are provided to the named function. + * + * @return the arguments value. + */ + @Generated + public String getArguments() { + return this.arguments; + } + + /** + * Get the output property: The output of the function, only populated for function calls that have already have + * had their outputs submitted. + * + * @return the output value. + */ + @Generated + public String getOutput() { + return this.output; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolDefinition.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolDefinition.java new file mode 100644 index 000000000000..fb5bdfd430d0 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/FunctionToolDefinition.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The input definition information for a function tool as used to configure an assistant. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("function") +@Immutable +public final class FunctionToolDefinition extends ToolDefinition { + /* + * The definition of the concrete function that the function tool should call. + */ + @Generated + @JsonProperty(value = "function") + private FunctionDefinition function; + + /** + * Creates an instance of FunctionToolDefinition class. + * + * @param function the function value to set. + */ + @Generated + @JsonCreator + public FunctionToolDefinition(@JsonProperty(value = "function") FunctionDefinition function) { + this.function = function; + } + + /** + * Get the function property: The definition of the concrete function that the function tool should call. + * + * @return the function value. + */ + @Generated + public FunctionDefinition getFunction() { + return this.function; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ListSortOrder.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ListSortOrder.java new file mode 100644 index 000000000000..33d4cad8378f --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ListSortOrder.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The available sorting options when requesting a list of response objects. + */ +public final class ListSortOrder extends ExpandableStringEnum { + /** + * Specifies an ascending sort order. + */ + @Generated + public static final ListSortOrder ASCENDING = fromString("asc"); + + /** + * Specifies a descending sort order. + */ + @Generated + public static final ListSortOrder DESCENDING = fromString("desc"); + + /** + * Creates a new instance of ListSortOrder value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ListSortOrder() { + } + + /** + * Creates or finds a ListSortOrder from its string representation. + * + * @param name a name to look for. + * @return the corresponding ListSortOrder. + */ + @Generated + @JsonCreator + public static ListSortOrder fromString(String name) { + return fromString(name, ListSortOrder.class); + } + + /** + * Gets known ListSortOrder values. + * + * @return known ListSortOrder values. + */ + @Generated + public static Collection values() { + return values(ListSortOrder.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageContent.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageContent.java new file mode 100644 index 000000000000..1406c7fe9ac7 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageContent.java @@ -0,0 +1,33 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of a single item of thread message content. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = MessageContent.class) +@JsonTypeName("MessageContent") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "text", value = MessageTextContent.class), + @JsonSubTypes.Type(name = "image_file", value = MessageImageFileContent.class) }) +@Immutable +public class MessageContent { + /** + * Creates an instance of MessageContent class. + */ + @Generated + protected MessageContent() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFile.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFile.java new file mode 100644 index 000000000000..3727b0490af2 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFile.java @@ -0,0 +1,108 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Information about a file attached to an assistant thread message. + */ +@Immutable +public final class MessageFile { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'thread.message.file'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread.message.file"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The ID of the message that this file is attached to. + */ + @Generated + @JsonProperty(value = "message_id") + private String messageId; + + /** + * Creates an instance of MessageFile class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param messageId the messageId value to set. + */ + @Generated + private MessageFile(String id, OffsetDateTime createdAt, String messageId) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.messageId = messageId; + } + + @Generated + @JsonCreator + private MessageFile(@JsonProperty(value = "id") String id, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "message_id") String messageId) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), messageId); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'thread.message.file'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the messageId property: The ID of the message that this file is attached to. + * + * @return the messageId value. + */ + @Generated + public String getMessageId() { + return this.messageId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFileCitationTextAnnotation.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFileCitationTextAnnotation.java new file mode 100644 index 000000000000..9d6fb0a5c9e0 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFileCitationTextAnnotation.java @@ -0,0 +1,58 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A citation within the message that points to a specific quote from a specific File associated with the assistant or + * the message. Generated when the assistant uses the 'retrieval' tool to search files. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("file_citation") +@Immutable +public final class MessageFileCitationTextAnnotation extends MessageTextAnnotation { + /* + * A citation within the message that points to a specific quote from a specific file. + * Generated when the assistant uses the "retrieval" tool to search files. + */ + @Generated + @JsonProperty(value = "file_citation") + private MessageTextFileCitationDetails fileCitation; + + /** + * Creates an instance of MessageFileCitationTextAnnotation class. + * + * @param text the text value to set. + * @param startIndex the startIndex value to set. + * @param endIndex the endIndex value to set. + * @param fileCitation the fileCitation value to set. + */ + @Generated + @JsonCreator + private MessageFileCitationTextAnnotation(@JsonProperty(value = "text") String text, + @JsonProperty(value = "start_index") int startIndex, @JsonProperty(value = "end_index") int endIndex, + @JsonProperty(value = "file_citation") MessageTextFileCitationDetails fileCitation) { + super(text, startIndex, endIndex); + this.fileCitation = fileCitation; + } + + /** + * Get the fileCitation property: A citation within the message that points to a specific quote from a specific + * file. + * Generated when the assistant uses the "retrieval" tool to search files. + * + * @return the fileCitation value. + */ + @Generated + public MessageTextFileCitationDetails getFileCitation() { + return this.fileCitation; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathDetails.java new file mode 100644 index 000000000000..823536b29d47 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathDetails.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An encapsulation of an image file ID, as used by message image content. + */ +@Immutable +public final class MessageFilePathDetails { + /* + * The ID of the specific file that the citation is from. + */ + @Generated + @JsonProperty(value = "file_id") + private String fileId; + + /** + * Creates an instance of MessageFilePathDetails class. + * + * @param fileId the fileId value to set. + */ + @Generated + @JsonCreator + private MessageFilePathDetails(@JsonProperty(value = "file_id") String fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID of the specific file that the citation is from. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathTextAnnotation.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathTextAnnotation.java new file mode 100644 index 000000000000..b6b74b824392 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageFilePathTextAnnotation.java @@ -0,0 +1,55 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A citation within the message that points to a file located at a specific path. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("file_path") +@Immutable +public final class MessageFilePathTextAnnotation extends MessageTextAnnotation { + /* + * A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. + */ + @Generated + @JsonProperty(value = "file_path") + private MessageFilePathDetails filePath; + + /** + * Creates an instance of MessageFilePathTextAnnotation class. + * + * @param text the text value to set. + * @param startIndex the startIndex value to set. + * @param endIndex the endIndex value to set. + * @param filePath the filePath value to set. + */ + @Generated + @JsonCreator + private MessageFilePathTextAnnotation(@JsonProperty(value = "text") String text, + @JsonProperty(value = "start_index") int startIndex, @JsonProperty(value = "end_index") int endIndex, + @JsonProperty(value = "file_path") MessageFilePathDetails filePath) { + super(text, startIndex, endIndex); + this.filePath = filePath; + } + + /** + * Get the filePath property: A URL for the file that's generated when the assistant used the code_interpreter tool + * to generate a file. + * + * @return the filePath value. + */ + @Generated + public MessageFilePathDetails getFilePath() { + return this.filePath; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileContent.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileContent.java new file mode 100644 index 000000000000..c201f651ac21 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileContent.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A representation of image file content in a thread message. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("image_file") +@Immutable +public final class MessageImageFileContent extends MessageContent { + /* + * The image file for this thread message content item. + */ + @Generated + @JsonProperty(value = "image_file") + private MessageImageFileDetails imageFile; + + /** + * Creates an instance of MessageImageFileContent class. + * + * @param imageFile the imageFile value to set. + */ + @Generated + @JsonCreator + private MessageImageFileContent(@JsonProperty(value = "image_file") MessageImageFileDetails imageFile) { + this.imageFile = imageFile; + } + + /** + * Get the imageFile property: The image file for this thread message content item. + * + * @return the imageFile value. + */ + @Generated + public MessageImageFileDetails getImageFile() { + return this.imageFile; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileDetails.java new file mode 100644 index 000000000000..dadb2160a05d --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileDetails.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An image reference, as represented in thread message content. + */ +@Immutable +public final class MessageImageFileDetails { + /* + * The ID for the file associated with this image. + */ + @Generated + @JsonProperty(value = "file_id") + private MessageImageFileIdDetails fileId; + + /** + * Creates an instance of MessageImageFileDetails class. + * + * @param fileId the fileId value to set. + */ + @Generated + @JsonCreator + private MessageImageFileDetails(@JsonProperty(value = "file_id") MessageImageFileIdDetails fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID for the file associated with this image. + * + * @return the fileId value. + */ + @Generated + public MessageImageFileIdDetails getFileId() { + return this.fileId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileIdDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileIdDetails.java new file mode 100644 index 000000000000..bced211e82f0 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageImageFileIdDetails.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An encapsulation of an image file ID, as used by message image content. + */ +@Immutable +public final class MessageImageFileIdDetails { + /* + * The ID of the specific image file. + */ + @Generated + @JsonProperty(value = "file_id") + private String fileId; + + /** + * Creates an instance of MessageImageFileIdDetails class. + * + * @param fileId the fileId value to set. + */ + @Generated + @JsonCreator + private MessageImageFileIdDetails(@JsonProperty(value = "file_id") String fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID of the specific image file. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageRole.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageRole.java new file mode 100644 index 000000000000..cc49bee731d3 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageRole.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The possible values for roles attributed to messages in a thread. + */ +public final class MessageRole extends ExpandableStringEnum { + /** + * The role representing the end-user. + */ + @Generated + public static final MessageRole USER = fromString("user"); + + /** + * The role representing the assistant. + */ + @Generated + public static final MessageRole ASSISTANT = fromString("assistant"); + + /** + * Creates a new instance of MessageRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MessageRole() { + } + + /** + * Creates or finds a MessageRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageRole. + */ + @Generated + @JsonCreator + public static MessageRole fromString(String name) { + return fromString(name, MessageRole.class); + } + + /** + * Gets known MessageRole values. + * + * @return known MessageRole values. + */ + @Generated + public static Collection values() { + return values(MessageRole.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextAnnotation.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextAnnotation.java new file mode 100644 index 000000000000..2208074cf071 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextAnnotation.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of an annotation to text thread message content. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = MessageTextAnnotation.class) +@JsonTypeName("MessageTextAnnotation") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "file_citation", value = MessageFileCitationTextAnnotation.class), + @JsonSubTypes.Type(name = "file_path", value = MessageFilePathTextAnnotation.class) }) +@Immutable +public class MessageTextAnnotation { + /* + * The textual content associated with this text annotation item. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The first text index associated with this text annotation. + */ + @Generated + @JsonProperty(value = "start_index") + private int startIndex; + + /* + * The last text index associated with this text annotation. + */ + @Generated + @JsonProperty(value = "end_index") + private int endIndex; + + /** + * Creates an instance of MessageTextAnnotation class. + * + * @param text the text value to set. + * @param startIndex the startIndex value to set. + * @param endIndex the endIndex value to set. + */ + @Generated + @JsonCreator + protected MessageTextAnnotation(@JsonProperty(value = "text") String text, + @JsonProperty(value = "start_index") int startIndex, @JsonProperty(value = "end_index") int endIndex) { + this.text = text; + this.startIndex = startIndex; + this.endIndex = endIndex; + } + + /** + * Get the text property: The textual content associated with this text annotation item. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the startIndex property: The first text index associated with this text annotation. + * + * @return the startIndex value. + */ + @Generated + public int getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The last text index associated with this text annotation. + * + * @return the endIndex value. + */ + @Generated + public int getEndIndex() { + return this.endIndex; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextContent.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextContent.java new file mode 100644 index 000000000000..4614755c8cad --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextContent.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A representation of a textual item of thread message content. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("text") +@Immutable +public final class MessageTextContent extends MessageContent { + /* + * The text and associated annotations for this thread message content item. + */ + @Generated + @JsonProperty(value = "text") + private MessageTextDetails text; + + /** + * Creates an instance of MessageTextContent class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private MessageTextContent(@JsonProperty(value = "text") MessageTextDetails text) { + this.text = text; + } + + /** + * Get the text property: The text and associated annotations for this thread message content item. + * + * @return the text value. + */ + @Generated + public MessageTextDetails getText() { + return this.text; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextDetails.java new file mode 100644 index 000000000000..0bc03efc0184 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextDetails.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The text and associated annotations for a single item of assistant thread message content. + */ +@Immutable +public final class MessageTextDetails { + /* + * The text data. + */ + @Generated + @JsonProperty(value = "value") + private String value; + + /* + * A list of annotations associated with this text. + */ + @Generated + @JsonProperty(value = "annotations") + private List annotations; + + /** + * Creates an instance of MessageTextDetails class. + * + * @param value the value value to set. + * @param annotations the annotations value to set. + */ + @Generated + @JsonCreator + private MessageTextDetails(@JsonProperty(value = "value") String value, + @JsonProperty(value = "annotations") List annotations) { + this.value = value; + this.annotations = annotations; + } + + /** + * Get the value property: The text data. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Get the annotations property: A list of annotations associated with this text. + * + * @return the annotations value. + */ + @Generated + public List getAnnotations() { + return this.annotations; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextFileCitationDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextFileCitationDetails.java new file mode 100644 index 000000000000..d717713b1ea2 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/MessageTextFileCitationDetails.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A representation of a file-based text citation, as used in a file-based annotation of text thread message content. + */ +@Immutable +public final class MessageTextFileCitationDetails { + /* + * The ID of the file associated with this citation. + */ + @Generated + @JsonProperty(value = "file_id") + private String fileId; + + /* + * The specific quote cited in the associated file. + */ + @Generated + @JsonProperty(value = "quote") + private String quote; + + /** + * Creates an instance of MessageTextFileCitationDetails class. + * + * @param fileId the fileId value to set. + * @param quote the quote value to set. + */ + @Generated + @JsonCreator + private MessageTextFileCitationDetails(@JsonProperty(value = "file_id") String fileId, + @JsonProperty(value = "quote") String quote) { + this.fileId = fileId; + this.quote = quote; + } + + /** + * Get the fileId property: The ID of the file associated with this citation. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Get the quote property: The specific quote cited in the associated file. + * + * @return the quote value. + */ + @Generated + public String getQuote() { + return this.quote; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIFile.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIFile.java new file mode 100644 index 000000000000..a034d52e02e7 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIFile.java @@ -0,0 +1,147 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Represents an assistant that can call the model and use tools. + */ +@Immutable +public final class OpenAIFile { + /* + * The object type, which is always 'file'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "file"; + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The size of the file, in bytes. + */ + @Generated + @JsonProperty(value = "bytes") + private int bytes; + + /* + * The name of the file. + */ + @Generated + @JsonProperty(value = "filename") + private String filename; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The intended purpose of a file. + */ + @Generated + @JsonProperty(value = "purpose") + private FilePurpose purpose; + + /** + * Creates an instance of OpenAIFile class. + * + * @param id the id value to set. + * @param bytes the bytes value to set. + * @param filename the filename value to set. + * @param createdAt the createdAt value to set. + * @param purpose the purpose value to set. + */ + @Generated + private OpenAIFile(String id, int bytes, String filename, OffsetDateTime createdAt, FilePurpose purpose) { + this.id = id; + this.bytes = bytes; + this.filename = filename; + this.createdAt = createdAt.toEpochSecond(); + this.purpose = purpose; + } + + @Generated + @JsonCreator + private OpenAIFile(@JsonProperty(value = "id") String id, @JsonProperty(value = "bytes") int bytes, + @JsonProperty(value = "filename") String filename, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "purpose") FilePurpose purpose) { + this(id, bytes, filename, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), purpose); + } + + /** + * Get the object property: The object type, which is always 'file'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the bytes property: The size of the file, in bytes. + * + * @return the bytes value. + */ + @Generated + public int getBytes() { + return this.bytes; + } + + /** + * Get the filename property: The name of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the purpose property: The intended purpose of a file. + * + * @return the purpose value. + */ + @Generated + public FilePurpose getPurpose() { + return this.purpose; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistant.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistant.java new file mode 100644 index 000000000000..746da58cdb1e --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistant.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfAssistant { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfAssistant class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfAssistant(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistantFile.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistantFile.java new file mode 100644 index 000000000000..9c733ce66790 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfAssistantFile.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfAssistantFile { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfAssistantFile class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfAssistantFile(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfMessageFile.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfMessageFile.java new file mode 100644 index 000000000000..088b275c758b --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfMessageFile.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfMessageFile { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfMessageFile class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfMessageFile(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfRunStep.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfRunStep.java new file mode 100644 index 000000000000..2ad088e031ee --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfRunStep.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfRunStep { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfRunStep class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfRunStep(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadMessage.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadMessage.java new file mode 100644 index 000000000000..2769467a12fa --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadMessage.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfThreadMessage { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfThreadMessage class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfThreadMessage(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadRun.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadRun.java new file mode 100644 index 000000000000..6932f551ab5a --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/OpenAIPageableListOfThreadRun.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfThreadRun { + /* + * The object type, which is always list. + */ + @Generated + @JsonProperty(value = "object") + private String object = "list"; + + /* + * The requested list of items. + */ + @Generated + @JsonProperty(value = "data") + private List data; + + /* + * The first ID represented in this list. + */ + @Generated + @JsonProperty(value = "first_id") + private String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + @JsonProperty(value = "last_id") + private String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + @JsonProperty(value = "has_more") + private boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfThreadRun class. + * + * @param data the data value to set. + * @param firstId the firstId value to set. + * @param lastId the lastId value to set. + * @param hasMore the hasMore value to set. + */ + @Generated + @JsonCreator + private OpenAIPageableListOfThreadRun(@JsonProperty(value = "data") List data, + @JsonProperty(value = "first_id") String firstId, @JsonProperty(value = "last_id") String lastId, + @JsonProperty(value = "has_more") boolean hasMore) { + this.data = data; + this.firstId = firstId; + this.lastId = lastId; + this.hasMore = hasMore; + } + + /** + * Get the object property: The object type, which is always list. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the data property: The requested list of items. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the firstId property: The first ID represented in this list. + * + * @return the firstId value. + */ + @Generated + public String getFirstId() { + return this.firstId; + } + + /** + * Get the lastId property: The last ID represented in this list. + * + * @return the lastId value. + */ + @Generated + public String getLastId() { + return this.lastId; + } + + /** + * Get the hasMore property: A value indicating whether there are additional values available not captured in this + * list. + * + * @return the hasMore value. + */ + @Generated + public boolean isHasMore() { + return this.hasMore; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RequiredAction.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RequiredAction.java new file mode 100644 index 000000000000..809ad18fdaad --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RequiredAction.java @@ -0,0 +1,31 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of a required action for an assistant thread run to continue. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = RequiredAction.class) +@JsonTypeName("RequiredAction") +@JsonSubTypes({ @JsonSubTypes.Type(name = "submit_tool_outputs", value = SubmitToolOutputsAction.class) }) +@Immutable +public class RequiredAction { + /** + * Creates an instance of RequiredAction class. + */ + @Generated + protected RequiredAction() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolCall.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolCall.java new file mode 100644 index 000000000000..8869c9b4134d --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolCall.java @@ -0,0 +1,53 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** + * A tool call to a retrieval tool, issued by the model in evaluation of a configured retrieval tool, that represents + * submitted output needed or already fulfilled by the tool for the model to continue. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("retrieval") +@Immutable +public final class RetrievalToolCall extends ToolCall { + /* + * The key/value pairs produced by the retrieval tool. + */ + @Generated + @JsonProperty(value = "retrieval") + private Map retrieval; + + /** + * Creates an instance of RetrievalToolCall class. + * + * @param id the id value to set. + * @param retrieval the retrieval value to set. + */ + @Generated + @JsonCreator + private RetrievalToolCall(@JsonProperty(value = "id") String id, + @JsonProperty(value = "retrieval") Map retrieval) { + super(id); + this.retrieval = retrieval; + } + + /** + * Get the retrieval property: The key/value pairs produced by the retrieval tool. + * + * @return the retrieval value. + */ + @Generated + public Map getRetrieval() { + return this.retrieval; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolDefinition.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolDefinition.java new file mode 100644 index 000000000000..f95c99ee8ea7 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RetrievalToolDefinition.java @@ -0,0 +1,25 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The input definition information for a retrieval tool as used to configure an assistant. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("retrieval") +@Immutable +public final class RetrievalToolDefinition extends ToolDefinition { + /** + * Creates an instance of RetrievalToolDefinition class. + */ + @Generated + public RetrievalToolDefinition() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunError.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunError.java new file mode 100644 index 000000000000..76fb52cc33b0 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunError.java @@ -0,0 +1,63 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of an error as encountered by an assistant thread run. + */ +@Immutable +public final class RunError { + /* + * The status for the error. + */ + @Generated + @JsonProperty(value = "code") + private String code; + + /* + * The human-readable text associated with the error. + */ + @Generated + @JsonProperty(value = "message") + private String message; + + /** + * Creates an instance of RunError class. + * + * @param code the code value to set. + * @param message the message value to set. + */ + @Generated + @JsonCreator + private RunError(@JsonProperty(value = "code") String code, @JsonProperty(value = "message") String message) { + this.code = code; + this.message = message; + } + + /** + * Get the code property: The status for the error. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the message property: The human-readable text associated with the error. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStatus.java new file mode 100644 index 000000000000..bafdb465e610 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStatus.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Possible values for the status of an assistant thread run. + */ +public final class RunStatus extends ExpandableStringEnum { + /** + * Represents a run that is queued to start. + */ + @Generated + public static final RunStatus QUEUED = fromString("queued"); + + /** + * Represents a run that is in progress. + */ + @Generated + public static final RunStatus IN_PROGRESS = fromString("in_progress"); + + /** + * Represents a run that needs another operation, such as tool output submission, to continue. + */ + @Generated + public static final RunStatus REQUIRES_ACTION = fromString("requires_action"); + + /** + * Represents a run that is in the process of cancellation. + */ + @Generated + public static final RunStatus CANCELLING = fromString("cancelling"); + + /** + * Represents a run that has been cancelled. + */ + @Generated + public static final RunStatus CANCELLED = fromString("cancelled"); + + /** + * Represents a run that failed. + */ + @Generated + public static final RunStatus FAILED = fromString("failed"); + + /** + * Represents a run that successfully completed. + */ + @Generated + public static final RunStatus COMPLETED = fromString("completed"); + + /** + * Represents a run that expired before it could otherwise finish. + */ + @Generated + public static final RunStatus EXPIRED = fromString("expired"); + + /** + * Creates a new instance of RunStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStatus() { + } + + /** + * Creates or finds a RunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStatus. + */ + @Generated + @JsonCreator + public static RunStatus fromString(String name) { + return fromString(name, RunStatus.class); + } + + /** + * Gets known RunStatus values. + * + * @return known RunStatus values. + */ + @Generated + public static Collection values() { + return values(RunStatus.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStep.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStep.java new file mode 100644 index 000000000000..315c8973887a --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStep.java @@ -0,0 +1,335 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Detailed information about a single step of an assistant thread run. + */ +@Immutable +public final class RunStep { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'thread.run.step'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread.run.step"; + + /* + * The type of run step, which can be either message_creation or tool_calls. + */ + @Generated + @JsonProperty(value = "type") + private RunStepType type; + + /* + * The ID of the assistant associated with the run step. + */ + @Generated + @JsonProperty(value = "assistant_id") + private String assistantId; + + /* + * The ID of the thread that was run. + */ + @Generated + @JsonProperty(value = "thread_id") + private String threadId; + + /* + * The ID of the run that this run step is a part of. + */ + @Generated + @JsonProperty(value = "run_id") + private String runId; + + /* + * The status of this run step. + */ + @Generated + @JsonProperty(value = "status") + private RunStepStatus status; + + /* + * The details for this run step. + */ + @Generated + @JsonProperty(value = "step_details") + private RunStepDetails stepDetails; + + /* + * If applicable, information about the last error encountered by this run step. + */ + @Generated + @JsonProperty(value = "last_error") + private RunStepError lastError; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The Unix timestamp, in seconds, representing when this item expired. + */ + @Generated + @JsonProperty(value = "expired_at") + private OffsetDateTime expiredAt; + + /* + * The Unix timestamp, in seconds, representing when this completed. + */ + @Generated + @JsonProperty(value = "completed_at") + private OffsetDateTime completedAt; + + /* + * The Unix timestamp, in seconds, representing when this was cancelled. + */ + @Generated + @JsonProperty(value = "cancelled_at") + private OffsetDateTime cancelledAt; + + /* + * The Unix timestamp, in seconds, representing when this failed. + */ + @Generated + @JsonProperty(value = "failed_at") + private OffsetDateTime failedAt; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of RunStep class. + * + * @param id the id value to set. + * @param type the type value to set. + * @param assistantId the assistantId value to set. + * @param threadId the threadId value to set. + * @param runId the runId value to set. + * @param status the status value to set. + * @param stepDetails the stepDetails value to set. + * @param lastError the lastError value to set. + * @param createdAt the createdAt value to set. + * @param expiredAt the expiredAt value to set. + * @param completedAt the completedAt value to set. + * @param cancelledAt the cancelledAt value to set. + * @param failedAt the failedAt value to set. + * @param metadata the metadata value to set. + */ + @Generated + private RunStep(String id, RunStepType type, String assistantId, String threadId, String runId, + RunStepStatus status, RunStepDetails stepDetails, RunStepError lastError, OffsetDateTime createdAt, + OffsetDateTime expiredAt, OffsetDateTime completedAt, OffsetDateTime cancelledAt, OffsetDateTime failedAt, + Map metadata) { + this.id = id; + this.type = type; + this.assistantId = assistantId; + this.threadId = threadId; + this.runId = runId; + this.status = status; + this.stepDetails = stepDetails; + this.lastError = lastError; + this.createdAt = createdAt.toEpochSecond(); + this.expiredAt = expiredAt; + this.completedAt = completedAt; + this.cancelledAt = cancelledAt; + this.failedAt = failedAt; + this.metadata = metadata; + } + + @Generated + @JsonCreator + private RunStep(@JsonProperty(value = "id") String id, @JsonProperty(value = "type") RunStepType type, + @JsonProperty(value = "assistant_id") String assistantId, @JsonProperty(value = "thread_id") String threadId, + @JsonProperty(value = "run_id") String runId, @JsonProperty(value = "status") RunStepStatus status, + @JsonProperty(value = "step_details") RunStepDetails stepDetails, + @JsonProperty(value = "last_error") RunStepError lastError, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "expired_at") OffsetDateTime expiredAt, + @JsonProperty(value = "completed_at") OffsetDateTime completedAt, + @JsonProperty(value = "cancelled_at") OffsetDateTime cancelledAt, + @JsonProperty(value = "failed_at") OffsetDateTime failedAt, + @JsonProperty(value = "metadata") Map metadata) { + this(id, type, assistantId, threadId, runId, status, stepDetails, lastError, + OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), expiredAt, completedAt, + cancelledAt, failedAt, metadata); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'thread.run.step'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the type property: The type of run step, which can be either message_creation or tool_calls. + * + * @return the type value. + */ + @Generated + public RunStepType getType() { + return this.type; + } + + /** + * Get the assistantId property: The ID of the assistant associated with the run step. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the threadId property: The ID of the thread that was run. + * + * @return the threadId value. + */ + @Generated + public String getThreadId() { + return this.threadId; + } + + /** + * Get the runId property: The ID of the run that this run step is a part of. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } + + /** + * Get the status property: The status of this run step. + * + * @return the status value. + */ + @Generated + public RunStepStatus getStatus() { + return this.status; + } + + /** + * Get the stepDetails property: The details for this run step. + * + * @return the stepDetails value. + */ + @Generated + public RunStepDetails getStepDetails() { + return this.stepDetails; + } + + /** + * Get the lastError property: If applicable, information about the last error encountered by this run step. + * + * @return the lastError value. + */ + @Generated + public RunStepError getLastError() { + return this.lastError; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the expiredAt property: The Unix timestamp, in seconds, representing when this item expired. + * + * @return the expiredAt value. + */ + @Generated + public OffsetDateTime getExpiredAt() { + return this.expiredAt; + } + + /** + * Get the completedAt property: The Unix timestamp, in seconds, representing when this completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * Get the cancelledAt property: The Unix timestamp, in seconds, representing when this was cancelled. + * + * @return the cancelledAt value. + */ + @Generated + public OffsetDateTime getCancelledAt() { + return this.cancelledAt; + } + + /** + * Get the failedAt property: The Unix timestamp, in seconds, representing when this failed. + * + * @return the failedAt value. + */ + @Generated + public OffsetDateTime getFailedAt() { + return this.failedAt; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepDetails.java new file mode 100644 index 000000000000..e31e90266710 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepDetails.java @@ -0,0 +1,33 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of the details for a run step. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = RunStepDetails.class) +@JsonTypeName("RunStepDetails") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "message_creation", value = RunStepMessageCreationDetails.class), + @JsonSubTypes.Type(name = "tool_calls", value = RunStepToolCallDetails.class) }) +@Immutable +public class RunStepDetails { + /** + * Creates an instance of RunStepDetails class. + */ + @Generated + protected RunStepDetails() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepError.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepError.java new file mode 100644 index 000000000000..d665f2f9a232 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepError.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error information associated with a failed run step. + */ +@Immutable +public final class RunStepError { + /* + * The error code for this error. + */ + @Generated + @JsonProperty(value = "code") + private RunStepErrorCode code; + + /* + * The human-readable text associated with this error. + */ + @Generated + @JsonProperty(value = "message") + private String message; + + /** + * Creates an instance of RunStepError class. + * + * @param code the code value to set. + * @param message the message value to set. + */ + @Generated + @JsonCreator + private RunStepError(@JsonProperty(value = "code") RunStepErrorCode code, + @JsonProperty(value = "message") String message) { + this.code = code; + this.message = message; + } + + /** + * Get the code property: The error code for this error. + * + * @return the code value. + */ + @Generated + public RunStepErrorCode getCode() { + return this.code; + } + + /** + * Get the message property: The human-readable text associated with this error. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepErrorCode.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepErrorCode.java new file mode 100644 index 000000000000..0931c8d24e96 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepErrorCode.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Possible error code values attributable to a failed run step. + */ +public final class RunStepErrorCode extends ExpandableStringEnum { + /** + * Represents a server error. + */ + @Generated + public static final RunStepErrorCode SERVER_ERROR = fromString("server_error"); + + /** + * Represents an error indicating configured rate limits were exceeded. + */ + @Generated + public static final RunStepErrorCode RATE_LIMIT_EXCEEDED = fromString("rate_limit_exceeded"); + + /** + * Creates a new instance of RunStepErrorCode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStepErrorCode() { + } + + /** + * Creates or finds a RunStepErrorCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStepErrorCode. + */ + @Generated + @JsonCreator + public static RunStepErrorCode fromString(String name) { + return fromString(name, RunStepErrorCode.class); + } + + /** + * Gets known RunStepErrorCode values. + * + * @return known RunStepErrorCode values. + */ + @Generated + public static Collection values() { + return values(RunStepErrorCode.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationDetails.java new file mode 100644 index 000000000000..8267633a5996 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationDetails.java @@ -0,0 +1,49 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The detailed information associated with a message creation run step. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("message_creation") +@Immutable +public final class RunStepMessageCreationDetails extends RunStepDetails { + /* + * Information about the message creation associated with this run step. + */ + @Generated + @JsonProperty(value = "message_creation") + private RunStepMessageCreationReference messageCreation; + + /** + * Creates an instance of RunStepMessageCreationDetails class. + * + * @param messageCreation the messageCreation value to set. + */ + @Generated + @JsonCreator + private RunStepMessageCreationDetails( + @JsonProperty(value = "message_creation") RunStepMessageCreationReference messageCreation) { + this.messageCreation = messageCreation; + } + + /** + * Get the messageCreation property: Information about the message creation associated with this run step. + * + * @return the messageCreation value. + */ + @Generated + public RunStepMessageCreationReference getMessageCreation() { + return this.messageCreation; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationReference.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationReference.java new file mode 100644 index 000000000000..953e2ca4b92b --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepMessageCreationReference.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of a message created as a part of a run step. + */ +@Immutable +public final class RunStepMessageCreationReference { + /* + * The ID of the message created by this run step. + */ + @Generated + @JsonProperty(value = "message_id") + private String messageId; + + /** + * Creates an instance of RunStepMessageCreationReference class. + * + * @param messageId the messageId value to set. + */ + @Generated + @JsonCreator + private RunStepMessageCreationReference(@JsonProperty(value = "message_id") String messageId) { + this.messageId = messageId; + } + + /** + * Get the messageId property: The ID of the message created by this run step. + * + * @return the messageId value. + */ + @Generated + public String getMessageId() { + return this.messageId; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepStatus.java new file mode 100644 index 000000000000..6e2d8e66a932 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepStatus.java @@ -0,0 +1,77 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Possible values for the status of a run step. + */ +public final class RunStepStatus extends ExpandableStringEnum { + /** + * Represents a run step still in progress. + */ + @Generated + public static final RunStepStatus IN_PROGRESS = fromString("in_progress"); + + /** + * Represents a run step that was cancelled. + */ + @Generated + public static final RunStepStatus CANCELLED = fromString("cancelled"); + + /** + * Represents a run step that failed. + */ + @Generated + public static final RunStepStatus FAILED = fromString("failed"); + + /** + * Represents a run step that successfully completed. + */ + @Generated + public static final RunStepStatus COMPLETED = fromString("completed"); + + /** + * Represents a run step that expired before otherwise finishing. + */ + @Generated + public static final RunStepStatus EXPIRED = fromString("expired"); + + /** + * Creates a new instance of RunStepStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStepStatus() { + } + + /** + * Creates or finds a RunStepStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStepStatus. + */ + @Generated + @JsonCreator + public static RunStepStatus fromString(String name) { + return fromString(name, RunStepStatus.class); + } + + /** + * Gets known RunStepStatus values. + * + * @return known RunStepStatus values. + */ + @Generated + public static Collection values() { + return values(RunStepStatus.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepToolCallDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepToolCallDetails.java new file mode 100644 index 000000000000..e4b94ae7851f --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepToolCallDetails.java @@ -0,0 +1,49 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** + * The detailed information associated with a run step calling tools. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("tool_calls") +@Immutable +public final class RunStepToolCallDetails extends RunStepDetails { + /* + * A list tool call details for this run step. + */ + @Generated + @JsonProperty(value = "tool_calls") + private List toolCalls; + + /** + * Creates an instance of RunStepToolCallDetails class. + * + * @param toolCalls the toolCalls value to set. + */ + @Generated + @JsonCreator + private RunStepToolCallDetails(@JsonProperty(value = "tool_calls") List toolCalls) { + this.toolCalls = toolCalls; + } + + /** + * Get the toolCalls property: A list tool call details for this run step. + * + * @return the toolCalls value. + */ + @Generated + public List getToolCalls() { + return this.toolCalls; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepType.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepType.java new file mode 100644 index 000000000000..4250f5d17685 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/RunStepType.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The possible types of run steps. + */ +public final class RunStepType extends ExpandableStringEnum { + /** + * Represents a run step to create a message. + */ + @Generated + public static final RunStepType MESSAGE_CREATION = fromString("message_creation"); + + /** + * Represents a run step that calls tools. + */ + @Generated + public static final RunStepType TOOL_CALLS = fromString("tool_calls"); + + /** + * Creates a new instance of RunStepType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStepType() { + } + + /** + * Creates or finds a RunStepType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStepType. + */ + @Generated + @JsonCreator + public static RunStepType fromString(String name) { + return fromString(name, RunStepType.class); + } + + /** + * Gets known RunStepType values. + * + * @return known RunStepType values. + */ + @Generated + public static Collection values() { + return values(RunStepType.class); + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsAction.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsAction.java new file mode 100644 index 000000000000..30b41cdc94da --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsAction.java @@ -0,0 +1,49 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The details for required tool calls that must be submitted for an assistant thread run to continue. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("submit_tool_outputs") +@Immutable +public final class SubmitToolOutputsAction extends RequiredAction { + /* + * The details describing tools that should be called to submit tool outputs. + */ + @Generated + @JsonProperty(value = "submit_tool_outputs") + private SubmitToolOutputsDetails submitToolOutputs; + + /** + * Creates an instance of SubmitToolOutputsAction class. + * + * @param submitToolOutputs the submitToolOutputs value to set. + */ + @Generated + @JsonCreator + private SubmitToolOutputsAction( + @JsonProperty(value = "submit_tool_outputs") SubmitToolOutputsDetails submitToolOutputs) { + this.submitToolOutputs = submitToolOutputs; + } + + /** + * Get the submitToolOutputs property: The details describing tools that should be called to submit tool outputs. + * + * @return the submitToolOutputs value. + */ + @Generated + public SubmitToolOutputsDetails getSubmitToolOutputs() { + return this.submitToolOutputs; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsDetails.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsDetails.java new file mode 100644 index 000000000000..6776d9366c7b --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/SubmitToolOutputsDetails.java @@ -0,0 +1,46 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The details describing tools that should be called to submit tool outputs. + */ +@Immutable +public final class SubmitToolOutputsDetails { + /* + * The list of tool calls that must be resolved for the assistant thread run to continue. + */ + @Generated + @JsonProperty(value = "tool_calls") + private List toolCalls; + + /** + * Creates an instance of SubmitToolOutputsDetails class. + * + * @param toolCalls the toolCalls value to set. + */ + @Generated + @JsonCreator + private SubmitToolOutputsDetails(@JsonProperty(value = "tool_calls") List toolCalls) { + this.toolCalls = toolCalls; + } + + /** + * Get the toolCalls property: The list of tool calls that must be resolved for the assistant thread run to + * continue. + * + * @return the toolCalls value. + */ + @Generated + public List getToolCalls() { + return this.toolCalls; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadDeletionStatus.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadDeletionStatus.java new file mode 100644 index 000000000000..bdf9e6a03bf8 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadDeletionStatus.java @@ -0,0 +1,81 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of a thread deletion operation. + */ +@Immutable +public final class ThreadDeletionStatus { + /* + * The ID of the resource specified for deletion. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + @JsonProperty(value = "deleted") + private boolean deleted; + + /* + * The object type, which is always 'thread.deleted'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread.deleted"; + + /** + * Creates an instance of ThreadDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + @JsonCreator + private ThreadDeletionStatus(@JsonProperty(value = "id") String id, + @JsonProperty(value = "deleted") boolean deleted) { + this.id = id; + this.deleted = deleted; + } + + /** + * Get the id property: The ID of the resource specified for deletion. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the deleted property: A value indicating whether deletion was successful. + * + * @return the deleted value. + */ + @Generated + public boolean isDeleted() { + return this.deleted; + } + + /** + * Get the object property: The object type, which is always 'thread.deleted'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadInitializationMessage.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadInitializationMessage.java new file mode 100644 index 000000000000..5bfc4e73cd63 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadInitializationMessage.java @@ -0,0 +1,139 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * A single message within an assistant thread, as provided during that thread's creation for its initial state. + */ +@Fluent +public final class ThreadInitializationMessage { + /* + * The role associated with the assistant thread message. Currently, only 'user' is supported when providing + * initial messages to a new thread. + */ + @Generated + @JsonProperty(value = "role") + private MessageRole role; + + /* + * The textual content of the initial message. Currently, robust input including images and annotated text may only + * be provided via a separate call to the create message API. + */ + @Generated + @JsonProperty(value = "content") + private String content; + + /* + * A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + * access files. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of ThreadInitializationMessage class. + * + * @param role the role value to set. + * @param content the content value to set. + */ + @Generated + @JsonCreator + public ThreadInitializationMessage(@JsonProperty(value = "role") MessageRole role, + @JsonProperty(value = "content") String content) { + this.role = role; + this.content = content; + } + + /** + * Get the role property: The role associated with the assistant thread message. Currently, only 'user' is + * supported when providing initial messages to a new thread. + * + * @return the role value. + */ + @Generated + public MessageRole getRole() { + return this.role; + } + + /** + * Get the content property: The textual content of the initial message. Currently, robust input including images + * and annotated text may only be provided via a separate call to the create message API. + * + * @return the content value. + */ + @Generated + public String getContent() { + return this.content; + } + + /** + * Get the fileIds property: A list of file IDs that the assistant should use. Useful for tools like retrieval and + * code_interpreter that can + * access files. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: A list of file IDs that the assistant should use. Useful for tools like retrieval and + * code_interpreter that can + * access files. + * + * @param fileIds the fileIds value to set. + * @return the ThreadInitializationMessage object itself. + */ + @Generated + public ThreadInitializationMessage setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: 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. + * + * @param metadata the metadata value to set. + * @return the ThreadInitializationMessage object itself. + */ + @Generated + public ThreadInitializationMessage setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadMessage.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadMessage.java new file mode 100644 index 000000000000..effffeaac858 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadMessage.java @@ -0,0 +1,232 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +/** + * A single, existing message within an assistant thread. + */ +@Immutable +public final class ThreadMessage { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'thread.message'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread.message"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The ID of the thread that this message belongs to. + */ + @Generated + @JsonProperty(value = "thread_id") + private String threadId; + + /* + * The role associated with the assistant thread message. + */ + @Generated + @JsonProperty(value = "role") + private MessageRole role; + + /* + * The list of content items associated with the assistant thread message. + */ + @Generated + @JsonProperty(value = "content") + private List content; + + /* + * If applicable, the ID of the assistant that authored this message. + */ + @Generated + @JsonProperty(value = "assistant_id") + private String assistantId; + + /* + * If applicable, the ID of the run associated with the authoring of this message. + */ + @Generated + @JsonProperty(value = "run_id") + private String runId; + + /* + * A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + * access files. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of ThreadMessage class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param threadId the threadId value to set. + * @param role the role value to set. + * @param content the content value to set. + * @param fileIds the fileIds value to set. + * @param metadata the metadata value to set. + */ + @Generated + private ThreadMessage(String id, OffsetDateTime createdAt, String threadId, MessageRole role, + List content, List fileIds, Map metadata) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.threadId = threadId; + this.role = role; + this.content = content; + this.fileIds = fileIds; + this.metadata = metadata; + } + + @Generated + @JsonCreator + private ThreadMessage(@JsonProperty(value = "id") String id, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "thread_id") String threadId, @JsonProperty(value = "role") MessageRole role, + @JsonProperty(value = "content") List content, + @JsonProperty(value = "file_ids") List fileIds, + @JsonProperty(value = "metadata") Map metadata) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), threadId, role, content, + fileIds, metadata); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'thread.message'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the threadId property: The ID of the thread that this message belongs to. + * + * @return the threadId value. + */ + @Generated + public String getThreadId() { + return this.threadId; + } + + /** + * Get the role property: The role associated with the assistant thread message. + * + * @return the role value. + */ + @Generated + public MessageRole getRole() { + return this.role; + } + + /** + * Get the content property: The list of content items associated with the assistant thread message. + * + * @return the content value. + */ + @Generated + public List getContent() { + return this.content; + } + + /** + * Get the assistantId property: If applicable, the ID of the assistant that authored this message. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the runId property: If applicable, the ID of the run associated with the authoring of this message. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } + + /** + * Get the fileIds property: A list of file IDs that the assistant should use. Useful for tools like retrieval and + * code_interpreter that can + * access files. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadRun.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadRun.java new file mode 100644 index 000000000000..71abbf2671c2 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ThreadRun.java @@ -0,0 +1,393 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +/** + * Data representing a single evaluation run of an assistant thread. + */ +@Immutable +public final class ThreadRun { + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The object type, which is always 'thread.run'. + */ + @Generated + @JsonProperty(value = "object") + private String object = "thread.run"; + + /* + * The ID of the thread associated with this run. + */ + @Generated + @JsonProperty(value = "thread_id") + private String threadId; + + /* + * The ID of the assistant associated with the thread this run was performed against. + */ + @Generated + @JsonProperty(value = "assistant_id") + private String assistantId; + + /* + * The status of the assistant thread run. + */ + @Generated + @JsonProperty(value = "status") + private RunStatus status; + + /* + * The details of the action required for the assistant thread run to continue. + */ + @Generated + @JsonProperty(value = "required_action") + private RequiredAction requiredAction; + + /* + * The last error, if any, encountered by this assistant thread run. + */ + @Generated + @JsonProperty(value = "last_error") + private RunError lastError; + + /* + * The ID of the model to use. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The overridden system instructions used for this assistant thread run. + */ + @Generated + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The overridden enabled tools used for this assistant thread run. + */ + @Generated + @JsonProperty(value = "tools") + private List tools; + + /* + * A list of attached file IDs, ordered by creation date in ascending order. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + @JsonProperty(value = "created_at") + private long createdAt; + + /* + * The Unix timestamp, in seconds, representing when this item expires. + */ + @Generated + @JsonProperty(value = "expires_at") + private OffsetDateTime expiresAt; + + /* + * The Unix timestamp, in seconds, representing when this item was started. + */ + @Generated + @JsonProperty(value = "started_at") + private OffsetDateTime startedAt; + + /* + * The Unix timestamp, in seconds, representing when this completed. + */ + @Generated + @JsonProperty(value = "completed_at") + private OffsetDateTime completedAt; + + /* + * The Unix timestamp, in seconds, representing when this was cancelled. + */ + @Generated + @JsonProperty(value = "cancelled_at") + private OffsetDateTime cancelledAt; + + /* + * The Unix timestamp, in seconds, representing when this failed. + */ + @Generated + @JsonProperty(value = "failed_at") + private OffsetDateTime failedAt; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of ThreadRun class. + * + * @param id the id value to set. + * @param threadId the threadId value to set. + * @param assistantId the assistantId value to set. + * @param status the status value to set. + * @param lastError the lastError value to set. + * @param model the model value to set. + * @param instructions the instructions value to set. + * @param tools the tools value to set. + * @param fileIds the fileIds value to set. + * @param createdAt the createdAt value to set. + * @param expiresAt the expiresAt value to set. + * @param startedAt the startedAt value to set. + * @param completedAt the completedAt value to set. + * @param cancelledAt the cancelledAt value to set. + * @param failedAt the failedAt value to set. + * @param metadata the metadata value to set. + */ + @Generated + private ThreadRun(String id, String threadId, String assistantId, RunStatus status, RunError lastError, + String model, String instructions, List tools, List fileIds, OffsetDateTime createdAt, + OffsetDateTime expiresAt, OffsetDateTime startedAt, OffsetDateTime completedAt, OffsetDateTime cancelledAt, + OffsetDateTime failedAt, Map metadata) { + this.id = id; + this.threadId = threadId; + this.assistantId = assistantId; + this.status = status; + this.lastError = lastError; + this.model = model; + this.instructions = instructions; + this.tools = tools; + this.fileIds = fileIds; + this.createdAt = createdAt.toEpochSecond(); + this.expiresAt = expiresAt; + this.startedAt = startedAt; + this.completedAt = completedAt; + this.cancelledAt = cancelledAt; + this.failedAt = failedAt; + this.metadata = metadata; + } + + @Generated + @JsonCreator + private ThreadRun(@JsonProperty(value = "id") String id, @JsonProperty(value = "thread_id") String threadId, + @JsonProperty(value = "assistant_id") String assistantId, @JsonProperty(value = "status") RunStatus status, + @JsonProperty(value = "last_error") RunError lastError, @JsonProperty(value = "model") String model, + @JsonProperty(value = "instructions") String instructions, + @JsonProperty(value = "tools") List tools, + @JsonProperty(value = "file_ids") List fileIds, @JsonProperty(value = "created_at") long createdAt, + @JsonProperty(value = "expires_at") OffsetDateTime expiresAt, + @JsonProperty(value = "started_at") OffsetDateTime startedAt, + @JsonProperty(value = "completed_at") OffsetDateTime completedAt, + @JsonProperty(value = "cancelled_at") OffsetDateTime cancelledAt, + @JsonProperty(value = "failed_at") OffsetDateTime failedAt, + @JsonProperty(value = "metadata") Map metadata) { + this(id, threadId, assistantId, status, lastError, model, instructions, tools, fileIds, + OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), expiresAt, startedAt, + completedAt, cancelledAt, failedAt, metadata); + } + + /** + * Get the id property: The identifier, which can be referenced in API endpoints. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the object property: The object type, which is always 'thread.run'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the threadId property: The ID of the thread associated with this run. + * + * @return the threadId value. + */ + @Generated + public String getThreadId() { + return this.threadId; + } + + /** + * Get the assistantId property: The ID of the assistant associated with the thread this run was performed against. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the status property: The status of the assistant thread run. + * + * @return the status value. + */ + @Generated + public RunStatus getStatus() { + return this.status; + } + + /** + * Get the requiredAction property: The details of the action required for the assistant thread run to continue. + * + * @return the requiredAction value. + */ + @Generated + public RequiredAction getRequiredAction() { + return this.requiredAction; + } + + /** + * Get the lastError property: The last error, if any, encountered by this assistant thread run. + * + * @return the lastError value. + */ + @Generated + public RunError getLastError() { + return this.lastError; + } + + /** + * Get the model property: The ID of the model to use. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Get the instructions property: The overridden system instructions used for this assistant thread run. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Get the tools property: The overridden enabled tools used for this assistant thread run. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Get the fileIds property: A list of attached file IDs, ordered by creation date in ascending order. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the expiresAt property: The Unix timestamp, in seconds, representing when this item expires. + * + * @return the expiresAt value. + */ + @Generated + public OffsetDateTime getExpiresAt() { + return this.expiresAt; + } + + /** + * Get the startedAt property: The Unix timestamp, in seconds, representing when this item was started. + * + * @return the startedAt value. + */ + @Generated + public OffsetDateTime getStartedAt() { + return this.startedAt; + } + + /** + * Get the completedAt property: The Unix timestamp, in seconds, representing when this completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * Get the cancelledAt property: The Unix timestamp, in seconds, representing when this was cancelled. + * + * @return the cancelledAt value. + */ + @Generated + public OffsetDateTime getCancelledAt() { + return this.cancelledAt; + } + + /** + * Get the failedAt property: The Unix timestamp, in seconds, representing when this failed. + * + * @return the failedAt value. + */ + @Generated + public OffsetDateTime getFailedAt() { + return this.failedAt; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolCall.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolCall.java new file mode 100644 index 000000000000..77ec606cea1a --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolCall.java @@ -0,0 +1,58 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation a tool call, issued by the model in evaluation of a configured tool definition, that must + * be fulfilled and have its outputs submitted before the model can continue. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ToolCall.class) +@JsonTypeName("ToolCall") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "code_interpreter", value = CodeInterpreterToolCall.class), + @JsonSubTypes.Type(name = "retrieval", value = RetrievalToolCall.class), + @JsonSubTypes.Type(name = "function", value = FunctionToolCall.class) }) +@Immutable +public class ToolCall { + /* + * The ID of the tool call. This ID must be referenced when you submit tool outputs. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /** + * Creates an instance of ToolCall class. + * + * @param id the id value to set. + */ + @Generated + @JsonCreator + protected ToolCall(@JsonProperty(value = "id") String id) { + this.id = id; + } + + /** + * Get the id property: The ID of the tool call. This ID must be referenced when you submit tool outputs. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolDefinition.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolDefinition.java new file mode 100644 index 000000000000..725a67b881d2 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolDefinition.java @@ -0,0 +1,34 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * An abstract representation of an input tool definition that an assistant can use. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ToolDefinition.class) +@JsonTypeName("ToolDefinition") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "code_interpreter", value = CodeInterpreterToolDefinition.class), + @JsonSubTypes.Type(name = "retrieval", value = RetrievalToolDefinition.class), + @JsonSubTypes.Type(name = "function", value = FunctionToolDefinition.class) }) +@Immutable +public class ToolDefinition { + /** + * Creates an instance of ToolDefinition class. + */ + @Generated + public ToolDefinition() { + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolOutput.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolOutput.java new file mode 100644 index 000000000000..99f03e9d0f51 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/ToolOutput.java @@ -0,0 +1,82 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. + */ +@Fluent +public final class ToolOutput { + /* + * The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + */ + @Generated + @JsonProperty(value = "tool_call_id") + private String toolCallId; + + /* + * The output from the tool to be submitted. + */ + @Generated + @JsonProperty(value = "output") + private String output; + + /** + * Creates an instance of ToolOutput class. + */ + @Generated + public ToolOutput() { + } + + /** + * Get the toolCallId property: The ID of the tool call being resolved, as provided in the tool calls of a required + * action from a run. + * + * @return the toolCallId value. + */ + @Generated + public String getToolCallId() { + return this.toolCallId; + } + + /** + * Set the toolCallId property: The ID of the tool call being resolved, as provided in the tool calls of a required + * action from a run. + * + * @param toolCallId the toolCallId value to set. + * @return the ToolOutput object itself. + */ + @Generated + public ToolOutput setToolCallId(String toolCallId) { + this.toolCallId = toolCallId; + return this; + } + + /** + * Get the output property: The output from the tool to be submitted. + * + * @return the output value. + */ + @Generated + public String getOutput() { + return this.output; + } + + /** + * Set the output property: The output from the tool to be submitted. + * + * @param output the output value to set. + * @return the ToolOutput object itself. + */ + @Generated + public ToolOutput setOutput(String output) { + this.output = output; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/UpdateAssistantOptions.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/UpdateAssistantOptions.java new file mode 100644 index 000000000000..5eb4d26f89e7 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/UpdateAssistantOptions.java @@ -0,0 +1,233 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * The request details to use when modifying an existing assistant. + */ +@Fluent +public final class UpdateAssistantOptions { + /* + * The ID of the model to use. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The modified name for the assistant to use. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The modified description for the assistant to use. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The modified system instructions for the new assistant to use. + */ + @Generated + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The modified collection of tools to enable for the assistant. + */ + @Generated + @JsonProperty(value = "tools") + private List tools; + + /* + * The modified list of previously uploaded fileIDs to attach to the assistant. + */ + @Generated + @JsonProperty(value = "file_ids") + private List fileIds; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Creates an instance of UpdateAssistantOptions class. + */ + @Generated + public UpdateAssistantOptions() { + } + + /** + * Get the model property: The ID of the model to use. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The ID of the model to use. + * + * @param model the model value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the name property: The modified name for the assistant to use. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The modified name for the assistant to use. + * + * @param name the name value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The modified description for the assistant to use. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The modified description for the assistant to use. + * + * @param description the description value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The modified system instructions for the new assistant to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The modified system instructions for the new assistant to use. + * + * @param instructions the instructions value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The modified collection of tools to enable for the assistant. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The modified collection of tools to enable for the assistant. + * + * @param tools the tools value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the fileIds property: The modified list of previously uploaded fileIDs to attach to the assistant. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: The modified list of previously uploaded fileIDs to attach to the assistant. + * + * @param fileIds the fileIds value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the metadata property: 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. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: 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. + * + * @param metadata the metadata value to set. + * @return the UpdateAssistantOptions object itself. + */ + @Generated + public UpdateAssistantOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/package-info.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/package-info.java new file mode 100644 index 000000000000..b7b8acfd2c71 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Assistants. + * Azure OpenAI APIs for Assistants. + * + */ +package com.azure.ai.openai.assistants.models; diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/package-info.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/package-info.java new file mode 100644 index 000000000000..893ac18e91af --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/com/azure/ai/openai/assistants/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Assistants. + * Azure OpenAI APIs for Assistants. + * + */ +package com.azure.ai.openai.assistants; diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/module-info.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/module-info.java new file mode 100644 index 000000000000..d0cdac41c37d --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/java/module-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.ai.openai.assistants { + requires transitive com.azure.core; + + exports com.azure.ai.openai.assistants; + exports com.azure.ai.openai.assistants.models; + + opens com.azure.ai.openai.assistants.models to com.azure.core, com.fasterxml.jackson.databind; +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/main/resources/azure-ai-openai-assistants.properties b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/resources/azure-ai-openai-assistants.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/main/resources/azure-ai-openai-assistants.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/src/samples/java/com/azure/ai/openai/assistants/ReadmeSamples.java b/sdk/openai/assistants/azure-ai-openai-assistants/src/samples/java/com/azure/ai/openai/assistants/ReadmeSamples.java new file mode 100644 index 000000000000..318fbee4e1b4 --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/src/samples/java/com/azure/ai/openai/assistants/ReadmeSamples.java @@ -0,0 +1,12 @@ +// 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; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.ai.openai.assistants.readme + // END: com.azure.ai.openai.assistants.readme + } +} diff --git a/sdk/openai/assistants/azure-ai-openai-assistants/tsp-location.yaml b/sdk/openai/assistants/azure-ai-openai-assistants/tsp-location.yaml new file mode 100644 index 000000000000..7ec873a49bad --- /dev/null +++ b/sdk/openai/assistants/azure-ai-openai-assistants/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/ai/OpenAI.Assistants +repo: Azure/azure-rest-api-specs +additionalDirectories: [] +commit: d5461a5a4f829a485c5315a72c9214944f82269a + diff --git a/sdk/openai/assistants/ci.yml b/sdk/openai/assistants/ci.yml new file mode 100644 index 000000000000..344074733250 --- /dev/null +++ b/sdk/openai/assistants/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/openai/assistants/ci.yml + - sdk/openai/assistants/azure-ai-openai-assistants/ + exclude: + - sdk/openai/assistants/pom.xml + - sdk/openai/assistants/azure-ai-openai-assistants/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/openai/assistants/ci.yml + - sdk/openai/assistants/azure-ai-openai-assistants/ + exclude: + - sdk/openai/assistants/pom.xml + - sdk/openai/assistants/azure-ai-openai-assistants/pom.xml + +parameters: + - name: release_azureaiopenaiassistants + displayName: azure-ai-openai-assistants + type: boolean + default: true + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: openai/assistants + EnableBatchRelease: true + Artifacts: + - name: azure-ai-openai-assistants + groupId: com.azure + safeName: azureaiopenaiassistants + releaseInBatch: ${{ parameters.release_azureaiopenaiassistants }} diff --git a/sdk/openai/assistants/pom.xml b/sdk/openai/assistants/pom.xml new file mode 100644 index 000000000000..f5ff5f7331dd --- /dev/null +++ b/sdk/openai/assistants/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-openai/assistants-service + pom + 1.0.0 + + + azure-ai-openai-assistants + +