diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 69d589739b08..af0c9cb8badc 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -1382,6 +1382,16 @@ "gcch", "updation" // current typo in a swagger ] + }, + { + "filename": "sdk/ai/azure-ai-projects/**", + "words": [ + "AISEARCH", + "AISERVICES", + "SUBSCRIPTIONID", + "RESOURCEGROUPNAME", + "PROJECTNAME" + ] } ], "allowCompoundWords": true diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b7e855905bac..916e103ed6f9 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -42,6 +42,7 @@ com.azure:azure-ai-documenttranslator;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-ai-formrecognizer;4.1.13;4.2.0-beta.1 com.azure:azure-ai-formrecognizer-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-ai-inference;1.0.0-beta.4;1.0.0-beta.5 +com.azure:azure-ai-projects;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-ai-metricsadvisor;1.2.6;1.3.0-beta.1 com.azure:azure-ai-metricsadvisor-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-ai-openai;1.0.0-beta.16;1.0.0-beta.17 diff --git a/sdk/ai/azure-ai-inference/tsp-location.yaml b/sdk/ai/azure-ai-inference/tsp-location.yaml index 8d2ac99826fa..7eb6ee95ca66 100644 --- a/sdk/ai/azure-ai-inference/tsp-location.yaml +++ b/sdk/ai/azure-ai-inference/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: 70d146a18939fcfd36661adc0bb123046cd3d19b +commit: 84342a4f74f4d959a3755d7156ef3981d16d0b43 additionalDirectories: [] repo: Azure/azure-rest-api-specs directory: specification/ai/ModelClient diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md new file mode 100644 index 000000000000..cc87dea383af --- /dev/null +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -0,0 +1,13 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure Projects client library for Java. This package contains Microsoft Azure Projects client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/ai/azure-ai-projects/README.md b/sdk/ai/azure-ai-projects/README.md new file mode 100644 index 000000000000..6a8d3521adad --- /dev/null +++ b/sdk/ai/azure-ai-projects/README.md @@ -0,0 +1,78 @@ +# Azure Projects client library for Java + +Azure Projects client library for Java. + +This package contains Microsoft Azure Projects 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-projects;current}) +```xml + + com.azure + azure-ai-projects + 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.projects.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json new file mode 100644 index 000000000000..6218ebb2a369 --- /dev/null +++ b/sdk/ai/azure-ai-projects/assets.json @@ -0,0 +1 @@ +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/ai/azure-ai-projects","Tag":""} \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/customization/pom.xml b/sdk/ai/azure-ai-projects/customization/pom.xml new file mode 100644 index 000000000000..e6ec56e5ab48 --- /dev/null +++ b/sdk/ai/azure-ai-projects/customization/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + com.azure + azure-code-customization-parent + 1.0.0-beta.1 + ../../../parents/azure-code-customization-parent + + + Azure AI Projects SDK for Java + This package contains client customization for Azure AI Projects + + com.azure.tools + azure-ai-projects-customization + 1.0.0-beta.1 + jar + diff --git a/sdk/ai/azure-ai-projects/customization/src/main/java/AIProjectsCustomizations.java b/sdk/ai/azure-ai-projects/customization/src/main/java/AIProjectsCustomizations.java new file mode 100644 index 000000000000..6bda43bf3db8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/customization/src/main/java/AIProjectsCustomizations.java @@ -0,0 +1,17 @@ +import com.azure.autorest.customization.*; +import org.eclipse.lsp4j.Range; +import org.slf4j.Logger; + +import java.util.List; + +/** + * This class contains the customization code to customize the AutoRest generated code for Azure AI Inference. + */ +public class AIProjectsCustomizations extends Customization { + + @Override + public void customize(LibraryCustomization customization, Logger logger) { + // remove unused class (no reference to them, after partial-update) + + } +} diff --git a/sdk/ai/azure-ai-projects/pom.xml b/sdk/ai/azure-ai-projects/pom.xml new file mode 100644 index 000000000000..5213df8943ee --- /dev/null +++ b/sdk/ai/azure-ai-projects/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-ai-projects + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Projects + This package contains Microsoft Azure Projects 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 + false + + + --add-exports com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED + --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED + + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-http-netty + 1.15.11 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AIProjectClientBuilder.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AIProjectClientBuilder.java new file mode 100644 index 000000000000..2a94a772c647 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AIProjectClientBuilder.java @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.AIProjectClientImpl; +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.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +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.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 AIProjectClient type. + */ +@ServiceClientBuilder( + serviceClients = { + AgentsClient.class, + ConnectionsClient.class, + TelemetryClient.class, + EvaluationsClient.class, + AgentsAsyncClient.class, + ConnectionsAsyncClient.class, + TelemetryAsyncClient.class, + EvaluationsAsyncClient.class }) +public final class AIProjectClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, 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://management.azure.com/.default" }; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-projects.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AIProjectClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("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 AIProjectClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AIProjectClientBuilder 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 AIProjectClientBuilder 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 AIProjectClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AIProjectClientBuilder 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 AIProjectClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AIProjectClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AIProjectClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The Azure subscription ID. + */ + @Generated + private String subscriptionId; + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The name of the Azure Resource Group. + */ + @Generated + private String resourceGroupName; + + /** + * Sets The name of the Azure Resource Group. + * + * @param resourceGroupName the resourceGroupName value. + * @return the AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder resourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /* + * The Azure AI Foundry project name. + */ + @Generated + private String projectName; + + /** + * Sets The Azure AI Foundry project name. + * + * @param projectName the projectName value. + * @return the AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder projectName(String projectName) { + this.projectName = projectName; + return this; + } + + /* + * Service version + */ + @Generated + private ProjectsServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder serviceVersion(ProjectsServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + 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 AIProjectClientBuilder. + */ + @Generated + public AIProjectClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AIProjectClientImpl with the provided parameters. + * + * @return an instance of AIProjectClientImpl. + */ + @Generated + private AIProjectClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ProjectsServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ProjectsServiceVersion.getLatest(); + AIProjectClientImpl client + = new AIProjectClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, + this.subscriptionId, this.resourceGroupName, this.projectName, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(subscriptionId, "'subscriptionId' cannot be null."); + Objects.requireNonNull(resourceGroupName, "'resourceGroupName' cannot be null."); + Objects.requireNonNull(projectName, "'projectName' cannot be null."); + } + + @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 = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + 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 (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 AgentsAsyncClient class. + * + * @return an instance of AgentsAsyncClient. + */ + @Generated + public AgentsAsyncClient buildAgentsAsyncClient() { + return new AgentsAsyncClient(buildInnerClient().getAgents()); + } + + /** + * Builds an instance of ConnectionsAsyncClient class. + * + * @return an instance of ConnectionsAsyncClient. + */ + @Generated + public ConnectionsAsyncClient buildConnectionsAsyncClient() { + return new ConnectionsAsyncClient(buildInnerClient().getConnections()); + } + + /** + * Builds an instance of TelemetryAsyncClient class. + * + * @return an instance of TelemetryAsyncClient. + */ + @Generated + public TelemetryAsyncClient buildTelemetryAsyncClient() { + return new TelemetryAsyncClient(buildInnerClient().getTelemetries()); + } + + /** + * Builds an instance of EvaluationsAsyncClient class. + * + * @return an instance of EvaluationsAsyncClient. + */ + @Generated + public EvaluationsAsyncClient buildEvaluationsAsyncClient() { + return new EvaluationsAsyncClient(buildInnerClient().getEvaluations()); + } + + /** + * Builds an instance of AgentsClient class. + * + * @return an instance of AgentsClient. + */ + @Generated + public AgentsClient buildAgentsClient() { + return new AgentsClient(buildInnerClient().getAgents()); + } + + /** + * Builds an instance of ConnectionsClient class. + * + * @return an instance of ConnectionsClient. + */ + @Generated + public ConnectionsClient buildConnectionsClient() { + return new ConnectionsClient(buildInnerClient().getConnections()); + } + + /** + * Builds an instance of TelemetryClient class. + * + * @return an instance of TelemetryClient. + */ + @Generated + public TelemetryClient buildTelemetryClient() { + return new TelemetryClient(buildInnerClient().getTelemetries()); + } + + /** + * Builds an instance of EvaluationsClient class. + * + * @return an instance of EvaluationsClient. + */ + @Generated + public EvaluationsClient buildEvaluationsClient() { + return new EvaluationsClient(buildInnerClient().getEvaluations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AIProjectClientBuilder.class); +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsAsyncClient.java new file mode 100644 index 000000000000..aea826048919 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsAsyncClient.java @@ -0,0 +1,5107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.AgentsImpl; +import com.azure.ai.projects.implementation.MultipartFormDataHelper; +import com.azure.ai.projects.implementation.models.CreateAgentRequest; +import com.azure.ai.projects.implementation.models.CreateMessageRequest; +import com.azure.ai.projects.implementation.models.CreateRunRequest; +import com.azure.ai.projects.implementation.models.CreateThreadAndRunRequest; +import com.azure.ai.projects.implementation.models.CreateThreadRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreFileBatchRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreFileRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreRequest; +import com.azure.ai.projects.implementation.models.ModifyVectorStoreRequest; +import com.azure.ai.projects.implementation.models.SubmitToolOutputsToRunRequest; +import com.azure.ai.projects.implementation.models.UpdateAgentRequest; +import com.azure.ai.projects.implementation.models.UpdateMessageRequest; +import com.azure.ai.projects.implementation.models.UpdateRunRequest; +import com.azure.ai.projects.implementation.models.UpdateThreadRequest; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentDeletionStatus; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.CreateThreadAndRunOptions; +import com.azure.ai.projects.models.FileDeletionStatus; +import com.azure.ai.projects.models.FileListResponse; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.ListSortOrder; +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.OpenAIPageableListOfAgent; +import com.azure.ai.projects.models.OpenAIPageableListOfAgentThread; +import com.azure.ai.projects.models.OpenAIPageableListOfRunStep; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadRun; +import com.azure.ai.projects.models.OpenAIPageableListOfVectorStore; +import com.azure.ai.projects.models.OpenAIPageableListOfVectorStoreFile; +import com.azure.ai.projects.models.RunAdditionalFieldList; +import com.azure.ai.projects.models.RunStep; +import com.azure.ai.projects.models.ThreadDeletionStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolOutput; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.UpdateAgentOptions; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDeletionStatus; +import com.azure.ai.projects.models.VectorStoreExpirationPolicy; +import com.azure.ai.projects.models.VectorStoreFile; +import com.azure.ai.projects.models.VectorStoreFileBatch; +import com.azure.ai.projects.models.VectorStoreFileDeletionStatus; +import com.azure.ai.projects.models.VectorStoreFileStatusFilter; +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.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) +public final class AgentsAsyncClient { + + @Generated + private final AgentsImpl serviceClient; + + /** + * Initializes an instance of AgentsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AgentsAsyncClient(AgentsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates a new agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Required)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createAgentRequest The createAgentRequest 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 agent 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> createAgentWithResponse(BinaryData createAgentRequest, + RequestOptions requestOptions) { + return this.serviceClient.createAgentWithResponseAsync(createAgentRequest, requestOptions); + } + + /** + * Gets a list of agents 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){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             temperature: Double (Required)
+     *             top_p: Double (Required)
+     *             response_format: BinaryData (Optional)
+     *             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 agents that were previously created along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listAgentsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listAgentsWithResponseAsync(requestOptions); + } + + /** + * Retrieves an existing agent. + *

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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent 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> getAgentWithResponse(String assistantId, RequestOptions requestOptions) { + return this.serviceClient.getAgentWithResponseAsync(assistantId, requestOptions); + } + + /** + * Modifies an existing agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Optional)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId The ID of the agent to modify. + * @param updateAgentRequest The updateAgentRequest 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 agent 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> updateAgentWithResponse(String assistantId, BinaryData updateAgentRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateAgentWithResponseAsync(assistantId, updateAgentRequest, requestOptions); + } + + /** + * Deletes an agent. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAgentWithResponse(String assistantId, RequestOptions requestOptions) { + return this.serviceClient.deleteAgentWithResponseAsync(assistantId, requestOptions); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createThreadRequest The createThreadRequest 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 agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createThreadWithResponse(BinaryData createThreadRequest, + RequestOptions requestOptions) { + return this.serviceClient.createThreadWithResponseAsync(createThreadRequest, requestOptions); + } + + /** + * Gets information about an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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
+     * {
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId The ID of the thread to modify. + * @param updateThreadRequest The updateThreadRequest 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 agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateThreadWithResponse(String threadId, BinaryData updateThreadRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateThreadWithResponseAsync(threadId, updateThreadRequest, requestOptions); + } + + /** + * Deletes an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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: BinaryData (Required)
+     *     attachments (Optional): [
+     *          (Optional){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     thread_id: String (Required)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createMessageRequest The createMessageRequest 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 agent thread along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createMessageWithResponse(String threadId, BinaryData createMessageRequest, + RequestOptions requestOptions) { + return this.serviceClient.createMessageWithResponseAsync(threadId, createMessageRequest, requestOptions); + } + + /** + * Gets a list of messages that exist on a thread. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoFilter messages by the run ID that generated them.
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)
+     *             status: String(in_progress/incomplete/completed) (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *             }
+     *             completed_at: Long (Required)
+     *             incomplete_at: Long (Required)
+     *             role: String(user/assistant) (Required)
+     *             content (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             assistant_id: String (Required)
+     *             run_id: String (Required)
+     *             attachments (Required): [
+     *                  (Required){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @param updateMessageRequest The updateMessageRequest 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 agent thread along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateMessageWithResponse(String threadId, String messageId, + BinaryData updateMessageRequest, RequestOptions requestOptions) { + return this.serviceClient.updateMessageWithResponseAsync(threadId, messageId, updateMessageRequest, + requestOptions); + } + + /** + * Creates a new run for an agent thread. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assistant_id: String (Required)
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     additional_instructions: String (Optional)
+     *     additional_messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createRunRequest The createRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createRunWithResponse(String threadId, BinaryData createRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.createRunWithResponseAsync(threadId, createRunRequest, 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): {
+     *                 type: String (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String (Required)
+     *                 message: String (Required)
+     *             }
+     *             model: String (Required)
+     *             instructions: String (Required)
+     *             tools (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             created_at: long (Required)
+     *             expires_at: Long (Required)
+     *             started_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *             }
+     *             usage (Required): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             temperature: Double (Optional)
+     *             top_p: Double (Optional)
+     *             max_prompt_tokens: Integer (Required)
+     *             max_completion_tokens: Integer (Required)
+     *             truncation_strategy (Required): {
+     *                 type: String(auto/last_messages) (Required)
+     *                 last_messages: Integer (Optional)
+     *             }
+     *             tool_choice: BinaryData (Required)
+     *             response_format: BinaryData (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *             tool_resources (Optional): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             parallel_tool_calls: boolean (Required)
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param updateRunRequest The updateRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateRunWithResponse(String threadId, String runId, BinaryData updateRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateRunWithResponseAsync(threadId, runId, updateRunRequest, 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)
+     *         }
+     *     ]
+     *     stream: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param submitToolOutputsToRunRequest The submitToolOutputsToRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> submitToolOutputsToRunWithResponse(String threadId, String runId, + BinaryData submitToolOutputsToRunRequest, RequestOptions requestOptions) { + return this.serviceClient.submitToolOutputsToRunWithResponseAsync(threadId, runId, + submitToolOutputsToRunRequest, 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent 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 agent 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: BinaryData (Required)
+     *                 attachments (Optional): [
+     *                      (Optional){
+     *                         file_id: String (Optional)
+     *                         data_source (Optional): {
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                         tools (Required): [
+     *                             BinaryData (Required)
+     *                         ]
+     *                     }
+     *                 ]
+     *                 metadata (Optional): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *         ]
+     *         tool_resources (Optional): {
+     *             code_interpreter (Optional): {
+     *                 file_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 data_sources (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             file_search (Optional): {
+     *                 vector_store_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 vector_stores (Optional): [
+     *                      (Optional){
+     *                         name: String (Required)
+     *                         configuration (Required): {
+     *                             data_sources (Required): [
+     *                                 (recursive schema, see above)
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             azure_ai_search (Optional): {
+     *                 indexes (Optional): [
+     *                      (Optional){
+     *                         index_connection_id: String (Required)
+     *                         index_name: String (Required)
+     *                         query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                         top_k: Integer (Optional)
+     *                         filter: String (Optional)
+     *                     }
+     *                 ]
+     *             }
+     *         }
+     *         metadata (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): (recursive schema, see azure_ai_search above)
+     *     }
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param createThreadAndRunRequest The createThreadAndRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createThreadAndRunWithResponse(BinaryData createThreadAndRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.createThreadAndRunWithResponseAsync(createThreadAndRunRequest, requestOptions); + } + + /** + * Gets a single run step from a thread run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

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): {
+     *         type: String(message_creation/tool_calls) (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String(server_error/rate_limit_exceeded) (Required)
+     *         message: String (Required)
+     *     }
+     *     created_at: long (Required)
+     *     expired_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     usage (Optional): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
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): {
+     *                 type: String(message_creation/tool_calls) (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String(server_error/rate_limit_exceeded) (Required)
+     *                 message: String (Required)
+     *             }
+     *             created_at: long (Required)
+     *             expired_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             usage (Optional): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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
purposeStringNoThe purpose of the file. Allowed values: "fine-tune", + * "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision".
+ * 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/batch/batch_output/vision) (Required)
+     *             status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *             status_details: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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. + *

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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body Multipart body. + * @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 agent 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 body, RequestOptions requestOptions) { + // Operation 'uploadFile' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadFileWithResponseAsync(body, 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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 agent 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); + } + + /** + * Retrieves the raw content of a specific file. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFileContentWithResponse(String fileId, RequestOptions requestOptions) { + return this.serviceClient.getFileContentWithResponseAsync(fileId, requestOptions); + } + + /** + * Returns a list of vector stores. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for + * ascending order and desc for descending order. Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the + * list.
+ * You can add these to a request with {@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)
+     *             usage_bytes: int (Required)
+     *             file_counts (Required): {
+     *                 in_progress: int (Required)
+     *                 completed: int (Required)
+     *                 failed: int (Required)
+     *                 cancelled: int (Required)
+     *                 total: int (Required)
+     *             }
+     *             status: String(expired/in_progress/completed) (Required)
+     *             expires_after (Optional): {
+     *                 anchor: String(last_active_at) (Required)
+     *                 days: int (Required)
+     *             }
+     *             expires_at: Long (Optional)
+     *             last_active_at: Long (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoresWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listVectorStoresWithResponseAsync(requestOptions); + } + + /** + * Creates a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     name: String (Optional)
+     *     configuration (Optional): {
+     *         data_sources (Required): [
+     *              (Required){
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *         ]
+     *     }
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createVectorStoreRequest The createVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreWithResponse(BinaryData createVectorStoreRequest, + RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreWithResponseAsync(createVectorStoreRequest, requestOptions); + } + + /** + * Returns the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreWithResponse(String vectorStoreId, RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreWithResponseAsync(vectorStoreId, requestOptions); + } + + /** + * The ID of the vector store to modify. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param modifyVectorStoreRequest The modifyVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modifyVectorStoreWithResponse(String vectorStoreId, + BinaryData modifyVectorStoreRequest, RequestOptions requestOptions) { + return this.serviceClient.modifyVectorStoreWithResponseAsync(vectorStoreId, modifyVectorStoreRequest, + requestOptions); + } + + /** + * Deletes the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVectorStoreWithResponse(String vectorStoreId, + RequestOptions requestOptions) { + return this.serviceClient.deleteVectorStoreWithResponseAsync(vectorStoreId, requestOptions); + } + + /** + * Returns a list of vector store files. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoreFilesWithResponse(String vectorStoreId, + RequestOptions requestOptions) { + return this.serviceClient.listVectorStoreFilesWithResponseAsync(vectorStoreId, requestOptions); + } + + /** + * Create a vector store file by attaching a file to a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Optional)
+     *     data_source (Optional): {
+     *         uri: String (Required)
+     *         type: String(uri_asset/id_asset) (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileRequest The createVectorStoreFileRequest 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 description of a file attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreFileWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileRequest, RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreFileWithResponseAsync(vectorStoreId, createVectorStoreFileRequest, + requestOptions); + } + + /** + * Retrieves a vector store file. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 description of a file attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreFileWithResponseAsync(vectorStoreId, fileId, requestOptions); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 response object for deleting a vector store file relationship along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.deleteVectorStoreFileWithResponseAsync(vectorStoreId, fileId, requestOptions); + } + + /** + * Create a vector store file batch. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     data_sources (Optional): [
+     *          (Optional){
+     *             uri: String (Required)
+     *             type: String(uri_asset/id_asset) (Required)
+     *         }
+     *     ]
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileBatchRequest The createVectorStoreFileBatchRequest 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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreFileBatchWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreFileBatchWithResponseAsync(vectorStoreId, + createVectorStoreFileBatchRequest, requestOptions); + } + + /** + * Retrieve a vector store file batch. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreFileBatchWithResponseAsync(vectorStoreId, batchId, requestOptions); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.cancelVectorStoreFileBatchWithResponseAsync(vectorStoreId, batchId, requestOptions); + } + + /** + * Returns a list of vector store files in a batch. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoreFileBatchFilesWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.listVectorStoreFileBatchFilesWithResponseAsync(vectorStoreId, batchId, + requestOptions); + } + + /** + * Creates a new agent. + * + * @param options Options for createAgent API. + * @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 agent that can call the model and use tools on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAgent(CreateAgentOptions options) { + // Generated convenience method for createAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateAgentRequest createAgentRequestObj = new CreateAgentRequest(options.getModel()).setName(options.getName()) + .setDescription(options.getDescription()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setResponseFormat(options.getResponseFormat()) + .setMetadata(options.getMetadata()); + BinaryData createAgentRequest = BinaryData.fromObject(createAgentRequestObj); + return createAgentWithResponse(createAgentRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Agent.class)); + } + + /** + * Gets a list of agents 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 agents that were previously created on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAgents(Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listAgentsWithResponse + 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 listAgentsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAgent.class)); + } + + /** + * Gets a list of agents 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 agents that were previously created on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAgents() { + // Generated convenience method for listAgentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listAgentsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAgent.class)); + } + + /** + * Retrieves an existing agent. + * + * @param assistantId Identifier of the agent. + * @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 agent that can call the model and use tools on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAgent(String assistantId) { + // Generated convenience method for getAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAgentWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Agent.class)); + } + + /** + * Modifies an existing agent. + * + * @param options Options for updateAgent API. + * @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 agent that can call the model and use tools on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAgent(UpdateAgentOptions options) { + // Generated convenience method for updateAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + String assistantId = options.getAssistantId(); + UpdateAgentRequest updateAgentRequestObj = new UpdateAgentRequest().setModel(options.getModel()) + .setName(options.getName()) + .setDescription(options.getDescription()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setResponseFormat(options.getResponseFormat()) + .setMetadata(options.getMetadata()); + BinaryData updateAgentRequest = BinaryData.fromObject(updateAgentRequestObj); + return updateAgentWithResponse(assistantId, updateAgentRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Agent.class)); + } + + /** + * Deletes an agent. + * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAgent(String assistantId) { + // Generated convenience method for deleteAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteAgentWithResponse(assistantId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AgentDeletionStatus.class)); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + * + * @param messages The initial messages to associate with the new thread. + * @param toolResources A set of resources that are made available to the agent's tools in this thread. The + * resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * @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 agent on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createThread(List messages, ToolResources toolResources, + Map metadata) { + // Generated convenience method for createThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadRequest createThreadRequestObj + = new CreateThreadRequest().setMessages(messages).setToolResources(toolResources).setMetadata(metadata); + BinaryData createThreadRequest = BinaryData.fromObject(createThreadRequestObj); + return createThreadWithResponse(createThreadRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AgentThread.class)); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 agent on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createThread() { + // Generated convenience method for createThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadRequest createThreadRequestObj = new CreateThreadRequest(); + BinaryData createThreadRequest = BinaryData.fromObject(createThreadRequestObj); + return createThreadWithResponse(createThreadRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AgentThread.class)); + } + + /** + * Gets information about an existing thread. + * + * @param threadId Identifier of 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 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(AgentThread.class)); + } + + /** + * Modifies an existing thread. + * + * @param threadId The ID of the thread to modify. + * @param toolResources A set of resources that are made available to the agent's tools in this thread. The + * resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * @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 agent on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateThread(String threadId, ToolResources toolResources, Map metadata) { + // Generated convenience method for updateThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateThreadRequest updateThreadRequestObj + = new UpdateThreadRequest().setToolResources(toolResources).setMetadata(metadata); + BinaryData updateThreadRequest = BinaryData.fromObject(updateThreadRequestObj); + return updateThreadWithResponse(threadId, updateThreadRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AgentThread.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 agent 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(); + UpdateThreadRequest updateThreadRequestObj = new UpdateThreadRequest(); + BinaryData updateThreadRequest = BinaryData.fromObject(updateThreadRequestObj); + return updateThreadWithResponse(threadId, updateThreadRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AgentThread.class)); + } + + /** + * Deletes an existing thread. + * + * @param threadId Identifier of 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 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)); + } + + /** + * Gets a list of messages that exist on a thread. + * + * @param threadId Identifier of the thread. + * @param runId Filter messages by the run ID that generated them. + * @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, String runId, Integer limit, + ListSortOrder order, String after, String before) { + // Generated convenience method for listMessagesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + 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 Identifier of 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 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 Identifier of the thread. + * @param messageId Identifier of the 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 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 Identifier of the thread. + * @param messageId Identifier of the message. + * @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 agent 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(); + UpdateMessageRequest updateMessageRequestObj = new UpdateMessageRequest().setMetadata(metadata); + BinaryData updateMessageRequest = BinaryData.fromObject(updateMessageRequestObj); + return updateMessageWithResponse(threadId, messageId, updateMessageRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class)); + } + + /** + * Modifies an existing message on an existing thread. + * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the 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 agent 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(); + UpdateMessageRequest updateMessageRequestObj = new UpdateMessageRequest(); + BinaryData updateMessageRequest = BinaryData.fromObject(updateMessageRequestObj); + return updateMessageWithResponse(threadId, messageId, updateMessageRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class)); + } + + /** + * Creates a new run for an agent thread. + * + * @param options Options for createRun API. + * @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 agent thread on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createRun(CreateRunOptions options) { + // Generated convenience method for createRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + String threadId = options.getThreadId(); + List include = options.getInclude(); + CreateRunRequest createRunRequestObj + = new CreateRunRequest(options.getAssistantId()).setModel(options.getModel()) + .setInstructions(options.getInstructions()) + .setAdditionalInstructions(options.getAdditionalInstructions()) + .setAdditionalMessages(options.getAdditionalMessages()) + .setTools(options.getTools()) + .setStream(options.isStream()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setMaxPromptTokens(options.getMaxPromptTokens()) + .setMaxCompletionTokens(options.getMaxCompletionTokens()) + .setTruncationStrategy(options.getTruncationStrategy()) + .setToolChoice(options.getToolChoice()) + .setResponseFormat(options.getResponseFormat()) + .setParallelToolCalls(options.isParallelToolCalls()) + .setMetadata(options.getMetadata()); + BinaryData createRunRequest = BinaryData.fromObject(createRunRequestObj); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return createRunWithResponse(threadId, createRunRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class)); + } + + /** + * Gets a list of runs for a specified thread. + * + * @param threadId Identifier of the thread. + * @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 Identifier of 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 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 Identifier of the thread. + * @param runId Identifier of the 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 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 Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent 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(); + UpdateRunRequest updateRunRequestObj = new UpdateRunRequest().setMetadata(metadata); + BinaryData updateRunRequest = BinaryData.fromObject(updateRunRequestObj); + return updateRunWithResponse(threadId, runId, updateRunRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class)); + } + + /** + * Modifies an existing thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the 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 agent 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(); + UpdateRunRequest updateRunRequestObj = new UpdateRunRequest(); + BinaryData updateRunRequest = BinaryData.fromObject(updateRunRequestObj); + return updateRunWithResponse(threadId, runId, updateRunRequest, 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 Identifier of the thread. + * @param runId Identifier of the run. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @param stream If true, returns a stream of events that happen during the Run as server-sent events, terminating + * when the run enters a terminal state. + * @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 agent thread on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitToolOutputsToRun(String threadId, String runId, List toolOutputs, + Boolean stream) { + // Generated convenience method for submitToolOutputsToRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequestObj + = new SubmitToolOutputsToRunRequest(toolOutputs).setStream(stream); + BinaryData submitToolOutputsToRunRequest = BinaryData.fromObject(submitToolOutputsToRunRequestObj); + return submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, 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 Identifier of the thread. + * @param runId Identifier of the run. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @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 agent 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(); + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequestObj = new SubmitToolOutputsToRunRequest(toolOutputs); + BinaryData submitToolOutputsToRunRequest = BinaryData.fromObject(submitToolOutputsToRunRequestObj); + return submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class)); + } + + /** + * Cancels a run of an in progress thread. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the 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 agent 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 agent thread and immediately starts a run using that new thread. + * + * @param options Options for createThreadAndRun API. + * @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 agent thread on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createThreadAndRun(CreateThreadAndRunOptions options) { + // Generated convenience method for createThreadAndRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadAndRunRequest createThreadAndRunRequestObj + = new CreateThreadAndRunRequest(options.getAssistantId()).setThread(options.getThread()) + .setModel(options.getModel()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setStream(options.isStream()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setMaxPromptTokens(options.getMaxPromptTokens()) + .setMaxCompletionTokens(options.getMaxCompletionTokens()) + .setTruncationStrategy(options.getTruncationStrategy()) + .setToolChoice(options.getToolChoice()) + .setResponseFormat(options.getResponseFormat()) + .setParallelToolCalls(options.isParallelToolCalls()) + .setMetadata(options.getMetadata()); + BinaryData createThreadAndRunRequest = BinaryData.fromObject(createThreadAndRunRequestObj); + return createThreadAndRunWithResponse(createThreadAndRunRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadRun.class)); + } + + /** + * Gets a single run step from a thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @param include A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * @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, + List include) { + // Generated convenience method for getRunStepWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return getRunStepWithResponse(threadId, runId, stepId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(RunStep.class)); + } + + /** + * Gets a single run step from a thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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 Identifier of the thread. + * @param runId Identifier of the run. + * @param include A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * @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, + List include, Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listRunStepsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + 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 Identifier of the thread. + * @param runId Identifier of the 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 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 The 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 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 body Multipart body. + * @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 agent that can call the model and use tools on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadFile(UploadFileRequest body) { + // Generated convenience method for uploadFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadFileWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeFileField("file", body.getFile().getContent(), body.getFile().getContentType(), + body.getFile().getFilename()) + .serializeTextField("purpose", Objects.toString(body.getPurpose())) + .serializeTextField("filename", body.getFilename()) + .end() + .getRequestBody(), 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 agent 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)); + } + + /** + * Retrieves the raw content of a specific 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 the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFileContent(String fileId) { + // Generated convenience method for getFileContentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFileContentWithResponse(fileId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Returns a list of vector stores. + * + * @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 the response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStores(Integer limit, ListSortOrder order, String after, + String before) { + // Generated convenience method for listVectorStoresWithResponse + 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 listVectorStoresWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStore.class)); + } + + /** + * Returns a list of vector stores. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStores() { + // Generated convenience method for listVectorStoresWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoresWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStore.class)); + } + + /** + * Creates a vector store. + * + * @param fileIds A list of file IDs that the vector store should use. Useful for tools like `file_search` that can + * access files. + * @param name The name of the vector store. + * @param storeConfiguration The vector store configuration, used when vector store is created from Azure asset + * URIs. + * @param expiresAfter Details on when this vector store expires. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * Only applicable if file_ids is non-empty. + * @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 vector store is a collection of processed files can be used by the `file_search` tool on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStore(List fileIds, String name, + VectorStoreConfiguration storeConfiguration, VectorStoreExpirationPolicy expiresAfter, + VectorStoreChunkingStrategyRequest chunkingStrategy, Map metadata) { + // Generated convenience method for createVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreRequest createVectorStoreRequestObj = new CreateVectorStoreRequest().setFileIds(fileIds) + .setName(name) + .setStoreConfiguration(storeConfiguration) + .setExpiresAfter(expiresAfter) + .setChunkingStrategy(chunkingStrategy) + .setMetadata(metadata); + BinaryData createVectorStoreRequest = BinaryData.fromObject(createVectorStoreRequestObj); + return createVectorStoreWithResponse(createVectorStoreRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStore.class)); + } + + /** + * Creates a vector store. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 vector store is a collection of processed files can be used by the `file_search` tool on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStore() { + // Generated convenience method for createVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreRequest createVectorStoreRequestObj = new CreateVectorStoreRequest(); + BinaryData createVectorStoreRequest = BinaryData.fromObject(createVectorStoreRequestObj); + return createVectorStoreWithResponse(createVectorStoreRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStore.class)); + } + + /** + * Returns the vector store object matching the specified ID. + * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getVectorStore(String vectorStoreId) { + // Generated convenience method for getVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreWithResponse(vectorStoreId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStore.class)); + } + + /** + * The ID of the vector store to modify. + * + * @param vectorStoreId Identifier of the vector store. + * @param name The name of the vector store. + * @param expiresAfter Details on when this vector store expires. + * @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 vector store is a collection of processed files can be used by the `file_search` tool on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono modifyVectorStore(String vectorStoreId, String name, + VectorStoreExpirationPolicy expiresAfter, Map metadata) { + // Generated convenience method for modifyVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + ModifyVectorStoreRequest modifyVectorStoreRequestObj + = new ModifyVectorStoreRequest().setName(name).setExpiresAfter(expiresAfter).setMetadata(metadata); + BinaryData modifyVectorStoreRequest = BinaryData.fromObject(modifyVectorStoreRequestObj); + return modifyVectorStoreWithResponse(vectorStoreId, modifyVectorStoreRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStore.class)); + } + + /** + * The ID of the vector store to modify. + * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono modifyVectorStore(String vectorStoreId) { + // Generated convenience method for modifyVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + ModifyVectorStoreRequest modifyVectorStoreRequestObj = new ModifyVectorStoreRequest(); + BinaryData modifyVectorStoreRequest = BinaryData.fromObject(modifyVectorStoreRequestObj); + return modifyVectorStoreWithResponse(vectorStoreId, modifyVectorStoreRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStore.class)); + } + + /** + * Deletes the vector store object matching the specified ID. + * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteVectorStore(String vectorStoreId) { + // Generated convenience method for deleteVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteVectorStoreWithResponse(vectorStoreId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreDeletionStatus.class)); + } + + /** + * Returns a list of vector store files. + * + * @param vectorStoreId Identifier of the vector store. + * @param filter Filter by file status. + * @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 the response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStoreFiles(String vectorStoreId, + VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listVectorStoreFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter.toString(), false); + } + 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 listVectorStoreFilesWithResponse(vectorStoreId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStoreFile.class)); + } + + /** + * Returns a list of vector store files. + * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStoreFiles(String vectorStoreId) { + // Generated convenience method for listVectorStoreFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoreFilesWithResponse(vectorStoreId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStoreFile.class)); + } + + /** + * Create a vector store file by attaching a file to a vector store. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @param dataSource Azure asset ID. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * @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 description of a file attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStoreFile(String vectorStoreId, String fileId, + VectorStoreDataSource dataSource, VectorStoreChunkingStrategyRequest chunkingStrategy) { + // Generated convenience method for createVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileRequest createVectorStoreFileRequestObj + = new CreateVectorStoreFileRequest().setFileId(fileId) + .setDataSource(dataSource) + .setChunkingStrategy(chunkingStrategy); + BinaryData createVectorStoreFileRequest = BinaryData.fromObject(createVectorStoreFileRequestObj); + return createVectorStoreFileWithResponse(vectorStoreId, createVectorStoreFileRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFile.class)); + } + + /** + * Create a vector store file by attaching a file to a vector store. + * + * @param vectorStoreId Identifier of the vector store. + * @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 description of a file attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStoreFile(String vectorStoreId) { + // Generated convenience method for createVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileRequest createVectorStoreFileRequestObj = new CreateVectorStoreFileRequest(); + BinaryData createVectorStoreFileRequest = BinaryData.fromObject(createVectorStoreFileRequestObj); + return createVectorStoreFileWithResponse(vectorStoreId, createVectorStoreFileRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFile.class)); + } + + /** + * Retrieves a vector store file. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier 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 description of a file attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getVectorStoreFile(String vectorStoreId, String fileId) { + // Generated convenience method for getVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFile.class)); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier 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 response object for deleting a vector store file relationship on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteVectorStoreFile(String vectorStoreId, String fileId) { + // Generated convenience method for deleteVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFileDeletionStatus.class)); + } + + /** + * Create a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileIds List of file identifiers. + * @param dataSources List of Azure assets. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * @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 batch of files attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStoreFileBatch(String vectorStoreId, List fileIds, + List dataSources, VectorStoreChunkingStrategyRequest chunkingStrategy) { + // Generated convenience method for createVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequestObj + = new CreateVectorStoreFileBatchRequest().setFileIds(fileIds) + .setDataSources(dataSources) + .setChunkingStrategy(chunkingStrategy); + BinaryData createVectorStoreFileBatchRequest = BinaryData.fromObject(createVectorStoreFileBatchRequestObj); + return createVectorStoreFileBatchWithResponse(vectorStoreId, createVectorStoreFileBatchRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFileBatch.class)); + } + + /** + * Create a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @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 batch of files attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVectorStoreFileBatch(String vectorStoreId) { + // Generated convenience method for createVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequestObj + = new CreateVectorStoreFileBatchRequest(); + BinaryData createVectorStoreFileBatchRequest = BinaryData.fromObject(createVectorStoreFileBatchRequestObj); + return createVectorStoreFileBatchWithResponse(vectorStoreId, createVectorStoreFileBatchRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFileBatch.class)); + } + + /** + * Retrieve a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getVectorStoreFileBatch(String vectorStoreId, String batchId) { + // Generated convenience method for getVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFileBatch.class)); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelVectorStoreFileBatch(String vectorStoreId, String batchId) { + // Generated convenience method for cancelVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return cancelVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VectorStoreFileBatch.class)); + } + + /** + * Returns a list of vector store files in a batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @param filter Filter by file status. + * @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 the response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStoreFileBatchFiles(String vectorStoreId, String batchId, + VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listVectorStoreFileBatchFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter.toString(), false); + } + 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 listVectorStoreFileBatchFilesWithResponse(vectorStoreId, batchId, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStoreFile.class)); + } + + /** + * Returns a list of vector store files in a batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listVectorStoreFileBatchFiles(String vectorStoreId, + String batchId) { + // Generated convenience method for listVectorStoreFileBatchFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoreFileBatchFilesWithResponse(vectorStoreId, batchId, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfVectorStoreFile.class)); + } + + /** + * Gets a list of threads 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)
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             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 threads that were previously created along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listThreadsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listThreadsWithResponseAsync(requestOptions); + } + + /** + * Gets a list of threads 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 threads that were previously created on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listThreads(Integer limit, ListSortOrder order, String after, + String before) { + // Generated convenience method for listThreadsWithResponse + 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 listThreadsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAgentThread.class)); + } + + /** + * Gets a list of threads 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 threads that were previously created on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listThreads() { + // Generated convenience method for listThreadsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listThreadsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OpenAIPageableListOfAgentThread.class)); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @param attachments A list of files attached to the message, and the tools they should be added to. + * @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 agent thread on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createMessage(String threadId, MessageRole role, BinaryData content, + List attachments, Map metadata) { + // Generated convenience method for createMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateMessageRequest createMessageRequestObj + = new CreateMessageRequest(role, content).setAttachments(attachments).setMetadata(metadata); + BinaryData createMessageRequest = BinaryData.fromObject(createMessageRequestObj); + return createMessageWithResponse(threadId, createMessageRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class)); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @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 agent thread on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createMessage(String threadId, MessageRole role, BinaryData content) { + // Generated convenience method for createMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateMessageRequest createMessageRequestObj = new CreateMessageRequest(role, content); + BinaryData createMessageRequest = BinaryData.fromObject(createMessageRequestObj); + return createMessageWithResponse(threadId, createMessageRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ThreadMessage.class)); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @param attachments A list of files attached to the message, and the tools they should be added to. + * @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. + * @return a single, existing message within an agent thread on successful completion of {@link Mono}. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createMessage(String threadId, MessageRole role, String content, + List attachments, Map metadata) { + // Generated convenience method for createMessageWithResponse + BinaryData binaryContent = BinaryData.fromString(content); + return this.createMessage(threadId, role, binaryContent, attachments, metadata); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @return a single, existing message within an agent thread on successful completion of {@link Mono}. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createMessage(String threadId, MessageRole role, String content) { + // Generated convenience method for createMessageWithResponse + BinaryData binaryContent = BinaryData.fromString(content); + return this.createMessage(threadId, role, binaryContent); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsClient.java new file mode 100644 index 000000000000..0f6bc3d23de7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AgentsClient.java @@ -0,0 +1,5105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.AgentsImpl; +import com.azure.ai.projects.implementation.MultipartFormDataHelper; +import com.azure.ai.projects.implementation.models.CreateAgentRequest; +import com.azure.ai.projects.implementation.models.CreateMessageRequest; +import com.azure.ai.projects.implementation.models.CreateRunRequest; +import com.azure.ai.projects.implementation.models.CreateThreadAndRunRequest; +import com.azure.ai.projects.implementation.models.CreateThreadRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreFileBatchRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreFileRequest; +import com.azure.ai.projects.implementation.models.CreateVectorStoreRequest; +import com.azure.ai.projects.implementation.models.ModifyVectorStoreRequest; +import com.azure.ai.projects.implementation.models.SubmitToolOutputsToRunRequest; +import com.azure.ai.projects.implementation.models.UpdateAgentRequest; +import com.azure.ai.projects.implementation.models.UpdateMessageRequest; +import com.azure.ai.projects.implementation.models.UpdateRunRequest; +import com.azure.ai.projects.implementation.models.UpdateThreadRequest; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentDeletionStatus; +import com.azure.ai.projects.models.AgentServerSentEvents; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.CreateThreadAndRunOptions; +import com.azure.ai.projects.models.FileDeletionStatus; +import com.azure.ai.projects.models.FileListResponse; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.ListSortOrder; +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.OpenAIPageableListOfAgent; +import com.azure.ai.projects.models.OpenAIPageableListOfAgentThread; +import com.azure.ai.projects.models.OpenAIPageableListOfRunStep; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadRun; +import com.azure.ai.projects.models.OpenAIPageableListOfVectorStore; +import com.azure.ai.projects.models.OpenAIPageableListOfVectorStoreFile; +import com.azure.ai.projects.models.RunAdditionalFieldList; +import com.azure.ai.projects.models.RunStep; +import com.azure.ai.projects.models.ThreadDeletionStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolOutput; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.UpdateAgentOptions; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDeletionStatus; +import com.azure.ai.projects.models.VectorStoreExpirationPolicy; +import com.azure.ai.projects.models.VectorStoreFile; +import com.azure.ai.projects.models.VectorStoreFileBatch; +import com.azure.ai.projects.models.VectorStoreFileDeletionStatus; +import com.azure.ai.projects.models.VectorStoreFileStatusFilter; +import com.azure.ai.projects.models.streaming.StreamUpdate; +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.nio.ByteBuffer; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; + +/** + * Initializes a new instance of the synchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class) +public final class AgentsClient { + + @Generated + private final AgentsImpl serviceClient; + + /** + * Initializes an instance of AgentsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AgentsClient(AgentsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates a new agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Required)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createAgentRequest The createAgentRequest 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 agent that can call the model and use tools along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createAgentWithResponse(BinaryData createAgentRequest, RequestOptions requestOptions) { + return this.serviceClient.createAgentWithResponse(createAgentRequest, requestOptions); + } + + /** + * Gets a list of agents 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){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             temperature: Double (Required)
+     *             top_p: Double (Required)
+     *             response_format: BinaryData (Optional)
+     *             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 agents that were previously created along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAgentsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listAgentsWithResponse(requestOptions); + } + + /** + * Retrieves an existing agent. + *

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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent that can call the model and use tools along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAgentWithResponse(String assistantId, RequestOptions requestOptions) { + return this.serviceClient.getAgentWithResponse(assistantId, requestOptions); + } + + /** + * Modifies an existing agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Optional)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId The ID of the agent to modify. + * @param updateAgentRequest The updateAgentRequest 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 agent that can call the model and use tools along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateAgentWithResponse(String assistantId, BinaryData updateAgentRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateAgentWithResponse(assistantId, updateAgentRequest, requestOptions); + } + + /** + * Deletes an agent. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAgentWithResponse(String assistantId, RequestOptions requestOptions) { + return this.serviceClient.deleteAgentWithResponse(assistantId, requestOptions); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createThreadRequest The createThreadRequest 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 agent along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createThreadWithResponse(BinaryData createThreadRequest, + RequestOptions requestOptions) { + return this.serviceClient.createThreadWithResponse(createThreadRequest, requestOptions); + } + + /** + * Gets information about an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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
+     * {
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId The ID of the thread to modify. + * @param updateThreadRequest The updateThreadRequest 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 agent along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateThreadWithResponse(String threadId, BinaryData updateThreadRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateThreadWithResponse(threadId, updateThreadRequest, requestOptions); + } + + /** + * Deletes an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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: BinaryData (Required)
+     *     attachments (Optional): [
+     *          (Optional){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     thread_id: String (Required)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createMessageRequest The createMessageRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createMessageWithResponse(String threadId, BinaryData createMessageRequest, + RequestOptions requestOptions) { + return this.serviceClient.createMessageWithResponse(threadId, createMessageRequest, requestOptions); + } + + /** + * Gets a list of messages that exist on a thread. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoFilter messages by the run ID that generated them.
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)
+     *             status: String(in_progress/incomplete/completed) (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *             }
+     *             completed_at: Long (Required)
+     *             incomplete_at: Long (Required)
+     *             role: String(user/assistant) (Required)
+     *             content (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             assistant_id: String (Required)
+     *             run_id: String (Required)
+     *             attachments (Required): [
+     *                  (Required){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @param updateMessageRequest The updateMessageRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateMessageWithResponse(String threadId, String messageId, + BinaryData updateMessageRequest, RequestOptions requestOptions) { + return this.serviceClient.updateMessageWithResponse(threadId, messageId, updateMessageRequest, requestOptions); + } + + /** + * Creates a new run for an agent thread. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assistant_id: String (Required)
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     additional_instructions: String (Optional)
+     *     additional_messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createRunRequest The createRunRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createRunWithResponse(String threadId, BinaryData createRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.createRunWithResponse(threadId, createRunRequest, 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): {
+     *                 type: String (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String (Required)
+     *                 message: String (Required)
+     *             }
+     *             model: String (Required)
+     *             instructions: String (Required)
+     *             tools (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             created_at: long (Required)
+     *             expires_at: Long (Required)
+     *             started_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *             }
+     *             usage (Required): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             temperature: Double (Optional)
+     *             top_p: Double (Optional)
+     *             max_prompt_tokens: Integer (Required)
+     *             max_completion_tokens: Integer (Required)
+     *             truncation_strategy (Required): {
+     *                 type: String(auto/last_messages) (Required)
+     *                 last_messages: Integer (Optional)
+     *             }
+     *             tool_choice: BinaryData (Required)
+     *             response_format: BinaryData (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *             tool_resources (Optional): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             parallel_tool_calls: boolean (Required)
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param updateRunRequest The updateRunRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateRunWithResponse(String threadId, String runId, BinaryData updateRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateRunWithResponse(threadId, runId, updateRunRequest, 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)
+     *         }
+     *     ]
+     *     stream: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param submitToolOutputsToRunRequest The submitToolOutputsToRunRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response submitToolOutputsToRunWithResponse(String threadId, String runId, + BinaryData submitToolOutputsToRunRequest, RequestOptions requestOptions) { + return this.serviceClient.submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, + 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent 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 agent 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: BinaryData (Required)
+     *                 attachments (Optional): [
+     *                      (Optional){
+     *                         file_id: String (Optional)
+     *                         data_source (Optional): {
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                         tools (Required): [
+     *                             BinaryData (Required)
+     *                         ]
+     *                     }
+     *                 ]
+     *                 metadata (Optional): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *         ]
+     *         tool_resources (Optional): {
+     *             code_interpreter (Optional): {
+     *                 file_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 data_sources (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             file_search (Optional): {
+     *                 vector_store_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 vector_stores (Optional): [
+     *                      (Optional){
+     *                         name: String (Required)
+     *                         configuration (Required): {
+     *                             data_sources (Required): [
+     *                                 (recursive schema, see above)
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             azure_ai_search (Optional): {
+     *                 indexes (Optional): [
+     *                      (Optional){
+     *                         index_connection_id: String (Required)
+     *                         index_name: String (Required)
+     *                         query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                         top_k: Integer (Optional)
+     *                         filter: String (Optional)
+     *                     }
+     *                 ]
+     *             }
+     *         }
+     *         metadata (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): (recursive schema, see azure_ai_search above)
+     *     }
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param createThreadAndRunRequest The createThreadAndRunRequest 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 agent thread along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createThreadAndRunWithResponse(BinaryData createThreadAndRunRequest, + RequestOptions requestOptions) { + return this.serviceClient.createThreadAndRunWithResponse(createThreadAndRunRequest, requestOptions); + } + + /** + * Gets a single run step from a thread run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

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): {
+     *         type: String(message_creation/tool_calls) (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String(server_error/rate_limit_exceeded) (Required)
+     *         message: String (Required)
+     *     }
+     *     created_at: long (Required)
+     *     expired_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     usage (Optional): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
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): {
+     *                 type: String(message_creation/tool_calls) (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String(server_error/rate_limit_exceeded) (Required)
+     *                 message: String (Required)
+     *             }
+     *             created_at: long (Required)
+     *             expired_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             usage (Optional): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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
purposeStringNoThe purpose of the file. Allowed values: "fine-tune", + * "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision".
+ * 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/batch/batch_output/vision) (Required)
+     *             status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *             status_details: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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. + *

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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body Multipart body. + * @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 agent that can call the model and use tools along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response uploadFileWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'uploadFile' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadFileWithResponse(body, 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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 agent 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); + } + + /** + * Retrieves the raw content of a specific file. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @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 the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFileContentWithResponse(String fileId, RequestOptions requestOptions) { + return this.serviceClient.getFileContentWithResponse(fileId, requestOptions); + } + + /** + * Returns a list of vector stores. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for + * ascending order and desc for descending order. Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the + * list.
+ * You can add these to a request with {@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)
+     *             usage_bytes: int (Required)
+     *             file_counts (Required): {
+     *                 in_progress: int (Required)
+     *                 completed: int (Required)
+     *                 failed: int (Required)
+     *                 cancelled: int (Required)
+     *                 total: int (Required)
+     *             }
+     *             status: String(expired/in_progress/completed) (Required)
+     *             expires_after (Optional): {
+     *                 anchor: String(last_active_at) (Required)
+     *                 days: int (Required)
+     *             }
+     *             expires_at: Long (Optional)
+     *             last_active_at: Long (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @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 response data for a requested list of items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoresWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listVectorStoresWithResponse(requestOptions); + } + + /** + * Creates a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     name: String (Optional)
+     *     configuration (Optional): {
+     *         data_sources (Required): [
+     *              (Required){
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *         ]
+     *     }
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createVectorStoreRequest The createVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreWithResponse(BinaryData createVectorStoreRequest, + RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreWithResponse(createVectorStoreRequest, requestOptions); + } + + /** + * Returns the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreWithResponse(String vectorStoreId, RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreWithResponse(vectorStoreId, requestOptions); + } + + /** + * The ID of the vector store to modify. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param modifyVectorStoreRequest The modifyVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modifyVectorStoreWithResponse(String vectorStoreId, BinaryData modifyVectorStoreRequest, + RequestOptions requestOptions) { + return this.serviceClient.modifyVectorStoreWithResponse(vectorStoreId, modifyVectorStoreRequest, + requestOptions); + } + + /** + * Deletes the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVectorStoreWithResponse(String vectorStoreId, RequestOptions requestOptions) { + return this.serviceClient.deleteVectorStoreWithResponse(vectorStoreId, requestOptions); + } + + /** + * Returns a list of vector store files. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoreFilesWithResponse(String vectorStoreId, RequestOptions requestOptions) { + return this.serviceClient.listVectorStoreFilesWithResponse(vectorStoreId, requestOptions); + } + + /** + * Create a vector store file by attaching a file to a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Optional)
+     *     data_source (Optional): {
+     *         uri: String (Required)
+     *         type: String(uri_asset/id_asset) (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileRequest The createVectorStoreFileRequest 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 description of a file attached to a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreFileWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileRequest, RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreFileWithResponse(vectorStoreId, createVectorStoreFileRequest, + requestOptions); + } + + /** + * Retrieves a vector store file. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 description of a file attached to a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 response object for deleting a vector store file relationship along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.deleteVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions); + } + + /** + * Create a vector store file batch. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     data_sources (Optional): [
+     *          (Optional){
+     *             uri: String (Required)
+     *             type: String(uri_asset/id_asset) (Required)
+     *         }
+     *     ]
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileBatchRequest The createVectorStoreFileBatchRequest 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 batch of files attached to a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreFileBatchWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions) { + return this.serviceClient.createVectorStoreFileBatchWithResponse(vectorStoreId, + createVectorStoreFileBatchRequest, requestOptions); + } + + /** + * Retrieve a vector store file batch. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.getVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.cancelVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions); + } + + /** + * Returns a list of vector store files in a batch. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoreFileBatchFilesWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + return this.serviceClient.listVectorStoreFileBatchFilesWithResponse(vectorStoreId, batchId, requestOptions); + } + + /** + * Creates a new agent. + * + * @param options Options for createAgent API. + * @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 agent that can call the model and use tools. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Agent createAgent(CreateAgentOptions options) { + // Generated convenience method for createAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateAgentRequest createAgentRequestObj = new CreateAgentRequest(options.getModel()).setName(options.getName()) + .setDescription(options.getDescription()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setResponseFormat(options.getResponseFormat()) + .setMetadata(options.getMetadata()); + BinaryData createAgentRequest = BinaryData.fromObject(createAgentRequestObj); + return createAgentWithResponse(createAgentRequest, requestOptions).getValue().toObject(Agent.class); + } + + /** + * Gets a list of agents 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 agents that were previously created. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfAgent listAgents(Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listAgentsWithResponse + 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 listAgentsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAgent.class); + } + + /** + * Gets a list of agents 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 agents that were previously created. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfAgent listAgents() { + // Generated convenience method for listAgentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listAgentsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAgent.class); + } + + /** + * Retrieves an existing agent. + * + * @param assistantId Identifier of the agent. + * @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 agent that can call the model and use tools. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Agent getAgent(String assistantId) { + // Generated convenience method for getAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAgentWithResponse(assistantId, requestOptions).getValue().toObject(Agent.class); + } + + /** + * Modifies an existing agent. + * + * @param options Options for updateAgent API. + * @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 agent that can call the model and use tools. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Agent updateAgent(UpdateAgentOptions options) { + // Generated convenience method for updateAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + String assistantId = options.getAssistantId(); + UpdateAgentRequest updateAgentRequestObj = new UpdateAgentRequest().setModel(options.getModel()) + .setName(options.getName()) + .setDescription(options.getDescription()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setResponseFormat(options.getResponseFormat()) + .setMetadata(options.getMetadata()); + BinaryData updateAgentRequest = BinaryData.fromObject(updateAgentRequestObj); + return updateAgentWithResponse(assistantId, updateAgentRequest, requestOptions).getValue() + .toObject(Agent.class); + } + + /** + * Deletes an agent. + * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentDeletionStatus deleteAgent(String assistantId) { + // Generated convenience method for deleteAgentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteAgentWithResponse(assistantId, requestOptions).getValue().toObject(AgentDeletionStatus.class); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + * + * @param messages The initial messages to associate with the new thread. + * @param toolResources A set of resources that are made available to the agent's tools in this thread. The + * resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * @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 agent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentThread createThread(List messages, ToolResources toolResources, + Map metadata) { + // Generated convenience method for createThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadRequest createThreadRequestObj + = new CreateThreadRequest().setMessages(messages).setToolResources(toolResources).setMetadata(metadata); + BinaryData createThreadRequest = BinaryData.fromObject(createThreadRequestObj); + return createThreadWithResponse(createThreadRequest, requestOptions).getValue().toObject(AgentThread.class); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 agent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentThread createThread() { + // Generated convenience method for createThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadRequest createThreadRequestObj = new CreateThreadRequest(); + BinaryData createThreadRequest = BinaryData.fromObject(createThreadRequestObj); + return createThreadWithResponse(createThreadRequest, requestOptions).getValue().toObject(AgentThread.class); + } + + /** + * Gets information about an existing thread. + * + * @param threadId Identifier of 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 information about an existing thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentThread getThread(String threadId) { + // Generated convenience method for getThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getThreadWithResponse(threadId, requestOptions).getValue().toObject(AgentThread.class); + } + + /** + * Modifies an existing thread. + * + * @param threadId The ID of the thread to modify. + * @param toolResources A set of resources that are made available to the agent's tools in this thread. The + * resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * @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 agent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentThread updateThread(String threadId, ToolResources toolResources, Map metadata) { + // Generated convenience method for updateThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateThreadRequest updateThreadRequestObj + = new UpdateThreadRequest().setToolResources(toolResources).setMetadata(metadata); + BinaryData updateThreadRequest = BinaryData.fromObject(updateThreadRequestObj); + return updateThreadWithResponse(threadId, updateThreadRequest, requestOptions).getValue() + .toObject(AgentThread.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 agent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentThread updateThread(String threadId) { + // Generated convenience method for updateThreadWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateThreadRequest updateThreadRequestObj = new UpdateThreadRequest(); + BinaryData updateThreadRequest = BinaryData.fromObject(updateThreadRequestObj); + return updateThreadWithResponse(threadId, updateThreadRequest, requestOptions).getValue() + .toObject(AgentThread.class); + } + + /** + * Deletes an existing thread. + * + * @param threadId Identifier of 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 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); + } + + /** + * Gets a list of messages that exist on a thread. + * + * @param threadId Identifier of the thread. + * @param runId Filter messages by the run ID that generated them. + * @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, String runId, Integer limit, + ListSortOrder order, String after, String before) { + // Generated convenience method for listMessagesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + 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 Identifier of 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 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 Identifier of the thread. + * @param messageId Identifier of the 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 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 Identifier of the thread. + * @param messageId Identifier of the message. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage updateMessage(String threadId, String messageId, Map metadata) { + // Generated convenience method for updateMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateMessageRequest updateMessageRequestObj = new UpdateMessageRequest().setMetadata(metadata); + BinaryData updateMessageRequest = BinaryData.fromObject(updateMessageRequestObj); + return updateMessageWithResponse(threadId, messageId, updateMessageRequest, requestOptions).getValue() + .toObject(ThreadMessage.class); + } + + /** + * Modifies an existing message on an existing thread. + * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the 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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage updateMessage(String threadId, String messageId) { + // Generated convenience method for updateMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateMessageRequest updateMessageRequestObj = new UpdateMessageRequest(); + BinaryData updateMessageRequest = BinaryData.fromObject(updateMessageRequestObj); + return updateMessageWithResponse(threadId, messageId, updateMessageRequest, requestOptions).getValue() + .toObject(ThreadMessage.class); + } + + /** + * Creates a new run for an agent thread. + * + * @param options Options for createRun API. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun createRun(CreateRunOptions options) { + // Generated convenience method for createRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + String threadId = options.getThreadId(); + List include = options.getInclude(); + CreateRunRequest createRunRequestObj + = new CreateRunRequest(options.getAssistantId()).setModel(options.getModel()) + .setInstructions(options.getInstructions()) + .setAdditionalInstructions(options.getAdditionalInstructions()) + .setAdditionalMessages(options.getAdditionalMessages()) + .setTools(options.getTools()) + .setStream(options.isStream()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setMaxPromptTokens(options.getMaxPromptTokens()) + .setMaxCompletionTokens(options.getMaxCompletionTokens()) + .setTruncationStrategy(options.getTruncationStrategy()) + .setToolChoice(options.getToolChoice()) + .setResponseFormat(options.getResponseFormat()) + .setParallelToolCalls(options.isParallelToolCalls()) + .setMetadata(options.getMetadata()); + BinaryData createRunRequest = BinaryData.fromObject(createRunRequestObj); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return createRunWithResponse(threadId, createRunRequest, requestOptions).getValue().toObject(ThreadRun.class); + } + + /** + * Gets a list of runs for a specified thread. + * + * @param threadId Identifier of the thread. + * @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 Identifier of 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 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 Identifier of the thread. + * @param runId Identifier of the 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 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 Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun updateRun(String threadId, String runId, Map metadata) { + // Generated convenience method for updateRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateRunRequest updateRunRequestObj = new UpdateRunRequest().setMetadata(metadata); + BinaryData updateRunRequest = BinaryData.fromObject(updateRunRequestObj); + return updateRunWithResponse(threadId, runId, updateRunRequest, requestOptions).getValue() + .toObject(ThreadRun.class); + } + + /** + * Modifies an existing thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the 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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun updateRun(String threadId, String runId) { + // Generated convenience method for updateRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + UpdateRunRequest updateRunRequestObj = new UpdateRunRequest(); + BinaryData updateRunRequest = BinaryData.fromObject(updateRunRequestObj); + return updateRunWithResponse(threadId, runId, updateRunRequest, 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 Identifier of the thread. + * @param runId Identifier of the run. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @param stream If true, returns a stream of events that happen during the Run as server-sent events, terminating + * when the run enters a terminal state. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun submitToolOutputsToRun(String threadId, String runId, List toolOutputs, + Boolean stream) { + // Generated convenience method for submitToolOutputsToRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequestObj + = new SubmitToolOutputsToRunRequest(toolOutputs).setStream(stream); + BinaryData submitToolOutputsToRunRequest = BinaryData.fromObject(submitToolOutputsToRunRequestObj); + return submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, 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 Identifier of the thread. + * @param runId Identifier of the run. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun submitToolOutputsToRun(String threadId, String runId, List toolOutputs) { + // Generated convenience method for submitToolOutputsToRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequestObj = new SubmitToolOutputsToRunRequest(toolOutputs); + BinaryData submitToolOutputsToRunRequest = BinaryData.fromObject(submitToolOutputsToRunRequestObj); + return submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, requestOptions) + .getValue() + .toObject(ThreadRun.class); + } + + /** + * Cancels a run of an in progress thread. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the 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 agent 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 agent thread and immediately starts a run using that new thread. + * + * @param options Options for createThreadAndRun API. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadRun createThreadAndRun(CreateThreadAndRunOptions options) { + // Generated convenience method for createThreadAndRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateThreadAndRunRequest createThreadAndRunRequestObj + = new CreateThreadAndRunRequest(options.getAssistantId()).setThread(options.getThread()) + .setModel(options.getModel()) + .setInstructions(options.getInstructions()) + .setTools(options.getTools()) + .setToolResources(options.getToolResources()) + .setStream(options.isStream()) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setMaxPromptTokens(options.getMaxPromptTokens()) + .setMaxCompletionTokens(options.getMaxCompletionTokens()) + .setTruncationStrategy(options.getTruncationStrategy()) + .setToolChoice(options.getToolChoice()) + .setResponseFormat(options.getResponseFormat()) + .setParallelToolCalls(options.isParallelToolCalls()) + .setMetadata(options.getMetadata()); + BinaryData createThreadAndRunRequest = BinaryData.fromObject(createThreadAndRunRequestObj); + return createThreadAndRunWithResponse(createThreadAndRunRequest, requestOptions).getValue() + .toObject(ThreadRun.class); + } + + /** + * Gets a single run step from a thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @param include A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * @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, List include) { + // Generated convenience method for getRunStepWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return getRunStepWithResponse(threadId, runId, stepId, requestOptions).getValue().toObject(RunStep.class); + } + + /** + * Gets a single run step from a thread run. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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 Identifier of the thread. + * @param runId Identifier of the run. + * @param include A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * @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, List include, + Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listRunStepsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + 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 Identifier of the thread. + * @param runId Identifier of the 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 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 The 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 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 body Multipart body. + * @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 agent that can call the model and use tools. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIFile uploadFile(UploadFileRequest body) { + // Generated convenience method for uploadFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadFileWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeFileField("file", body.getFile().getContent(), body.getFile().getContentType(), + body.getFile().getFilename()) + .serializeTextField("purpose", Objects.toString(body.getPurpose())) + .serializeTextField("filename", body.getFilename()) + .end() + .getRequestBody(), 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 agent 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); + } + + /** + * Retrieves the raw content of a specific 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 the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getFileContent(String fileId) { + // Generated convenience method for getFileContentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFileContentWithResponse(fileId, requestOptions).getValue(); + } + + /** + * Returns a list of vector stores. + * + * @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 the response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStore listVectorStores(Integer limit, ListSortOrder order, String after, + String before) { + // Generated convenience method for listVectorStoresWithResponse + 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 listVectorStoresWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfVectorStore.class); + } + + /** + * Returns a list of vector stores. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStore listVectorStores() { + // Generated convenience method for listVectorStoresWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoresWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfVectorStore.class); + } + + /** + * Creates a vector store. + * + * @param fileIds A list of file IDs that the vector store should use. Useful for tools like `file_search` that can + * access files. + * @param name The name of the vector store. + * @param storeConfiguration The vector store configuration, used when vector store is created from Azure asset + * URIs. + * @param expiresAfter Details on when this vector store expires. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * Only applicable if file_ids is non-empty. + * @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 vector store is a collection of processed files can be used by the `file_search` tool. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStore createVectorStore(List fileIds, String name, VectorStoreConfiguration storeConfiguration, + VectorStoreExpirationPolicy expiresAfter, VectorStoreChunkingStrategyRequest chunkingStrategy, + Map metadata) { + // Generated convenience method for createVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreRequest createVectorStoreRequestObj = new CreateVectorStoreRequest().setFileIds(fileIds) + .setName(name) + .setStoreConfiguration(storeConfiguration) + .setExpiresAfter(expiresAfter) + .setChunkingStrategy(chunkingStrategy) + .setMetadata(metadata); + BinaryData createVectorStoreRequest = BinaryData.fromObject(createVectorStoreRequestObj); + return createVectorStoreWithResponse(createVectorStoreRequest, requestOptions).getValue() + .toObject(VectorStore.class); + } + + /** + * Creates a vector store. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 vector store is a collection of processed files can be used by the `file_search` tool. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStore createVectorStore() { + // Generated convenience method for createVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreRequest createVectorStoreRequestObj = new CreateVectorStoreRequest(); + BinaryData createVectorStoreRequest = BinaryData.fromObject(createVectorStoreRequestObj); + return createVectorStoreWithResponse(createVectorStoreRequest, requestOptions).getValue() + .toObject(VectorStore.class); + } + + /** + * Returns the vector store object matching the specified ID. + * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStore getVectorStore(String vectorStoreId) { + // Generated convenience method for getVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreWithResponse(vectorStoreId, requestOptions).getValue().toObject(VectorStore.class); + } + + /** + * The ID of the vector store to modify. + * + * @param vectorStoreId Identifier of the vector store. + * @param name The name of the vector store. + * @param expiresAfter Details on when this vector store expires. + * @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 vector store is a collection of processed files can be used by the `file_search` tool. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStore modifyVectorStore(String vectorStoreId, String name, VectorStoreExpirationPolicy expiresAfter, + Map metadata) { + // Generated convenience method for modifyVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + ModifyVectorStoreRequest modifyVectorStoreRequestObj + = new ModifyVectorStoreRequest().setName(name).setExpiresAfter(expiresAfter).setMetadata(metadata); + BinaryData modifyVectorStoreRequest = BinaryData.fromObject(modifyVectorStoreRequestObj); + return modifyVectorStoreWithResponse(vectorStoreId, modifyVectorStoreRequest, requestOptions).getValue() + .toObject(VectorStore.class); + } + + /** + * The ID of the vector store to modify. + * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStore modifyVectorStore(String vectorStoreId) { + // Generated convenience method for modifyVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + ModifyVectorStoreRequest modifyVectorStoreRequestObj = new ModifyVectorStoreRequest(); + BinaryData modifyVectorStoreRequest = BinaryData.fromObject(modifyVectorStoreRequestObj); + return modifyVectorStoreWithResponse(vectorStoreId, modifyVectorStoreRequest, requestOptions).getValue() + .toObject(VectorStore.class); + } + + /** + * Deletes the vector store object matching the specified ID. + * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreDeletionStatus deleteVectorStore(String vectorStoreId) { + // Generated convenience method for deleteVectorStoreWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteVectorStoreWithResponse(vectorStoreId, requestOptions).getValue() + .toObject(VectorStoreDeletionStatus.class); + } + + /** + * Returns a list of vector store files. + * + * @param vectorStoreId Identifier of the vector store. + * @param filter Filter by file status. + * @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 the response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStoreFile listVectorStoreFiles(String vectorStoreId, + VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listVectorStoreFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter.toString(), false); + } + 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 listVectorStoreFilesWithResponse(vectorStoreId, requestOptions).getValue() + .toObject(OpenAIPageableListOfVectorStoreFile.class); + } + + /** + * Returns a list of vector store files. + * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStoreFile listVectorStoreFiles(String vectorStoreId) { + // Generated convenience method for listVectorStoreFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoreFilesWithResponse(vectorStoreId, requestOptions).getValue() + .toObject(OpenAIPageableListOfVectorStoreFile.class); + } + + /** + * Create a vector store file by attaching a file to a vector store. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @param dataSource Azure asset ID. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * @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 description of a file attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFile createVectorStoreFile(String vectorStoreId, String fileId, VectorStoreDataSource dataSource, + VectorStoreChunkingStrategyRequest chunkingStrategy) { + // Generated convenience method for createVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileRequest createVectorStoreFileRequestObj + = new CreateVectorStoreFileRequest().setFileId(fileId) + .setDataSource(dataSource) + .setChunkingStrategy(chunkingStrategy); + BinaryData createVectorStoreFileRequest = BinaryData.fromObject(createVectorStoreFileRequestObj); + return createVectorStoreFileWithResponse(vectorStoreId, createVectorStoreFileRequest, requestOptions).getValue() + .toObject(VectorStoreFile.class); + } + + /** + * Create a vector store file by attaching a file to a vector store. + * + * @param vectorStoreId Identifier of the vector store. + * @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 description of a file attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFile createVectorStoreFile(String vectorStoreId) { + // Generated convenience method for createVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileRequest createVectorStoreFileRequestObj = new CreateVectorStoreFileRequest(); + BinaryData createVectorStoreFileRequest = BinaryData.fromObject(createVectorStoreFileRequestObj); + return createVectorStoreFileWithResponse(vectorStoreId, createVectorStoreFileRequest, requestOptions).getValue() + .toObject(VectorStoreFile.class); + } + + /** + * Retrieves a vector store file. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier 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 description of a file attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFile getVectorStoreFile(String vectorStoreId, String fileId) { + // Generated convenience method for getVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions).getValue() + .toObject(VectorStoreFile.class); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier 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 response object for deleting a vector store file relationship. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFileDeletionStatus deleteVectorStoreFile(String vectorStoreId, String fileId) { + // Generated convenience method for deleteVectorStoreFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteVectorStoreFileWithResponse(vectorStoreId, fileId, requestOptions).getValue() + .toObject(VectorStoreFileDeletionStatus.class); + } + + /** + * Create a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param fileIds List of file identifiers. + * @param dataSources List of Azure assets. + * @param chunkingStrategy The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + * @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 batch of files attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFileBatch createVectorStoreFileBatch(String vectorStoreId, List fileIds, + List dataSources, VectorStoreChunkingStrategyRequest chunkingStrategy) { + // Generated convenience method for createVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequestObj + = new CreateVectorStoreFileBatchRequest().setFileIds(fileIds) + .setDataSources(dataSources) + .setChunkingStrategy(chunkingStrategy); + BinaryData createVectorStoreFileBatchRequest = BinaryData.fromObject(createVectorStoreFileBatchRequestObj); + return createVectorStoreFileBatchWithResponse(vectorStoreId, createVectorStoreFileBatchRequest, requestOptions) + .getValue() + .toObject(VectorStoreFileBatch.class); + } + + /** + * Create a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @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 batch of files attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFileBatch createVectorStoreFileBatch(String vectorStoreId) { + // Generated convenience method for createVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequestObj + = new CreateVectorStoreFileBatchRequest(); + BinaryData createVectorStoreFileBatchRequest = BinaryData.fromObject(createVectorStoreFileBatchRequestObj); + return createVectorStoreFileBatchWithResponse(vectorStoreId, createVectorStoreFileBatchRequest, requestOptions) + .getValue() + .toObject(VectorStoreFileBatch.class); + } + + /** + * Retrieve a vector store file batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFileBatch getVectorStoreFileBatch(String vectorStoreId, String batchId) { + // Generated convenience method for getVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions).getValue() + .toObject(VectorStoreFileBatch.class); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VectorStoreFileBatch cancelVectorStoreFileBatch(String vectorStoreId, String batchId) { + // Generated convenience method for cancelVectorStoreFileBatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return cancelVectorStoreFileBatchWithResponse(vectorStoreId, batchId, requestOptions).getValue() + .toObject(VectorStoreFileBatch.class); + } + + /** + * Returns a list of vector store files in a batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @param filter Filter by file status. + * @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 the response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStoreFile listVectorStoreFileBatchFiles(String vectorStoreId, String batchId, + VectorStoreFileStatusFilter filter, Integer limit, ListSortOrder order, String after, String before) { + // Generated convenience method for listVectorStoreFileBatchFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter.toString(), false); + } + 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 listVectorStoreFileBatchFilesWithResponse(vectorStoreId, batchId, requestOptions).getValue() + .toObject(OpenAIPageableListOfVectorStoreFile.class); + } + + /** + * Returns a list of vector store files in a batch. + * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfVectorStoreFile listVectorStoreFileBatchFiles(String vectorStoreId, String batchId) { + // Generated convenience method for listVectorStoreFileBatchFilesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listVectorStoreFileBatchFilesWithResponse(vectorStoreId, batchId, requestOptions).getValue() + .toObject(OpenAIPageableListOfVectorStoreFile.class); + } + + /** + * Creates a new streaming run for an agent thread. + * + * @param options Options for createRun API. + * @return data representing a single evaluation run of an agent 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Flux createRunStreaming(CreateRunOptions options) { + // Generated convenience method for createRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + String threadId = options.getThreadId(); + List include = options.getInclude(); + CreateRunRequest createRunRequestObj + = new CreateRunRequest(options.getAssistantId()).setModel(options.getModel()) + .setInstructions(options.getInstructions()) + .setAdditionalInstructions(options.getAdditionalInstructions()) + .setAdditionalMessages(options.getAdditionalMessages()) + .setTools(options.getTools()) + .setStream(true) + .setTemperature(options.getTemperature()) + .setTopP(options.getTopP()) + .setMaxPromptTokens(options.getMaxPromptTokens()) + .setMaxCompletionTokens(options.getMaxCompletionTokens()) + .setTruncationStrategy(options.getTruncationStrategy()) + .setToolChoice(options.getToolChoice()) + .setResponseFormat(options.getResponseFormat()) + .setParallelToolCalls(options.isParallelToolCalls()) + .setMetadata(options.getMetadata()); + BinaryData createRunRequest = BinaryData.fromObject(createRunRequestObj); + if (include != null) { + requestOptions.addQueryParam("include[]", + include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + Flux response + = createRunWithResponse(threadId, createRunRequest, requestOptions).getValue().toFluxByteBuffer(); + AgentServerSentEvents eventStream = new AgentServerSentEvents(response); + return eventStream.getEvents(); + } + + /** + * Submits outputs from tools as requested by tool calls in a run with streaming updates. + * Runs that need submitted tool outputs will have a status of 'requires_action' + * with a required_action.type of 'submit_tool_outputs'. + * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @return data representing a single evaluation run of an agent 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Flux submitToolOutputsToRunStreaming(String threadId, String runId, + List toolOutputs) { + // Generated convenience method for submitToolOutputsToRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequestObj + = new SubmitToolOutputsToRunRequest(toolOutputs).setStream(true); + BinaryData submitToolOutputsToRunRequest = BinaryData.fromObject(submitToolOutputsToRunRequestObj); + Flux response + = submitToolOutputsToRunWithResponse(threadId, runId, submitToolOutputsToRunRequest, requestOptions) + .getValue() + .toFluxByteBuffer(); + AgentServerSentEvents eventStream = new AgentServerSentEvents(response); + return eventStream.getEvents(); + } + + /** + * Gets a list of threads 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)
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             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 threads that were previously created along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listThreadsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listThreadsWithResponse(requestOptions); + } + + /** + * Gets a list of threads 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 threads that were previously created. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfAgentThread listThreads(Integer limit, ListSortOrder order, String after, + String before) { + // Generated convenience method for listThreadsWithResponse + 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 listThreadsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAgentThread.class); + } + + /** + * Gets a list of threads 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 threads that were previously created. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OpenAIPageableListOfAgentThread listThreads() { + // Generated convenience method for listThreadsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listThreadsWithResponse(requestOptions).getValue().toObject(OpenAIPageableListOfAgentThread.class); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @param attachments A list of files attached to the message, and the tools they should be added to. + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage createMessage(String threadId, MessageRole role, BinaryData content, + List attachments, Map metadata) { + // Generated convenience method for createMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateMessageRequest createMessageRequestObj + = new CreateMessageRequest(role, content).setAttachments(attachments).setMetadata(metadata); + BinaryData createMessageRequest = BinaryData.fromObject(createMessageRequestObj); + return createMessageWithResponse(threadId, createMessageRequest, requestOptions).getValue() + .toObject(ThreadMessage.class); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @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 agent thread. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage createMessage(String threadId, MessageRole role, BinaryData content) { + // Generated convenience method for createMessageWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateMessageRequest createMessageRequestObj = new CreateMessageRequest(role, content); + BinaryData createMessageRequest = BinaryData.fromObject(createMessageRequestObj); + return createMessageWithResponse(threadId, createMessageRequest, requestOptions).getValue() + .toObject(ThreadMessage.class); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @param attachments A list of files attached to the message, and the tools they should be added to. + * @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. + * @return a single, existing message within an agent 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage createMessage(String threadId, MessageRole role, String content, + List attachments, Map metadata) { + // Generated convenience method for createMessageWithResponse + BinaryData binaryContent = BinaryData.fromString(content); + return this.createMessage(threadId, role, binaryContent, attachments, metadata); + } + + /** + * Creates a new message on a specified thread. + * + * @param threadId Identifier of the thread. + * @param role The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * @param content The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * @return a single, existing message within an agent 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreadMessage createMessage(String threadId, MessageRole role, String content) { + // Generated convenience method for createMessageWithResponse + BinaryData binaryContent = BinaryData.fromString(content); + return this.createMessage(threadId, role, binaryContent); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsAsyncClient.java new file mode 100644 index 000000000000..31b9020e275d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsAsyncClient.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.ConnectionsImpl; +import com.azure.ai.projects.implementation.models.GetConnectionResponse; +import com.azure.ai.projects.implementation.models.GetConnectionWithSecretsRequest; +import com.azure.ai.projects.implementation.models.GetWorkspaceResponse; +import com.azure.ai.projects.implementation.models.ListConnectionsResponse; +import com.azure.ai.projects.models.ConnectionType; +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 reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) +public final class ConnectionsAsyncClient { + + @Generated + private final ConnectionsImpl serviceClient; + + /** + * Initializes an instance of ConnectionsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConnectionsAsyncClient(ConnectionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets the properties of the specified machine learning workspace. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         applicationInsights: String (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 the properties of the specified machine learning workspace along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWorkspaceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWorkspaceWithResponseAsync(requestOptions); + } + + /** + * List the details of all the connections (not including their credentials). + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
categoryStringNoCategory of the workspace connection. Allowed values: + * "AzureOpenAI", "Serverless", "AzureBlob", "AIServices", "CognitiveSearch", "ApiKey", "CustomKeys", + * "CognitiveService".
includeAllBooleanNoIndicates whether to list datastores. Service default: do + * not list datastores.
targetStringNoTarget of the workspace connection.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             properties (Required): {
+     *                 authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *                 category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *                 target: String (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 response from the list operation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> listConnectionsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listConnectionsWithResponseAsync(requestOptions); + } + + /** + * Get the details of a single connection, without credentials. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getConnectionWithResponse(String connectionName, RequestOptions requestOptions) { + return this.serviceClient.getConnectionWithResponseAsync(connectionName, requestOptions); + } + + /** + * Get the details of a single connection, including credentials (if available). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     ignored: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @param getConnectionWithSecretsRequest The getConnectionWithSecretsRequest 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 the details of a single connection, including credentials (if available) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getConnectionWithSecretsWithResponse(String connectionName, + BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions) { + return this.serviceClient.getConnectionWithSecretsWithResponseAsync(connectionName, + getConnectionWithSecretsRequest, requestOptions); + } + + /** + * Gets the properties of the specified machine learning workspace. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 properties of the specified machine learning workspace on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getWorkspace() { + // Generated convenience method for getWorkspaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWorkspaceWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetWorkspaceResponse.class)); + } + + /** + * List the details of all the connections (not including their credentials). + * + * @param category Category of the workspace connection. + * @param includeAll Indicates whether to list datastores. Service default: do not list datastores. + * @param target Target of the workspace connection. + * @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 response from the list operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono listConnections(ConnectionType category, Boolean includeAll, String target) { + // Generated convenience method for listConnectionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (category != null) { + requestOptions.addQueryParam("category", category.toString(), false); + } + if (includeAll != null) { + requestOptions.addQueryParam("includeAll", String.valueOf(includeAll), false); + } + if (target != null) { + requestOptions.addQueryParam("target", target, false); + } + return listConnectionsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ListConnectionsResponse.class)); + } + + /** + * List the details of all the connections (not including their credentials). + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 response from the list operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono listConnections() { + // Generated convenience method for listConnectionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listConnectionsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ListConnectionsResponse.class)); + } + + /** + * Get the details of a single connection, without credentials. + * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getConnection(String connectionName) { + // Generated convenience method for getConnectionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getConnectionWithResponse(connectionName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetConnectionResponse.class)); + } + + /** + * Get the details of a single connection, including credentials (if available). + * + * @param connectionName Connection Name. + * @param ignored The body is ignored. TODO: Can we remove this?. + * @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 details of a single connection, including credentials (if available) on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getConnectionWithSecrets(String connectionName, String ignored) { + // Generated convenience method for getConnectionWithSecretsWithResponse + RequestOptions requestOptions = new RequestOptions(); + GetConnectionWithSecretsRequest getConnectionWithSecretsRequestObj + = new GetConnectionWithSecretsRequest(ignored); + BinaryData getConnectionWithSecretsRequest = BinaryData.fromObject(getConnectionWithSecretsRequestObj); + return getConnectionWithSecretsWithResponse(connectionName, getConnectionWithSecretsRequest, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetConnectionResponse.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsClient.java new file mode 100644 index 000000000000..540760739812 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ConnectionsClient.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.ConnectionsImpl; +import com.azure.ai.projects.implementation.models.GetConnectionResponse; +import com.azure.ai.projects.implementation.models.GetConnectionWithSecretsRequest; +import com.azure.ai.projects.implementation.models.GetWorkspaceResponse; +import com.azure.ai.projects.implementation.models.ListConnectionsResponse; +import com.azure.ai.projects.models.ConnectionType; +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; + +/** + * Initializes a new instance of the synchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class) +public final class ConnectionsClient { + + @Generated + private final ConnectionsImpl serviceClient; + + /** + * Initializes an instance of ConnectionsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConnectionsClient(ConnectionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets the properties of the specified machine learning workspace. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         applicationInsights: String (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 the properties of the specified machine learning workspace along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWorkspaceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWorkspaceWithResponse(requestOptions); + } + + /** + * List the details of all the connections (not including their credentials). + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
categoryStringNoCategory of the workspace connection. Allowed values: + * "AzureOpenAI", "Serverless", "AzureBlob", "AIServices", "CognitiveSearch", "ApiKey", "CustomKeys", + * "CognitiveService".
includeAllBooleanNoIndicates whether to list datastores. Service default: do + * not list datastores.
targetStringNoTarget of the workspace connection.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             properties (Required): {
+     *                 authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *                 category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *                 target: String (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 response from the list operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listConnectionsWithResponse(requestOptions); + } + + /** + * Get the details of a single connection, without credentials. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getConnectionWithResponse(String connectionName, RequestOptions requestOptions) { + return this.serviceClient.getConnectionWithResponse(connectionName, requestOptions); + } + + /** + * Get the details of a single connection, including credentials (if available). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     ignored: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @param getConnectionWithSecretsRequest The getConnectionWithSecretsRequest 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 the details of a single connection, including credentials (if available) along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getConnectionWithSecretsWithResponse(String connectionName, + BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions) { + return this.serviceClient.getConnectionWithSecretsWithResponse(connectionName, getConnectionWithSecretsRequest, + requestOptions); + } + + /** + * Gets the properties of the specified machine learning workspace. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 properties of the specified machine learning workspace. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + GetWorkspaceResponse getWorkspace() { + // Generated convenience method for getWorkspaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWorkspaceWithResponse(requestOptions).getValue().toObject(GetWorkspaceResponse.class); + } + + /** + * List the details of all the connections (not including their credentials). + * + * @param category Category of the workspace connection. + * @param includeAll Indicates whether to list datastores. Service default: do not list datastores. + * @param target Target of the workspace connection. + * @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 response from the list operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + ListConnectionsResponse listConnections(ConnectionType category, Boolean includeAll, String target) { + // Generated convenience method for listConnectionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (category != null) { + requestOptions.addQueryParam("category", category.toString(), false); + } + if (includeAll != null) { + requestOptions.addQueryParam("includeAll", String.valueOf(includeAll), false); + } + if (target != null) { + requestOptions.addQueryParam("target", target, false); + } + return listConnectionsWithResponse(requestOptions).getValue().toObject(ListConnectionsResponse.class); + } + + /** + * List the details of all the connections (not including their credentials). + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 response from the list operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + ListConnectionsResponse listConnections() { + // Generated convenience method for listConnectionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listConnectionsWithResponse(requestOptions).getValue().toObject(ListConnectionsResponse.class); + } + + /** + * Get the details of a single connection, without credentials. + * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + GetConnectionResponse getConnection(String connectionName) { + // Generated convenience method for getConnectionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getConnectionWithResponse(connectionName, requestOptions).getValue() + .toObject(GetConnectionResponse.class); + } + + /** + * Get the details of a single connection, including credentials (if available). + * + * @param connectionName Connection Name. + * @param ignored The body is ignored. TODO: Can we remove this?. + * @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 details of a single connection, including credentials (if available). + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + GetConnectionResponse getConnectionWithSecrets(String connectionName, String ignored) { + // Generated convenience method for getConnectionWithSecretsWithResponse + RequestOptions requestOptions = new RequestOptions(); + GetConnectionWithSecretsRequest getConnectionWithSecretsRequestObj + = new GetConnectionWithSecretsRequest(ignored); + BinaryData getConnectionWithSecretsRequest = BinaryData.fromObject(getConnectionWithSecretsRequestObj); + return getConnectionWithSecretsWithResponse(connectionName, getConnectionWithSecretsRequest, requestOptions) + .getValue() + .toObject(GetConnectionResponse.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsAsyncClient.java new file mode 100644 index 000000000000..b8825f1eab57 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsAsyncClient.java @@ -0,0 +1,939 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.EvaluationsImpl; +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.ai.projects.models.Evaluation; +import com.azure.ai.projects.models.EvaluationSchedule; +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.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +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.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) +public final class EvaluationsAsyncClient { + + @Generated + private final EvaluationsImpl serviceClient; + + /** + * Initializes an instance of EvaluationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluationsAsyncClient(EvaluationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(id, requestOptions); + } + + /** + * Run the evaluation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param evaluation Evaluation to run. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(BinaryData evaluation, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(evaluation, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Resource update operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(String id, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(id, resource, requestOptions); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getScheduleWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getScheduleWithResponseAsync(name, requestOptions); + } + + /** + * Create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceScheduleWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceScheduleWithResponseAsync(name, resource, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSchedule(RequestOptions requestOptions) { + return this.serviceClient.listScheduleAsync(requestOptions); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> disableScheduleWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.disableScheduleWithResponseAsync(name, requestOptions); + } + + /** + * Resource read operation template. + * + * @param id Identifier of the evaluation. + * @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 evaluation Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)); + } + + /** + * Run the evaluation. + * + * @param evaluation Evaluation to 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 evaluation Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(Evaluation evaluation) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(evaluation), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)); + } + + /** + * Resource list operation template. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @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 paged collection of Evaluation items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(Integer top, Integer skip) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 paged collection of Evaluation items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Resource update operation template. + * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono update(String id, Evaluation resource) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getEvaluationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getEvaluationAccessor().prepareModelForJsonMergePatch(resource, false); + return updateWithResponse(id, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)); + } + + /** + * Resource read operation template. + * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSchedule(String name) { + // Generated convenience method for getScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getScheduleWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationSchedule.class)); + } + + /** + * Create or replace operation template. + * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrReplaceSchedule(String name, EvaluationSchedule resource) { + // Generated convenience method for createOrReplaceScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceScheduleWithResponse(name, BinaryData.fromObject(resource), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationSchedule.class)); + } + + /** + * Resource list operation template. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @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 paged collection of EvaluationSchedule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSchedule(Integer top, Integer skip) { + // Generated convenience method for listSchedule + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + PagedFlux pagedFluxResponse = listSchedule(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationSchedule.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 paged collection of EvaluationSchedule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSchedule() { + // Generated convenience method for listSchedule + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listSchedule(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationSchedule.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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 {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono disableSchedule(String name) { + // Generated convenience method for disableScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return disableScheduleWithResponse(name, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsClient.java new file mode 100644 index 000000000000..aab117efb8f5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationsClient.java @@ -0,0 +1,881 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.EvaluationsImpl; +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.ai.projects.models.Evaluation; +import com.azure.ai.projects.models.EvaluationSchedule; +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.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class) +public final class EvaluationsClient { + + @Generated + private final EvaluationsImpl serviceClient; + + /** + * Initializes an instance of EvaluationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluationsClient(EvaluationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @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 evaluation Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(id, requestOptions); + } + + /** + * Run the evaluation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param evaluation Evaluation to run. + * @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 evaluation Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData evaluation, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(evaluation, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Resource update operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String id, BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponse(id, resource, requestOptions); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getScheduleWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getScheduleWithResponse(name, requestOptions); + } + + /** + * Create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceScheduleWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceScheduleWithResponse(name, resource, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSchedule(RequestOptions requestOptions) { + return this.serviceClient.listSchedule(requestOptions); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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 {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableScheduleWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.disableScheduleWithResponse(name, requestOptions); + } + + /** + * Resource read operation template. + * + * @param id Identifier of the evaluation. + * @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 evaluation Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Evaluation get(String id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).getValue().toObject(Evaluation.class); + } + + /** + * Run the evaluation. + * + * @param evaluation Evaluation to 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 evaluation Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Evaluation create(Evaluation evaluation) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(evaluation), requestOptions).getValue() + .toObject(Evaluation.class); + } + + /** + * Resource list operation template. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @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 paged collection of Evaluation items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Integer skip) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Evaluation.class)); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 paged collection of Evaluation items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Evaluation.class)); + } + + /** + * Resource update operation template. + * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Evaluation update(String id, Evaluation resource) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getEvaluationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getEvaluationAccessor().prepareModelForJsonMergePatch(resource, false); + return updateWithResponse(id, resourceInBinaryData, requestOptions).getValue().toObject(Evaluation.class); + } + + /** + * Resource read operation template. + * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationSchedule getSchedule(String name) { + // Generated convenience method for getScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getScheduleWithResponse(name, requestOptions).getValue().toObject(EvaluationSchedule.class); + } + + /** + * Create or replace operation template. + * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationSchedule createOrReplaceSchedule(String name, EvaluationSchedule resource) { + // Generated convenience method for createOrReplaceScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceScheduleWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() + .toObject(EvaluationSchedule.class); + } + + /** + * Resource list operation template. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @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 paged collection of EvaluationSchedule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSchedule(Integer top, Integer skip) { + // Generated convenience method for listSchedule + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + return serviceClient.listSchedule(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluationSchedule.class)); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if 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 paged collection of EvaluationSchedule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSchedule() { + // Generated convenience method for listSchedule + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listSchedule(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluationSchedule.class)); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void disableSchedule(String name) { + // Generated convenience method for disableScheduleWithResponse + RequestOptions requestOptions = new RequestOptions(); + disableScheduleWithResponse(name, requestOptions).getValue(); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ProjectsServiceVersion.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ProjectsServiceVersion.java new file mode 100644 index 000000000000..b008c29977af --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ProjectsServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ProjectsClient. + */ +public enum ProjectsServiceVersion implements ServiceVersion { + /** + * Enum value 2024-07-01-preview. + */ + V2024_07_01_PREVIEW("2024-07-01-preview"); + + private final String version; + + ProjectsServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ProjectsServiceVersion}. + */ + public static ProjectsServiceVersion getLatest() { + return V2024_07_01_PREVIEW; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryAsyncClient.java new file mode 100644 index 000000000000..ed05798a71ff --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryAsyncClient.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.projects; + +import com.azure.ai.projects.implementation.TelemetriesImpl; +import com.azure.ai.projects.implementation.models.GetAppInsightsResponse; +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 reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) +public final class TelemetryAsyncClient { + + @Generated + private final TelemetriesImpl serviceClient; + + /** + * Initializes an instance of TelemetryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TelemetryAsyncClient(TelemetriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets the properties of the specified Application Insights resource. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         ConnectionString: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getAppInsightsWithResponse(String appInsightsResourceUrl, + RequestOptions requestOptions) { + return this.serviceClient.getAppInsightsWithResponseAsync(appInsightsResourceUrl, requestOptions); + } + + /** + * Gets the properties of the specified Application Insights resource. + * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAppInsights(String appInsightsResourceUrl) { + // Generated convenience method for getAppInsightsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppInsightsWithResponse(appInsightsResourceUrl, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetAppInsightsResponse.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryClient.java new file mode 100644 index 000000000000..e1761c84ec8e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryClient.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects; + +import com.azure.ai.projects.implementation.TelemetriesImpl; +import com.azure.ai.projects.implementation.models.GetAppInsightsResponse; +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; + +/** + * Initializes a new instance of the synchronous AIProjectClient type. + */ +@ServiceClient(builder = AIProjectClientBuilder.class) +public final class TelemetryClient { + + @Generated + private final TelemetriesImpl serviceClient; + + /** + * Initializes an instance of TelemetryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TelemetryClient(TelemetriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets the properties of the specified Application Insights resource. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         ConnectionString: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAppInsightsWithResponse(String appInsightsResourceUrl, RequestOptions requestOptions) { + return this.serviceClient.getAppInsightsWithResponse(appInsightsResourceUrl, requestOptions); + } + + /** + * Gets the properties of the specified Application Insights resource. + * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + GetAppInsightsResponse getAppInsights(String appInsightsResourceUrl) { + // Generated convenience method for getAppInsightsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppInsightsWithResponse(appInsightsResourceUrl, requestOptions).getValue() + .toObject(GetAppInsightsResponse.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AIProjectClientImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AIProjectClientImpl.java new file mode 100644 index 000000000000..98bc35fc092b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AIProjectClientImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.ProjectsServiceVersion; +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.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** + * Initializes a new instance of the AIProjectClient type. + */ +public final class AIProjectClientImpl { + /** + * The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or + * `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure + * region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise + * private link. + */ + private final String endpoint; + + /** + * Gets The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or + * `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure + * region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise + * private link. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The Azure subscription ID. + */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The name of the Azure Resource Group. + */ + private final String resourceGroupName; + + /** + * Gets The name of the Azure Resource Group. + * + * @return the resourceGroupName value. + */ + public String getResourceGroupName() { + return this.resourceGroupName; + } + + /** + * The Azure AI Foundry project name. + */ + private final String projectName; + + /** + * Gets The Azure AI Foundry project name. + * + * @return the projectName value. + */ + public String getProjectName() { + return this.projectName; + } + + /** + * Service version. + */ + private final ProjectsServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProjectsServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * The AgentsImpl object to access its operations. + */ + private final AgentsImpl agents; + + /** + * Gets the AgentsImpl object to access its operations. + * + * @return the AgentsImpl object. + */ + public AgentsImpl getAgents() { + return this.agents; + } + + /** + * The ConnectionsImpl object to access its operations. + */ + private final ConnectionsImpl connections; + + /** + * Gets the ConnectionsImpl object to access its operations. + * + * @return the ConnectionsImpl object. + */ + public ConnectionsImpl getConnections() { + return this.connections; + } + + /** + * The TelemetriesImpl object to access its operations. + */ + private final TelemetriesImpl telemetries; + + /** + * Gets the TelemetriesImpl object to access its operations. + * + * @return the TelemetriesImpl object. + */ + public TelemetriesImpl getTelemetries() { + return this.telemetries; + } + + /** + * The EvaluationsImpl object to access its operations. + */ + private final EvaluationsImpl evaluations; + + /** + * Gets the EvaluationsImpl object to access its operations. + * + * @return the EvaluationsImpl object. + */ + public EvaluationsImpl getEvaluations() { + return this.evaluations; + } + + /** + * Initializes an instance of AIProjectClient client. + * + * @param endpoint The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` + * or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the + * Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the + * Enterprise private link. + * @param subscriptionId The Azure subscription ID. + * @param resourceGroupName The name of the Azure Resource Group. + * @param projectName The Azure AI Foundry project name. + * @param serviceVersion Service version. + */ + public AIProjectClientImpl(String endpoint, String subscriptionId, String resourceGroupName, String projectName, + ProjectsServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, subscriptionId, resourceGroupName, projectName, + serviceVersion); + } + + /** + * Initializes an instance of AIProjectClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` + * or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the + * Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the + * Enterprise private link. + * @param subscriptionId The Azure subscription ID. + * @param resourceGroupName The name of the Azure Resource Group. + * @param projectName The Azure AI Foundry project name. + * @param serviceVersion Service version. + */ + public AIProjectClientImpl(HttpPipeline httpPipeline, String endpoint, String subscriptionId, + String resourceGroupName, String projectName, ProjectsServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, subscriptionId, resourceGroupName, + projectName, serviceVersion); + } + + /** + * Initializes an instance of AIProjectClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` + * or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the + * Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the + * Enterprise private link. + * @param subscriptionId The Azure subscription ID. + * @param resourceGroupName The name of the Azure Resource Group. + * @param projectName The Azure AI Foundry project name. + * @param serviceVersion Service version. + */ + public AIProjectClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String subscriptionId, String resourceGroupName, String projectName, ProjectsServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.resourceGroupName = resourceGroupName; + this.projectName = projectName; + this.serviceVersion = serviceVersion; + this.agents = new AgentsImpl(this); + this.connections = new ConnectionsImpl(this); + this.telemetries = new TelemetriesImpl(this); + this.evaluations = new EvaluationsImpl(this); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AgentsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AgentsImpl.java new file mode 100644 index 000000000000..5bd572a157c8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/AgentsImpl.java @@ -0,0 +1,7737 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.ProjectsServiceVersion; +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.QueryParam; +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.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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Agents. + */ +public final class AgentsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AgentsService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of AgentsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AgentsImpl(AIProjectClientImpl client) { + this.service = RestProxy.create(AgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientAgents to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}") + @ServiceInterface(name = "AIProjectClientAgent") + public interface AgentsService { + @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> createAgent(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createAgentRequest, + 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 createAgentSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createAgentRequest, + 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> listAgents(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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 listAgentsSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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> getAgent(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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 getAgentSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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> updateAgent(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("assistantId") String assistantId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData updateAgentRequest, 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 updateAgentSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("assistantId") String assistantId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData updateAgentRequest, 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> deleteAgent(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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 deleteAgentSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("assistantId") String assistantId, + @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createThreadRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createThreadRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData updateThreadRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData updateThreadRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/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> listThreads(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/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 listThreadsSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createMessageRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createMessageRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("messageId") String messageId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData updateMessageRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("messageId") String messageId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData updateMessageRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createRunRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createRunRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData updateRunRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData updateRunRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData submitToolOutputsToRunRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("threadId") String threadId, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData submitToolOutputsToRunRequest, 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createThreadAndRunRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createThreadAndRunRequest, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData body, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData body, + 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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @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, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("fileId") String fileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/files/{fileId}/content") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFileContent(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("fileId") String fileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/files/{fileId}/content") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFileContentSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("fileId") String fileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/vector_stores") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listVectorStores(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/vector_stores") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listVectorStoresSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/vector_stores") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createVectorStore(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createVectorStoreRequest, + RequestOptions requestOptions, Context context); + + @Post("/vector_stores") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createVectorStoreSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createVectorStoreRequest, + RequestOptions requestOptions, Context context); + + @Get("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getVectorStore(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getVectorStoreSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> modifyVectorStore(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData modifyVectorStoreRequest, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response modifyVectorStoreSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData modifyVectorStoreRequest, RequestOptions requestOptions, + Context context); + + @Delete("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteVectorStore(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/vector_stores/{vectorStoreId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteVectorStoreSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/vector_stores/{vectorStoreId}/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> listVectorStoreFiles(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/vector_stores/{vectorStoreId}/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 listVectorStoreFilesSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/vector_stores/{vectorStoreId}/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> createVectorStoreFile(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createVectorStoreFileRequest, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}/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 createVectorStoreFileSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createVectorStoreFileRequest, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/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> getVectorStoreFile(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("fileId") String fileId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/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 getVectorStoreFileSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("fileId") String fileId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/vector_stores/{vectorStoreId}/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> deleteVectorStoreFile(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("fileId") String fileId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/vector_stores/{vectorStoreId}/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 deleteVectorStoreFileSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("fileId") String fileId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}/file_batches") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createVectorStoreFileBatch(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}/file_batches") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createVectorStoreFileBatchSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/file_batches/{batchId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getVectorStoreFileBatch(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/file_batches/{batchId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getVectorStoreFileBatchSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}/file_batches/{batchId}/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> cancelVectorStoreFileBatch(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/vector_stores/{vectorStoreId}/file_batches/{batchId}/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 cancelVectorStoreFileBatchSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/file_batches/{batchId}/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> listVectorStoreFileBatchFiles(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/vector_stores/{vectorStoreId}/file_batches/{batchId}/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 listVectorStoreFileBatchFilesSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("vectorStoreId") String vectorStoreId, + @PathParam("batchId") String batchId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Creates a new agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Required)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createAgentRequest The createAgentRequest 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 agent that can call the model and use tools along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createAgentWithResponseAsync(BinaryData createAgentRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createAgent(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createAgentRequest, requestOptions, + context)); + } + + /** + * Creates a new agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Required)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createAgentRequest The createAgentRequest 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 agent that can call the model and use tools along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createAgentWithResponse(BinaryData createAgentRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createAgentSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createAgentRequest, requestOptions, + Context.NONE); + } + + /** + * Gets a list of agents 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){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             temperature: Double (Required)
+     *             top_p: Double (Required)
+     *             response_format: BinaryData (Optional)
+     *             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 agents that were previously created along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listAgentsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listAgents(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Gets a list of agents 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){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             temperature: Double (Required)
+     *             top_p: Double (Required)
+     *             response_format: BinaryData (Optional)
+     *             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 agents that were previously created along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAgentsWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listAgentsSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * Retrieves an existing agent. + *

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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent that can call the model and use tools along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAgentWithResponseAsync(String assistantId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getAgent(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, accept, requestOptions, context)); + } + + /** + * Retrieves an existing agent. + *

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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent that can call the model and use tools along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAgentWithResponse(String assistantId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAgentSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, accept, requestOptions, Context.NONE); + } + + /** + * Modifies an existing agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Optional)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId The ID of the agent to modify. + * @param updateAgentRequest The updateAgentRequest 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 agent that can call the model and use tools along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateAgentWithResponseAsync(String assistantId, BinaryData updateAgentRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateAgent(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, contentType, accept, updateAgentRequest, + requestOptions, context)); + } + + /** + * Modifies an existing agent. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     model: String (Optional)
+     *     name: String (Optional)
+     *     description: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     response_format: BinaryData (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){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     temperature: Double (Required)
+     *     top_p: Double (Required)
+     *     response_format: BinaryData (Optional)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param assistantId The ID of the agent to modify. + * @param updateAgentRequest The updateAgentRequest 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 agent that can call the model and use tools along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateAgentWithResponse(String assistantId, BinaryData updateAgentRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateAgentSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, contentType, accept, updateAgentRequest, + requestOptions, Context.NONE); + } + + /** + * Deletes an agent. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAgentWithResponseAsync(String assistantId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteAgent(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, accept, requestOptions, context)); + } + + /** + * Deletes an agent. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param assistantId Identifier of the agent. + * @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 agent deletion operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAgentWithResponse(String assistantId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteAgentSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), assistantId, accept, requestOptions, Context.NONE); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createThreadRequest The createThreadRequest 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 agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createThreadWithResponseAsync(BinaryData createThreadRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createThread(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createThreadRequest, requestOptions, + context)); + } + + /** + * Creates a new thread. Threads contain messages and can be run by agents. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createThreadRequest The createThreadRequest 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 agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createThreadWithResponse(BinaryData createThreadRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createThreadSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createThreadRequest, requestOptions, + Context.NONE); + } + + /** + * Gets information about an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, accept, requestOptions, context)); + } + + /** + * Gets information about an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, accept, requestOptions, Context.NONE); + } + + /** + * Modifies an existing thread. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId The ID of the thread to modify. + * @param updateThreadRequest The updateThreadRequest 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 agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateThreadWithResponseAsync(String threadId, BinaryData updateThreadRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateThread(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, updateThreadRequest, + requestOptions, context)); + } + + /** + * Modifies an existing thread. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     tool_resources (Required): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             data_sources (Optional): [
+     *                  (Optional){
+     *                     uri: String (Required)
+     *                     type: String(uri_asset/id_asset) (Required)
+     *                 }
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             vector_stores (Optional): [
+     *                  (Optional){
+     *                     name: String (Required)
+     *                     configuration (Required): {
+     *                         data_sources (Required): [
+     *                             (recursive schema, see above)
+     *                         ]
+     *                     }
+     *                 }
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId The ID of the thread to modify. + * @param updateThreadRequest The updateThreadRequest 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 agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateThreadWithResponse(String threadId, BinaryData updateThreadRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateThreadSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, updateThreadRequest, + requestOptions, Context.NONE); + } + + /** + * Deletes an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, accept, requestOptions, context)); + } + + /** + * Deletes an existing thread. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, accept, requestOptions, Context.NONE); + } + + /** + * Gets a list of threads 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)
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             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 threads that were previously created along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listThreadsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listThreads(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Gets a list of threads 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)
+     *             tool_resources (Required): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     data_sources (Optional): [
+     *                          (Optional){
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                     vector_stores (Optional): [
+     *                          (Optional){
+     *                             name: String (Required)
+     *                             configuration (Required): {
+     *                                 data_sources (Required): [
+     *                                     (recursive schema, see above)
+     *                                 ]
+     *                             }
+     *                         }
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             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 threads that were previously created along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listThreadsWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listThreadsSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * Creates a new message on a specified thread. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     role: String(user/assistant) (Required)
+     *     content: BinaryData (Required)
+     *     attachments (Optional): [
+     *          (Optional){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     thread_id: String (Required)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createMessageRequest The createMessageRequest 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 agent thread along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createMessageWithResponseAsync(String threadId, BinaryData createMessageRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createMessage(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, createMessageRequest, + requestOptions, context)); + } + + /** + * Creates a new message on a specified thread. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     role: String(user/assistant) (Required)
+     *     content: BinaryData (Required)
+     *     attachments (Optional): [
+     *          (Optional){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     thread_id: String (Required)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createMessageRequest The createMessageRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createMessageWithResponse(String threadId, BinaryData createMessageRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createMessageSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, createMessageRequest, + requestOptions, Context.NONE); + } + + /** + * Gets a list of messages that exist on a thread. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoFilter messages by the run ID that generated them.
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)
+     *             status: String(in_progress/incomplete/completed) (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *             }
+     *             completed_at: Long (Required)
+     *             incomplete_at: Long (Required)
+     *             role: String(user/assistant) (Required)
+     *             content (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             assistant_id: String (Required)
+     *             run_id: String (Required)
+     *             attachments (Required): [
+     *                  (Required){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, accept, requestOptions, context)); + } + + /** + * Gets a list of messages that exist on a thread. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoFilter messages by the run ID that generated them.
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)
+     *             status: String(in_progress/incomplete/completed) (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *             }
+     *             completed_at: Long (Required)
+     *             incomplete_at: Long (Required)
+     *             role: String(user/assistant) (Required)
+     *             content (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             assistant_id: String (Required)
+     *             run_id: String (Required)
+     *             attachments (Required): [
+     *                  (Required){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @param updateMessageRequest The updateMessageRequest 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 agent thread along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateMessageWithResponseAsync(String threadId, String messageId, + BinaryData updateMessageRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateMessage(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, messageId, contentType, accept, + updateMessageRequest, 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)
+     *     status: String(in_progress/incomplete/completed) (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(content_filter/max_tokens/run_cancelled/run_failed/run_expired) (Required)
+     *     }
+     *     completed_at: Long (Required)
+     *     incomplete_at: Long (Required)
+     *     role: String(user/assistant) (Required)
+     *     content (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     assistant_id: String (Required)
+     *     run_id: String (Required)
+     *     attachments (Required): [
+     *          (Required){
+     *             file_id: String (Optional)
+     *             data_source (Optional): {
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *             tools (Required): [
+     *                 BinaryData (Required)
+     *             ]
+     *         }
+     *     ]
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param messageId Identifier of the message. + * @param updateMessageRequest The updateMessageRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateMessageWithResponse(String threadId, String messageId, + BinaryData updateMessageRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateMessageSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, messageId, contentType, accept, + updateMessageRequest, requestOptions, Context.NONE); + } + + /** + * Creates a new run for an agent thread. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assistant_id: String (Required)
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     additional_instructions: String (Optional)
+     *     additional_messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createRunRequest The createRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createRunWithResponseAsync(String threadId, BinaryData createRunRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createRun(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, createRunRequest, + requestOptions, context)); + } + + /** + * Creates a new run for an agent thread. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assistant_id: String (Required)
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     additional_instructions: String (Optional)
+     *     additional_messages (Optional): [
+     *          (Optional){
+     *             role: String(user/assistant) (Required)
+     *             content: BinaryData (Required)
+     *             attachments (Optional): [
+     *                  (Optional){
+     *                     file_id: String (Optional)
+     *                     data_source (Optional): {
+     *                         uri: String (Required)
+     *                         type: String(uri_asset/id_asset) (Required)
+     *                     }
+     *                     tools (Required): [
+     *                         BinaryData (Required)
+     *                     ]
+     *                 }
+     *             ]
+     *             metadata (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param createRunRequest The createRunRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createRunWithResponse(String threadId, BinaryData createRunRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createRunSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, contentType, accept, createRunRequest, + 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): {
+     *                 type: String (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String (Required)
+     *                 message: String (Required)
+     *             }
+     *             model: String (Required)
+     *             instructions: String (Required)
+     *             tools (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             created_at: long (Required)
+     *             expires_at: Long (Required)
+     *             started_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *             }
+     *             usage (Required): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             temperature: Double (Optional)
+     *             top_p: Double (Optional)
+     *             max_prompt_tokens: Integer (Required)
+     *             max_completion_tokens: Integer (Required)
+     *             truncation_strategy (Required): {
+     *                 type: String(auto/last_messages) (Required)
+     *                 last_messages: Integer (Optional)
+     *             }
+     *             tool_choice: BinaryData (Required)
+     *             response_format: BinaryData (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *             tool_resources (Optional): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             parallel_tool_calls: boolean (Required)
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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): {
+     *                 type: String (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String (Required)
+     *                 message: String (Required)
+     *             }
+     *             model: String (Required)
+     *             instructions: String (Required)
+     *             tools (Required): [
+     *                  (Required){
+     *                     type: String (Required)
+     *                 }
+     *             ]
+     *             created_at: long (Required)
+     *             expires_at: Long (Required)
+     *             started_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             incomplete_details (Required): {
+     *                 reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *             }
+     *             usage (Required): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             temperature: Double (Optional)
+     *             top_p: Double (Optional)
+     *             max_prompt_tokens: Integer (Required)
+     *             max_completion_tokens: Integer (Required)
+     *             truncation_strategy (Required): {
+     *                 type: String(auto/last_messages) (Required)
+     *                 last_messages: Integer (Optional)
+     *             }
+     *             tool_choice: BinaryData (Required)
+     *             response_format: BinaryData (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *             tool_resources (Optional): {
+     *                 code_interpreter (Optional): {
+     *                     file_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 file_search (Optional): {
+     *                     vector_store_ids (Optional): [
+     *                         String (Optional)
+     *                     ]
+     *                 }
+     *                 azure_ai_search (Optional): {
+     *                     indexes (Optional): [
+     *                          (Optional){
+     *                             index_connection_id: String (Required)
+     *                             index_name: String (Required)
+     *                             query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                             top_k: Integer (Optional)
+     *                             filter: String (Optional)
+     *                         }
+     *                     ]
+     *                 }
+     *             }
+     *             parallel_tool_calls: boolean (Required)
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the 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 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param updateRunRequest The updateRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateRunWithResponseAsync(String threadId, String runId, + BinaryData updateRunRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateRun(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, contentType, accept, updateRunRequest, + 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param updateRunRequest The updateRunRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateRunWithResponse(String threadId, String runId, BinaryData updateRunRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateRunSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, contentType, accept, updateRunRequest, + 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)
+     *         }
+     *     ]
+     *     stream: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param submitToolOutputsToRunRequest The submitToolOutputsToRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> submitToolOutputsToRunWithResponseAsync(String threadId, String runId, + BinaryData submitToolOutputsToRunRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.submitToolOutputsToRun(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, contentType, accept, + submitToolOutputsToRunRequest, 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)
+     *         }
+     *     ]
+     *     stream: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param submitToolOutputsToRunRequest The submitToolOutputsToRunRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response submitToolOutputsToRunWithResponse(String threadId, String runId, + BinaryData submitToolOutputsToRunRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.submitToolOutputsToRunSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, contentType, accept, + submitToolOutputsToRunRequest, 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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 agent 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, accept, requestOptions, Context.NONE); + } + + /** + * Creates a new agent 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: BinaryData (Required)
+     *                 attachments (Optional): [
+     *                      (Optional){
+     *                         file_id: String (Optional)
+     *                         data_source (Optional): {
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                         tools (Required): [
+     *                             BinaryData (Required)
+     *                         ]
+     *                     }
+     *                 ]
+     *                 metadata (Optional): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *         ]
+     *         tool_resources (Optional): {
+     *             code_interpreter (Optional): {
+     *                 file_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 data_sources (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             file_search (Optional): {
+     *                 vector_store_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 vector_stores (Optional): [
+     *                      (Optional){
+     *                         name: String (Required)
+     *                         configuration (Required): {
+     *                             data_sources (Required): [
+     *                                 (recursive schema, see above)
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             azure_ai_search (Optional): {
+     *                 indexes (Optional): [
+     *                      (Optional){
+     *                         index_connection_id: String (Required)
+     *                         index_name: String (Required)
+     *                         query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                         top_k: Integer (Optional)
+     *                         filter: String (Optional)
+     *                     }
+     *                 ]
+     *             }
+     *         }
+     *         metadata (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): (recursive schema, see azure_ai_search above)
+     *     }
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param createThreadAndRunRequest The createThreadAndRunRequest 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 agent thread along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createThreadAndRunWithResponseAsync(BinaryData createThreadAndRunRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createThreadAndRun(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createThreadAndRunRequest, + requestOptions, context)); + } + + /** + * Creates a new agent 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: BinaryData (Required)
+     *                 attachments (Optional): [
+     *                      (Optional){
+     *                         file_id: String (Optional)
+     *                         data_source (Optional): {
+     *                             uri: String (Required)
+     *                             type: String(uri_asset/id_asset) (Required)
+     *                         }
+     *                         tools (Required): [
+     *                             BinaryData (Required)
+     *                         ]
+     *                     }
+     *                 ]
+     *                 metadata (Optional): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *         ]
+     *         tool_resources (Optional): {
+     *             code_interpreter (Optional): {
+     *                 file_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 data_sources (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             file_search (Optional): {
+     *                 vector_store_ids (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 vector_stores (Optional): [
+     *                      (Optional){
+     *                         name: String (Required)
+     *                         configuration (Required): {
+     *                             data_sources (Required): [
+     *                                 (recursive schema, see above)
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             azure_ai_search (Optional): {
+     *                 indexes (Optional): [
+     *                      (Optional){
+     *                         index_connection_id: String (Required)
+     *                         index_name: String (Required)
+     *                         query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                         top_k: Integer (Optional)
+     *                         filter: String (Optional)
+     *                     }
+     *                 ]
+     *             }
+     *         }
+     *         metadata (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     model: String (Optional)
+     *     instructions: String (Optional)
+     *     tools (Optional): [
+     *          (Optional){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): (recursive schema, see azure_ai_search above)
+     *     }
+     *     stream: Boolean (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Optional)
+     *     max_completion_tokens: Integer (Optional)
+     *     truncation_strategy (Optional): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Optional)
+     *     response_format: BinaryData (Optional)
+     *     parallel_tool_calls: Boolean (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): {
+     *         type: String (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *     }
+     *     model: String (Required)
+     *     instructions: String (Required)
+     *     tools (Required): [
+     *          (Required){
+     *             type: String (Required)
+     *         }
+     *     ]
+     *     created_at: long (Required)
+     *     expires_at: Long (Required)
+     *     started_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     incomplete_details (Required): {
+     *         reason: String(max_completion_tokens/max_prompt_tokens) (Required)
+     *     }
+     *     usage (Required): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     max_prompt_tokens: Integer (Required)
+     *     max_completion_tokens: Integer (Required)
+     *     truncation_strategy (Required): {
+     *         type: String(auto/last_messages) (Required)
+     *         last_messages: Integer (Optional)
+     *     }
+     *     tool_choice: BinaryData (Required)
+     *     response_format: BinaryData (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     *     tool_resources (Optional): {
+     *         code_interpreter (Optional): {
+     *             file_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         file_search (Optional): {
+     *             vector_store_ids (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         azure_ai_search (Optional): {
+     *             indexes (Optional): [
+     *                  (Optional){
+     *                     index_connection_id: String (Required)
+     *                     index_name: String (Required)
+     *                     query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
+     *                     top_k: Integer (Optional)
+     *                     filter: String (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     }
+     *     parallel_tool_calls: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param createThreadAndRunRequest The createThreadAndRunRequest 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 agent thread along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createThreadAndRunWithResponse(BinaryData createThreadAndRunRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createThreadAndRunSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createThreadAndRunRequest, + requestOptions, Context.NONE); + } + + /** + * Gets a single run step from a thread run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

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): {
+     *         type: String(message_creation/tool_calls) (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String(server_error/rate_limit_exceeded) (Required)
+     *         message: String (Required)
+     *     }
+     *     created_at: long (Required)
+     *     expired_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     usage (Optional): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, stepId, accept, requestOptions, context)); + } + + /** + * Gets a single run step from a thread run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

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): {
+     *         type: String(message_creation/tool_calls) (Required)
+     *     }
+     *     last_error (Required): {
+     *         code: String(server_error/rate_limit_exceeded) (Required)
+     *         message: String (Required)
+     *     }
+     *     created_at: long (Required)
+     *     expired_at: Long (Required)
+     *     completed_at: Long (Required)
+     *     cancelled_at: Long (Required)
+     *     failed_at: Long (Required)
+     *     usage (Optional): {
+     *         completion_tokens: long (Required)
+     *         prompt_tokens: long (Required)
+     *         total_tokens: long (Required)
+     *     }
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @param stepId Identifier of the run step. + * @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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, stepId, accept, requestOptions, + Context.NONE); + } + + /** + * Gets a list of run steps from a thread run. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
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): {
+     *                 type: String(message_creation/tool_calls) (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String(server_error/rate_limit_exceeded) (Required)
+     *                 message: String (Required)
+     *             }
+     *             created_at: long (Required)
+     *             expired_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             usage (Optional): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, accept, requestOptions, context)); + } + + /** + * Gets a list of run steps from a thread run. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
include[]List<String>NoA list of additional fields to include in the + * response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. In the form of "," separated string.
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): {
+     *                 type: String(message_creation/tool_calls) (Required)
+     *             }
+     *             last_error (Required): {
+     *                 code: String(server_error/rate_limit_exceeded) (Required)
+     *                 message: String (Required)
+     *             }
+     *             created_at: long (Required)
+     *             expired_at: Long (Required)
+     *             completed_at: Long (Required)
+     *             cancelled_at: Long (Required)
+     *             failed_at: Long (Required)
+     *             usage (Optional): {
+     *                 completion_tokens: long (Required)
+     *                 prompt_tokens: long (Required)
+     *                 total_tokens: long (Required)
+     *             }
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param threadId Identifier of the thread. + * @param runId Identifier of the run. + * @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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), threadId, runId, accept, requestOptions, Context.NONE); + } + + /** + * Gets a list of previously uploaded files. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
purposeStringNoThe purpose of the file. Allowed values: "fine-tune", + * "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision".
+ * 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/batch/batch_output/vision) (Required)
+     *             status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *             status_details: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Gets a list of previously uploaded files. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
purposeStringNoThe purpose of the file. Allowed values: "fine-tune", + * "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision".
+ * 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/batch/batch_output/vision) (Required)
+     *             status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *             status_details: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * Uploads a file for use by other operations. + *

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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body Multipart body. + * @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 agent 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 body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.uploadFile(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * Uploads a file for use by other operations. + *

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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body Multipart body. + * @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 agent that can call the model and use tools along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadFileWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return service.uploadFileSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, body, 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 agent 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.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), 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/batch/batch_output/vision) (Required)
+     *     status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
+     *     status_details: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 agent 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.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), fileId, accept, requestOptions, Context.NONE); + } + + /** + * Retrieves the raw content of a specific file. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFileContentWithResponseAsync(String fileId, RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return FluxUtil.withContext(context -> service.getFileContent(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), fileId, accept, requestOptions, context)); + } + + /** + * Retrieves the raw content of a specific file. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @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 the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFileContentWithResponse(String fileId, RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return service.getFileContentSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), fileId, accept, requestOptions, Context.NONE); + } + + /** + * Returns a list of vector stores. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for + * ascending order and desc for descending order. Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the + * list.
+ * You can add these to a request with {@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)
+     *             usage_bytes: int (Required)
+     *             file_counts (Required): {
+     *                 in_progress: int (Required)
+     *                 completed: int (Required)
+     *                 failed: int (Required)
+     *                 cancelled: int (Required)
+     *                 total: int (Required)
+     *             }
+     *             status: String(expired/in_progress/completed) (Required)
+     *             expires_after (Optional): {
+     *                 anchor: String(last_active_at) (Required)
+     *                 days: int (Required)
+     *             }
+     *             expires_at: Long (Optional)
+     *             last_active_at: Long (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoresWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listVectorStores(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Returns a list of vector stores. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
orderStringNoSort order by the created_at timestamp of the objects. asc for + * ascending order and desc for descending order. Allowed values: "asc", "desc".
afterStringNoA cursor for use in pagination. after is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
beforeStringNoA cursor for use in pagination. before is an object ID that + * defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with + * obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the + * list.
+ * You can add these to a request with {@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)
+     *             usage_bytes: int (Required)
+     *             file_counts (Required): {
+     *                 in_progress: int (Required)
+     *                 completed: int (Required)
+     *                 failed: int (Required)
+     *                 cancelled: int (Required)
+     *                 total: int (Required)
+     *             }
+     *             status: String(expired/in_progress/completed) (Required)
+     *             expires_after (Optional): {
+     *                 anchor: String(last_active_at) (Required)
+     *                 days: int (Required)
+     *             }
+     *             expires_at: Long (Optional)
+     *             last_active_at: Long (Required)
+     *             metadata (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @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 response data for a requested list of items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoresWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listVectorStoresSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * Creates a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     name: String (Optional)
+     *     configuration (Optional): {
+     *         data_sources (Required): [
+     *              (Required){
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *         ]
+     *     }
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createVectorStoreRequest The createVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreWithResponseAsync(BinaryData createVectorStoreRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createVectorStore(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createVectorStoreRequest, requestOptions, + context)); + } + + /** + * Creates a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     name: String (Optional)
+     *     configuration (Optional): {
+     *         data_sources (Required): [
+     *              (Required){
+     *                 uri: String (Required)
+     *                 type: String(uri_asset/id_asset) (Required)
+     *             }
+     *         ]
+     *     }
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param createVectorStoreRequest The createVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreWithResponse(BinaryData createVectorStoreRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createVectorStoreSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, createVectorStoreRequest, requestOptions, + Context.NONE); + } + + /** + * Returns the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreWithResponseAsync(String vectorStoreId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getVectorStore(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, context)); + } + + /** + * Returns the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreWithResponse(String vectorStoreId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getVectorStoreSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, Context.NONE); + } + + /** + * The ID of the vector store to modify. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param modifyVectorStoreRequest The modifyVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modifyVectorStoreWithResponseAsync(String vectorStoreId, + BinaryData modifyVectorStoreRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.modifyVectorStore(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, modifyVectorStoreRequest, + requestOptions, context)); + } + + /** + * The ID of the vector store to modify. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     name: String (Required)
+     *     usage_bytes: int (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     *     status: String(expired/in_progress/completed) (Required)
+     *     expires_after (Optional): {
+     *         anchor: String(last_active_at) (Required)
+     *         days: int (Required)
+     *     }
+     *     expires_at: Long (Optional)
+     *     last_active_at: Long (Required)
+     *     metadata (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param modifyVectorStoreRequest The modifyVectorStoreRequest 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 vector store is a collection of processed files can be used by the `file_search` tool along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modifyVectorStoreWithResponse(String vectorStoreId, BinaryData modifyVectorStoreRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.modifyVectorStoreSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, modifyVectorStoreRequest, + requestOptions, Context.NONE); + } + + /** + * Deletes the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVectorStoreWithResponseAsync(String vectorStoreId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteVectorStore(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, context)); + } + + /** + * Deletes the vector store object matching the specified ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response object for deleting a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVectorStoreWithResponse(String vectorStoreId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteVectorStoreSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, Context.NONE); + } + + /** + * Returns a list of vector store files. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoreFilesWithResponseAsync(String vectorStoreId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listVectorStoreFiles(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, context)); + } + + /** + * Returns a list of vector store files. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @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 response data for a requested list of items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoreFilesWithResponse(String vectorStoreId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listVectorStoreFilesSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, accept, requestOptions, Context.NONE); + } + + /** + * Create a vector store file by attaching a file to a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Optional)
+     *     data_source (Optional): {
+     *         uri: String (Required)
+     *         type: String(uri_asset/id_asset) (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileRequest The createVectorStoreFileRequest 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 description of a file attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreFileWithResponseAsync(String vectorStoreId, + BinaryData createVectorStoreFileRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createVectorStoreFile(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, + createVectorStoreFileRequest, requestOptions, context)); + } + + /** + * Create a vector store file by attaching a file to a vector store. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Optional)
+     *     data_source (Optional): {
+     *         uri: String (Required)
+     *         type: String(uri_asset/id_asset) (Required)
+     *     }
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileRequest The createVectorStoreFileRequest 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 description of a file attached to a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreFileWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createVectorStoreFileSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, + createVectorStoreFileRequest, requestOptions, Context.NONE); + } + + /** + * Retrieves a vector store file. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 description of a file attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreFileWithResponseAsync(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getVectorStoreFile(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, fileId, accept, requestOptions, context)); + } + + /** + * Retrieves a vector store file. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     usage_bytes: int (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/failed/cancelled) (Required)
+     *     last_error (Required): {
+     *         code: String(server_error/invalid_file/unsupported_file) (Required)
+     *         message: String (Required)
+     *     }
+     *     chunking_strategy (Required): {
+     *         type: String(other/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 description of a file attached to a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getVectorStoreFileSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, fileId, accept, requestOptions, Context.NONE); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 response object for deleting a vector store file relationship along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVectorStoreFileWithResponseAsync(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteVectorStoreFile(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, fileId, accept, requestOptions, context)); + } + + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be + * deleted. + * To delete the file, use the delete file endpoint. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     deleted: boolean (Required)
+     *     object: String (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param fileId Identifier of the file. + * @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 response object for deleting a vector store file relationship along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVectorStoreFileWithResponse(String vectorStoreId, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteVectorStoreFileSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, fileId, accept, requestOptions, Context.NONE); + } + + /** + * Create a vector store file batch. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     data_sources (Optional): [
+     *          (Optional){
+     *             uri: String (Required)
+     *             type: String(uri_asset/id_asset) (Required)
+     *         }
+     *     ]
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileBatchRequest The createVectorStoreFileBatchRequest 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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVectorStoreFileBatchWithResponseAsync(String vectorStoreId, + BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createVectorStoreFileBatch(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, + createVectorStoreFileBatchRequest, requestOptions, context)); + } + + /** + * Create a vector store file batch. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_ids (Optional): [
+     *         String (Optional)
+     *     ]
+     *     data_sources (Optional): [
+     *          (Optional){
+     *             uri: String (Required)
+     *             type: String(uri_asset/id_asset) (Required)
+     *         }
+     *     ]
+     *     chunking_strategy (Optional): {
+     *         type: String(auto/static) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param createVectorStoreFileBatchRequest The createVectorStoreFileBatchRequest 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 batch of files attached to a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVectorStoreFileBatchWithResponse(String vectorStoreId, + BinaryData createVectorStoreFileBatchRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createVectorStoreFileBatchSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, contentType, accept, + createVectorStoreFileBatchRequest, requestOptions, Context.NONE); + } + + /** + * Retrieve a vector store file batch. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVectorStoreFileBatchWithResponseAsync(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getVectorStoreFileBatch(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, context)); + } + + /** + * Retrieve a vector store file batch. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getVectorStoreFileBatchSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, Context.NONE); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelVectorStoreFileBatchWithResponseAsync(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.cancelVectorStoreFileBatch(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, context)); + } + + /** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as + * possible. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     object: String (Required)
+     *     created_at: long (Required)
+     *     vector_store_id: String (Required)
+     *     status: String(in_progress/completed/cancelled/failed) (Required)
+     *     file_counts (Required): {
+     *         in_progress: int (Required)
+     *         completed: int (Required)
+     *         failed: int (Required)
+     *         cancelled: int (Required)
+     *         total: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 batch of files attached to a vector store along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelVectorStoreFileBatchWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.cancelVectorStoreFileBatchSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, Context.NONE); + } + + /** + * Returns a list of vector store files in a batch. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listVectorStoreFileBatchFilesWithResponseAsync(String vectorStoreId, + String batchId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listVectorStoreFileBatchFiles(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, context)); + } + + /** + * Returns a list of vector store files in a batch. + *

Query Parameters

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

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     object: String (Required)
+     *     data (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             object: String (Required)
+     *             usage_bytes: int (Required)
+     *             created_at: long (Required)
+     *             vector_store_id: String (Required)
+     *             status: String(in_progress/completed/failed/cancelled) (Required)
+     *             last_error (Required): {
+     *                 code: String(server_error/invalid_file/unsupported_file) (Required)
+     *                 message: String (Required)
+     *             }
+     *             chunking_strategy (Required): {
+     *                 type: String(other/static) (Required)
+     *             }
+     *         }
+     *     ]
+     *     first_id: String (Required)
+     *     last_id: String (Required)
+     *     has_more: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param vectorStoreId Identifier of the vector store. + * @param batchId Identifier of the file batch. + * @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 response data for a requested list of items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listVectorStoreFileBatchFilesWithResponse(String vectorStoreId, String batchId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listVectorStoreFileBatchFilesSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), vectorStoreId, batchId, accept, requestOptions, Context.NONE); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/ConnectionsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/ConnectionsImpl.java new file mode 100644 index 000000000000..5a38dc692ac4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/ConnectionsImpl.java @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.core.annotation.BodyParam; +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.QueryParam; +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.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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Connections. + */ +public final class ConnectionsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of ConnectionsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConnectionsImpl(AIProjectClientImpl client) { + this.service + = RestProxy.create(ConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientConnections to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}") + @ServiceInterface(name = "AIProjectClientConne") + public interface ConnectionsService { + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWorkspace(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWorkspaceSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/connections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listConnections(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/connections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listConnectionsSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/connections/{connectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getConnection(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("connectionName") String connectionName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/connections/{connectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getConnectionSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("connectionName") String connectionName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/connections/{connectionName}/listsecrets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getConnectionWithSecrets(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("connectionName") String connectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions, + Context context); + + @Post("/connections/{connectionName}/listsecrets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getConnectionWithSecretsSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("connectionName") String connectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions, + Context context); + } + + /** + * Gets the properties of the specified machine learning workspace. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         applicationInsights: String (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 the properties of the specified machine learning workspace along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWorkspaceWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getWorkspace(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Gets the properties of the specified machine learning workspace. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         applicationInsights: String (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 the properties of the specified machine learning workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWorkspaceWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getWorkspaceSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * List the details of all the connections (not including their credentials). + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
categoryStringNoCategory of the workspace connection. Allowed values: + * "AzureOpenAI", "Serverless", "AzureBlob", "AIServices", "CognitiveSearch", "ApiKey", "CustomKeys", + * "CognitiveService".
includeAllBooleanNoIndicates whether to list datastores. Service default: do + * not list datastores.
targetStringNoTarget of the workspace connection.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             properties (Required): {
+     *                 authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *                 category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *                 target: String (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 response from the list operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listConnectionsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listConnections(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * List the details of all the connections (not including their credentials). + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
categoryStringNoCategory of the workspace connection. Allowed values: + * "AzureOpenAI", "Serverless", "AzureBlob", "AIServices", "CognitiveSearch", "ApiKey", "CustomKeys", + * "CognitiveService".
includeAllBooleanNoIndicates whether to list datastores. Service default: do + * not list datastores.
targetStringNoTarget of the workspace connection.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             properties (Required): {
+     *                 authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *                 category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *                 target: String (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 response from the list operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionsWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listConnectionsSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + } + + /** + * Get the details of a single connection, without credentials. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getConnectionWithResponseAsync(String connectionName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getConnection(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), connectionName, accept, requestOptions, context)); + } + + /** + * Get the details of a single connection, without credentials. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @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 details of a single connection, without credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getConnectionWithResponse(String connectionName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getConnectionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), connectionName, accept, requestOptions, Context.NONE); + } + + /** + * Get the details of a single connection, including credentials (if available). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     ignored: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @param getConnectionWithSecretsRequest The getConnectionWithSecretsRequest 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 the details of a single connection, including credentials (if available) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getConnectionWithSecretsWithResponseAsync(String connectionName, + BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getConnectionWithSecrets(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), connectionName, contentType, accept, + getConnectionWithSecretsRequest, requestOptions, context)); + } + + /** + * Get the details of a single connection, including credentials (if available). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     ignored: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         authType: String(ApiKey/AAD/SAS/CustomKeys/None) (Required)
+     *         category: String(AzureOpenAI/Serverless/AzureBlob/AIServices/CognitiveSearch/ApiKey/CustomKeys/CognitiveService) (Required)
+     *         target: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param connectionName Connection Name. + * @param getConnectionWithSecretsRequest The getConnectionWithSecretsRequest 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 the details of a single connection, including credentials (if available) along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getConnectionWithSecretsWithResponse(String connectionName, + BinaryData getConnectionWithSecretsRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.getConnectionWithSecretsSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), connectionName, contentType, accept, + getConnectionWithSecretsRequest, requestOptions, Context.NONE); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationsImpl.java new file mode 100644 index 000000000000..847be314c1f8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationsImpl.java @@ -0,0 +1,2291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.core.annotation.BodyParam; +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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +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.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +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.UrlBuilder; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Evaluations. + */ +public final class EvaluationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EvaluationsService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of EvaluationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EvaluationsImpl(AIProjectClientImpl client) { + this.service + = RestProxy.create(EvaluationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientEvaluations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}") + @ServiceInterface(name = "AIProjectClientEvalu") + public interface EvaluationsService { + @Get("/evaluations/runs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluations/runs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/evaluations/runs:run") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation, + RequestOptions requestOptions, Context context); + + @Post("/evaluations/runs:run") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation, + RequestOptions requestOptions, Context context); + + @Get("/evaluations/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> list(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/evaluations/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 listSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/evaluations/runs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/evaluations/runs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Get("/evaluations/schedules/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getSchedule(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluations/schedules/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getScheduleSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/evaluations/schedules/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplaceSchedule(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/evaluations/schedules/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceScheduleSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Get("/evaluations/schedules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listSchedule(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/evaluations/schedules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listScheduleSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/evaluations/schedules/{name}/disable") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> disableSchedule(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Patch("/evaluations/schedules/{name}/disable") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response disableScheduleSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listScheduleNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listScheduleNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), id, accept, requestOptions, context)); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @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 evaluation Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), id, accept, requestOptions, Context.NONE); + } + + /** + * Run the evaluation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param evaluation Evaluation to run. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(BinaryData evaluation, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, evaluation, requestOptions, context)); + } + + /** + * Run the evaluation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param evaluation Evaluation to run. + * @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 evaluation Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData evaluation, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), contentType, accept, evaluation, requestOptions, + Context.NONE); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (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 paged collection of Evaluation items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Resource update operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String id, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, context)); + } + + /** + * Resource update operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the evaluation. + * @param resource The resource instance. + * @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 evaluation Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String id, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, + Context.NONE); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getScheduleWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getSchedule(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @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 evaluation Schedule Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getScheduleWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getScheduleSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, Context.NONE); + } + + /** + * Create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceScheduleWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrReplaceSchedule(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + context)); + } + + /** + * Create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name Name of the schedule, which also serves as the unique identifier for the evaluation. + * @param resource The resource instance. + * @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 evaluation Schedule Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceScheduleWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceScheduleSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + Context.NONE); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listScheduleSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listSchedule(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listScheduleAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listScheduleSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listScheduleNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listScheduleSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listScheduleSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (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 paged collection of EvaluationSchedule items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSchedule(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listScheduleSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listScheduleNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> disableScheduleWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.disableSchedule(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + } + + /** + * Disable the evaluation schedule. + * + * @param name Name of the evaluation schedule. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableScheduleWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.disableScheduleSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of Evaluation items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     data (Optional, Required on create): {
+     *         type: String (Required)
+     *     }
+     *     target (Optional): {
+     *         systemMessage: String (Optional, Required on create)
+     *         modelConfig (Optional, Required on create): {
+     *             type: String (Required)
+     *         }
+     *         modelParams (Optional): {
+     *             String: BinaryData (Required)
+     *         }
+     *     }
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     status: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluators (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of Evaluation items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of EvaluationSchedule items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listScheduleNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listScheduleNext(nextLink, this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         type: String (Required)
+     *         resourceId: String (Optional, Required on create)
+     *         query: String (Optional, Required on create)
+     *         serviceName: String (Optional)
+     *         connectionString: String (Optional)
+     *     }
+     *     description: String (Optional)
+     *     systemData (Optional): {
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *     }
+     *     provisioningState: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     isEnabled: String (Optional)
+     *     evaluators (Required): {
+     *         String (Required): {
+     *             id: String (Optional, Required on create)
+     *             initParams (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *             dataMapping (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     trigger (Required): {
+     *         type: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of EvaluationSchedule items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listScheduleNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listScheduleNextSync(nextLink, this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/JsonMergePatchHelper.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/JsonMergePatchHelper.java new file mode 100644 index 000000000000..301ca3ec8c13 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/JsonMergePatchHelper.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.models.Evaluation; +import com.azure.ai.projects.models.EvaluationTarget; +import com.azure.ai.projects.models.EvaluatorConfiguration; +import com.azure.ai.projects.models.InputData; +import com.azure.ai.projects.models.TargetModelConfig; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static EvaluationAccessor evaluationAccessor; + + public interface EvaluationAccessor { + Evaluation prepareModelForJsonMergePatch(Evaluation evaluation, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Evaluation evaluation); + } + + public static void setEvaluationAccessor(EvaluationAccessor accessor) { + evaluationAccessor = accessor; + } + + public static EvaluationAccessor getEvaluationAccessor() { + return evaluationAccessor; + } + + private static InputDataAccessor inputDataAccessor; + + public interface InputDataAccessor { + InputData prepareModelForJsonMergePatch(InputData inputData, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(InputData inputData); + } + + public static void setInputDataAccessor(InputDataAccessor accessor) { + inputDataAccessor = accessor; + } + + public static InputDataAccessor getInputDataAccessor() { + return inputDataAccessor; + } + + private static EvaluationTargetAccessor evaluationTargetAccessor; + + public interface EvaluationTargetAccessor { + EvaluationTarget prepareModelForJsonMergePatch(EvaluationTarget evaluationTarget, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(EvaluationTarget evaluationTarget); + } + + public static void setEvaluationTargetAccessor(EvaluationTargetAccessor accessor) { + evaluationTargetAccessor = accessor; + } + + public static EvaluationTargetAccessor getEvaluationTargetAccessor() { + return evaluationTargetAccessor; + } + + private static TargetModelConfigAccessor targetModelConfigAccessor; + + public interface TargetModelConfigAccessor { + TargetModelConfig prepareModelForJsonMergePatch(TargetModelConfig targetModelConfig, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TargetModelConfig targetModelConfig); + } + + public static void setTargetModelConfigAccessor(TargetModelConfigAccessor accessor) { + targetModelConfigAccessor = accessor; + } + + public static TargetModelConfigAccessor getTargetModelConfigAccessor() { + return targetModelConfigAccessor; + } + + private static EvaluatorConfigurationAccessor evaluatorConfigurationAccessor; + + public interface EvaluatorConfigurationAccessor { + EvaluatorConfiguration prepareModelForJsonMergePatch(EvaluatorConfiguration evaluatorConfiguration, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(EvaluatorConfiguration evaluatorConfiguration); + } + + public static void setEvaluatorConfigurationAccessor(EvaluatorConfigurationAccessor accessor) { + evaluatorConfigurationAccessor = accessor; + } + + public static EvaluatorConfigurationAccessor getEvaluatorConfigurationAccessor() { + return evaluatorConfigurationAccessor; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/MultipartFormDataHelper.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/MultipartFormDataHelper.java new file mode 100644 index 000000000000..222b687fd761 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/MultipartFormDataHelper.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.UUID; + +// DO NOT modify this helper class + +public final class MultipartFormDataHelper { + /** + * Line separator for the multipart HTTP request. + */ + private static final String CRLF = "\r\n"; + + private static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; + + /** + * Value to be used as part of the divider for the multipart requests. + */ + private final String boundary; + + /** + * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". + */ + private final String partSeparator; + + /** + * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". + */ + private final String endMarker; + + /** + * Charset used for encoding the multipart HTTP request. + */ + private final Charset encoderCharset = StandardCharsets.UTF_8; + + private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]); + private long requestLength = 0; + + private RequestOptions requestOptions; + private BinaryData requestBody; + + /** + * Default constructor used in the code. The boundary is a random value. + * + * @param requestOptions the RequestOptions to update + */ + public MultipartFormDataHelper(RequestOptions requestOptions) { + this(requestOptions, UUID.randomUUID().toString().substring(0, 16)); + } + + private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) { + this.requestOptions = requestOptions; + this.boundary = boundary; + this.partSeparator = "--" + boundary; + this.endMarker = this.partSeparator + "--"; + } + + /** + * Gets the multipart HTTP request body. + * + * @return the BinaryData of the multipart HTTP request body + */ + public BinaryData getRequestBody() { + return requestBody; + } + + // text/plain + /** + * Formats a text/plain field for a multipart HTTP request. + * + * @param fieldName the field name + * @param value the value of the text/plain field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeTextField(String fieldName, String value) { + if (value != null) { + String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + + "\"" + CRLF + CRLF + value + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + // application/json + /** + * Formats a application/json field for a multipart HTTP request. + * + * @param fieldName the field name + * @param jsonObject the object of the application/json field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) { + if (jsonObject != null) { + String serialized + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF + + "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + /** + * Formats a file field for a multipart HTTP request. + * + * @param fieldName the field name + * @param file the BinaryData of the file + * @param contentType the content-type of the file + * @param filename the filename + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType, + String filename) { + if (file != null) { + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + writeFileField(fieldName, file, contentType, filename); + } + return this; + } + + /** + * Formats a file field (potentially multiple files) for a multipart HTTP request. + * + * @param fieldName the field name + * @param files the List of BinaryData of the files + * @param contentTypes the List of content-type of the files + * @param filenames the List of filenames + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileFields(String fieldName, List files, + List contentTypes, List filenames) { + if (files != null) { + for (int i = 0; i < files.size(); ++i) { + BinaryData file = files.get(i); + String contentType = contentTypes.get(i); + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + String filename = filenames.get(i); + writeFileField(fieldName, file, contentType, filename); + } + } + return this; + } + + /** + * Ends the serialization of the multipart HTTP request. + * + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper end() { + byte[] data = endMarker.getBytes(encoderCharset); + appendBytes(data); + + requestBody = BinaryData.fromStream(requestDataStream, requestLength); + + requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary) + .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength)); + + return this; + } + + private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) { + String contentDispositionFilename = ""; + if (!CoreUtils.isNullOrEmpty(filename)) { + contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\""; + } + + // Multipart preamble + String fileFieldPreamble + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + + contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF; + byte[] data = fileFieldPreamble.getBytes(encoderCharset); + appendBytes(data); + + // Writing the file into the request as a byte stream + requestLength += file.getLength(); + requestDataStream = new SequenceInputStream(requestDataStream, file.toStream()); + + // CRLF + data = CRLF.getBytes(encoderCharset); + appendBytes(data); + } + + private void appendBytes(byte[] bytes) { + requestLength += bytes.length; + requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes)); + } + + private static String escapeName(String name) { + return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22"); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/TelemetriesImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/TelemetriesImpl.java new file mode 100644 index 000000000000..c2676fe41996 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/TelemetriesImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.implementation; + +import com.azure.ai.projects.ProjectsServiceVersion; +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.QueryParam; +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.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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Telemetries. + */ +public final class TelemetriesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TelemetriesService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of TelemetriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TelemetriesImpl(AIProjectClientImpl client) { + this.service + = RestProxy.create(TelemetriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientTelemetries to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}") + @ServiceInterface(name = "AIProjectClientTelem") + public interface TelemetriesService { + @Get("/{appInsightsResourceUrl}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAppInsights(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @PathParam("appInsightsResourceUrl") String appInsightsResourceUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/{appInsightsResourceUrl}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAppInsightsSync(@HostParam("endpoint") String endpoint, + @HostParam("subscriptionId") String subscriptionId, + @HostParam("resourceGroupName") String resourceGroupName, @HostParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @PathParam("appInsightsResourceUrl") String appInsightsResourceUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * Gets the properties of the specified Application Insights resource. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         ConnectionString: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppInsightsWithResponseAsync(String appInsightsResourceUrl, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getAppInsights(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), appInsightsResourceUrl, accept, requestOptions, context)); + } + + /** + * Gets the properties of the specified Application Insights resource. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     properties (Required): {
+     *         ConnectionString: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param appInsightsResourceUrl The AppInsights Azure resource Url. It should have the format: + * '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'. + * @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 properties of the specified Application Insights resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppInsightsWithResponse(String appInsightsResourceUrl, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAppInsightsSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getResourceGroupName(), this.client.getProjectName(), + this.client.getServiceVersion().getVersion(), appInsightsResourceUrl, accept, requestOptions, Context.NONE); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/AppInsightsProperties.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/AppInsightsProperties.java new file mode 100644 index 000000000000..af771153bf12 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/AppInsightsProperties.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.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of the Application Insights resource. + */ +@Immutable +public final class AppInsightsProperties implements JsonSerializable { + + /* + * Authentication type of the connection target + */ + @Generated + private final String connectionString; + + /** + * Creates an instance of AppInsightsProperties class. + * + * @param connectionString the connectionString value to set. + */ + @Generated + private AppInsightsProperties(String connectionString) { + this.connectionString = connectionString; + } + + /** + * Get the connectionString property: Authentication type of the connection target. + * + * @return the connectionString value. + */ + @Generated + public String getConnectionString() { + return this.connectionString; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ConnectionString", this.connectionString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AppInsightsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AppInsightsProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AppInsightsProperties. + */ + @Generated + public static AppInsightsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String connectionString = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("ConnectionString".equals(fieldName)) { + connectionString = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new AppInsightsProperties(connectionString); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateAgentRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateAgentRequest.java new file mode 100644 index 000000000000..a0a91748438d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateAgentRequest.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.ToolDefinition; +import com.azure.ai.projects.models.ToolResources; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateAgentRequest model. + */ +@Fluent +public final class CreateAgentRequest implements JsonSerializable { + + /* + * The ID of the model to use. + */ + @Generated + private final String model; + + /* + * The name of the new agent. + */ + @Generated + private String name; + + /* + * The description of the new agent. + */ + @Generated + private String description; + + /* + * The system instructions for the new agent to use. + */ + @Generated + private String instructions; + + /* + * The collection of tools to enable for the new agent. + */ + @Generated + private List tools; + + /* + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For + * example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of + * the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The response format of the tool calls used by this agent. + */ + @Generated + private BinaryData responseFormat; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateAgentRequest class. + * + * @param model the model value to set. + */ + @Generated + public CreateAgentRequest(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 agent. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the new agent. + * + * @param name the name value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the new agent. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the new agent. + * + * @param description the description value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The system instructions for the new agent to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The system instructions for the new agent to use. + * + * @param instructions the instructions value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The collection of tools to enable for the new agent. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The collection of tools to enable for the new agent. + * + * @param tools the tools value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + * + * @param toolResources the toolResources value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the responseFormat property: The response format of the tool calls used by this agent. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The response format of the tool calls used by this agent. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + 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 CreateAgentRequest object itself. + */ + @Generated + public CreateAgentRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + if (this.responseFormat != null) { + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + } + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateAgentRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateAgentRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateAgentRequest. + */ + @Generated + public static CreateAgentRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String model = null; + String name = null; + String description = null; + String instructions = null; + List tools = null; + ToolResources toolResources = null; + Double temperature = null; + Double topP = null; + BinaryData responseFormat = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("model".equals(fieldName)) { + model = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = reader.getString(); + } else if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + } else if ("tool_resources".equals(fieldName)) { + toolResources = ToolResources.fromJson(reader); + } else if ("temperature".equals(fieldName)) { + temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + topP = reader.getNullable(JsonReader::getDouble); + } else if ("response_format".equals(fieldName)) { + responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + CreateAgentRequest deserializedCreateAgentRequest = new CreateAgentRequest(model); + deserializedCreateAgentRequest.name = name; + deserializedCreateAgentRequest.description = description; + deserializedCreateAgentRequest.instructions = instructions; + deserializedCreateAgentRequest.tools = tools; + deserializedCreateAgentRequest.toolResources = toolResources; + deserializedCreateAgentRequest.temperature = temperature; + deserializedCreateAgentRequest.topP = topP; + deserializedCreateAgentRequest.responseFormat = responseFormat; + deserializedCreateAgentRequest.metadata = metadata; + return deserializedCreateAgentRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateMessageRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateMessageRequest.java new file mode 100644 index 000000000000..7328dccfd5fd --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateMessageRequest.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageRole; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateMessageRequest model. + */ +@Fluent +public final class CreateMessageRequest implements JsonSerializable { + + /* + * The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + */ + @Generated + private final MessageRole role; + + /* + * The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + */ + @Generated + private final BinaryData content; + + /* + * A list of files attached to the message, and the tools they should be added to. + */ + @Generated + private List attachments; + + /* + * 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 + private Map metadata; + + /** + * Get the role property: The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * + * @return the role value. + */ + @Generated + public MessageRole getRole() { + return this.role; + } + + /** + * Get the content property: The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the attachments property: A list of files attached to the message, and the tools they should be added to. + * + * @return the attachments value. + */ + @Generated + public List getAttachments() { + return this.attachments; + } + + /** + * Set the attachments property: A list of files attached to the message, and the tools they should be added to. + * + * @param attachments the attachments value to set. + * @return the CreateMessageRequest object itself. + */ + @Generated + public CreateMessageRequest setAttachments(List attachments) { + this.attachments = attachments; + 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 CreateMessageRequest object itself. + */ + @Generated + public CreateMessageRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeFieldName("content"); + this.content.writeTo(jsonWriter); + jsonWriter.writeArrayField("attachments", this.attachments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateMessageRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateMessageRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateMessageRequest. + */ + @Generated + public static CreateMessageRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageRole role = null; + BinaryData content = null; + List attachments = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("role".equals(fieldName)) { + role = MessageRole.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + content = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("attachments".equals(fieldName)) { + attachments = reader.readArray(reader1 -> MessageAttachment.fromJson(reader1)); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + CreateMessageRequest deserializedCreateMessageRequest = new CreateMessageRequest(role, content); + deserializedCreateMessageRequest.attachments = attachments; + deserializedCreateMessageRequest.metadata = metadata; + return deserializedCreateMessageRequest; + }); + } + + /** + * Creates an instance of CreateMessageRequest class. + * + * @param role the role value to set. + * @param content the content value to set. + */ + @Generated + public CreateMessageRequest(MessageRole role, BinaryData content) { + this.role = role; + this.content = content; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateRunRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateRunRequest.java new file mode 100644 index 000000000000..b36eb5d00b67 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateRunRequest.java @@ -0,0 +1,651 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ToolDefinition; +import com.azure.ai.projects.models.TruncationObject; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateRunRequest model. + */ +@Fluent +public final class CreateRunRequest implements JsonSerializable { + + /* + * The ID of the agent that should run the thread. + */ + @Generated + private final String assistantId; + + /* + * The overridden model name that the agent should use to run the thread. + */ + @Generated + private String model; + + /* + * The overridden system instructions that the agent should use to run the thread. + */ + @Generated + private String instructions; + + /* + * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the + * behavior + * on a per-run basis without overriding other instructions. + */ + @Generated + private String additionalInstructions; + + /* + * Adds additional messages to the thread before creating the run. + */ + @Generated + private List additionalMessages; + + /* + * The overridden list of enabled tools that the agent should use to run the thread. + */ + @Generated + private List tools; + + /* + * If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + */ + @Generated + private Boolean stream; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort + * to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxPromptTokens; + + /* + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best + * effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxCompletionTokens; + + /* + * The strategy to use for dropping messages as the context windows moves forward. + */ + @Generated + private TruncationObject truncationStrategy; + + /* + * Controls whether or not and which tool is called by the model. + */ + @Generated + private BinaryData toolChoice; + + /* + * Specifies the format that the model must output. + */ + @Generated + private BinaryData responseFormat; + + /* + * If `true` functions will run in parallel during tool use. + */ + @Generated + private Boolean parallelToolCalls; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateRunRequest class. + * + * @param assistantId the assistantId value to set. + */ + @Generated + public CreateRunRequest(String assistantId) { + this.assistantId = assistantId; + } + + /** + * Get the assistantId property: The ID of the agent that should run the thread. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the model property: The overridden model name that the agent should use to run the thread. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The overridden model name that the agent should use to run the thread. + * + * @param model the model value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the instructions property: The overridden system instructions that the agent 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 that the agent should use to run the thread. + * + * @param instructions the instructions value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the additionalInstructions property: Additional instructions to append at the end of the instructions for the + * run. This is useful for modifying the behavior + * on a per-run basis without overriding other instructions. + * + * @return the additionalInstructions value. + */ + @Generated + public String getAdditionalInstructions() { + return this.additionalInstructions; + } + + /** + * Set the additionalInstructions property: Additional instructions to append at the end of the instructions for the + * run. This is useful for modifying the behavior + * on a per-run basis without overriding other instructions. + * + * @param additionalInstructions the additionalInstructions value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setAdditionalInstructions(String additionalInstructions) { + this.additionalInstructions = additionalInstructions; + return this; + } + + /** + * Get the additionalMessages property: Adds additional messages to the thread before creating the run. + * + * @return the additionalMessages value. + */ + @Generated + public List getAdditionalMessages() { + return this.additionalMessages; + } + + /** + * Set the additionalMessages property: Adds additional messages to the thread before creating the run. + * + * @param additionalMessages the additionalMessages value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setAdditionalMessages(List additionalMessages) { + this.additionalMessages = additionalMessages; + return this; + } + + /** + * Get the tools property: The overridden list of enabled tools that the agent 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 that the agent should use to run the thread. + * + * @param tools the tools value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @param stream the stream value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxPromptTokens value. + */ + @Generated + public Integer getMaxPromptTokens() { + return this.maxPromptTokens; + } + + /** + * Set the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxPromptTokens the maxPromptTokens value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setMaxPromptTokens(Integer maxPromptTokens) { + this.maxPromptTokens = maxPromptTokens; + return this; + } + + /** + * Get the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxCompletionTokens value. + */ + @Generated + public Integer getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * Set the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxCompletionTokens the maxCompletionTokens value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setMaxCompletionTokens(Integer maxCompletionTokens) { + this.maxCompletionTokens = maxCompletionTokens; + return this; + } + + /** + * Get the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @return the truncationStrategy value. + */ + @Generated + public TruncationObject getTruncationStrategy() { + return this.truncationStrategy; + } + + /** + * Set the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @param truncationStrategy the truncationStrategy value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setTruncationStrategy(TruncationObject truncationStrategy) { + this.truncationStrategy = truncationStrategy; + return this; + } + + /** + * Get the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @return the toolChoice value. + */ + @Generated + public BinaryData getToolChoice() { + return this.toolChoice; + } + + /** + * Set the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @param toolChoice the toolChoice value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setToolChoice(BinaryData toolChoice) { + this.toolChoice = toolChoice; + return this; + } + + /** + * Get the responseFormat property: Specifies the format that the model must output. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: Specifies the format that the model must output. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @return the parallelToolCalls value. + */ + @Generated + public Boolean isParallelToolCalls() { + return this.parallelToolCalls; + } + + /** + * Set the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @param parallelToolCalls the parallelToolCalls value to set. + * @return the CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setParallelToolCalls(Boolean parallelToolCalls) { + this.parallelToolCalls = parallelToolCalls; + 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 CreateRunRequest object itself. + */ + @Generated + public CreateRunRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assistant_id", this.assistantId); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeStringField("additional_instructions", this.additionalInstructions); + jsonWriter.writeArrayField("additional_messages", this.additionalMessages, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("stream", this.stream); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + jsonWriter.writeNumberField("max_prompt_tokens", this.maxPromptTokens); + jsonWriter.writeNumberField("max_completion_tokens", this.maxCompletionTokens); + jsonWriter.writeJsonField("truncation_strategy", this.truncationStrategy); + if (this.toolChoice != null) { + jsonWriter.writeFieldName("tool_choice"); + this.toolChoice.writeTo(jsonWriter); + } + if (this.responseFormat != null) { + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + } + jsonWriter.writeBooleanField("parallel_tool_calls", this.parallelToolCalls); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateRunRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateRunRequest. + */ + @Generated + public static CreateRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String assistantId = null; + String model = null; + String instructions = null; + String additionalInstructions = null; + List additionalMessages = null; + List tools = null; + Boolean stream = null; + Double temperature = null; + Double topP = null; + Integer maxPromptTokens = null; + Integer maxCompletionTokens = null; + TruncationObject truncationStrategy = null; + BinaryData toolChoice = null; + BinaryData responseFormat = null; + Boolean parallelToolCalls = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("assistant_id".equals(fieldName)) { + assistantId = reader.getString(); + } else if ("model".equals(fieldName)) { + model = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = reader.getString(); + } else if ("additional_instructions".equals(fieldName)) { + additionalInstructions = reader.getString(); + } else if ("additional_messages".equals(fieldName)) { + additionalMessages = reader.readArray(reader1 -> ThreadMessageOptions.fromJson(reader1)); + } else if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + } else if ("stream".equals(fieldName)) { + stream = reader.getNullable(JsonReader::getBoolean); + } else if ("temperature".equals(fieldName)) { + temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + topP = reader.getNullable(JsonReader::getDouble); + } else if ("max_prompt_tokens".equals(fieldName)) { + maxPromptTokens = reader.getNullable(JsonReader::getInt); + } else if ("max_completion_tokens".equals(fieldName)) { + maxCompletionTokens = reader.getNullable(JsonReader::getInt); + } else if ("truncation_strategy".equals(fieldName)) { + truncationStrategy = TruncationObject.fromJson(reader); + } else if ("tool_choice".equals(fieldName)) { + toolChoice + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("response_format".equals(fieldName)) { + responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("parallel_tool_calls".equals(fieldName)) { + parallelToolCalls = reader.getNullable(JsonReader::getBoolean); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + CreateRunRequest deserializedCreateRunRequest = new CreateRunRequest(assistantId); + deserializedCreateRunRequest.model = model; + deserializedCreateRunRequest.instructions = instructions; + deserializedCreateRunRequest.additionalInstructions = additionalInstructions; + deserializedCreateRunRequest.additionalMessages = additionalMessages; + deserializedCreateRunRequest.tools = tools; + deserializedCreateRunRequest.stream = stream; + deserializedCreateRunRequest.temperature = temperature; + deserializedCreateRunRequest.topP = topP; + deserializedCreateRunRequest.maxPromptTokens = maxPromptTokens; + deserializedCreateRunRequest.maxCompletionTokens = maxCompletionTokens; + deserializedCreateRunRequest.truncationStrategy = truncationStrategy; + deserializedCreateRunRequest.toolChoice = toolChoice; + deserializedCreateRunRequest.responseFormat = responseFormat; + deserializedCreateRunRequest.parallelToolCalls = parallelToolCalls; + deserializedCreateRunRequest.metadata = metadata; + return deserializedCreateRunRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadAndRunRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadAndRunRequest.java new file mode 100644 index 000000000000..9137e03351c9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadAndRunRequest.java @@ -0,0 +1,650 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AgentThreadCreationOptions; +import com.azure.ai.projects.models.ToolDefinition; +import com.azure.ai.projects.models.TruncationObject; +import com.azure.ai.projects.models.UpdateToolResourcesOptions; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateThreadAndRunRequest model. + */ +@Fluent +public final class CreateThreadAndRunRequest implements JsonSerializable { + + /* + * The ID of the agent for which the thread should be created. + */ + @Generated + private final String assistantId; + + /* + * The details used to create the new thread. If no thread is provided, an empty one will be created. + */ + @Generated + private AgentThreadCreationOptions thread; + + /* + * The overridden model that the agent should use to run the thread. + */ + @Generated + private String model; + + /* + * The overridden system instructions the agent should use to run the thread. + */ + @Generated + private String instructions; + + /* + * The overridden list of enabled tools the agent should use to run the thread. + */ + @Generated + private List tools; + + /* + * Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis + */ + @Generated + private UpdateToolResourcesOptions toolResources; + + /* + * If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + */ + @Generated + private Boolean stream; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort + * to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxPromptTokens; + + /* + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best + * effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxCompletionTokens; + + /* + * The strategy to use for dropping messages as the context windows moves forward. + */ + @Generated + private TruncationObject truncationStrategy; + + /* + * Controls whether or not and which tool is called by the model. + */ + @Generated + private BinaryData toolChoice; + + /* + * Specifies the format that the model must output. + */ + @Generated + private BinaryData responseFormat; + + /* + * If `true` functions will run in parallel during tool use. + */ + @Generated + private Boolean parallelToolCalls; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateThreadAndRunRequest class. + * + * @param assistantId the assistantId value to set. + */ + @Generated + public CreateThreadAndRunRequest(String assistantId) { + this.assistantId = assistantId; + } + + /** + * Get the assistantId property: The ID of the agent 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. If no thread is provided, an empty one will + * be created. + * + * @return the thread value. + */ + @Generated + public AgentThreadCreationOptions getThread() { + return this.thread; + } + + /** + * Set the thread property: The details used to create the new thread. If no thread is provided, an empty one will + * be created. + * + * @param thread the thread value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setThread(AgentThreadCreationOptions thread) { + this.thread = thread; + return this; + } + + /** + * Get the model property: The overridden model that the agent 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 agent should use to run the thread. + * + * @param model the model value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the instructions property: The overridden system instructions the agent 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 agent should use to run the thread. + * + * @param instructions the instructions value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The overridden list of enabled tools the agent 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 agent should use to run the thread. + * + * @param tools the tools value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: Override the tools the agent can use for this run. This is useful for modifying + * the behavior on a per-run basis. + * + * @return the toolResources value. + */ + @Generated + public UpdateToolResourcesOptions getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: Override the tools the agent can use for this run. This is useful for modifying + * the behavior on a per-run basis. + * + * @param toolResources the toolResources value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setToolResources(UpdateToolResourcesOptions toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @param stream the stream value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxPromptTokens value. + */ + @Generated + public Integer getMaxPromptTokens() { + return this.maxPromptTokens; + } + + /** + * Set the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxPromptTokens the maxPromptTokens value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setMaxPromptTokens(Integer maxPromptTokens) { + this.maxPromptTokens = maxPromptTokens; + return this; + } + + /** + * Get the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxCompletionTokens value. + */ + @Generated + public Integer getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * Set the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxCompletionTokens the maxCompletionTokens value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setMaxCompletionTokens(Integer maxCompletionTokens) { + this.maxCompletionTokens = maxCompletionTokens; + return this; + } + + /** + * Get the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @return the truncationStrategy value. + */ + @Generated + public TruncationObject getTruncationStrategy() { + return this.truncationStrategy; + } + + /** + * Set the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @param truncationStrategy the truncationStrategy value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setTruncationStrategy(TruncationObject truncationStrategy) { + this.truncationStrategy = truncationStrategy; + return this; + } + + /** + * Get the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @return the toolChoice value. + */ + @Generated + public BinaryData getToolChoice() { + return this.toolChoice; + } + + /** + * Set the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @param toolChoice the toolChoice value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setToolChoice(BinaryData toolChoice) { + this.toolChoice = toolChoice; + return this; + } + + /** + * Get the responseFormat property: Specifies the format that the model must output. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: Specifies the format that the model must output. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @return the parallelToolCalls value. + */ + @Generated + public Boolean isParallelToolCalls() { + return this.parallelToolCalls; + } + + /** + * Set the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @param parallelToolCalls the parallelToolCalls value to set. + * @return the CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setParallelToolCalls(Boolean parallelToolCalls) { + this.parallelToolCalls = parallelToolCalls; + 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 CreateThreadAndRunRequest object itself. + */ + @Generated + public CreateThreadAndRunRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assistant_id", this.assistantId); + jsonWriter.writeJsonField("thread", this.thread); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeBooleanField("stream", this.stream); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + jsonWriter.writeNumberField("max_prompt_tokens", this.maxPromptTokens); + jsonWriter.writeNumberField("max_completion_tokens", this.maxCompletionTokens); + jsonWriter.writeJsonField("truncation_strategy", this.truncationStrategy); + if (this.toolChoice != null) { + jsonWriter.writeFieldName("tool_choice"); + this.toolChoice.writeTo(jsonWriter); + } + if (this.responseFormat != null) { + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + } + jsonWriter.writeBooleanField("parallel_tool_calls", this.parallelToolCalls); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateThreadAndRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateThreadAndRunRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateThreadAndRunRequest. + */ + @Generated + public static CreateThreadAndRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String assistantId = null; + AgentThreadCreationOptions thread = null; + String model = null; + String instructions = null; + List tools = null; + UpdateToolResourcesOptions toolResources = null; + Boolean stream = null; + Double temperature = null; + Double topP = null; + Integer maxPromptTokens = null; + Integer maxCompletionTokens = null; + TruncationObject truncationStrategy = null; + BinaryData toolChoice = null; + BinaryData responseFormat = null; + Boolean parallelToolCalls = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("assistant_id".equals(fieldName)) { + assistantId = reader.getString(); + } else if ("thread".equals(fieldName)) { + thread = AgentThreadCreationOptions.fromJson(reader); + } else if ("model".equals(fieldName)) { + model = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = reader.getString(); + } else if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + } else if ("tool_resources".equals(fieldName)) { + toolResources = UpdateToolResourcesOptions.fromJson(reader); + } else if ("stream".equals(fieldName)) { + stream = reader.getNullable(JsonReader::getBoolean); + } else if ("temperature".equals(fieldName)) { + temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + topP = reader.getNullable(JsonReader::getDouble); + } else if ("max_prompt_tokens".equals(fieldName)) { + maxPromptTokens = reader.getNullable(JsonReader::getInt); + } else if ("max_completion_tokens".equals(fieldName)) { + maxCompletionTokens = reader.getNullable(JsonReader::getInt); + } else if ("truncation_strategy".equals(fieldName)) { + truncationStrategy = TruncationObject.fromJson(reader); + } else if ("tool_choice".equals(fieldName)) { + toolChoice + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("response_format".equals(fieldName)) { + responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("parallel_tool_calls".equals(fieldName)) { + parallelToolCalls = reader.getNullable(JsonReader::getBoolean); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + CreateThreadAndRunRequest deserializedCreateThreadAndRunRequest + = new CreateThreadAndRunRequest(assistantId); + deserializedCreateThreadAndRunRequest.thread = thread; + deserializedCreateThreadAndRunRequest.model = model; + deserializedCreateThreadAndRunRequest.instructions = instructions; + deserializedCreateThreadAndRunRequest.tools = tools; + deserializedCreateThreadAndRunRequest.toolResources = toolResources; + deserializedCreateThreadAndRunRequest.stream = stream; + deserializedCreateThreadAndRunRequest.temperature = temperature; + deserializedCreateThreadAndRunRequest.topP = topP; + deserializedCreateThreadAndRunRequest.maxPromptTokens = maxPromptTokens; + deserializedCreateThreadAndRunRequest.maxCompletionTokens = maxCompletionTokens; + deserializedCreateThreadAndRunRequest.truncationStrategy = truncationStrategy; + deserializedCreateThreadAndRunRequest.toolChoice = toolChoice; + deserializedCreateThreadAndRunRequest.responseFormat = responseFormat; + deserializedCreateThreadAndRunRequest.parallelToolCalls = parallelToolCalls; + deserializedCreateThreadAndRunRequest.metadata = metadata; + return deserializedCreateThreadAndRunRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadRequest.java new file mode 100644 index 000000000000..990796c78753 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateThreadRequest.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ToolResources; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateThreadRequest model. + */ +@Fluent +public final class CreateThreadRequest implements JsonSerializable { + + /* + * The initial messages to associate with the new thread. + */ + @Generated + private List messages; + + /* + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateThreadRequest class. + */ + @Generated + public CreateThreadRequest() { + } + + /** + * 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 CreateThreadRequest object itself. + */ + @Generated + public CreateThreadRequest setMessages(List messages) { + this.messages = messages; + return this; + } + + /** + * Get the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @param toolResources the toolResources value to set. + * @return the CreateThreadRequest object itself. + */ + @Generated + public CreateThreadRequest setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + 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 CreateThreadRequest object itself. + */ + @Generated + public CreateThreadRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("messages", this.messages, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateThreadRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateThreadRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CreateThreadRequest. + */ + @Generated + public static CreateThreadRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreateThreadRequest deserializedCreateThreadRequest = new CreateThreadRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("messages".equals(fieldName)) { + List messages + = reader.readArray(reader1 -> ThreadMessageOptions.fromJson(reader1)); + deserializedCreateThreadRequest.messages = messages; + } else if ("tool_resources".equals(fieldName)) { + deserializedCreateThreadRequest.toolResources = ToolResources.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedCreateThreadRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedCreateThreadRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileBatchRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileBatchRequest.java new file mode 100644 index 000000000000..768df470119a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileBatchRequest.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The CreateVectorStoreFileBatchRequest model. + */ +@Fluent +public final class CreateVectorStoreFileBatchRequest implements JsonSerializable { + + /* + * List of file identifiers. + */ + @Generated + private List fileIds; + + /* + * List of Azure assets. + */ + @Generated + private List dataSources; + + /* + * The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + */ + @Generated + private VectorStoreChunkingStrategyRequest chunkingStrategy; + + /** + * Creates an instance of CreateVectorStoreFileBatchRequest class. + */ + @Generated + public CreateVectorStoreFileBatchRequest() { + } + + /** + * Get the fileIds property: List of file identifiers. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: List of file identifiers. + * + * @param fileIds the fileIds value to set. + * @return the CreateVectorStoreFileBatchRequest object itself. + */ + @Generated + public CreateVectorStoreFileBatchRequest setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the dataSources property: List of Azure assets. + * + * @return the dataSources value. + */ + @Generated + public List getDataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: List of Azure assets. + * + * @param dataSources the dataSources value to set. + * @return the CreateVectorStoreFileBatchRequest object itself. + */ + @Generated + public CreateVectorStoreFileBatchRequest setDataSources(List dataSources) { + this.dataSources = dataSources; + return this; + } + + /** + * Get the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. + * + * @return the chunkingStrategy value. + */ + @Generated + public VectorStoreChunkingStrategyRequest getChunkingStrategy() { + return this.chunkingStrategy; + } + + /** + * Set the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. + * + * @param chunkingStrategy the chunkingStrategy value to set. + * @return the CreateVectorStoreFileBatchRequest object itself. + */ + @Generated + public CreateVectorStoreFileBatchRequest setChunkingStrategy(VectorStoreChunkingStrategyRequest chunkingStrategy) { + this.chunkingStrategy = chunkingStrategy; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("file_ids", this.fileIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("data_sources", this.dataSources, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("chunking_strategy", this.chunkingStrategy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateVectorStoreFileBatchRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateVectorStoreFileBatchRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CreateVectorStoreFileBatchRequest. + */ + @Generated + public static CreateVectorStoreFileBatchRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreateVectorStoreFileBatchRequest deserializedCreateVectorStoreFileBatchRequest + = new CreateVectorStoreFileBatchRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_ids".equals(fieldName)) { + List fileIds = reader.readArray(reader1 -> reader1.getString()); + deserializedCreateVectorStoreFileBatchRequest.fileIds = fileIds; + } else if ("data_sources".equals(fieldName)) { + List dataSources + = reader.readArray(reader1 -> VectorStoreDataSource.fromJson(reader1)); + deserializedCreateVectorStoreFileBatchRequest.dataSources = dataSources; + } else if ("chunking_strategy".equals(fieldName)) { + deserializedCreateVectorStoreFileBatchRequest.chunkingStrategy + = VectorStoreChunkingStrategyRequest.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedCreateVectorStoreFileBatchRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileRequest.java new file mode 100644 index 000000000000..72eb16873f1e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreFileRequest.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CreateVectorStoreFileRequest model. + */ +@Fluent +public final class CreateVectorStoreFileRequest implements JsonSerializable { + + /* + * Identifier of the file. + */ + @Generated + private String fileId; + + /* + * Azure asset ID. + */ + @Generated + private VectorStoreDataSource dataSource; + + /* + * The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + */ + @Generated + private VectorStoreChunkingStrategyRequest chunkingStrategy; + + /** + * Creates an instance of CreateVectorStoreFileRequest class. + */ + @Generated + public CreateVectorStoreFileRequest() { + } + + /** + * Get the fileId property: Identifier of the file. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Set the fileId property: Identifier of the file. + * + * @param fileId the fileId value to set. + * @return the CreateVectorStoreFileRequest object itself. + */ + @Generated + public CreateVectorStoreFileRequest setFileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the dataSource property: Azure asset ID. + * + * @return the dataSource value. + */ + @Generated + public VectorStoreDataSource getDataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: Azure asset ID. + * + * @param dataSource the dataSource value to set. + * @return the CreateVectorStoreFileRequest object itself. + */ + @Generated + public CreateVectorStoreFileRequest setDataSource(VectorStoreDataSource dataSource) { + this.dataSource = dataSource; + return this; + } + + /** + * Get the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. + * + * @return the chunkingStrategy value. + */ + @Generated + public VectorStoreChunkingStrategyRequest getChunkingStrategy() { + return this.chunkingStrategy; + } + + /** + * Set the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. + * + * @param chunkingStrategy the chunkingStrategy value to set. + * @return the CreateVectorStoreFileRequest object itself. + */ + @Generated + public CreateVectorStoreFileRequest setChunkingStrategy(VectorStoreChunkingStrategyRequest chunkingStrategy) { + this.chunkingStrategy = chunkingStrategy; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeJsonField("data_source", this.dataSource); + jsonWriter.writeJsonField("chunking_strategy", this.chunkingStrategy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateVectorStoreFileRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateVectorStoreFileRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CreateVectorStoreFileRequest. + */ + @Generated + public static CreateVectorStoreFileRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreateVectorStoreFileRequest deserializedCreateVectorStoreFileRequest = new CreateVectorStoreFileRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + deserializedCreateVectorStoreFileRequest.fileId = reader.getString(); + } else if ("data_source".equals(fieldName)) { + deserializedCreateVectorStoreFileRequest.dataSource = VectorStoreDataSource.fromJson(reader); + } else if ("chunking_strategy".equals(fieldName)) { + deserializedCreateVectorStoreFileRequest.chunkingStrategy + = VectorStoreChunkingStrategyRequest.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedCreateVectorStoreFileRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreRequest.java new file mode 100644 index 000000000000..b45aea8d0715 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CreateVectorStoreRequest.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreExpirationPolicy; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The CreateVectorStoreRequest model. + */ +@Fluent +public final class CreateVectorStoreRequest implements JsonSerializable { + + /* + * A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + */ + @Generated + private List fileIds; + + /* + * The name of the vector store. + */ + @Generated + private String name; + + /* + * The vector store configuration, used when vector store is created from Azure asset URIs. + */ + @Generated + private VectorStoreConfiguration storeConfiguration; + + /* + * Details on when this vector store expires + */ + @Generated + private VectorStoreExpirationPolicy expiresAfter; + + /* + * The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if + * file_ids is non-empty. + */ + @Generated + private VectorStoreChunkingStrategyRequest chunkingStrategy; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateVectorStoreRequest class. + */ + @Generated + public CreateVectorStoreRequest() { + } + + /** + * Get the fileIds property: A list of file IDs that the vector store should use. Useful for tools like + * `file_search` 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 vector store should use. Useful for tools like + * `file_search` that can access files. + * + * @param fileIds the fileIds value to set. + * @return the CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the name property: The name of the vector store. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the vector store. + * + * @param name the name value to set. + * @return the CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setName(String name) { + this.name = name; + return this; + } + + /** + * Get the storeConfiguration property: The vector store configuration, used when vector store is created from Azure + * asset URIs. + * + * @return the storeConfiguration value. + */ + @Generated + public VectorStoreConfiguration getStoreConfiguration() { + return this.storeConfiguration; + } + + /** + * Set the storeConfiguration property: The vector store configuration, used when vector store is created from Azure + * asset URIs. + * + * @param storeConfiguration the storeConfiguration value to set. + * @return the CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setStoreConfiguration(VectorStoreConfiguration storeConfiguration) { + this.storeConfiguration = storeConfiguration; + return this; + } + + /** + * Get the expiresAfter property: Details on when this vector store expires. + * + * @return the expiresAfter value. + */ + @Generated + public VectorStoreExpirationPolicy getExpiresAfter() { + return this.expiresAfter; + } + + /** + * Set the expiresAfter property: Details on when this vector store expires. + * + * @param expiresAfter the expiresAfter value to set. + * @return the CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setExpiresAfter(VectorStoreExpirationPolicy expiresAfter) { + this.expiresAfter = expiresAfter; + return this; + } + + /** + * Get the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. Only applicable if file_ids is non-empty. + * + * @return the chunkingStrategy value. + */ + @Generated + public VectorStoreChunkingStrategyRequest getChunkingStrategy() { + return this.chunkingStrategy; + } + + /** + * Set the chunkingStrategy property: The chunking strategy used to chunk the file(s). If not set, will use the auto + * strategy. Only applicable if file_ids is non-empty. + * + * @param chunkingStrategy the chunkingStrategy value to set. + * @return the CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setChunkingStrategy(VectorStoreChunkingStrategyRequest chunkingStrategy) { + this.chunkingStrategy = chunkingStrategy; + 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 CreateVectorStoreRequest object itself. + */ + @Generated + public CreateVectorStoreRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("file_ids", this.fileIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("configuration", this.storeConfiguration); + jsonWriter.writeJsonField("expires_after", this.expiresAfter); + jsonWriter.writeJsonField("chunking_strategy", this.chunkingStrategy); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateVectorStoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateVectorStoreRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CreateVectorStoreRequest. + */ + @Generated + public static CreateVectorStoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreateVectorStoreRequest deserializedCreateVectorStoreRequest = new CreateVectorStoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_ids".equals(fieldName)) { + List fileIds = reader.readArray(reader1 -> reader1.getString()); + deserializedCreateVectorStoreRequest.fileIds = fileIds; + } else if ("name".equals(fieldName)) { + deserializedCreateVectorStoreRequest.name = reader.getString(); + } else if ("configuration".equals(fieldName)) { + deserializedCreateVectorStoreRequest.storeConfiguration = VectorStoreConfiguration.fromJson(reader); + } else if ("expires_after".equals(fieldName)) { + deserializedCreateVectorStoreRequest.expiresAfter = VectorStoreExpirationPolicy.fromJson(reader); + } else if ("chunking_strategy".equals(fieldName)) { + deserializedCreateVectorStoreRequest.chunkingStrategy + = VectorStoreChunkingStrategyRequest.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedCreateVectorStoreRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedCreateVectorStoreRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsApiKeyAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsApiKeyAuth.java new file mode 100644 index 000000000000..6cac430fbf55 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsApiKeyAuth.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.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The credentials needed for API key authentication. + */ +@Immutable +public final class CredentialsApiKeyAuth implements JsonSerializable { + + /* + * The API key + */ + @Generated + private final String key; + + /** + * Creates an instance of CredentialsApiKeyAuth class. + * + * @param key the key value to set. + */ + @Generated + private CredentialsApiKeyAuth(String key) { + this.key = key; + } + + /** + * Get the key property: The API key. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("key", this.key); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CredentialsApiKeyAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CredentialsApiKeyAuth if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CredentialsApiKeyAuth. + */ + @Generated + public static CredentialsApiKeyAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String key = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("key".equals(fieldName)) { + key = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new CredentialsApiKeyAuth(key); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsSASAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsSASAuth.java new file mode 100644 index 000000000000..67db8d417168 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/CredentialsSASAuth.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.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The credentials needed for Shared Access Signatures (SAS) authentication. + */ +@Immutable +public final class CredentialsSASAuth implements JsonSerializable { + + /* + * The Shared Access Signatures (SAS) token + */ + @Generated + private final String sAS; + + /** + * Creates an instance of CredentialsSASAuth class. + * + * @param sAS the sAS value to set. + */ + @Generated + private CredentialsSASAuth(String sAS) { + this.sAS = sAS; + } + + /** + * Get the sAS property: The Shared Access Signatures (SAS) token. + * + * @return the sAS value. + */ + @Generated + public String getSAS() { + return this.sAS; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("SAS", this.sAS); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CredentialsSASAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CredentialsSASAuth if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CredentialsSASAuth. + */ + @Generated + public static CredentialsSASAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String sAS = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("SAS".equals(fieldName)) { + sAS = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new CredentialsSASAuth(sAS); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetAppInsightsResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetAppInsightsResponse.java new file mode 100644 index 000000000000..5e751d1ffd28 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetAppInsightsResponse.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response from getting properties of the Application Insights resource. + */ +@Immutable +public final class GetAppInsightsResponse implements JsonSerializable { + + /* + * A unique identifier for the resource + */ + @Generated + private final String id; + + /* + * The name of the resource + */ + @Generated + private final String name; + + /* + * The properties of the resource + */ + @Generated + private final AppInsightsProperties properties; + + /** + * Creates an instance of GetAppInsightsResponse class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param properties the properties value to set. + */ + @Generated + private GetAppInsightsResponse(String id, String name, AppInsightsProperties properties) { + this.id = id; + this.name = name; + this.properties = properties; + } + + /** + * Get the id property: A unique identifier for the resource. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the properties property: The properties of the resource. + * + * @return the properties value. + */ + @Generated + public AppInsightsProperties getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetAppInsightsResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetAppInsightsResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetAppInsightsResponse. + */ + @Generated + public static GetAppInsightsResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + AppInsightsProperties properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = AppInsightsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetAppInsightsResponse(id, name, properties); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionResponse.java new file mode 100644 index 000000000000..6dd87adb4671 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionResponse.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response from the listSecrets operation. + */ +@Immutable +public final class GetConnectionResponse implements JsonSerializable { + + /* + * A unique identifier for the connection + */ + @Generated + private final String id; + + /* + * The name of the resource + */ + @Generated + private final String name; + + /* + * The properties of the resource + */ + @Generated + private final InternalConnectionProperties properties; + + /** + * Creates an instance of GetConnectionResponse class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param properties the properties value to set. + */ + @Generated + private GetConnectionResponse(String id, String name, InternalConnectionProperties properties) { + this.id = id; + this.name = name; + this.properties = properties; + } + + /** + * Get the id property: A unique identifier for the connection. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the properties property: The properties of the resource. + * + * @return the properties value. + */ + @Generated + public InternalConnectionProperties getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetConnectionResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetConnectionResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetConnectionResponse. + */ + @Generated + public static GetConnectionResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + InternalConnectionProperties properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = InternalConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetConnectionResponse(id, name, properties); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionWithSecretsRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionWithSecretsRequest.java new file mode 100644 index 000000000000..7a55fd00e660 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetConnectionWithSecretsRequest.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.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetConnectionWithSecretsRequest model. + */ +@Immutable +public final class GetConnectionWithSecretsRequest implements JsonSerializable { + + /* + * The body is ignored. TODO: Can we remove this? + */ + @Generated + private final String ignored; + + /** + * Creates an instance of GetConnectionWithSecretsRequest class. + * + * @param ignored the ignored value to set. + */ + @Generated + public GetConnectionWithSecretsRequest(String ignored) { + this.ignored = ignored; + } + + /** + * Get the ignored property: The body is ignored. TODO: Can we remove this?. + * + * @return the ignored value. + */ + @Generated + public String getIgnored() { + return this.ignored; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ignored", this.ignored); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetConnectionWithSecretsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetConnectionWithSecretsRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetConnectionWithSecretsRequest. + */ + @Generated + public static GetConnectionWithSecretsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String ignored = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("ignored".equals(fieldName)) { + ignored = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new GetConnectionWithSecretsRequest(ignored); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetWorkspaceResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetWorkspaceResponse.java new file mode 100644 index 000000000000..8a2c36fdc1e5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/GetWorkspaceResponse.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response from the Workspace - Get operation. + */ +@Immutable +public final class GetWorkspaceResponse implements JsonSerializable { + + /* + * A unique identifier for the resource + */ + @Generated + private final String id; + + /* + * The name of the resource + */ + @Generated + private final String name; + + /* + * The properties of the resource + */ + @Generated + private final WorkspaceProperties properties; + + /** + * Creates an instance of GetWorkspaceResponse class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param properties the properties value to set. + */ + @Generated + private GetWorkspaceResponse(String id, String name, WorkspaceProperties properties) { + this.id = id; + this.name = name; + this.properties = properties; + } + + /** + * Get the id property: A unique identifier for the resource. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the properties property: The properties of the resource. + * + * @return the properties value. + */ + @Generated + public WorkspaceProperties getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetWorkspaceResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetWorkspaceResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetWorkspaceResponse. + */ + @Generated + public static GetWorkspaceResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + WorkspaceProperties properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = WorkspaceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetWorkspaceResponse(id, name, properties); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionProperties.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionProperties.java new file mode 100644 index 000000000000..b3f4290a1cb3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties. + */ +@Immutable +public class InternalConnectionProperties implements JsonSerializable { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType; + + /* + * Category of the connection + */ + @Generated + private final ConnectionType category; + + /* + * The connection URL to be used for this service + */ + @Generated + private final String target; + + /** + * Creates an instance of InternalConnectionProperties class. + * + * @param category the category value to set. + * @param target the target value to set. + */ + @Generated + protected InternalConnectionProperties(ConnectionType category, String target) { + this.category = category; + this.target = target; + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * Get the category property: Category of the connection. + * + * @return the category value. + */ + @Generated + public ConnectionType getCategory() { + return this.category; + } + + /** + * Get the target property: The connection URL to be used for this service. + * + * @return the target value. + */ + @Generated + public String getTarget() { + return this.target; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionProperties. + */ + @Generated + public static InternalConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("authType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ApiKey".equals(discriminatorValue)) { + return InternalConnectionPropertiesApiKeyAuth.fromJson(readerToUse.reset()); + } else if ("AAD".equals(discriminatorValue)) { + return InternalConnectionPropertiesAADAuth.fromJson(readerToUse.reset()); + } else if ("CustomKeys".equals(discriminatorValue)) { + return InternalConnectionPropertiesCustomAuth.fromJson(readerToUse.reset()); + } else if ("SAS".equals(discriminatorValue)) { + return InternalConnectionPropertiesSASAuth.fromJson(readerToUse.reset()); + } else if ("None".equals(discriminatorValue)) { + return InternalConnectionPropertiesNoAuth.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static InternalConnectionProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + AuthenticationType authType = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionProperties deserializedInternalConnectionProperties + = new InternalConnectionProperties(category, target); + deserializedInternalConnectionProperties.authType = authType; + return deserializedInternalConnectionProperties; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesAADAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesAADAuth.java new file mode 100644 index 000000000000..0867ea6dd7bd --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesAADAuth.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties for connections with AAD authentication (aka `Entra ID passthrough`). + */ +@Immutable +public final class InternalConnectionPropertiesAADAuth extends InternalConnectionProperties { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType = AuthenticationType.ENTRA_ID; + + /** + * Creates an instance of InternalConnectionPropertiesAADAuth class. + * + * @param category the category value to set. + * @param target the target value to set. + */ + @Generated + private InternalConnectionPropertiesAADAuth(ConnectionType category, String target) { + super(category, target); + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + @Override + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", getCategory() == null ? null : getCategory().toString()); + jsonWriter.writeStringField("target", getTarget()); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionPropertiesAADAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionPropertiesAADAuth if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionPropertiesAADAuth. + */ + @Generated + public static InternalConnectionPropertiesAADAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + AuthenticationType authType = AuthenticationType.ENTRA_ID; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionPropertiesAADAuth deserializedInternalConnectionPropertiesAADAuth + = new InternalConnectionPropertiesAADAuth(category, target); + deserializedInternalConnectionPropertiesAADAuth.authType = authType; + return deserializedInternalConnectionPropertiesAADAuth; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesApiKeyAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesApiKeyAuth.java new file mode 100644 index 000000000000..0b44de1e6bff --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesApiKeyAuth.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties for connections with API key authentication. + */ +@Immutable +public final class InternalConnectionPropertiesApiKeyAuth extends InternalConnectionProperties { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType = AuthenticationType.API_KEY; + + /* + * Credentials will only be present for authType=ApiKey + */ + @Generated + private final CredentialsApiKeyAuth credentials; + + /** + * Creates an instance of InternalConnectionPropertiesApiKeyAuth class. + * + * @param category the category value to set. + * @param target the target value to set. + * @param credentials the credentials value to set. + */ + @Generated + private InternalConnectionPropertiesApiKeyAuth(ConnectionType category, String target, + CredentialsApiKeyAuth credentials) { + super(category, target); + this.credentials = credentials; + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + @Override + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * Get the credentials property: Credentials will only be present for authType=ApiKey. + * + * @return the credentials value. + */ + @Generated + public CredentialsApiKeyAuth getCredentials() { + return this.credentials; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", getCategory() == null ? null : getCategory().toString()); + jsonWriter.writeStringField("target", getTarget()); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionPropertiesApiKeyAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionPropertiesApiKeyAuth if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionPropertiesApiKeyAuth. + */ + @Generated + public static InternalConnectionPropertiesApiKeyAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + CredentialsApiKeyAuth credentials = null; + AuthenticationType authType = AuthenticationType.API_KEY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("credentials".equals(fieldName)) { + credentials = CredentialsApiKeyAuth.fromJson(reader); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionPropertiesApiKeyAuth deserializedInternalConnectionPropertiesApiKeyAuth + = new InternalConnectionPropertiesApiKeyAuth(category, target, credentials); + deserializedInternalConnectionPropertiesApiKeyAuth.authType = authType; + return deserializedInternalConnectionPropertiesApiKeyAuth; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesCustomAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesCustomAuth.java new file mode 100644 index 000000000000..57f839514601 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesCustomAuth.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties for connections with Custom authentication. + */ +@Immutable +public final class InternalConnectionPropertiesCustomAuth extends InternalConnectionProperties { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType = AuthenticationType.CUSTOM; + + /** + * Creates an instance of InternalConnectionPropertiesCustomAuth class. + * + * @param category the category value to set. + * @param target the target value to set. + */ + @Generated + private InternalConnectionPropertiesCustomAuth(ConnectionType category, String target) { + super(category, target); + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + @Override + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", getCategory() == null ? null : getCategory().toString()); + jsonWriter.writeStringField("target", getTarget()); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionPropertiesCustomAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionPropertiesCustomAuth if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionPropertiesCustomAuth. + */ + @Generated + public static InternalConnectionPropertiesCustomAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + AuthenticationType authType = AuthenticationType.CUSTOM; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionPropertiesCustomAuth deserializedInternalConnectionPropertiesCustomAuth + = new InternalConnectionPropertiesCustomAuth(category, target); + deserializedInternalConnectionPropertiesCustomAuth.authType = authType; + return deserializedInternalConnectionPropertiesCustomAuth; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesNoAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesNoAuth.java new file mode 100644 index 000000000000..bd46b2f2cb7f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesNoAuth.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties for connections with no authentication. + */ +@Immutable +public final class InternalConnectionPropertiesNoAuth extends InternalConnectionProperties { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType = AuthenticationType.NONE; + + /** + * Creates an instance of InternalConnectionPropertiesNoAuth class. + * + * @param category the category value to set. + * @param target the target value to set. + */ + @Generated + private InternalConnectionPropertiesNoAuth(ConnectionType category, String target) { + super(category, target); + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + @Override + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", getCategory() == null ? null : getCategory().toString()); + jsonWriter.writeStringField("target", getTarget()); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionPropertiesNoAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionPropertiesNoAuth if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionPropertiesNoAuth. + */ + @Generated + public static InternalConnectionPropertiesNoAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + AuthenticationType authType = AuthenticationType.NONE; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionPropertiesNoAuth deserializedInternalConnectionPropertiesNoAuth + = new InternalConnectionPropertiesNoAuth(category, target); + deserializedInternalConnectionPropertiesNoAuth.authType = authType; + return deserializedInternalConnectionPropertiesNoAuth; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesSASAuth.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesSASAuth.java new file mode 100644 index 000000000000..bf7927ccf586 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/InternalConnectionPropertiesSASAuth.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.AuthenticationType; +import com.azure.ai.projects.models.ConnectionType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection properties for connections with SAS authentication. + */ +@Immutable +public final class InternalConnectionPropertiesSASAuth extends InternalConnectionProperties { + + /* + * Authentication type of the connection target + */ + @Generated + private AuthenticationType authType = AuthenticationType.SAS; + + /* + * Credentials will only be present for authType=ApiKey + */ + @Generated + private final CredentialsSASAuth credentials; + + /** + * Creates an instance of InternalConnectionPropertiesSASAuth class. + * + * @param category the category value to set. + * @param target the target value to set. + * @param credentials the credentials value to set. + */ + @Generated + private InternalConnectionPropertiesSASAuth(ConnectionType category, String target, + CredentialsSASAuth credentials) { + super(category, target); + this.credentials = credentials; + } + + /** + * Get the authType property: Authentication type of the connection target. + * + * @return the authType value. + */ + @Generated + @Override + public AuthenticationType getAuthType() { + return this.authType; + } + + /** + * Get the credentials property: Credentials will only be present for authType=ApiKey. + * + * @return the credentials value. + */ + @Generated + public CredentialsSASAuth getCredentials() { + return this.credentials; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", getCategory() == null ? null : getCategory().toString()); + jsonWriter.writeStringField("target", getTarget()); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalConnectionPropertiesSASAuth from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalConnectionPropertiesSASAuth if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalConnectionPropertiesSASAuth. + */ + @Generated + public static InternalConnectionPropertiesSASAuth fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionType category = null; + String target = null; + CredentialsSASAuth credentials = null; + AuthenticationType authType = AuthenticationType.SAS; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("category".equals(fieldName)) { + category = ConnectionType.fromString(reader.getString()); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("credentials".equals(fieldName)) { + credentials = CredentialsSASAuth.fromJson(reader); + } else if ("authType".equals(fieldName)) { + authType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InternalConnectionPropertiesSASAuth deserializedInternalConnectionPropertiesSASAuth + = new InternalConnectionPropertiesSASAuth(category, target, credentials); + deserializedInternalConnectionPropertiesSASAuth.authType = authType; + return deserializedInternalConnectionPropertiesSASAuth; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ListConnectionsResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ListConnectionsResponse.java new file mode 100644 index 000000000000..43590deeb5e7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ListConnectionsResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Response from the list operation. + */ +@Immutable +public final class ListConnectionsResponse implements JsonSerializable { + + /* + * A list of connection list secrets + */ + @Generated + private final List value; + + /** + * Creates an instance of ListConnectionsResponse class. + * + * @param value the value value to set. + */ + @Generated + private ListConnectionsResponse(List value) { + this.value = value; + } + + /** + * Get the value property: A list of connection list secrets. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListConnectionsResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListConnectionsResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListConnectionsResponse. + */ + @Generated + public static ListConnectionsResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> GetConnectionResponse.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new ListConnectionsResponse(value); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ModifyVectorStoreRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ModifyVectorStoreRequest.java new file mode 100644 index 000000000000..54e7299effc4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/ModifyVectorStoreRequest.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.VectorStoreExpirationPolicy; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The ModifyVectorStoreRequest model. + */ +@Fluent +public final class ModifyVectorStoreRequest implements JsonSerializable { + + /* + * The name of the vector store. + */ + @Generated + private String name; + + /* + * Details on when this vector store expires + */ + @Generated + private VectorStoreExpirationPolicy expiresAfter; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of ModifyVectorStoreRequest class. + */ + @Generated + public ModifyVectorStoreRequest() { + } + + /** + * Get the name property: The name of the vector store. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the vector store. + * + * @param name the name value to set. + * @return the ModifyVectorStoreRequest object itself. + */ + @Generated + public ModifyVectorStoreRequest setName(String name) { + this.name = name; + return this; + } + + /** + * Get the expiresAfter property: Details on when this vector store expires. + * + * @return the expiresAfter value. + */ + @Generated + public VectorStoreExpirationPolicy getExpiresAfter() { + return this.expiresAfter; + } + + /** + * Set the expiresAfter property: Details on when this vector store expires. + * + * @param expiresAfter the expiresAfter value to set. + * @return the ModifyVectorStoreRequest object itself. + */ + @Generated + public ModifyVectorStoreRequest setExpiresAfter(VectorStoreExpirationPolicy expiresAfter) { + this.expiresAfter = expiresAfter; + 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 ModifyVectorStoreRequest object itself. + */ + @Generated + public ModifyVectorStoreRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("expires_after", this.expiresAfter); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModifyVectorStoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModifyVectorStoreRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ModifyVectorStoreRequest. + */ + @Generated + public static ModifyVectorStoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModifyVectorStoreRequest deserializedModifyVectorStoreRequest = new ModifyVectorStoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + deserializedModifyVectorStoreRequest.name = reader.getString(); + } else if ("expires_after".equals(fieldName)) { + deserializedModifyVectorStoreRequest.expiresAfter = VectorStoreExpirationPolicy.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedModifyVectorStoreRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedModifyVectorStoreRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/SubmitToolOutputsToRunRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/SubmitToolOutputsToRunRequest.java new file mode 100644 index 000000000000..cfd9ee11348c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/SubmitToolOutputsToRunRequest.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.projects.implementation.models; + +import com.azure.ai.projects.models.ToolOutput; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SubmitToolOutputsToRunRequest model. + */ +@Fluent +public final class SubmitToolOutputsToRunRequest implements JsonSerializable { + + /* + * A list of tools for which the outputs are being submitted + */ + @Generated + private final List toolOutputs; + + /* + * If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run + * enters a terminal state. + */ + @Generated + private Boolean stream; + + /** + * Creates an instance of SubmitToolOutputsToRunRequest class. + * + * @param toolOutputs the toolOutputs value to set. + */ + @Generated + public SubmitToolOutputsToRunRequest(List toolOutputs) { + this.toolOutputs = toolOutputs; + } + + /** + * Get the toolOutputs property: A list of tools for which the outputs are being submitted. + * + * @return the toolOutputs value. + */ + @Generated + public List getToolOutputs() { + return this.toolOutputs; + } + + /** + * Get the stream property: If true, returns a stream of events that happen during the Run as server-sent events, + * terminating when the run enters a terminal state. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: If true, returns a stream of events that happen during the Run as server-sent events, + * terminating when the run enters a terminal state. + * + * @param stream the stream value to set. + * @return the SubmitToolOutputsToRunRequest object itself. + */ + @Generated + public SubmitToolOutputsToRunRequest setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tool_outputs", this.toolOutputs, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("stream", this.stream); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitToolOutputsToRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitToolOutputsToRunRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitToolOutputsToRunRequest. + */ + @Generated + public static SubmitToolOutputsToRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List toolOutputs = null; + Boolean stream = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_outputs".equals(fieldName)) { + toolOutputs = reader.readArray(reader1 -> ToolOutput.fromJson(reader1)); + } else if ("stream".equals(fieldName)) { + stream = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + SubmitToolOutputsToRunRequest deserializedSubmitToolOutputsToRunRequest + = new SubmitToolOutputsToRunRequest(toolOutputs); + deserializedSubmitToolOutputsToRunRequest.stream = stream; + return deserializedSubmitToolOutputsToRunRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateAgentRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateAgentRequest.java new file mode 100644 index 000000000000..0ea0a0775b5d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateAgentRequest.java @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.ToolDefinition; +import com.azure.ai.projects.models.ToolResources; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The UpdateAgentRequest model. + */ +@Fluent +public final class UpdateAgentRequest implements JsonSerializable { + + /* + * The ID of the model to use. + */ + @Generated + private String model; + + /* + * The modified name for the agent to use. + */ + @Generated + private String name; + + /* + * The modified description for the agent to use. + */ + @Generated + private String description; + + /* + * The modified system instructions for the new agent to use. + */ + @Generated + private String instructions; + + /* + * The modified collection of tools to enable for the agent. + */ + @Generated + private List tools; + + /* + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For + * example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of + * the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The response format of the tool calls used by this agent. + */ + @Generated + private BinaryData responseFormat; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of UpdateAgentRequest class. + */ + @Generated + public UpdateAgentRequest() { + } + + /** + * 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 UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the name property: The modified name for the agent to use. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The modified name for the agent to use. + * + * @param name the name value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The modified description for the agent to use. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The modified description for the agent to use. + * + * @param description the description value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The modified system instructions for the new agent to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The modified system instructions for the new agent to use. + * + * @param instructions the instructions value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The modified collection of tools to enable for the agent. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The modified collection of tools to enable for the agent. + * + * @param tools the tools value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + * + * @param toolResources the toolResources value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the responseFormat property: The response format of the tool calls used by this agent. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The response format of the tool calls used by this agent. + * + * @param responseFormat the responseFormat value to set. + * @return the UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + 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 UpdateAgentRequest object itself. + */ + @Generated + public UpdateAgentRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + if (this.responseFormat != null) { + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + } + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateAgentRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateAgentRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateAgentRequest. + */ + @Generated + public static UpdateAgentRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateAgentRequest deserializedUpdateAgentRequest = new UpdateAgentRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("model".equals(fieldName)) { + deserializedUpdateAgentRequest.model = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedUpdateAgentRequest.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedUpdateAgentRequest.description = reader.getString(); + } else if ("instructions".equals(fieldName)) { + deserializedUpdateAgentRequest.instructions = reader.getString(); + } else if ("tools".equals(fieldName)) { + List tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + deserializedUpdateAgentRequest.tools = tools; + } else if ("tool_resources".equals(fieldName)) { + deserializedUpdateAgentRequest.toolResources = ToolResources.fromJson(reader); + } else if ("temperature".equals(fieldName)) { + deserializedUpdateAgentRequest.temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + deserializedUpdateAgentRequest.topP = reader.getNullable(JsonReader::getDouble); + } else if ("response_format".equals(fieldName)) { + deserializedUpdateAgentRequest.responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateAgentRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateAgentRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateMessageRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateMessageRequest.java new file mode 100644 index 000000000000..a32bce2a3791 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateMessageRequest.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The UpdateMessageRequest model. + */ +@Fluent +public final class UpdateMessageRequest implements JsonSerializable { + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of UpdateMessageRequest class. + */ + @Generated + public UpdateMessageRequest() { + } + + /** + * 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 UpdateMessageRequest object itself. + */ + @Generated + public UpdateMessageRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateMessageRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateMessageRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateMessageRequest. + */ + @Generated + public static UpdateMessageRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateMessageRequest deserializedUpdateMessageRequest = new UpdateMessageRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateMessageRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateMessageRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateRunRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateRunRequest.java new file mode 100644 index 000000000000..b6c7ffb006b5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateRunRequest.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The UpdateRunRequest model. + */ +@Fluent +public final class UpdateRunRequest implements JsonSerializable { + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of UpdateRunRequest class. + */ + @Generated + public UpdateRunRequest() { + } + + /** + * 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 UpdateRunRequest object itself. + */ + @Generated + public UpdateRunRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateRunRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateRunRequest. + */ + @Generated + public static UpdateRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateRunRequest deserializedUpdateRunRequest = new UpdateRunRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateRunRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateRunRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateThreadRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateThreadRequest.java new file mode 100644 index 000000000000..bf9526291b68 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/UpdateThreadRequest.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.implementation.models; + +import com.azure.ai.projects.models.ToolResources; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The UpdateThreadRequest model. + */ +@Fluent +public final class UpdateThreadRequest implements JsonSerializable { + + /* + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs + */ + @Generated + private ToolResources toolResources; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of UpdateThreadRequest class. + */ + @Generated + public UpdateThreadRequest() { + } + + /** + * Get the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @param toolResources the toolResources value to set. + * @return the UpdateThreadRequest object itself. + */ + @Generated + public UpdateThreadRequest setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + 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 UpdateThreadRequest object itself. + */ + @Generated + public UpdateThreadRequest setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateThreadRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateThreadRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateThreadRequest. + */ + @Generated + public static UpdateThreadRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateThreadRequest deserializedUpdateThreadRequest = new UpdateThreadRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_resources".equals(fieldName)) { + deserializedUpdateThreadRequest.toolResources = ToolResources.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateThreadRequest.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateThreadRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/WorkspaceProperties.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/WorkspaceProperties.java new file mode 100644 index 000000000000..043717c2346a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/WorkspaceProperties.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.projects.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * workspace properties. + */ +@Immutable +public final class WorkspaceProperties implements JsonSerializable { + + /* + * Authentication type of the connection target + */ + @Generated + private final String applicationInsights; + + /** + * Creates an instance of WorkspaceProperties class. + * + * @param applicationInsights the applicationInsights value to set. + */ + @Generated + private WorkspaceProperties(String applicationInsights) { + this.applicationInsights = applicationInsights; + } + + /** + * Get the applicationInsights property: Authentication type of the connection target. + * + * @return the applicationInsights value. + */ + @Generated + public String getApplicationInsights() { + return this.applicationInsights; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("applicationInsights", this.applicationInsights); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceProperties. + */ + @Generated + public static WorkspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String applicationInsights = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("applicationInsights".equals(fieldName)) { + applicationInsights = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new WorkspaceProperties(applicationInsights); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/package-info.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/package-info.java new file mode 100644 index 000000000000..aa00f21412e7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/models/package-info.java @@ -0,0 +1,9 @@ +// 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 Projects. + * + */ +package com.azure.ai.projects.implementation.models; diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/package-info.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/package-info.java new file mode 100644 index 000000000000..09f9fb8c7506 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 Projects. + * + */ +package com.azure.ai.projects.implementation; diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AISearchIndexResource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AISearchIndexResource.java new file mode 100644 index 000000000000..6494fb878a3e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AISearchIndexResource.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A AI Search Index resource. + */ +@Fluent +public final class AISearchIndexResource implements JsonSerializable { + + /* + * An index connection id in an IndexResource attached to this agent. + */ + @Generated + private final String indexConnectionId; + + /* + * The name of an index in an IndexResource attached to this agent. + */ + @Generated + private final String indexName; + + /* + * Type of query in an AIIndexResource attached to this agent. + */ + @Generated + private AzureAISearchQueryType queryType; + + /* + * Number of documents to retrieve from search and present to the model. + */ + @Generated + private Integer topK; + + /* + * Odata filter string for search resource. + */ + @Generated + private String filter; + + /** + * Creates an instance of AISearchIndexResource class. + * + * @param indexConnectionId the indexConnectionId value to set. + * @param indexName the indexName value to set. + */ + @Generated + public AISearchIndexResource(String indexConnectionId, String indexName) { + this.indexConnectionId = indexConnectionId; + this.indexName = indexName; + } + + /** + * Get the indexConnectionId property: An index connection id in an IndexResource attached to this agent. + * + * @return the indexConnectionId value. + */ + @Generated + public String getIndexConnectionId() { + return this.indexConnectionId; + } + + /** + * Get the indexName property: The name of an index in an IndexResource attached to this agent. + * + * @return the indexName value. + */ + @Generated + public String getIndexName() { + return this.indexName; + } + + /** + * Get the queryType property: Type of query in an AIIndexResource attached to this agent. + * + * @return the queryType value. + */ + @Generated + public AzureAISearchQueryType getQueryType() { + return this.queryType; + } + + /** + * Set the queryType property: Type of query in an AIIndexResource attached to this agent. + * + * @param queryType the queryType value to set. + * @return the AISearchIndexResource object itself. + */ + @Generated + public AISearchIndexResource setQueryType(AzureAISearchQueryType queryType) { + this.queryType = queryType; + return this; + } + + /** + * Get the topK property: Number of documents to retrieve from search and present to the model. + * + * @return the topK value. + */ + @Generated + public Integer getTopK() { + return this.topK; + } + + /** + * Set the topK property: Number of documents to retrieve from search and present to the model. + * + * @param topK the topK value to set. + * @return the AISearchIndexResource object itself. + */ + @Generated + public AISearchIndexResource setTopK(Integer topK) { + this.topK = topK; + return this; + } + + /** + * Get the filter property: Odata filter string for search resource. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: Odata filter string for search resource. + * + * @param filter the filter value to set. + * @return the AISearchIndexResource object itself. + */ + @Generated + public AISearchIndexResource setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("index_connection_id", this.indexConnectionId); + jsonWriter.writeStringField("index_name", this.indexName); + jsonWriter.writeStringField("query_type", this.queryType == null ? null : this.queryType.toString()); + jsonWriter.writeNumberField("top_k", this.topK); + jsonWriter.writeStringField("filter", this.filter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AISearchIndexResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AISearchIndexResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AISearchIndexResource. + */ + @Generated + public static AISearchIndexResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String indexConnectionId = null; + String indexName = null; + AzureAISearchQueryType queryType = null; + Integer topK = null; + String filter = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index_connection_id".equals(fieldName)) { + indexConnectionId = reader.getString(); + } else if ("index_name".equals(fieldName)) { + indexName = reader.getString(); + } else if ("query_type".equals(fieldName)) { + queryType = AzureAISearchQueryType.fromString(reader.getString()); + } else if ("top_k".equals(fieldName)) { + topK = reader.getNullable(JsonReader::getInt); + } else if ("filter".equals(fieldName)) { + filter = reader.getString(); + } else { + reader.skipChildren(); + } + } + AISearchIndexResource deserializedAISearchIndexResource + = new AISearchIndexResource(indexConnectionId, indexName); + deserializedAISearchIndexResource.queryType = queryType; + deserializedAISearchIndexResource.topK = topK; + deserializedAISearchIndexResource.filter = filter; + return deserializedAISearchIndexResource; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AOAIModelConfig.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AOAIModelConfig.java new file mode 100644 index 000000000000..988cf48dce67 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AOAIModelConfig.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Azure OpenAI model configuration. The API version would be selected by the service for querying the model. + */ +@Fluent +public final class AOAIModelConfig extends TargetModelConfig { + + /* + * Type of the model configuration. + */ + @Generated + private String type = "AOAI"; + + /* + * Endpoint targetURI for AOAI model. + */ + @Generated + private String azureEndpoint; + + /* + * API Key for AOAI model. + */ + @Generated + private String apiKey; + + /* + * Deployment name for AOAI model. + */ + @Generated + private String azureDeployment; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of AOAIModelConfig class. + */ + @Generated + public AOAIModelConfig() { + } + + /** + * Get the type property: Type of the model configuration. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the azureEndpoint property: Endpoint targetURI for AOAI model. + * + * @return the azureEndpoint value. + */ + @Generated + public String getAzureEndpoint() { + return this.azureEndpoint; + } + + /** + * Set the azureEndpoint property: Endpoint targetURI for AOAI model. + *

Required when create the resource.

+ * + * @param azureEndpoint the azureEndpoint value to set. + * @return the AOAIModelConfig object itself. + */ + @Generated + public AOAIModelConfig setAzureEndpoint(String azureEndpoint) { + this.azureEndpoint = azureEndpoint; + this.updatedProperties.add("azureEndpoint"); + return this; + } + + /** + * Get the apiKey property: API Key for AOAI model. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API Key for AOAI model. + *

Required when create the resource.

+ * + * @param apiKey the apiKey value to set. + * @return the AOAIModelConfig object itself. + */ + @Generated + public AOAIModelConfig setApiKey(String apiKey) { + this.apiKey = apiKey; + this.updatedProperties.add("apiKey"); + return this; + } + + /** + * Get the azureDeployment property: Deployment name for AOAI model. + * + * @return the azureDeployment value. + */ + @Generated + public String getAzureDeployment() { + return this.azureDeployment; + } + + /** + * Set the azureDeployment property: Deployment name for AOAI model. + *

Required when create the resource.

+ * + * @param azureDeployment the azureDeployment value to set. + * @return the AOAIModelConfig object itself. + */ + @Generated + public AOAIModelConfig setAzureDeployment(String azureDeployment) { + this.azureDeployment = azureDeployment; + this.updatedProperties.add("azureDeployment"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getTargetModelConfigAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("azureEndpoint", this.azureEndpoint); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeStringField("azureDeployment", this.azureDeployment); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + if (updatedProperties.contains("azureEndpoint")) { + if (this.azureEndpoint == null) { + jsonWriter.writeNullField("azureEndpoint"); + } else { + jsonWriter.writeStringField("azureEndpoint", this.azureEndpoint); + } + } + if (updatedProperties.contains("apiKey")) { + if (this.apiKey == null) { + jsonWriter.writeNullField("apiKey"); + } else { + jsonWriter.writeStringField("apiKey", this.apiKey); + } + } + if (updatedProperties.contains("azureDeployment")) { + if (this.azureDeployment == null) { + jsonWriter.writeNullField("azureDeployment"); + } else { + jsonWriter.writeStringField("azureDeployment", this.azureDeployment); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AOAIModelConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AOAIModelConfig if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AOAIModelConfig. + */ + @Generated + public static AOAIModelConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AOAIModelConfig deserializedAOAIModelConfig = new AOAIModelConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedAOAIModelConfig.type = reader.getString(); + } else if ("azureEndpoint".equals(fieldName)) { + deserializedAOAIModelConfig.azureEndpoint = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedAOAIModelConfig.apiKey = reader.getString(); + } else if ("azureDeployment".equals(fieldName)) { + deserializedAOAIModelConfig.azureDeployment = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedAOAIModelConfig; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Agent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Agent.java new file mode 100644 index 000000000000..cea8b3fdc1fc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Agent.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +/** + * Represents an agent that can call the model and use tools. + */ +@Immutable +public final class Agent implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always assistant. + */ + @Generated + private final String object = "assistant"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * The name of the agent. + */ + @Generated + private final String name; + + /* + * The description of the agent. + */ + @Generated + private final String description; + + /* + * The ID of the model to use. + */ + @Generated + private final String model; + + /* + * The system instructions for the agent to use. + */ + @Generated + private final String instructions; + + /* + * The collection of tools enabled for the agent. + */ + @Generated + private final List tools; + + /* + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For + * example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + @Generated + private final ToolResources toolResources; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private final Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of + * the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private final Double topP; + + /* + * The response format of the tool calls used by this agent. + */ + @Generated + private BinaryData responseFormat; + + /* + * 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 + private final Map metadata; + + /** + * Creates an instance of Agent 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 toolResources the toolResources value to set. + * @param temperature the temperature value to set. + * @param topP the topP value to set. + * @param metadata the metadata value to set. + */ + @Generated + private Agent(String id, OffsetDateTime createdAt, String name, String description, String model, + String instructions, List tools, ToolResources toolResources, Double temperature, Double topP, + Map metadata) { + this.id = id; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.name = name; + this.description = description; + this.model = model; + this.instructions = instructions; + this.tools = tools; + this.toolResources = toolResources; + this.temperature = temperature; + this.topP = topP; + this.metadata = 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 agent. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description of the agent. + * + * @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 agent to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Get the tools property: The collection of tools enabled for the agent. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Get the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Get the responseFormat property: The response format of the tool calls used by this agent. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + if (this.responseFormat != null) { + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Agent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Agent if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Agent. + */ + @Generated + public static Agent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdAt = null; + String name = null; + String description = null; + String model = null; + String instructions = null; + List tools = null; + ToolResources toolResources = null; + Double temperature = null; + Double topP = null; + Map metadata = null; + BinaryData responseFormat = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("model".equals(fieldName)) { + model = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = reader.getString(); + } else if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + } else if ("tool_resources".equals(fieldName)) { + toolResources = ToolResources.fromJson(reader); + } else if ("temperature".equals(fieldName)) { + temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + topP = reader.getNullable(JsonReader::getDouble); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else if ("response_format".equals(fieldName)) { + responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + Agent deserializedAgent = new Agent(id, createdAt, name, description, model, instructions, tools, + toolResources, temperature, topP, metadata); + deserializedAgent.responseFormat = responseFormat; + return deserializedAgent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentDeletionStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentDeletionStatus.java new file mode 100644 index 000000000000..4220b5cb54b1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentDeletionStatus.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The status of an agent deletion operation. + */ +@Immutable +public final class AgentDeletionStatus implements JsonSerializable { + + /* + * The ID of the resource specified for deletion. + */ + @Generated + private final String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + private final boolean deleted; + + /* + * The object type, which is always 'assistant.deleted'. + */ + @Generated + private final String object = "assistant.deleted"; + + /** + * Creates an instance of AgentDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + private AgentDeletionStatus(String id, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("deleted", this.deleted); + jsonWriter.writeStringField("object", this.object); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentDeletionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentDeletionStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentDeletionStatus. + */ + @Generated + public static AgentDeletionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean deleted = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("deleted".equals(fieldName)) { + deleted = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new AgentDeletionStatus(id, deleted); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentServerSentEvents.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentServerSentEvents.java new file mode 100644 index 000000000000..cdafe63fc820 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentServerSentEvents.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.models.streaming.StreamTypeFactory; +import com.azure.ai.projects.models.streaming.StreamUpdate; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Flux; +import reactor.core.scheduler.Schedulers; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +import static com.azure.ai.projects.models.AgentStreamEvent.DONE; +import static com.azure.ai.projects.models.AgentStreamEvent.ERROR; + +/** + * A class that handles the deserialization of server sent events. + */ +public final class AgentServerSentEvents { + + // Server sent events are divided by 2 CRLF or single LF character + private static final int SSE_CHUNK_LINE_BREAK_COUNT_MARKER = 2; + + private final ClientLogger logger = new ClientLogger(AgentServerSentEvents.class); + + /** + * A factory that determines into which type to deserialize the server sent events. + */ + private final StreamTypeFactory eventDeserializer = new StreamTypeFactory(); + + /** + * The source of the server sent events. + */ + private final Flux source; + + /** + * The output stream accumulating the server sent events. + */ + private ByteArrayOutputStream outStream; + + /** + * Creates a new instance of AgentServerSentEvents. + * + * @param source The source of the server sent events. + */ + public AgentServerSentEvents(Flux source) { + this.source = source; + this.outStream = new ByteArrayOutputStream(); + } + + /** + * Gets the stream of server sent events. + * + * @return A stream of server sent events. + */ + public Flux getEvents() { + return mapEventStream(); + } + + /** + * Maps the byte buffer to a stream of server sent events. + * + * @return A stream of server sent events deserialized into StreamUpdates. + */ + private Flux mapEventStream() { + return source.publishOn(Schedulers.boundedElastic()).concatMap(byteBuffer -> { + List values = new ArrayList<>(); + byte[] byteArray = FluxUtil.byteBufferToArray(byteBuffer); + + byte[] outByteArray = outStream.toByteArray(); + int lineBreakCharsEncountered + = outByteArray.length > 0 && isByteLineFeed(outByteArray[outByteArray.length - 1]) ? 1 : 0; + + int startIndex = 0; + for (int i = 0; i < byteArray.length; i++) { + byte currentByte = byteArray[i]; + if (isByteLineFeed(currentByte)) { + lineBreakCharsEncountered++; + + // 2 line breaks signify the end of a server sent event. + if (lineBreakCharsEncountered == SSE_CHUNK_LINE_BREAK_COUNT_MARKER) { + outStream.write(byteArray, startIndex, i - startIndex + 1); + + String currentLine; + try { + currentLine = outStream.toString(StandardCharsets.UTF_8.name()); + handleCurrentEvent(currentLine, values); + } catch (IOException e) { + return Flux.error(e); + } + outStream = new ByteArrayOutputStream(); + startIndex = i + 1; + } + } else { + // In some cases line breaks can contain both the line feed and carriage return characters. + // We don't want to reset the line break count if we encounter a carriage return character. + // We are assuming that line feeds and carriage returns, if both present, are always paired. + // With this assumption, we are able to operate when carriage returns aren't present in the input also. + if (!isByteCarriageReturn(currentByte)) { + lineBreakCharsEncountered = 0; + } + } + } + + if (startIndex < byteArray.length) { + outStream.write(byteArray, startIndex, byteArray.length - startIndex); + } + + try { + String remainingBytes = outStream.toString(StandardCharsets.UTF_8.name()); + // If this is in fact, the last event, it will be appropriately chunked. Otherwise, we will cache and + // try again in the next byte buffer with a fuller event. + if (remainingBytes.endsWith("\n\n") || remainingBytes.endsWith("\r\n\r\n")) { + handleCurrentEvent(remainingBytes, values); + } + } catch (IllegalArgumentException | UncheckedIOException e) { + // UncheckedIOException is thrown when we attempt to deserialize incomplete JSON + // Even split across different ByteBuffers, the next one will contain the rest of the event. + return Flux.fromIterable(values); + } catch (IOException e) { + return Flux.error(e); + } + return Flux.fromIterable(values); + }).cache(); + } + + /** + * Determines if character is a line feed (0xA). + * + * @param character The character to check. + * @return True if character is a line feed character, false otherwise. + */ + private boolean isByteLineFeed(byte character) { + return character == 0xA; + } + + /** + * Determines if character is a carriage return (0xD). + * + * @param character The character to check. + * @return True if character is a carriage return character, false otherwise. + */ + private boolean isByteCarriageReturn(byte character) { + return character == 0xD; + } + + /** + * Handles a collected event from the byte buffer which is formated as a UTF_8 string. + * + * @param currentEvent The current line of the server sent event. + * @param outputValues The list of values to add the current line to. + * @throws IllegalStateException If the current event contains a server side error. + * @throws IllegalArgumentException If there's an error processing the event data. + * @throws UncheckedIOException If there's an error deserializing the event data. + */ + public void handleCurrentEvent(String currentEvent, List outputValues) + throws IllegalArgumentException { + if (currentEvent.isEmpty()) { + return; + } + + // We split the event into the event name and the event data. We don't want to split on \n in the data body. + String[] lines = currentEvent.split("\n", 2); + + if (lines.length != 2) { + return; + } + + if (lines[0].isEmpty() || lines[1].isEmpty()) { + return; + } + + String[] eventParts = lines[0].split(":", 2); + String[] dataParts = lines[1].split(":", 2); + + if (eventParts.length != 2 || !eventParts[0].trim().equals("event")) { + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid event format: missing event name")); + } + String eventName = eventParts[1].trim(); + + if (dataParts.length != 2 || !dataParts[0].trim().equals("data")) { + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid event format: missing event data")); + } + String eventJson = dataParts[1].trim(); + + if (DONE.equals(AgentStreamEvent.fromString(eventName))) { + return; + } + if (ERROR.equals(AgentStreamEvent.fromString(eventName))) { + throw logger.logExceptionAsError(new IllegalArgumentException(eventJson)); + } + + outputValues.add(this.eventDeserializer.deserializeEvent(eventName, BinaryData.fromString(eventJson))); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentStreamEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentStreamEvent.java new file mode 100644 index 000000000000..b13812cc0b4e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentStreamEvent.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Each event in a server-sent events stream has an `event` and `data` property: + * + * ``` + * event: thread.created + * data: {"id": "thread_123", "object": "thread", ...} + * ``` + * + * We emit events whenever a new object is created, transitions to a new state, or is being + * streamed in parts (deltas). For example, we emit `thread.run.created` when a new run + * is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses + * to create a message during a run, we emit a `thread.message.created event`, a + * `thread.message.in_progress` event, many `thread.message.delta` events, and finally a + * `thread.message.completed` event. + * + * We may add additional events over time, so we recommend handling unknown events gracefully + * in your code. + */ +public final class AgentStreamEvent extends ExpandableStringEnum { + + /** + * Event sent when a new thread is created. The data of this event is of type AgentThread. + */ + @Generated + public static final AgentStreamEvent THREAD_CREATED = fromString("thread.created"); + + /** + * Event sent when a new run is created. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_CREATED = fromString("thread.run.created"); + + /** + * Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_QUEUED = fromString("thread.run.queued"); + + /** + * Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_IN_PROGRESS = fromString("thread.run.in_progress"); + + /** + * Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_REQUIRES_ACTION = fromString("thread.run.requires_action"); + + /** + * Event sent when a run is completed. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_COMPLETED = fromString("thread.run.completed"); + + /** + * Event sent when a run ends incomplete. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_INCOMPLETE = fromString("thread.run.incomplete"); + + /** + * Event sent when a run fails. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_FAILED = fromString("thread.run.failed"); + + /** + * Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_CANCELLING = fromString("thread.run.cancelling"); + + /** + * Event sent when a run is cancelled. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_CANCELLED = fromString("thread.run.cancelled"); + + /** + * Event sent when a run is expired. The data of this event is of type ThreadRun. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_EXPIRED = fromString("thread.run.expired"); + + /** + * Event sent when a new thread run step is created. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_CREATED = fromString("thread.run.step.created"); + + /** + * Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_IN_PROGRESS = fromString("thread.run.step.in_progress"); + + /** + * Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_DELTA = fromString("thread.run.step.delta"); + + /** + * Event sent when a run step is completed. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_COMPLETED = fromString("thread.run.step.completed"); + + /** + * Event sent when a run step fails. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_FAILED = fromString("thread.run.step.failed"); + + /** + * Event sent when a run step is cancelled. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_CANCELLED = fromString("thread.run.step.cancelled"); + + /** + * Event sent when a run step is expired. The data of this event is of type RunStep. + */ + @Generated + public static final AgentStreamEvent THREAD_RUN_STEP_EXPIRED = fromString("thread.run.step.expired"); + + /** + * Event sent when a new message is created. The data of this event is of type ThreadMessage. + */ + @Generated + public static final AgentStreamEvent THREAD_MESSAGE_CREATED = fromString("thread.message.created"); + + /** + * Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. + */ + @Generated + public static final AgentStreamEvent THREAD_MESSAGE_IN_PROGRESS = fromString("thread.message.in_progress"); + + /** + * Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. + */ + @Generated + public static final AgentStreamEvent THREAD_MESSAGE_DELTA = fromString("thread.message.delta"); + + /** + * Event sent when a message is completed. The data of this event is of type ThreadMessage. + */ + @Generated + public static final AgentStreamEvent THREAD_MESSAGE_COMPLETED = fromString("thread.message.completed"); + + /** + * Event sent before a message is completed. The data of this event is of type ThreadMessage. + */ + @Generated + public static final AgentStreamEvent THREAD_MESSAGE_INCOMPLETE = fromString("thread.message.incomplete"); + + /** + * Event sent when an error occurs, such as an internal server error or a timeout. + */ + @Generated + public static final AgentStreamEvent ERROR = fromString("error"); + + /** + * Event sent when the stream is done. + */ + @Generated + public static final AgentStreamEvent DONE = fromString("done"); + + /** + * Creates a new instance of AgentStreamEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AgentStreamEvent() { + } + + /** + * Creates or finds a AgentStreamEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentStreamEvent. + */ + @Generated + public static AgentStreamEvent fromString(String name) { + return fromString(name, AgentStreamEvent.class); + } + + /** + * Gets known AgentStreamEvent values. + * + * @return known AgentStreamEvent values. + */ + @Generated + public static Collection values() { + return values(AgentStreamEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThread.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThread.java new file mode 100644 index 000000000000..ad83e92c482c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThread.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Information about a single thread associated with an agent. + */ +@Immutable +public final class AgentThread implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always 'thread'. + */ + @Generated + private final String object = "thread"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type + * of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires a list + * of vector store IDs. + */ + @Generated + private final ToolResources toolResources; + + /* + * 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 + private final Map metadata; + + /** + * Creates an instance of AgentThread class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param toolResources the toolResources value to set. + * @param metadata the metadata value to set. + */ + @Generated + private AgentThread(String id, OffsetDateTime createdAt, ToolResources toolResources, + Map metadata) { + this.id = id; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.toolResources = toolResources; + this.metadata = 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 toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the type + * of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires a list + * of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentThread from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentThread if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentThread. + */ + @Generated + public static AgentThread fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdAt = null; + ToolResources toolResources = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("tool_resources".equals(fieldName)) { + toolResources = ToolResources.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new AgentThread(id, createdAt, toolResources, metadata); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThreadCreationOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThreadCreationOptions.java new file mode 100644 index 000000000000..059ffdbcd648 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentThreadCreationOptions.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The details used to create a new agent thread. + */ +@Fluent +public final class AgentThreadCreationOptions implements JsonSerializable { + + /* + * The initial messages to associate with the new thread. + */ + @Generated + private List messages; + + /* + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of AgentThreadCreationOptions class. + */ + @Generated + public AgentThreadCreationOptions() { + } + + /** + * 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 AgentThreadCreationOptions object itself. + */ + @Generated + public AgentThreadCreationOptions setMessages(List messages) { + this.messages = messages; + return this; + } + + /** + * Get the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are made available to the agent's tools in this thread. + * The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool + * requires + * a list of vector store IDs. + * + * @param toolResources the toolResources value to set. + * @return the AgentThreadCreationOptions object itself. + */ + @Generated + public AgentThreadCreationOptions setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + 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 AgentThreadCreationOptions object itself. + */ + @Generated + public AgentThreadCreationOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("messages", this.messages, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentThreadCreationOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentThreadCreationOptions if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentThreadCreationOptions. + */ + @Generated + public static AgentThreadCreationOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentThreadCreationOptions deserializedAgentThreadCreationOptions = new AgentThreadCreationOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("messages".equals(fieldName)) { + List messages + = reader.readArray(reader1 -> ThreadMessageOptions.fromJson(reader1)); + deserializedAgentThreadCreationOptions.messages = messages; + } else if ("tool_resources".equals(fieldName)) { + deserializedAgentThreadCreationOptions.toolResources = ToolResources.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + Map metadata = reader.readMap(reader1 -> reader1.getString()); + deserializedAgentThreadCreationOptions.metadata = metadata; + } else { + reader.skipChildren(); + } + } + return deserializedAgentThreadCreationOptions; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormat.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormat.java new file mode 100644 index 000000000000..cca1c4455ff4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormat.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to + * be passed to the Run. + * If `text` the model can return text or any value needed. + */ +@Fluent +public final class AgentsApiResponseFormat implements JsonSerializable { + + /* + * Must be one of `text` or `json_object`. + */ + @Generated + private ResponseFormat type; + + /** + * Creates an instance of AgentsApiResponseFormat class. + */ + @Generated + public AgentsApiResponseFormat() { + } + + /** + * Get the type property: Must be one of `text` or `json_object`. + * + * @return the type value. + */ + @Generated + public ResponseFormat getType() { + return this.type; + } + + /** + * Set the type property: Must be one of `text` or `json_object`. + * + * @param type the type value to set. + * @return the AgentsApiResponseFormat object itself. + */ + @Generated + public AgentsApiResponseFormat setType(ResponseFormat type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentsApiResponseFormat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentsApiResponseFormat if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentsApiResponseFormat. + */ + @Generated + public static AgentsApiResponseFormat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentsApiResponseFormat deserializedAgentsApiResponseFormat = new AgentsApiResponseFormat(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedAgentsApiResponseFormat.type = ResponseFormat.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedAgentsApiResponseFormat; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormatMode.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormatMode.java new file mode 100644 index 000000000000..0a40ae663788 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiResponseFormatMode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the mode in which the model will handle the return format of a tool call. + */ +public final class AgentsApiResponseFormatMode extends ExpandableStringEnum { + + /** + * Default value. Let the model handle the return format. + */ + @Generated + public static final AgentsApiResponseFormatMode AUTO = fromString("auto"); + + /** + * Setting the value to `none`, will result in a 400 Bad request. + */ + @Generated + public static final AgentsApiResponseFormatMode NONE = fromString("none"); + + /** + * Creates a new instance of AgentsApiResponseFormatMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AgentsApiResponseFormatMode() { + } + + /** + * Creates or finds a AgentsApiResponseFormatMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentsApiResponseFormatMode. + */ + @Generated + public static AgentsApiResponseFormatMode fromString(String name) { + return fromString(name, AgentsApiResponseFormatMode.class); + } + + /** + * Gets known AgentsApiResponseFormatMode values. + * + * @return known AgentsApiResponseFormatMode values. + */ + @Generated + public static Collection values() { + return values(AgentsApiResponseFormatMode.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiToolChoiceOptionMode.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiToolChoiceOptionMode.java new file mode 100644 index 000000000000..d4e8d423c58b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsApiToolChoiceOptionMode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies how the tool choice will be used. + */ +public final class AgentsApiToolChoiceOptionMode extends ExpandableStringEnum { + + /** + * The model will not call a function and instead generates a message. + */ + @Generated + public static final AgentsApiToolChoiceOptionMode NONE = fromString("none"); + + /** + * The model can pick between generating a message or calling a function. + */ + @Generated + public static final AgentsApiToolChoiceOptionMode AUTO = fromString("auto"); + + /** + * Creates a new instance of AgentsApiToolChoiceOptionMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AgentsApiToolChoiceOptionMode() { + } + + /** + * Creates or finds a AgentsApiToolChoiceOptionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentsApiToolChoiceOptionMode. + */ + @Generated + public static AgentsApiToolChoiceOptionMode fromString(String name) { + return fromString(name, AgentsApiToolChoiceOptionMode.class); + } + + /** + * Gets known AgentsApiToolChoiceOptionMode values. + * + * @return known AgentsApiToolChoiceOptionMode values. + */ + @Generated + public static Collection values() { + return values(AgentsApiToolChoiceOptionMode.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoice.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoice.java new file mode 100644 index 000000000000..adf1ce852118 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoice.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies a tool the model should use. Use to force the model to call a specific tool. + */ +@Fluent +public final class AgentsNamedToolChoice implements JsonSerializable { + + /* + * the type of tool. If type is `function`, the function name must be set. + */ + @Generated + private final AgentsNamedToolChoiceType type; + + /* + * The name of the function to call + */ + @Generated + private FunctionName function; + + /** + * Creates an instance of AgentsNamedToolChoice class. + * + * @param type the type value to set. + */ + @Generated + public AgentsNamedToolChoice(AgentsNamedToolChoiceType type) { + this.type = type; + } + + /** + * Get the type property: the type of tool. If type is `function`, the function name must be set. + * + * @return the type value. + */ + @Generated + public AgentsNamedToolChoiceType getType() { + return this.type; + } + + /** + * Get the function property: The name of the function to call. + * + * @return the function value. + */ + @Generated + public FunctionName getFunction() { + return this.function; + } + + /** + * Set the function property: The name of the function to call. + * + * @param function the function value to set. + * @return the AgentsNamedToolChoice object itself. + */ + @Generated + public AgentsNamedToolChoice setFunction(FunctionName function) { + this.function = function; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("function", this.function); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentsNamedToolChoice from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentsNamedToolChoice if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentsNamedToolChoice. + */ + @Generated + public static AgentsNamedToolChoice fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentsNamedToolChoiceType type = null; + FunctionName function = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + type = AgentsNamedToolChoiceType.fromString(reader.getString()); + } else if ("function".equals(fieldName)) { + function = FunctionName.fromJson(reader); + } else { + reader.skipChildren(); + } + } + AgentsNamedToolChoice deserializedAgentsNamedToolChoice = new AgentsNamedToolChoice(type); + deserializedAgentsNamedToolChoice.function = function; + return deserializedAgentsNamedToolChoice; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoiceType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoiceType.java new file mode 100644 index 000000000000..ab2d3c688f9c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentsNamedToolChoiceType.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Available tool types for agents named tools. + */ +public final class AgentsNamedToolChoiceType extends ExpandableStringEnum { + + /** + * Tool type `function`. + */ + @Generated + public static final AgentsNamedToolChoiceType FUNCTION = fromString("function"); + + /** + * Tool type `code_interpreter`. + */ + @Generated + public static final AgentsNamedToolChoiceType CODE_INTERPRETER = fromString("code_interpreter"); + + /** + * Tool type `file_search`. + */ + @Generated + public static final AgentsNamedToolChoiceType FILE_SEARCH = fromString("file_search"); + + /** + * Tool type `bing_grounding`. + */ + @Generated + public static final AgentsNamedToolChoiceType BING_GROUNDING = fromString("bing_grounding"); + + /** + * Tool type `fabric_dataagent`. + */ + @Generated + public static final AgentsNamedToolChoiceType MICROSOFT_FABRIC = fromString("fabric_dataagent"); + + /** + * Tool type `sharepoint_grounding`. + */ + @Generated + public static final AgentsNamedToolChoiceType SHAREPOINT = fromString("sharepoint_grounding"); + + /** + * Tool type `azure_ai_search`. + */ + @Generated + public static final AgentsNamedToolChoiceType AZURE_AISEARCH = fromString("azure_ai_search"); + + /** + * Creates a new instance of AgentsNamedToolChoiceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AgentsNamedToolChoiceType() { + } + + /** + * Creates or finds a AgentsNamedToolChoiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentsNamedToolChoiceType. + */ + @Generated + public static AgentsNamedToolChoiceType fromString(String name) { + return fromString(name, AgentsNamedToolChoiceType.class); + } + + /** + * Gets known AgentsNamedToolChoiceType values. + * + * @return known AgentsNamedToolChoiceType values. + */ + @Generated + public static Collection values() { + return values(AgentsNamedToolChoiceType.class); + } + + /** + * Tool type `bing_custom_search`. + */ + @Generated + public static final AgentsNamedToolChoiceType BING_CUSTOM_SEARCH = fromString("bing_custom_search"); + + /** + * Tool type `connected_agent`. + */ + @Generated + public static final AgentsNamedToolChoiceType CONNECTED_AGENT = fromString("connected_agent"); +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ApplicationInsightsConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ApplicationInsightsConfiguration.java new file mode 100644 index 000000000000..294854b4fa43 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ApplicationInsightsConfiguration.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Data Source for Application Insights. + */ +@Fluent +public final class ApplicationInsightsConfiguration extends InputData { + + /* + * Type of the data. + */ + @Generated + private String type = "app_insights"; + + /* + * LogAnalytic Workspace resourceID associated with ApplicationInsights + */ + @Generated + private String resourceId; + + /* + * Query to fetch the data. + */ + @Generated + private String query; + + /* + * Service name. + */ + @Generated + private String serviceName; + + /* + * Connection String to connect to ApplicationInsights. + */ + @Generated + private String connectionString; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of ApplicationInsightsConfiguration class. + */ + @Generated + public ApplicationInsightsConfiguration() { + } + + /** + * Get the type property: Type of the data. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the resourceId property: LogAnalytic Workspace resourceID associated with ApplicationInsights. + * + * @return the resourceId value. + */ + @Generated + public String getResourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: LogAnalytic Workspace resourceID associated with ApplicationInsights. + *

Required when create the resource.

+ * + * @param resourceId the resourceId value to set. + * @return the ApplicationInsightsConfiguration object itself. + */ + @Generated + public ApplicationInsightsConfiguration setResourceId(String resourceId) { + this.resourceId = resourceId; + this.updatedProperties.add("resourceId"); + return this; + } + + /** + * Get the query property: Query to fetch the data. + * + * @return the query value. + */ + @Generated + public String getQuery() { + return this.query; + } + + /** + * Set the query property: Query to fetch the data. + *

Required when create the resource.

+ * + * @param query the query value to set. + * @return the ApplicationInsightsConfiguration object itself. + */ + @Generated + public ApplicationInsightsConfiguration setQuery(String query) { + this.query = query; + this.updatedProperties.add("query"); + return this; + } + + /** + * Get the serviceName property: Service name. + * + * @return the serviceName value. + */ + @Generated + public String getServiceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: Service name. + * + * @param serviceName the serviceName value to set. + * @return the ApplicationInsightsConfiguration object itself. + */ + @Generated + public ApplicationInsightsConfiguration setServiceName(String serviceName) { + this.serviceName = serviceName; + this.updatedProperties.add("serviceName"); + return this; + } + + /** + * Get the connectionString property: Connection String to connect to ApplicationInsights. + * + * @return the connectionString value. + */ + @Generated + public String getConnectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: Connection String to connect to ApplicationInsights. + * + * @param connectionString the connectionString value to set. + * @return the ApplicationInsightsConfiguration object itself. + */ + @Generated + public ApplicationInsightsConfiguration setConnectionString(String connectionString) { + this.connectionString = connectionString; + this.updatedProperties.add("connectionString"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getInputDataAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("serviceName", this.serviceName); + jsonWriter.writeStringField("connectionString", this.connectionString); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + if (updatedProperties.contains("resourceId")) { + if (this.resourceId == null) { + jsonWriter.writeNullField("resourceId"); + } else { + jsonWriter.writeStringField("resourceId", this.resourceId); + } + } + if (updatedProperties.contains("query")) { + if (this.query == null) { + jsonWriter.writeNullField("query"); + } else { + jsonWriter.writeStringField("query", this.query); + } + } + if (updatedProperties.contains("serviceName")) { + if (this.serviceName == null) { + jsonWriter.writeNullField("serviceName"); + } else { + jsonWriter.writeStringField("serviceName", this.serviceName); + } + } + if (updatedProperties.contains("connectionString")) { + if (this.connectionString == null) { + jsonWriter.writeNullField("connectionString"); + } else { + jsonWriter.writeStringField("connectionString", this.connectionString); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationInsightsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationInsightsConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ApplicationInsightsConfiguration. + */ + @Generated + public static ApplicationInsightsConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationInsightsConfiguration deserializedApplicationInsightsConfiguration + = new ApplicationInsightsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedApplicationInsightsConfiguration.type = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedApplicationInsightsConfiguration.resourceId = reader.getString(); + } else if ("query".equals(fieldName)) { + deserializedApplicationInsightsConfiguration.query = reader.getString(); + } else if ("serviceName".equals(fieldName)) { + deserializedApplicationInsightsConfiguration.serviceName = reader.getString(); + } else if ("connectionString".equals(fieldName)) { + deserializedApplicationInsightsConfiguration.connectionString = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedApplicationInsightsConfiguration; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AuthenticationType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AuthenticationType.java new file mode 100644 index 000000000000..d4b912155f3c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AuthenticationType.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.projects.models; + +/** + * Authentication type used by Azure AI service to connect to another service. + */ +public enum AuthenticationType { + /** + * API Key authentication. + */ + API_KEY("ApiKey"), + + /** + * Entra ID authentication (formerly known as AAD). + */ + ENTRA_ID("AAD"), + + /** + * Shared Access Signature (SAS) authentication. + */ + SAS("SAS"), + + /** + * Custom authentication. + */ + CUSTOM("CustomKeys"), + + /** + * No authentication. + */ + NONE("None"); + + /** + * The actual serialized value for a AuthenticationType instance. + */ + private final String value; + + AuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthenticationType object, or null if unable to parse. + */ + public static AuthenticationType fromString(String value) { + if (value == null) { + return null; + } + AuthenticationType[] items = AuthenticationType.values(); + for (AuthenticationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchQueryType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchQueryType.java new file mode 100644 index 000000000000..ca6d83ec4d36 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchQueryType.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Available query types for Azure AI Search tool. + */ +public final class AzureAISearchQueryType extends ExpandableStringEnum { + + /** + * Query type `simple`. + */ + @Generated + public static final AzureAISearchQueryType SIMPLE = fromString("simple"); + + /** + * Query type `semantic`. + */ + @Generated + public static final AzureAISearchQueryType SEMANTIC = fromString("semantic"); + + /** + * Query type `vector`. + */ + @Generated + public static final AzureAISearchQueryType VECTOR = fromString("vector"); + + /** + * Query type `vector_simple_hybrid`. + */ + @Generated + public static final AzureAISearchQueryType VECTOR_SIMPLE_HYBRID = fromString("vector_simple_hybrid"); + + /** + * Query type `vector_semantic_hybrid`. + */ + @Generated + public static final AzureAISearchQueryType VECTOR_SEMANTIC_HYBRID = fromString("vector_semantic_hybrid"); + + /** + * Creates a new instance of AzureAISearchQueryType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AzureAISearchQueryType() { + } + + /** + * Creates or finds a AzureAISearchQueryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureAISearchQueryType. + */ + @Generated + public static AzureAISearchQueryType fromString(String name) { + return fromString(name, AzureAISearchQueryType.class); + } + + /** + * Gets known AzureAISearchQueryType values. + * + * @return known AzureAISearchQueryType values. + */ + @Generated + public static Collection values() { + return values(AzureAISearchQueryType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchResource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchResource.java new file mode 100644 index 000000000000..d935a0b4ee76 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchResource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A set of index resources used by the `azure_ai_search` tool. + */ +@Fluent +public final class AzureAISearchResource implements JsonSerializable { + + /* + * The indices attached to this agent. There can be a maximum of 1 index + * resource attached to the agent. + */ + @Generated + private List indexList; + + /** + * Creates an instance of AzureAISearchResource class. + */ + @Generated + public AzureAISearchResource() { + } + + /** + * Get the indexList property: The indices attached to this agent. There can be a maximum of 1 index + * resource attached to the agent. + * + * @return the indexList value. + */ + @Generated + public List getIndexList() { + return this.indexList; + } + + /** + * Set the indexList property: The indices attached to this agent. There can be a maximum of 1 index + * resource attached to the agent. + * + * @param indexList the indexList value to set. + * @return the AzureAISearchResource object itself. + */ + @Generated + public AzureAISearchResource setIndexList(List indexList) { + this.indexList = indexList; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("indexes", this.indexList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureAISearchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureAISearchResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureAISearchResource. + */ + @Generated + public static AzureAISearchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureAISearchResource deserializedAzureAISearchResource = new AzureAISearchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("indexes".equals(fieldName)) { + List indexList + = reader.readArray(reader1 -> AISearchIndexResource.fromJson(reader1)); + deserializedAzureAISearchResource.indexList = indexList; + } else { + reader.skipChildren(); + } + } + return deserializedAzureAISearchResource; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchToolDefinition.java new file mode 100644 index 000000000000..00e0b9678f50 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAISearchToolDefinition.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for an Azure AI search tool as used to configure an agent. + */ +@Immutable +public final class AzureAISearchToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "azure_ai_search"; + + /** + * Creates an instance of AzureAISearchToolDefinition class. + */ + @Generated + public AzureAISearchToolDefinition() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureAISearchToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureAISearchToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureAISearchToolDefinition. + */ + @Generated + public static AzureAISearchToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureAISearchToolDefinition deserializedAzureAISearchToolDefinition = new AzureAISearchToolDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedAzureAISearchToolDefinition.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedAzureAISearchToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionBinding.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionBinding.java new file mode 100644 index 000000000000..d733cbb57002 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionBinding.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The structure for keeping storage queue name and URI. + */ +@Immutable +public final class AzureFunctionBinding implements JsonSerializable { + + /* + * The type of binding, which is always 'storage_queue'. + */ + @Generated + private final String type = "storage_queue"; + + /* + * Storage queue. + */ + @Generated + private final AzureFunctionStorageQueue storageQueue; + + /** + * Creates an instance of AzureFunctionBinding class. + * + * @param storageQueue the storageQueue value to set. + */ + @Generated + public AzureFunctionBinding(AzureFunctionStorageQueue storageQueue) { + this.storageQueue = storageQueue; + } + + /** + * Get the type property: The type of binding, which is always 'storage_queue'. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the storageQueue property: Storage queue. + * + * @return the storageQueue value. + */ + @Generated + public AzureFunctionStorageQueue getStorageQueue() { + return this.storageQueue; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("storage_queue", this.storageQueue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFunctionBinding from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFunctionBinding if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureFunctionBinding. + */ + @Generated + public static AzureFunctionBinding fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFunctionStorageQueue storageQueue = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("storage_queue".equals(fieldName)) { + storageQueue = AzureFunctionStorageQueue.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new AzureFunctionBinding(storageQueue); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionDefinition.java new file mode 100644 index 000000000000..a099583d6e11 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionDefinition.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The definition of Azure function. + */ +@Immutable +public final class AzureFunctionDefinition implements JsonSerializable { + + /* + * The definition of azure function and its parameters. + */ + @Generated + private final FunctionDefinition function; + + /* + * Input storage queue. The queue storage trigger runs a function as messages are added to it. + */ + @Generated + private final AzureFunctionBinding inputBinding; + + /* + * Output storage queue. The function writes output to this queue when the input items are processed. + */ + @Generated + private final AzureFunctionBinding outputBinding; + + /** + * Creates an instance of AzureFunctionDefinition class. + * + * @param function the function value to set. + * @param inputBinding the inputBinding value to set. + * @param outputBinding the outputBinding value to set. + */ + @Generated + public AzureFunctionDefinition(FunctionDefinition function, AzureFunctionBinding inputBinding, + AzureFunctionBinding outputBinding) { + this.function = function; + this.inputBinding = inputBinding; + this.outputBinding = outputBinding; + } + + /** + * Get the function property: The definition of azure function and its parameters. + * + * @return the function value. + */ + @Generated + public FunctionDefinition getFunction() { + return this.function; + } + + /** + * Get the inputBinding property: Input storage queue. The queue storage trigger runs a function as messages are + * added to it. + * + * @return the inputBinding value. + */ + @Generated + public AzureFunctionBinding getInputBinding() { + return this.inputBinding; + } + + /** + * Get the outputBinding property: Output storage queue. The function writes output to this queue when the input + * items are processed. + * + * @return the outputBinding value. + */ + @Generated + public AzureFunctionBinding getOutputBinding() { + return this.outputBinding; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("function", this.function); + jsonWriter.writeJsonField("input_binding", this.inputBinding); + jsonWriter.writeJsonField("output_binding", this.outputBinding); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFunctionDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFunctionDefinition if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureFunctionDefinition. + */ + @Generated + public static AzureFunctionDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionDefinition function = null; + AzureFunctionBinding inputBinding = null; + AzureFunctionBinding outputBinding = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("function".equals(fieldName)) { + function = FunctionDefinition.fromJson(reader); + } else if ("input_binding".equals(fieldName)) { + inputBinding = AzureFunctionBinding.fromJson(reader); + } else if ("output_binding".equals(fieldName)) { + outputBinding = AzureFunctionBinding.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new AzureFunctionDefinition(function, inputBinding, outputBinding); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionStorageQueue.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionStorageQueue.java new file mode 100644 index 000000000000..6c82946c0c77 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionStorageQueue.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The structure for keeping storage queue name and URI. + */ +@Immutable +public final class AzureFunctionStorageQueue implements JsonSerializable { + + /* + * URI to the Azure Storage Queue service allowing you to manipulate a queue. + */ + @Generated + private final String storageServiceEndpoint; + + /* + * The name of an Azure function storage queue. + */ + @Generated + private final String queueName; + + /** + * Creates an instance of AzureFunctionStorageQueue class. + * + * @param storageServiceEndpoint the storageServiceEndpoint value to set. + * @param queueName the queueName value to set. + */ + @Generated + public AzureFunctionStorageQueue(String storageServiceEndpoint, String queueName) { + this.storageServiceEndpoint = storageServiceEndpoint; + this.queueName = queueName; + } + + /** + * Get the storageServiceEndpoint property: URI to the Azure Storage Queue service allowing you to manipulate a + * queue. + * + * @return the storageServiceEndpoint value. + */ + @Generated + public String getStorageServiceEndpoint() { + return this.storageServiceEndpoint; + } + + /** + * Get the queueName property: The name of an Azure function storage queue. + * + * @return the queueName value. + */ + @Generated + public String getQueueName() { + return this.queueName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("queue_service_endpoint", this.storageServiceEndpoint); + jsonWriter.writeStringField("queue_name", this.queueName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFunctionStorageQueue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFunctionStorageQueue if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureFunctionStorageQueue. + */ + @Generated + public static AzureFunctionStorageQueue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String storageServiceEndpoint = null; + String queueName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("queue_service_endpoint".equals(fieldName)) { + storageServiceEndpoint = reader.getString(); + } else if ("queue_name".equals(fieldName)) { + queueName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new AzureFunctionStorageQueue(storageServiceEndpoint, queueName); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionToolDefinition.java new file mode 100644 index 000000000000..9be7cbfa3781 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureFunctionToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a azure function tool as used to configure an agent. + */ +@Immutable +public final class AzureFunctionToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "azure_function"; + + /* + * The definition of the concrete function that the function tool should call. + */ + @Generated + private final AzureFunctionDefinition azureFunction; + + /** + * Creates an instance of AzureFunctionToolDefinition class. + * + * @param azureFunction the azureFunction value to set. + */ + @Generated + public AzureFunctionToolDefinition(AzureFunctionDefinition azureFunction) { + this.azureFunction = azureFunction; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the azureFunction property: The definition of the concrete function that the function tool should call. + * + * @return the azureFunction value. + */ + @Generated + public AzureFunctionDefinition getAzureFunction() { + return this.azureFunction; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azure_function", this.azureFunction); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFunctionToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFunctionToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureFunctionToolDefinition. + */ + @Generated + public static AzureFunctionToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFunctionDefinition azureFunction = null; + String type = "azure_function"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("azure_function".equals(fieldName)) { + azureFunction = AzureFunctionDefinition.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + AzureFunctionToolDefinition deserializedAzureFunctionToolDefinition + = new AzureFunctionToolDefinition(azureFunction); + deserializedAzureFunctionToolDefinition.type = type; + return deserializedAzureFunctionToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingCustomSearchToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingCustomSearchToolDefinition.java new file mode 100644 index 000000000000..73adb93a15a7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingCustomSearchToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a Bing custom search tool as used to configure an agent. + */ +@Immutable +public final class BingCustomSearchToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "bing_custom_search"; + + /* + * The list of search configurations used by the bing custom search tool. + */ + @Generated + private final SearchConfigurationList bingCustomSearch; + + /** + * Creates an instance of BingCustomSearchToolDefinition class. + * + * @param bingCustomSearch the bingCustomSearch value to set. + */ + @Generated + public BingCustomSearchToolDefinition(SearchConfigurationList bingCustomSearch) { + this.bingCustomSearch = bingCustomSearch; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the bingCustomSearch property: The list of search configurations used by the bing custom search tool. + * + * @return the bingCustomSearch value. + */ + @Generated + public SearchConfigurationList getBingCustomSearch() { + return this.bingCustomSearch; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("bing_custom_search", this.bingCustomSearch); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BingCustomSearchToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BingCustomSearchToolDefinition if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BingCustomSearchToolDefinition. + */ + @Generated + public static BingCustomSearchToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchConfigurationList bingCustomSearch = null; + String type = "bing_custom_search"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("bing_custom_search".equals(fieldName)) { + bingCustomSearch = SearchConfigurationList.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + BingCustomSearchToolDefinition deserializedBingCustomSearchToolDefinition + = new BingCustomSearchToolDefinition(bingCustomSearch); + deserializedBingCustomSearchToolDefinition.type = type; + return deserializedBingCustomSearchToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingGroundingToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingGroundingToolDefinition.java new file mode 100644 index 000000000000..b404cdef22cb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BingGroundingToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a bing grounding search tool as used to configure an agent. + */ +@Immutable +public final class BingGroundingToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "bing_grounding"; + + /* + * The list of connections used by the bing grounding tool. + */ + @Generated + private final ToolConnectionList bingGrounding; + + /** + * Creates an instance of BingGroundingToolDefinition class. + * + * @param bingGrounding the bingGrounding value to set. + */ + @Generated + public BingGroundingToolDefinition(ToolConnectionList bingGrounding) { + this.bingGrounding = bingGrounding; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the bingGrounding property: The list of connections used by the bing grounding tool. + * + * @return the bingGrounding value. + */ + @Generated + public ToolConnectionList getBingGrounding() { + return this.bingGrounding; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("bing_grounding", this.bingGrounding); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BingGroundingToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BingGroundingToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BingGroundingToolDefinition. + */ + @Generated + public static BingGroundingToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolConnectionList bingGrounding = null; + String type = "bing_grounding"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("bing_grounding".equals(fieldName)) { + bingGrounding = ToolConnectionList.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + BingGroundingToolDefinition deserializedBingGroundingToolDefinition + = new BingGroundingToolDefinition(bingGrounding); + deserializedBingGroundingToolDefinition.type = type; + return deserializedBingGroundingToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolDefinition.java new file mode 100644 index 000000000000..0410df232927 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolDefinition.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a code interpreter tool as used to configure an agent. + */ +@Immutable +public final class CodeInterpreterToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "code_interpreter"; + + /** + * Creates an instance of CodeInterpreterToolDefinition class. + */ + @Generated + public CodeInterpreterToolDefinition() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeInterpreterToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeInterpreterToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodeInterpreterToolDefinition. + */ + @Generated + public static CodeInterpreterToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeInterpreterToolDefinition deserializedCodeInterpreterToolDefinition + = new CodeInterpreterToolDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedCodeInterpreterToolDefinition.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedCodeInterpreterToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolResource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolResource.java new file mode 100644 index 000000000000..d789df801e9f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeInterpreterToolResource.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A set of resources that are used by the `code_interpreter` tool. + */ +@Fluent +public final class CodeInterpreterToolResource implements JsonSerializable { + + /* + * A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + @Generated + private List fileIds; + + /* + * The data sources to be used. This option is mutually exclusive with the `fileIds` property. + */ + @Generated + private List dataSources; + + /** + * Creates an instance of CodeInterpreterToolResource class. + */ + @Generated + public CodeInterpreterToolResource() { + } + + /** + * Get the fileIds property: A list of file IDs made available to the `code_interpreter` tool. There can be a + * maximum of 20 files + * associated with the tool. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: A list of file IDs made available to the `code_interpreter` tool. There can be a + * maximum of 20 files + * associated with the tool. + * + * @param fileIds the fileIds value to set. + * @return the CodeInterpreterToolResource object itself. + */ + @Generated + public CodeInterpreterToolResource setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * Get the dataSources property: The data sources to be used. This option is mutually exclusive with the `fileIds` + * property. + * + * @return the dataSources value. + */ + @Generated + public List getDataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: The data sources to be used. This option is mutually exclusive with the `fileIds` + * property. + * + * @param dataSources the dataSources value to set. + * @return the CodeInterpreterToolResource object itself. + */ + @Generated + public CodeInterpreterToolResource setDataSources(List dataSources) { + this.dataSources = dataSources; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("file_ids", this.fileIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("data_sources", this.dataSources, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeInterpreterToolResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeInterpreterToolResource if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodeInterpreterToolResource. + */ + @Generated + public static CodeInterpreterToolResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeInterpreterToolResource deserializedCodeInterpreterToolResource = new CodeInterpreterToolResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_ids".equals(fieldName)) { + List fileIds = reader.readArray(reader1 -> reader1.getString()); + deserializedCodeInterpreterToolResource.fileIds = fileIds; + } else if ("data_sources".equals(fieldName)) { + List dataSources + = reader.readArray(reader1 -> VectorStoreDataSource.fromJson(reader1)); + deserializedCodeInterpreterToolResource.dataSources = dataSources; + } else { + reader.skipChildren(); + } + } + return deserializedCodeInterpreterToolResource; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentDetails.java new file mode 100644 index 000000000000..ad907a2f5a5e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentDetails.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information for connecting one agent to another as a tool. + */ +@Immutable +public final class ConnectedAgentDetails implements JsonSerializable { + + /* + * The identifier of the child agent. + */ + @Generated + private final String id; + + /* + * The name of the agent to be called. + */ + @Generated + private final String name; + + /* + * A description of what the agent does, used by the model to choose when and how to call the agent. + */ + @Generated + private final String description; + + /** + * Creates an instance of ConnectedAgentDetails class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param description the description value to set. + */ + @Generated + public ConnectedAgentDetails(String id, String name, String description) { + this.id = id; + this.name = name; + this.description = description; + } + + /** + * Get the id property: The identifier of the child agent. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name of the agent to be called. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: A description of what the agent does, used by the model to choose when and how to + * call the agent. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectedAgentDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectedAgentDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectedAgentDetails. + */ + @Generated + public static ConnectedAgentDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ConnectedAgentDetails(id, name, description); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentToolDefinition.java new file mode 100644 index 000000000000..41608083f98b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectedAgentToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a connected agent tool which defines a domain specific sub-agent. + */ +@Immutable +public final class ConnectedAgentToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "connected_agent"; + + /* + * The sub-agent to connect + */ + @Generated + private final ConnectedAgentDetails connectedAgent; + + /** + * Creates an instance of ConnectedAgentToolDefinition class. + * + * @param connectedAgent the connectedAgent value to set. + */ + @Generated + public ConnectedAgentToolDefinition(ConnectedAgentDetails connectedAgent) { + this.connectedAgent = connectedAgent; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the connectedAgent property: The sub-agent to connect. + * + * @return the connectedAgent value. + */ + @Generated + public ConnectedAgentDetails getConnectedAgent() { + return this.connectedAgent; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connected_agent", this.connectedAgent); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectedAgentToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectedAgentToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectedAgentToolDefinition. + */ + @Generated + public static ConnectedAgentToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectedAgentDetails connectedAgent = null; + String type = "connected_agent"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("connected_agent".equals(fieldName)) { + connectedAgent = ConnectedAgentDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + ConnectedAgentToolDefinition deserializedConnectedAgentToolDefinition + = new ConnectedAgentToolDefinition(connectedAgent); + deserializedConnectedAgentToolDefinition.type = type; + return deserializedConnectedAgentToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectionType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectionType.java new file mode 100644 index 000000000000..7ddb20607643 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ConnectionType.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Type (or category) of the connection. + */ +public final class ConnectionType extends ExpandableStringEnum { + + /** + * Azure OpenAI Service. + */ + @Generated + public static final ConnectionType AZURE_OPEN_AI = fromString("AzureOpenAI"); + + /** + * Serverless API Service. + */ + @Generated + public static final ConnectionType SERVERLESS = fromString("Serverless"); + + /** + * Azure Blob Storage. + */ + @Generated + public static final ConnectionType AZURE_BLOB_STORAGE = fromString("AzureBlob"); + + /** + * Azure AI Services. + */ + @Generated + public static final ConnectionType AZURE_AISERVICES = fromString("AIServices"); + + /** + * Azure AI Search. + */ + @Generated + public static final ConnectionType AZURE_AISEARCH = fromString("CognitiveSearch"); + + /** + * Generic connection that uses API Key authentication. + */ + @Generated + public static final ConnectionType APIKEY = fromString("ApiKey"); + + /** + * Generic connection that uses Custom authentication. + */ + @Generated + public static final ConnectionType CUSTOM = fromString("CustomKeys"); + + /** + * Cognitive Service. + */ + @Generated + public static final ConnectionType COGNITIVE_SERVICE = fromString("CognitiveService"); + + /** + * Creates a new instance of ConnectionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ConnectionType() { + } + + /** + * Creates or finds a ConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionType. + */ + @Generated + public static ConnectionType fromString(String name) { + return fromString(name, ConnectionType.class); + } + + /** + * Gets known ConnectionType values. + * + * @return known ConnectionType values. + */ + @Generated + public static Collection values() { + return values(ConnectionType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateAgentOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateAgentOptions.java new file mode 100644 index 000000000000..56be1e7661db --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateAgentOptions.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import java.util.List; +import java.util.Map; + +/** + * Options for createAgent API. + */ +@Fluent +public final class CreateAgentOptions { + + /* + * The ID of the model to use. + */ + @Generated + private final String model; + + /* + * The name of the new agent. + */ + @Generated + private String name; + + /* + * The description of the new agent. + */ + @Generated + private String description; + + /* + * The system instructions for the new agent to use. + */ + @Generated + private String instructions; + + /* + * The collection of tools to enable for the new agent. + */ + @Generated + private List tools; + + /* + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For + * example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of + * the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The response format of the tool calls used by this agent. + */ + @Generated + private BinaryData responseFormat; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateAgentOptions class. + * + * @param model the model value to set. + */ + @Generated + public CreateAgentOptions(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 agent. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the new agent. + * + * @param name the name value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the new agent. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the new agent. + * + * @param description the description value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The system instructions for the new agent to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The system instructions for the new agent to use. + * + * @param instructions the instructions value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The collection of tools to enable for the new agent. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The collection of tools to enable for the new agent. + * + * @param tools the tools value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + * + * @param toolResources the toolResources value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the responseFormat property: The response format of the tool calls used by this agent. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The response format of the tool calls used by this agent. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + 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 CreateAgentOptions object itself. + */ + @Generated + public CreateAgentOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateRunOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateRunOptions.java new file mode 100644 index 000000000000..8c8700dbe4a5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateRunOptions.java @@ -0,0 +1,573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import java.util.List; +import java.util.Map; + +/** + * Options for createRun API. + */ +@Fluent +public final class CreateRunOptions { + + /* + * Identifier of the thread. + */ + @Generated + private final String threadId; + + /* + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + */ + @Generated + private List include; + + /* + * The ID of the agent that should run the thread. + */ + @Generated + private final String assistantId; + + /* + * The overridden model name that the agent should use to run the thread. + */ + @Generated + private String model; + + /* + * The overridden system instructions that the agent should use to run the thread. + */ + @Generated + private String instructions; + + /* + * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the + * behavior + * on a per-run basis without overriding other instructions. + */ + @Generated + private String additionalInstructions; + + /* + * Adds additional messages to the thread before creating the run. + */ + @Generated + private List additionalMessages; + + /* + * The overridden list of enabled tools that the agent should use to run the thread. + */ + @Generated + private List tools; + + /* + * If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + */ + @Generated + private Boolean stream; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort + * to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxPromptTokens; + + /* + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best + * effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxCompletionTokens; + + /* + * The strategy to use for dropping messages as the context windows moves forward. + */ + @Generated + private TruncationObject truncationStrategy; + + /* + * Controls whether or not and which tool is called by the model. + */ + @Generated + private BinaryData toolChoice; + + /* + * Specifies the format that the model must output. + */ + @Generated + private BinaryData responseFormat; + + /* + * If `true` functions will run in parallel during tool use. + */ + @Generated + private Boolean parallelToolCalls; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateRunOptions class. + * + * @param threadId the threadId value to set. + * @param assistantId the assistantId value to set. + */ + @Generated + public CreateRunOptions(String threadId, String assistantId) { + this.threadId = threadId; + this.assistantId = assistantId; + } + + /** + * Get the threadId property: Identifier of the thread. + * + * @return the threadId value. + */ + @Generated + public String getThreadId() { + return this.threadId; + } + + /** + * Get the include property: A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * + * @return the include value. + */ + @Generated + public List getInclude() { + return this.include; + } + + /** + * Set the include property: A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the + * file search result content. + * + * @param include the include value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setInclude(List include) { + this.include = include; + return this; + } + + /** + * Get the assistantId property: The ID of the agent that should run the thread. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * Get the model property: The overridden model name that the agent should use to run the thread. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The overridden model name that the agent should use to run the thread. + * + * @param model the model value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the instructions property: The overridden system instructions that the agent 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 that the agent should use to run the thread. + * + * @param instructions the instructions value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the additionalInstructions property: Additional instructions to append at the end of the instructions for the + * run. This is useful for modifying the behavior + * on a per-run basis without overriding other instructions. + * + * @return the additionalInstructions value. + */ + @Generated + public String getAdditionalInstructions() { + return this.additionalInstructions; + } + + /** + * Set the additionalInstructions property: Additional instructions to append at the end of the instructions for the + * run. This is useful for modifying the behavior + * on a per-run basis without overriding other instructions. + * + * @param additionalInstructions the additionalInstructions value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setAdditionalInstructions(String additionalInstructions) { + this.additionalInstructions = additionalInstructions; + return this; + } + + /** + * Get the additionalMessages property: Adds additional messages to the thread before creating the run. + * + * @return the additionalMessages value. + */ + @Generated + public List getAdditionalMessages() { + return this.additionalMessages; + } + + /** + * Set the additionalMessages property: Adds additional messages to the thread before creating the run. + * + * @param additionalMessages the additionalMessages value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setAdditionalMessages(List additionalMessages) { + this.additionalMessages = additionalMessages; + return this; + } + + /** + * Get the tools property: The overridden list of enabled tools that the agent 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 that the agent should use to run the thread. + * + * @param tools the tools value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @param stream the stream value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxPromptTokens value. + */ + @Generated + public Integer getMaxPromptTokens() { + return this.maxPromptTokens; + } + + /** + * Set the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxPromptTokens the maxPromptTokens value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setMaxPromptTokens(Integer maxPromptTokens) { + this.maxPromptTokens = maxPromptTokens; + return this; + } + + /** + * Get the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxCompletionTokens value. + */ + @Generated + public Integer getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * Set the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the + * number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxCompletionTokens the maxCompletionTokens value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setMaxCompletionTokens(Integer maxCompletionTokens) { + this.maxCompletionTokens = maxCompletionTokens; + return this; + } + + /** + * Get the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @return the truncationStrategy value. + */ + @Generated + public TruncationObject getTruncationStrategy() { + return this.truncationStrategy; + } + + /** + * Set the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @param truncationStrategy the truncationStrategy value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setTruncationStrategy(TruncationObject truncationStrategy) { + this.truncationStrategy = truncationStrategy; + return this; + } + + /** + * Get the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @return the toolChoice value. + */ + @Generated + public BinaryData getToolChoice() { + return this.toolChoice; + } + + /** + * Set the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @param toolChoice the toolChoice value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setToolChoice(BinaryData toolChoice) { + this.toolChoice = toolChoice; + return this; + } + + /** + * Get the responseFormat property: Specifies the format that the model must output. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: Specifies the format that the model must output. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @return the parallelToolCalls value. + */ + @Generated + public Boolean isParallelToolCalls() { + return this.parallelToolCalls; + } + + /** + * Set the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @param parallelToolCalls the parallelToolCalls value to set. + * @return the CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setParallelToolCalls(Boolean parallelToolCalls) { + this.parallelToolCalls = parallelToolCalls; + 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 CreateRunOptions object itself. + */ + @Generated + public CreateRunOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateThreadAndRunOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateThreadAndRunOptions.java new file mode 100644 index 000000000000..4aa13425c93e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CreateThreadAndRunOptions.java @@ -0,0 +1,519 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import java.util.List; +import java.util.Map; + +/** + * Options for createThreadAndRun API. + */ +@Fluent +public final class CreateThreadAndRunOptions { + + /* + * The ID of the agent for which the thread should be created. + */ + @Generated + private final String assistantId; + + /* + * The details used to create the new thread. If no thread is provided, an empty one will be created. + */ + @Generated + private AgentThreadCreationOptions thread; + + /* + * The overridden model that the agent should use to run the thread. + */ + @Generated + private String model; + + /* + * The overridden system instructions the agent should use to run the thread. + */ + @Generated + private String instructions; + + /* + * The overridden list of enabled tools the agent should use to run the thread. + */ + @Generated + private List tools; + + /* + * Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis + */ + @Generated + private UpdateToolResourcesOptions toolResources; + + /* + * If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + */ + @Generated + private Boolean stream; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort + * to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxPromptTokens; + + /* + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best + * effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + @Generated + private Integer maxCompletionTokens; + + /* + * The strategy to use for dropping messages as the context windows moves forward. + */ + @Generated + private TruncationObject truncationStrategy; + + /* + * Controls whether or not and which tool is called by the model. + */ + @Generated + private BinaryData toolChoice; + + /* + * Specifies the format that the model must output. + */ + @Generated + private BinaryData responseFormat; + + /* + * If `true` functions will run in parallel during tool use. + */ + @Generated + private Boolean parallelToolCalls; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of CreateThreadAndRunOptions class. + * + * @param assistantId the assistantId value to set. + */ + @Generated + public CreateThreadAndRunOptions(String assistantId) { + this.assistantId = assistantId; + } + + /** + * Get the assistantId property: The ID of the agent 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. If no thread is provided, an empty one will + * be created. + * + * @return the thread value. + */ + @Generated + public AgentThreadCreationOptions getThread() { + return this.thread; + } + + /** + * Set the thread property: The details used to create the new thread. If no thread is provided, an empty one will + * be created. + * + * @param thread the thread value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setThread(AgentThreadCreationOptions thread) { + this.thread = thread; + return this; + } + + /** + * Get the model property: The overridden model that the agent 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 agent should use to run the thread. + * + * @param model the model value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the instructions property: The overridden system instructions the agent 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 agent should use to run the thread. + * + * @param instructions the instructions value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The overridden list of enabled tools the agent 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 agent should use to run the thread. + * + * @param tools the tools value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: Override the tools the agent can use for this run. This is useful for modifying + * the behavior on a per-run basis. + * + * @return the toolResources value. + */ + @Generated + public UpdateToolResourcesOptions getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: Override the tools the agent can use for this run. This is useful for modifying + * the behavior on a per-run basis. + * + * @param toolResources the toolResources value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setToolResources(UpdateToolResourcesOptions toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + * + * @param stream the stream value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxPromptTokens value. + */ + @Generated + public Integer getMaxPromptTokens() { + return this.maxPromptTokens; + } + + /** + * Set the maxPromptTokens property: The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt + * tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxPromptTokens the maxPromptTokens value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setMaxPromptTokens(Integer maxPromptTokens) { + this.maxPromptTokens = maxPromptTokens; + return this; + } + + /** + * Get the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @return the maxCompletionTokens value. + */ + @Generated + public Integer getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * Set the maxCompletionTokens property: The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + * + * @param maxCompletionTokens the maxCompletionTokens value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setMaxCompletionTokens(Integer maxCompletionTokens) { + this.maxCompletionTokens = maxCompletionTokens; + return this; + } + + /** + * Get the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @return the truncationStrategy value. + */ + @Generated + public TruncationObject getTruncationStrategy() { + return this.truncationStrategy; + } + + /** + * Set the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @param truncationStrategy the truncationStrategy value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setTruncationStrategy(TruncationObject truncationStrategy) { + this.truncationStrategy = truncationStrategy; + return this; + } + + /** + * Get the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @return the toolChoice value. + */ + @Generated + public BinaryData getToolChoice() { + return this.toolChoice; + } + + /** + * Set the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @param toolChoice the toolChoice value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setToolChoice(BinaryData toolChoice) { + this.toolChoice = toolChoice; + return this; + } + + /** + * Get the responseFormat property: Specifies the format that the model must output. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: Specifies the format that the model must output. + * + * @param responseFormat the responseFormat value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @return the parallelToolCalls value. + */ + @Generated + public Boolean isParallelToolCalls() { + return this.parallelToolCalls; + } + + /** + * Set the parallelToolCalls property: If `true` functions will run in parallel during tool use. + * + * @param parallelToolCalls the parallelToolCalls value to set. + * @return the CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setParallelToolCalls(Boolean parallelToolCalls) { + this.parallelToolCalls = parallelToolCalls; + 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 CreateThreadAndRunOptions object itself. + */ + @Generated + public CreateThreadAndRunOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CronTrigger.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CronTrigger.java new file mode 100644 index 000000000000..1a44082d76a8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CronTrigger.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cron Trigger Definition. + */ +@Immutable +public final class CronTrigger extends Trigger { + + /* + * Type of the trigger. + */ + @Generated + private String type = "Cron"; + + /* + * Cron expression for the trigger. + */ + @Generated + private final String expression; + + /** + * Creates an instance of CronTrigger class. + * + * @param expression the expression value to set. + */ + @Generated + public CronTrigger(String expression) { + this.expression = expression; + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the expression property: Cron expression for the trigger. + * + * @return the expression value. + */ + @Generated + public String getExpression() { + return this.expression; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("expression", this.expression); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CronTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CronTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CronTrigger. + */ + @Generated + public static CronTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String expression = null; + String type = "Cron"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("expression".equals(fieldName)) { + expression = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + CronTrigger deserializedCronTrigger = new CronTrigger(expression); + deserializedCronTrigger.type = type; + return deserializedCronTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Dataset.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Dataset.java new file mode 100644 index 000000000000..af0db9a2e1ad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Dataset.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Dataset as source for evaluation. + */ +@Fluent +public final class Dataset extends InputData { + + /* + * Type of the data. + */ + @Generated + private String type = "dataset"; + + /* + * Evaluation input data + */ + @Generated + private String id; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of Dataset class. + */ + @Generated + public Dataset() { + } + + /** + * Get the type property: Type of the data. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the id property: Evaluation input data. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: Evaluation input data. + *

Required when create the resource.

+ * + * @param id the id value to set. + * @return the Dataset object itself. + */ + @Generated + public Dataset setId(String id) { + this.id = id; + this.updatedProperties.add("id"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getInputDataAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + if (updatedProperties.contains("id")) { + if (this.id == null) { + jsonWriter.writeNullField("id"); + } else { + jsonWriter.writeStringField("id", this.id); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dataset from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dataset if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Dataset. + */ + @Generated + public static Dataset fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dataset deserializedDataset = new Dataset(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedDataset.type = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedDataset.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedDataset; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DoneEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DoneEvent.java new file mode 100644 index 000000000000..6740aeaa9825 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DoneEvent.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Terminal event indicating the successful end of a stream. + */ +public final class DoneEvent extends ExpandableStringEnum { + + /** + * Event sent when the stream is done. + */ + @Generated + public static final DoneEvent DONE = fromString("done"); + + /** + * Creates a new instance of DoneEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DoneEvent() { + } + + /** + * Creates or finds a DoneEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding DoneEvent. + */ + @Generated + public static DoneEvent fromString(String name) { + return fromString(name, DoneEvent.class); + } + + /** + * Gets known DoneEvent values. + * + * @return known DoneEvent values. + */ + @Generated + public static Collection values() { + return values(DoneEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ErrorEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ErrorEvent.java new file mode 100644 index 000000000000..127ce8fc5909 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ErrorEvent.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Terminal event indicating a server side error while streaming. + */ +public final class ErrorEvent extends ExpandableStringEnum { + + /** + * Event sent when an error occurs, such as an internal server error or a timeout. + */ + @Generated + public static final ErrorEvent ERROR = fromString("error"); + + /** + * Creates a new instance of ErrorEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ErrorEvent() { + } + + /** + * Creates or finds a ErrorEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding ErrorEvent. + */ + @Generated + public static ErrorEvent fromString(String name) { + return fromString(name, ErrorEvent.class); + } + + /** + * Gets known ErrorEvent values. + * + * @return known ErrorEvent values. + */ + @Generated + public static Collection values() { + return values(ErrorEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Evaluation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Evaluation.java new file mode 100644 index 000000000000..831256580126 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Evaluation.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Evaluation Definition. + */ +@Fluent +public final class Evaluation implements JsonSerializable { + + /* + * Identifier of the evaluation. + */ + @Generated + private String id; + + /* + * Data for evaluation. + */ + @Generated + private InputData data; + + /* + * Evaluation target specifying the model config and parameters + */ + @Generated + private EvaluationTarget target; + + /* + * Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. + */ + @Generated + private String displayName; + + /* + * Description of the evaluation. It can be used to store additional information about the evaluation and is + * mutable. + */ + @Generated + private String description; + + /* + * Metadata containing createdBy and modifiedBy information. + */ + @Generated + private SystemData systemData; + + /* + * Status of the evaluation. It is set by service and is read-only. + */ + @Generated + private String status; + + /* + * Evaluation's tags. Unlike properties, tags are fully mutable. + */ + @Generated + private Map tags; + + /* + * Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. + */ + @Generated + private Map properties; + + /* + * Evaluators to be used for the evaluation. + */ + @Generated + private Map evaluators; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setEvaluationAccessor(new JsonMergePatchHelper.EvaluationAccessor() { + + @Override + public Evaluation prepareModelForJsonMergePatch(Evaluation model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Evaluation model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Evaluation class. + */ + @Generated + public Evaluation() { + } + + /** + * Get the id property: Identifier of the evaluation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the data property: Data for evaluation. + * + * @return the data value. + */ + @Generated + public InputData getData() { + return this.data; + } + + /** + * Set the data property: Data for evaluation. + *

Required when create the resource.

+ * + * @param data the data value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setData(InputData data) { + this.data = data; + this.updatedProperties.add("data"); + return this; + } + + /** + * Get the target property: Evaluation target specifying the model config and parameters. + * + * @return the target value. + */ + @Generated + public EvaluationTarget getTarget() { + return this.target; + } + + /** + * Set the target property: Evaluation target specifying the model config and parameters. + * + * @param target the target value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setTarget(EvaluationTarget target) { + this.target = target; + this.updatedProperties.add("target"); + return this; + } + + /** + * Get the displayName property: Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. + * It does not need to be unique. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. + * It does not need to be unique. + * + * @param displayName the displayName value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the description property: Description of the evaluation. It can be used to store additional information about + * the evaluation and is mutable. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the evaluation. It can be used to store additional information about + * the evaluation and is mutable. + * + * @param description the description value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the systemData property: Metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Generated + public SystemData getSystemData() { + return this.systemData; + } + + /** + * Get the status property: Status of the evaluation. It is set by service and is read-only. + * + * @return the status value. + */ + @Generated + public String getStatus() { + return this.status; + } + + /** + * Get the tags property: Evaluation's tags. Unlike properties, tags are fully mutable. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: Evaluation's tags. Unlike properties, tags are fully mutable. + * + * @param tags the tags value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setTags(Map tags) { + this.tags = tags; + this.updatedProperties.add("tags"); + return this; + } + + /** + * Get the properties property: Evaluation's properties. Unlike tags, properties are add-only. Once added, a + * property cannot be removed. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Evaluation's properties. Unlike tags, properties are add-only. Once added, a + * property cannot be removed. + * + * @param properties the properties value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setProperties(Map properties) { + this.properties = properties; + this.updatedProperties.add("properties"); + return this; + } + + /** + * Get the evaluators property: Evaluators to be used for the evaluation. + * + * @return the evaluators value. + */ + @Generated + public Map getEvaluators() { + return this.evaluators; + } + + /** + * Set the evaluators property: Evaluators to be used for the evaluation. + *

Required when create the resource.

+ * + * @param evaluators the evaluators value to set. + * @return the Evaluation object itself. + */ + @Generated + public Evaluation setEvaluators(Map evaluators) { + this.evaluators = evaluators; + this.updatedProperties.add("evaluators"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("data", this.data); + jsonWriter.writeJsonField("target", this.target); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("evaluators", this.evaluators, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("data")) { + if (this.data == null) { + jsonWriter.writeNullField("data"); + } else { + JsonMergePatchHelper.getInputDataAccessor().prepareModelForJsonMergePatch(this.data, true); + jsonWriter.writeJsonField("data", this.data); + JsonMergePatchHelper.getInputDataAccessor().prepareModelForJsonMergePatch(this.data, false); + } + } + if (updatedProperties.contains("target")) { + if (this.target == null) { + jsonWriter.writeNullField("target"); + } else { + JsonMergePatchHelper.getEvaluationTargetAccessor().prepareModelForJsonMergePatch(this.target, true); + jsonWriter.writeJsonField("target", this.target); + JsonMergePatchHelper.getEvaluationTargetAccessor().prepareModelForJsonMergePatch(this.target, false); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("tags")) { + if (this.tags == null) { + jsonWriter.writeNullField("tags"); + } else { + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> { + if (element != null) { + writer.writeString(element); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("properties")) { + if (this.properties == null) { + jsonWriter.writeNullField("properties"); + } else { + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> { + if (element != null) { + writer.writeString(element); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("evaluators")) { + if (this.evaluators == null) { + jsonWriter.writeNullField("evaluators"); + } else { + jsonWriter.writeMapField("evaluators", this.evaluators, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getEvaluatorConfigurationAccessor() + .prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getEvaluatorConfigurationAccessor() + .prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Evaluation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Evaluation if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Evaluation. + */ + @Generated + public static Evaluation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Evaluation deserializedEvaluation = new Evaluation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + deserializedEvaluation.id = reader.getString(); + } else if ("data".equals(fieldName)) { + deserializedEvaluation.data = InputData.fromJson(reader); + } else if ("target".equals(fieldName)) { + deserializedEvaluation.target = EvaluationTarget.fromJson(reader); + } else if ("displayName".equals(fieldName)) { + deserializedEvaluation.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedEvaluation.description = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedEvaluation.systemData = SystemData.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedEvaluation.status = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEvaluation.tags = tags; + } else if ("properties".equals(fieldName)) { + Map properties = reader.readMap(reader1 -> reader1.getString()); + deserializedEvaluation.properties = properties; + } else if ("evaluators".equals(fieldName)) { + Map evaluators + = reader.readMap(reader1 -> EvaluatorConfiguration.fromJson(reader1)); + deserializedEvaluation.evaluators = evaluators; + } else { + reader.skipChildren(); + } + } + return deserializedEvaluation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationSchedule.java new file mode 100644 index 000000000000..efc607744081 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationSchedule.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Evaluation Schedule Definition. + */ +@Fluent +public final class EvaluationSchedule implements JsonSerializable { + + /* + * Name of the schedule, which also serves as the unique identifier for the evaluation + */ + @Generated + private String name; + + /* + * Data for evaluation. + */ + @Generated + private final ApplicationInsightsConfiguration data; + + /* + * Description of the evaluation. It can be used to store additional information about the evaluation and is + * mutable. + */ + @Generated + private String description; + + /* + * Metadata containing createdBy and modifiedBy information. + */ + @Generated + private SystemData systemData; + + /* + * Provisioning State of the evaluation. It is set by service and is read-only. + */ + @Generated + private String provisioningState; + + /* + * Evaluation's tags. Unlike properties, tags are fully mutable. + */ + @Generated + private Map tags; + + /* + * Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. + */ + @Generated + private Map properties; + + /* + * Enabled status of the evaluation. It is set by service and is read-only. + */ + @Generated + private String isEnabled; + + /* + * Evaluators to be used for the evaluation. + */ + @Generated + private final Map evaluators; + + /* + * Trigger for the evaluation. + */ + @Generated + private final Trigger trigger; + + /** + * Creates an instance of EvaluationSchedule class. + * + * @param data the data value to set. + * @param evaluators the evaluators value to set. + * @param trigger the trigger value to set. + */ + @Generated + public EvaluationSchedule(ApplicationInsightsConfiguration data, Map evaluators, + Trigger trigger) { + this.data = data; + this.evaluators = evaluators; + this.trigger = trigger; + } + + /** + * Get the name property: Name of the schedule, which also serves as the unique identifier for the evaluation. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the data property: Data for evaluation. + * + * @return the data value. + */ + @Generated + public ApplicationInsightsConfiguration getData() { + return this.data; + } + + /** + * Get the description property: Description of the evaluation. It can be used to store additional information about + * the evaluation and is mutable. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the evaluation. It can be used to store additional information about + * the evaluation and is mutable. + * + * @param description the description value to set. + * @return the EvaluationSchedule object itself. + */ + @Generated + public EvaluationSchedule setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the systemData property: Metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Generated + public SystemData getSystemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: Provisioning State of the evaluation. It is set by service and is read-only. + * + * @return the provisioningState value. + */ + @Generated + public String getProvisioningState() { + return this.provisioningState; + } + + /** + * Get the tags property: Evaluation's tags. Unlike properties, tags are fully mutable. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: Evaluation's tags. Unlike properties, tags are fully mutable. + * + * @param tags the tags value to set. + * @return the EvaluationSchedule object itself. + */ + @Generated + public EvaluationSchedule setTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Evaluation's properties. Unlike tags, properties are add-only. Once added, a + * property cannot be removed. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Evaluation's properties. Unlike tags, properties are add-only. Once added, a + * property cannot be removed. + * + * @param properties the properties value to set. + * @return the EvaluationSchedule object itself. + */ + @Generated + public EvaluationSchedule setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the isEnabled property: Enabled status of the evaluation. It is set by service and is read-only. + * + * @return the isEnabled value. + */ + @Generated + public String getIsEnabled() { + return this.isEnabled; + } + + /** + * Get the evaluators property: Evaluators to be used for the evaluation. + * + * @return the evaluators value. + */ + @Generated + public Map getEvaluators() { + return this.evaluators; + } + + /** + * Get the trigger property: Trigger for the evaluation. + * + * @return the trigger value. + */ + @Generated + public Trigger getTrigger() { + return this.trigger; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("data", this.data); + jsonWriter.writeMapField("evaluators", this.evaluators, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("trigger", this.trigger); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationSchedule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EvaluationSchedule. + */ + @Generated + public static EvaluationSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + ApplicationInsightsConfiguration data = null; + Map evaluators = null; + Trigger trigger = null; + String description = null; + SystemData systemData = null; + String provisioningState = null; + Map tags = null; + Map properties = null; + String isEnabled = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data".equals(fieldName)) { + data = ApplicationInsightsConfiguration.fromJson(reader); + } else if ("evaluators".equals(fieldName)) { + evaluators = reader.readMap(reader1 -> EvaluatorConfiguration.fromJson(reader1)); + } else if ("trigger".equals(fieldName)) { + trigger = Trigger.fromJson(reader); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("systemData".equals(fieldName)) { + systemData = SystemData.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + provisioningState = reader.getString(); + } else if ("tags".equals(fieldName)) { + tags = reader.readMap(reader1 -> reader1.getString()); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else if ("isEnabled".equals(fieldName)) { + isEnabled = reader.getString(); + } else { + reader.skipChildren(); + } + } + EvaluationSchedule deserializedEvaluationSchedule = new EvaluationSchedule(data, evaluators, trigger); + deserializedEvaluationSchedule.name = name; + deserializedEvaluationSchedule.description = description; + deserializedEvaluationSchedule.systemData = systemData; + deserializedEvaluationSchedule.provisioningState = provisioningState; + deserializedEvaluationSchedule.tags = tags; + deserializedEvaluationSchedule.properties = properties; + deserializedEvaluationSchedule.isEnabled = isEnabled; + return deserializedEvaluationSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTarget.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTarget.java new file mode 100644 index 000000000000..14e5a87ed7f7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTarget.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Target for the evaluation process. + */ +@Fluent +public final class EvaluationTarget implements JsonSerializable { + + /* + * System message related to the evaluation target. + */ + @Generated + private String systemMessage; + + /* + * Model configuration for the evaluation. + */ + @Generated + private TargetModelConfig modelConfig; + + /* + * A dictionary of parameters for the model. + */ + @Generated + private Map modelParams; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setEvaluationTargetAccessor(new JsonMergePatchHelper.EvaluationTargetAccessor() { + + @Override + public EvaluationTarget prepareModelForJsonMergePatch(EvaluationTarget model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(EvaluationTarget model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of EvaluationTarget class. + */ + @Generated + public EvaluationTarget() { + } + + /** + * Get the systemMessage property: System message related to the evaluation target. + * + * @return the systemMessage value. + */ + @Generated + public String getSystemMessage() { + return this.systemMessage; + } + + /** + * Set the systemMessage property: System message related to the evaluation target. + *

Required when create the resource.

+ * + * @param systemMessage the systemMessage value to set. + * @return the EvaluationTarget object itself. + */ + @Generated + public EvaluationTarget setSystemMessage(String systemMessage) { + this.systemMessage = systemMessage; + this.updatedProperties.add("systemMessage"); + return this; + } + + /** + * Get the modelConfig property: Model configuration for the evaluation. + * + * @return the modelConfig value. + */ + @Generated + public TargetModelConfig getModelConfig() { + return this.modelConfig; + } + + /** + * Set the modelConfig property: Model configuration for the evaluation. + *

Required when create the resource.

+ * + * @param modelConfig the modelConfig value to set. + * @return the EvaluationTarget object itself. + */ + @Generated + public EvaluationTarget setModelConfig(TargetModelConfig modelConfig) { + this.modelConfig = modelConfig; + this.updatedProperties.add("modelConfig"); + return this; + } + + /** + * Get the modelParams property: A dictionary of parameters for the model. + * + * @return the modelParams value. + */ + @Generated + public Map getModelParams() { + return this.modelParams; + } + + /** + * Set the modelParams property: A dictionary of parameters for the model. + * + * @param modelParams the modelParams value to set. + * @return the EvaluationTarget object itself. + */ + @Generated + public EvaluationTarget setModelParams(Map modelParams) { + this.modelParams = modelParams; + this.updatedProperties.add("modelParams"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("systemMessage", this.systemMessage); + jsonWriter.writeJsonField("modelConfig", this.modelConfig); + jsonWriter.writeMapField("modelParams", this.modelParams, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("systemMessage")) { + if (this.systemMessage == null) { + jsonWriter.writeNullField("systemMessage"); + } else { + jsonWriter.writeStringField("systemMessage", this.systemMessage); + } + } + if (updatedProperties.contains("modelConfig")) { + if (this.modelConfig == null) { + jsonWriter.writeNullField("modelConfig"); + } else { + JsonMergePatchHelper.getTargetModelConfigAccessor() + .prepareModelForJsonMergePatch(this.modelConfig, true); + jsonWriter.writeJsonField("modelConfig", this.modelConfig); + JsonMergePatchHelper.getTargetModelConfigAccessor() + .prepareModelForJsonMergePatch(this.modelConfig, false); + } + } + if (updatedProperties.contains("modelParams")) { + if (this.modelParams == null) { + jsonWriter.writeNullField("modelParams"); + } else { + jsonWriter.writeMapField("modelParams", this.modelParams, (writer, element) -> { + if (element != null) { + writer.writeUntyped(element == null ? null : element.toObject(Object.class)); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationTarget if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EvaluationTarget. + */ + @Generated + public static EvaluationTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluationTarget deserializedEvaluationTarget = new EvaluationTarget(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("systemMessage".equals(fieldName)) { + deserializedEvaluationTarget.systemMessage = reader.getString(); + } else if ("modelConfig".equals(fieldName)) { + deserializedEvaluationTarget.modelConfig = TargetModelConfig.fromJson(reader); + } else if ("modelParams".equals(fieldName)) { + Map modelParams = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedEvaluationTarget.modelParams = modelParams; + } else { + reader.skipChildren(); + } + } + return deserializedEvaluationTarget; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorConfiguration.java new file mode 100644 index 000000000000..15f8137f0310 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorConfiguration.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Evaluator Configuration. + */ +@Fluent +public final class EvaluatorConfiguration implements JsonSerializable { + + /* + * Identifier of the evaluator. + */ + @Generated + private String id; + + /* + * Initialization parameters of the evaluator. + */ + @Generated + private Map initParams; + + /* + * Data parameters of the evaluator. + */ + @Generated + private Map dataMapping; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setEvaluatorConfigurationAccessor(new JsonMergePatchHelper.EvaluatorConfigurationAccessor() { + + @Override + public EvaluatorConfiguration prepareModelForJsonMergePatch(EvaluatorConfiguration model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(EvaluatorConfiguration model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of EvaluatorConfiguration class. + */ + @Generated + public EvaluatorConfiguration() { + } + + /** + * Get the id property: Identifier of the evaluator. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: Identifier of the evaluator. + *

Required when create the resource.

+ * + * @param id the id value to set. + * @return the EvaluatorConfiguration object itself. + */ + @Generated + public EvaluatorConfiguration setId(String id) { + this.id = id; + this.updatedProperties.add("id"); + return this; + } + + /** + * Get the initParams property: Initialization parameters of the evaluator. + * + * @return the initParams value. + */ + @Generated + public Map getInitParams() { + return this.initParams; + } + + /** + * Set the initParams property: Initialization parameters of the evaluator. + * + * @param initParams the initParams value to set. + * @return the EvaluatorConfiguration object itself. + */ + @Generated + public EvaluatorConfiguration setInitParams(Map initParams) { + this.initParams = initParams; + this.updatedProperties.add("initParams"); + return this; + } + + /** + * Get the dataMapping property: Data parameters of the evaluator. + * + * @return the dataMapping value. + */ + @Generated + public Map getDataMapping() { + return this.dataMapping; + } + + /** + * Set the dataMapping property: Data parameters of the evaluator. + * + * @param dataMapping the dataMapping value to set. + * @return the EvaluatorConfiguration object itself. + */ + @Generated + public EvaluatorConfiguration setDataMapping(Map dataMapping) { + this.dataMapping = dataMapping; + this.updatedProperties.add("dataMapping"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeMapField("initParams", this.initParams, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeMapField("dataMapping", this.dataMapping, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("id")) { + if (this.id == null) { + jsonWriter.writeNullField("id"); + } else { + jsonWriter.writeStringField("id", this.id); + } + } + if (updatedProperties.contains("initParams")) { + if (this.initParams == null) { + jsonWriter.writeNullField("initParams"); + } else { + jsonWriter.writeMapField("initParams", this.initParams, (writer, element) -> { + if (element != null) { + writer.writeUntyped(element == null ? null : element.toObject(Object.class)); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("dataMapping")) { + if (this.dataMapping == null) { + jsonWriter.writeNullField("dataMapping"); + } else { + jsonWriter.writeMapField("dataMapping", this.dataMapping, (writer, element) -> { + if (element != null) { + writer.writeString(element); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluatorConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluatorConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EvaluatorConfiguration. + */ + @Generated + public static EvaluatorConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluatorConfiguration deserializedEvaluatorConfiguration = new EvaluatorConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + deserializedEvaluatorConfiguration.id = reader.getString(); + } else if ("initParams".equals(fieldName)) { + Map initParams = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedEvaluatorConfiguration.initParams = initParams; + } else if ("dataMapping".equals(fieldName)) { + Map dataMapping = reader.readMap(reader1 -> reader1.getString()); + deserializedEvaluatorConfiguration.dataMapping = dataMapping; + } else { + reader.skipChildren(); + } + } + return deserializedEvaluatorConfiguration; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDeletionStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDeletionStatus.java new file mode 100644 index 000000000000..3964874e229a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDeletionStatus.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A status response from a file deletion operation. + */ +@Immutable +public final class FileDeletionStatus implements JsonSerializable { + + /* + * The ID of the resource specified for deletion. + */ + @Generated + private final String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + private final boolean deleted; + + /* + * The object type, which is always 'file'. + */ + @Generated + private final String object = "file"; + + /** + * Creates an instance of FileDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + private FileDeletionStatus(String id, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("deleted", this.deleted); + jsonWriter.writeStringField("object", this.object); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileDeletionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileDeletionStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileDeletionStatus. + */ + @Generated + public static FileDeletionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean deleted = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("deleted".equals(fieldName)) { + deleted = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new FileDeletionStatus(id, deleted); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDetails.java new file mode 100644 index 000000000000..59dc50c926e2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDetails.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * A file in an HTTP request, response, or multipart payload. + * + * A file in an HTTP request, response, or multipart payload. + * + * Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, + * or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the + * operation is treated as a file upload or download. + * + * When using file bodies, the fields of the file model are defined to come from particular locations by default: + * + * - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or + * changed). + * - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). + * - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload + * (MAY be overridden or changed). + * + * A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit + * `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON + * payload, + * it will have a structure like: + * + * ``` + * { + * "contentType": <string?>, + * "filename": <string?>, + * "contents": <string, base64> + * } + * ``` + * + * The `contentType` _within_ the file defines what media types the data inside the file can be, but if the + * specification + * defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is + * serialized_. See the examples below for more information. + * + * NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` + * (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart + * payloads. If + * you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the + * `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` + * location + * is overridden, as shown in the examples below. + */ +@Fluent +public final class FileDetails { + + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of FileDetails class. + * + * @param content the content value to set. + */ + @Generated + public FileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the FileDetails object itself. + */ + @Generated + public FileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the FileDetails object itself. + */ + @Generated + public FileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileListResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileListResponse.java new file mode 100644 index 000000000000..f71a63a7809a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileListResponse.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data from a file list operation. + */ +@Immutable +public final class FileListResponse implements JsonSerializable { + + /* + * The object type, which is always 'list'. + */ + @Generated + private final String object = "list"; + + /* + * The files returned for the request. + */ + @Generated + private final List data; + + /** + * Creates an instance of FileListResponse class. + * + * @param data the data value to set. + */ + @Generated + private FileListResponse(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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileListResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileListResponse. + */ + @Generated + public static FileListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> OpenAIFile.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new FileListResponse(data); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FilePurpose.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FilePurpose.java new file mode 100644 index 000000000000..51b33bfc18ec --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FilePurpose.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 agents. + */ + @Generated + public static final FilePurpose AGENTS = fromString("assistants"); + + /** + * Indicates a file is used as output by agents. + */ + @Generated + public static final FilePurpose AGENTS_OUTPUT = fromString("assistants_output"); + + /** + * Indicates a file is used as input to . + */ + @Generated + public static final FilePurpose BATCH = fromString("batch"); + + /** + * Indicates a file is used as output by a vector store batch operation. + */ + @Generated + public static final FilePurpose BATCH_OUTPUT = fromString("batch_output"); + + /** + * Indicates a file is used as input to a vision operation. + */ + @Generated + public static final FilePurpose VISION = fromString("vision"); + + /** + * 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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchRankingOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchRankingOptions.java new file mode 100644 index 000000000000..87e7b9af7eec --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchRankingOptions.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Ranking options for file search. + */ +@Immutable +public final class FileSearchRankingOptions implements JsonSerializable { + + /* + * File search ranker. + */ + @Generated + private final String ranker; + + /* + * Ranker search threshold. + */ + @Generated + private final double scoreThreshold; + + /** + * Creates an instance of FileSearchRankingOptions class. + * + * @param ranker the ranker value to set. + * @param scoreThreshold the scoreThreshold value to set. + */ + @Generated + public FileSearchRankingOptions(String ranker, double scoreThreshold) { + this.ranker = ranker; + this.scoreThreshold = scoreThreshold; + } + + /** + * Get the ranker property: File search ranker. + * + * @return the ranker value. + */ + @Generated + public String getRanker() { + return this.ranker; + } + + /** + * Get the scoreThreshold property: Ranker search threshold. + * + * @return the scoreThreshold value. + */ + @Generated + public double getScoreThreshold() { + return this.scoreThreshold; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ranker", this.ranker); + jsonWriter.writeDoubleField("score_threshold", this.scoreThreshold); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileSearchRankingOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileSearchRankingOptions if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileSearchRankingOptions. + */ + @Generated + public static FileSearchRankingOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String ranker = null; + double scoreThreshold = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("ranker".equals(fieldName)) { + ranker = reader.getString(); + } else if ("score_threshold".equals(fieldName)) { + scoreThreshold = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new FileSearchRankingOptions(ranker, scoreThreshold); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolCallContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolCallContent.java new file mode 100644 index 000000000000..2dfaceca578b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolCallContent.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The file search result content object. + */ +@Immutable +public final class FileSearchToolCallContent implements JsonSerializable { + + /* + * The type of the content. + */ + @Generated + private final String type = "text"; + + /* + * The text content of the file. + */ + @Generated + private final String text; + + /** + * Creates an instance of FileSearchToolCallContent class. + * + * @param text the text value to set. + */ + @Generated + private FileSearchToolCallContent(String text) { + this.text = text; + } + + /** + * Get the type property: The type of the content. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the text property: The text content of the file. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("text", this.text); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileSearchToolCallContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileSearchToolCallContent if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileSearchToolCallContent. + */ + @Generated + public static FileSearchToolCallContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new FileSearchToolCallContent(text); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinition.java new file mode 100644 index 000000000000..8fdea1880927 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinition.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a file search tool as used to configure an agent. + */ +@Fluent +public final class FileSearchToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "file_search"; + + /* + * Options overrides for the file search tool. + */ + @Generated + private FileSearchToolDefinitionDetails fileSearch; + + /** + * Creates an instance of FileSearchToolDefinition class. + */ + @Generated + public FileSearchToolDefinition() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fileSearch property: Options overrides for the file search tool. + * + * @return the fileSearch value. + */ + @Generated + public FileSearchToolDefinitionDetails getFileSearch() { + return this.fileSearch; + } + + /** + * Set the fileSearch property: Options overrides for the file search tool. + * + * @param fileSearch the fileSearch value to set. + * @return the FileSearchToolDefinition object itself. + */ + @Generated + public FileSearchToolDefinition setFileSearch(FileSearchToolDefinitionDetails fileSearch) { + this.fileSearch = fileSearch; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("file_search", this.fileSearch); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileSearchToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileSearchToolDefinition if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FileSearchToolDefinition. + */ + @Generated + public static FileSearchToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileSearchToolDefinition deserializedFileSearchToolDefinition = new FileSearchToolDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedFileSearchToolDefinition.type = reader.getString(); + } else if ("file_search".equals(fieldName)) { + deserializedFileSearchToolDefinition.fileSearch = FileSearchToolDefinitionDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedFileSearchToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinitionDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinitionDetails.java new file mode 100644 index 000000000000..09846d043522 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolDefinitionDetails.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Options overrides for the file search tool. + */ +@Fluent +public final class FileSearchToolDefinitionDetails implements JsonSerializable { + + /* + * The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for + * gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + * + * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool + * documentation for more information. + */ + @Generated + private Integer maxNumResults; + + /* + * Ranking options for file search. + */ + @Generated + private FileSearchRankingOptions rankingOptions; + + /** + * Creates an instance of FileSearchToolDefinitionDetails class. + */ + @Generated + public FileSearchToolDefinitionDetails() { + } + + /** + * Get the maxNumResults property: The maximum number of results the file search tool should output. The default is + * 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + * + * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool + * documentation for more information. + * + * @return the maxNumResults value. + */ + @Generated + public Integer getMaxNumResults() { + return this.maxNumResults; + } + + /** + * Set the maxNumResults property: The maximum number of results the file search tool should output. The default is + * 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + * + * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool + * documentation for more information. + * + * @param maxNumResults the maxNumResults value to set. + * @return the FileSearchToolDefinitionDetails object itself. + */ + @Generated + public FileSearchToolDefinitionDetails setMaxNumResults(Integer maxNumResults) { + this.maxNumResults = maxNumResults; + return this; + } + + /** + * Get the rankingOptions property: Ranking options for file search. + * + * @return the rankingOptions value. + */ + @Generated + public FileSearchRankingOptions getRankingOptions() { + return this.rankingOptions; + } + + /** + * Set the rankingOptions property: Ranking options for file search. + * + * @param rankingOptions the rankingOptions value to set. + * @return the FileSearchToolDefinitionDetails object itself. + */ + @Generated + public FileSearchToolDefinitionDetails setRankingOptions(FileSearchRankingOptions rankingOptions) { + this.rankingOptions = rankingOptions; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("max_num_results", this.maxNumResults); + jsonWriter.writeJsonField("ranking_options", this.rankingOptions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileSearchToolDefinitionDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileSearchToolDefinitionDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FileSearchToolDefinitionDetails. + */ + @Generated + public static FileSearchToolDefinitionDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileSearchToolDefinitionDetails deserializedFileSearchToolDefinitionDetails + = new FileSearchToolDefinitionDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("max_num_results".equals(fieldName)) { + deserializedFileSearchToolDefinitionDetails.maxNumResults = reader.getNullable(JsonReader::getInt); + } else if ("ranking_options".equals(fieldName)) { + deserializedFileSearchToolDefinitionDetails.rankingOptions + = FileSearchRankingOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedFileSearchToolDefinitionDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolResource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolResource.java new file mode 100644 index 000000000000..5ec48a57d570 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileSearchToolResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A set of resources that are used by the `file_search` tool. + */ +@Fluent +public final class FileSearchToolResource implements JsonSerializable { + + /* + * The ID of the vector store attached to this agent. There can be a maximum of 1 vector + * store attached to the agent. + */ + @Generated + private List vectorStoreIds; + + /* + * The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. + */ + @Generated + private List vectorStores; + + /** + * Creates an instance of FileSearchToolResource class. + */ + @Generated + public FileSearchToolResource() { + } + + /** + * Get the vectorStoreIds property: The ID of the vector store attached to this agent. There can be a maximum of 1 + * vector + * store attached to the agent. + * + * @return the vectorStoreIds value. + */ + @Generated + public List getVectorStoreIds() { + return this.vectorStoreIds; + } + + /** + * Set the vectorStoreIds property: The ID of the vector store attached to this agent. There can be a maximum of 1 + * vector + * store attached to the agent. + * + * @param vectorStoreIds the vectorStoreIds value to set. + * @return the FileSearchToolResource object itself. + */ + @Generated + public FileSearchToolResource setVectorStoreIds(List vectorStoreIds) { + this.vectorStoreIds = vectorStoreIds; + return this; + } + + /** + * Get the vectorStores property: The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. + * + * @return the vectorStores value. + */ + @Generated + public List getVectorStores() { + return this.vectorStores; + } + + /** + * Set the vectorStores property: The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. + * + * @param vectorStores the vectorStores value to set. + * @return the FileSearchToolResource object itself. + */ + @Generated + public FileSearchToolResource setVectorStores(List vectorStores) { + this.vectorStores = vectorStores; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("vector_store_ids", this.vectorStoreIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("vector_stores", this.vectorStores, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileSearchToolResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileSearchToolResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FileSearchToolResource. + */ + @Generated + public static FileSearchToolResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileSearchToolResource deserializedFileSearchToolResource = new FileSearchToolResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("vector_store_ids".equals(fieldName)) { + List vectorStoreIds = reader.readArray(reader1 -> reader1.getString()); + deserializedFileSearchToolResource.vectorStoreIds = vectorStoreIds; + } else if ("vector_stores".equals(fieldName)) { + List vectorStores + = reader.readArray(reader1 -> VectorStoreConfigurations.fromJson(reader1)); + deserializedFileSearchToolResource.vectorStores = vectorStores; + } else { + reader.skipChildren(); + } + } + return deserializedFileSearchToolResource; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileState.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileState.java new file mode 100644 index 000000000000..ca183f1fa559 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileState.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the file. + */ +public final class FileState extends ExpandableStringEnum { + + /** + * The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed + * only for + * compatibility. It can be categorized as an inactive state. + */ + @Generated + public static final FileState UPLOADED = fromString("uploaded"); + + /** + * The operation was created and is not queued to be processed in the future. It can be categorized as an inactive + * state. + */ + @Generated + public static final FileState PENDING = fromString("pending"); + + /** + * The operation has started to be processed. It can be categorized as an active state. + */ + @Generated + public static final FileState RUNNING = fromString("running"); + + /** + * The operation has successfully processed and is ready for consumption. It can be categorized as a terminal state. + */ + @Generated + public static final FileState PROCESSED = fromString("processed"); + + /** + * The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a + * terminal state. + */ + @Generated + public static final FileState ERROR = fromString("error"); + + /** + * The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed only for + * compatibility. + * It can be categorized as an active state. + */ + @Generated + public static final FileState DELETING = fromString("deleting"); + + /** + * The entity has been deleted but may still be referenced by other entities predating the deletion. It can be + * categorized as a + * terminal state. + */ + @Generated + public static final FileState DELETED = fromString("deleted"); + + /** + * Creates a new instance of FileState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FileState() { + } + + /** + * Creates or finds a FileState from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileState. + */ + @Generated + public static FileState fromString(String name) { + return fromString(name, FileState.class); + } + + /** + * Gets known FileState values. + * + * @return known FileState values. + */ + @Generated + public static Collection values() { + return values(FileState.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Frequency.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Frequency.java new file mode 100644 index 000000000000..b40baddc0df3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Frequency.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Frequency of the schedule - day, week, month, hour, minute. + */ +public final class Frequency extends ExpandableStringEnum { + + /** + * Static value Month for Frequency. + */ + @Generated + public static final Frequency MONTH = fromString("Month"); + + /** + * Static value Week for Frequency. + */ + @Generated + public static final Frequency WEEK = fromString("Week"); + + /** + * Static value Day for Frequency. + */ + @Generated + public static final Frequency DAY = fromString("Day"); + + /** + * Static value Hour for Frequency. + */ + @Generated + public static final Frequency HOUR = fromString("Hour"); + + /** + * Static value Minute for Frequency. + */ + @Generated + public static final Frequency MINUTE = fromString("Minute"); + + /** + * Creates a new instance of Frequency value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public Frequency() { + } + + /** + * Creates or finds a Frequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding Frequency. + */ + @Generated + public static Frequency fromString(String name) { + return fromString(name, Frequency.class); + } + + /** + * Gets known Frequency values. + * + * @return known Frequency values. + */ + @Generated + public static Collection values() { + return values(Frequency.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionDefinition.java new file mode 100644 index 000000000000..41691726e8bc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionDefinition.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a function. + */ +@Fluent +public final class FunctionDefinition implements JsonSerializable { + + /* + * The name of the function to be called. + */ + @Generated + private final String name; + + /* + * A description of what the function does, used by the model to choose when and how to call the function. + */ + @Generated + private String description; + + /* + * The parameters the functions accepts, described as a JSON Schema object. + */ + @Generated + private final BinaryData parameters; + + /** + * Creates an instance of FunctionDefinition class. + * + * @param name the name value to set. + * @param parameters the parameters value to set. + */ + @Generated + public FunctionDefinition(String name, BinaryData 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 BinaryData getParameters() { + return this.parameters; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeFieldName("parameters"); + this.parameters.writeTo(jsonWriter); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionDefinition if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FunctionDefinition. + */ + @Generated + public static FunctionDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData parameters = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("parameters".equals(fieldName)) { + parameters + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + FunctionDefinition deserializedFunctionDefinition = new FunctionDefinition(name, parameters); + deserializedFunctionDefinition.description = description; + return deserializedFunctionDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionName.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionName.java new file mode 100644 index 000000000000..d07e7bbe4fd0 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionName.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The function name that will be used, if using the `function` tool. + */ +@Immutable +public final class FunctionName implements JsonSerializable { + + /* + * The name of the function to call + */ + @Generated + private final String name; + + /** + * Creates an instance of FunctionName class. + * + * @param name the name value to set. + */ + @Generated + public FunctionName(String name) { + this.name = name; + } + + /** + * Get the name property: The name of the function to call. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionName from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionName if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FunctionName. + */ + @Generated + public static FunctionName fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new FunctionName(name); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionToolDefinition.java new file mode 100644 index 000000000000..f197dc26234b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FunctionToolDefinition.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a function tool as used to configure an agent. + */ +@Immutable +public final class FunctionToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "function"; + + /* + * The definition of the concrete function that the function tool should call. + */ + @Generated + private final FunctionDefinition function; + + /** + * Creates an instance of FunctionToolDefinition class. + * + * @param function the function value to set. + */ + @Generated + public FunctionToolDefinition(FunctionDefinition function) { + this.function = function; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("function", this.function); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionToolDefinition if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FunctionToolDefinition. + */ + @Generated + public static FunctionToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionDefinition function = null; + String type = "function"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("function".equals(fieldName)) { + function = FunctionDefinition.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + FunctionToolDefinition deserializedFunctionToolDefinition = new FunctionToolDefinition(function); + deserializedFunctionToolDefinition.type = type; + return deserializedFunctionToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ImageDetailLevel.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ImageDetailLevel.java new file mode 100644 index 000000000000..e82abf8612bb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ImageDetailLevel.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies an image's detail level. Can be 'auto', 'low', 'high', or an unknown future value. + */ +public final class ImageDetailLevel extends ExpandableStringEnum { + + /** + * Automatically select an appropriate detail level. + */ + @Generated + public static final ImageDetailLevel AUTO = fromString("auto"); + + /** + * Use a lower detail level to reduce bandwidth or cost. + */ + @Generated + public static final ImageDetailLevel LOW = fromString("low"); + + /** + * Use a higher detail level—potentially more resource-intensive. + */ + @Generated + public static final ImageDetailLevel HIGH = fromString("high"); + + /** + * Creates a new instance of ImageDetailLevel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageDetailLevel() { + } + + /** + * Creates or finds a ImageDetailLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageDetailLevel. + */ + @Generated + public static ImageDetailLevel fromString(String name) { + return fromString(name, ImageDetailLevel.class); + } + + /** + * Gets known ImageDetailLevel values. + * + * @return known ImageDetailLevel values. + */ + @Generated + public static Collection values() { + return values(ImageDetailLevel.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteDetailsReason.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteDetailsReason.java new file mode 100644 index 000000000000..b38a5a0304c7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteDetailsReason.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The reason why the run is incomplete. This will point to which specific token limit was reached over the course of + * the run. + */ +public final class IncompleteDetailsReason extends ExpandableStringEnum { + + /** + * Maximum completion tokens exceeded. + */ + @Generated + public static final IncompleteDetailsReason MAX_COMPLETION_TOKENS = fromString("max_completion_tokens"); + + /** + * Maximum prompt tokens exceeded. + */ + @Generated + public static final IncompleteDetailsReason MAX_PROMPT_TOKENS = fromString("max_prompt_tokens"); + + /** + * Creates a new instance of IncompleteDetailsReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IncompleteDetailsReason() { + } + + /** + * Creates or finds a IncompleteDetailsReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding IncompleteDetailsReason. + */ + @Generated + public static IncompleteDetailsReason fromString(String name) { + return fromString(name, IncompleteDetailsReason.class); + } + + /** + * Gets known IncompleteDetailsReason values. + * + * @return known IncompleteDetailsReason values. + */ + @Generated + public static Collection values() { + return values(IncompleteDetailsReason.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteRunDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteRunDetails.java new file mode 100644 index 000000000000..54b76789e5f4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IncompleteRunDetails.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details on why the run is incomplete. Will be `null` if the run is not incomplete. + */ +@Immutable +public final class IncompleteRunDetails implements JsonSerializable { + + /* + * The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + */ + @Generated + private final IncompleteDetailsReason reason; + + /** + * Creates an instance of IncompleteRunDetails class. + * + * @param reason the reason value to set. + */ + @Generated + private IncompleteRunDetails(IncompleteDetailsReason reason) { + this.reason = reason; + } + + /** + * Get the reason property: The reason why the run is incomplete. This indicates which specific token limit was + * reached during the run. + * + * @return the reason value. + */ + @Generated + public IncompleteDetailsReason getReason() { + return this.reason; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IncompleteRunDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IncompleteRunDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IncompleteRunDetails. + */ + @Generated + public static IncompleteRunDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IncompleteDetailsReason reason = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("reason".equals(fieldName)) { + reason = IncompleteDetailsReason.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new IncompleteRunDetails(reason); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IndexResource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IndexResource.java new file mode 100644 index 000000000000..23fd19d042a8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/IndexResource.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A Index resource. + */ +@Immutable +public final class IndexResource implements JsonSerializable { + + /* + * An index connection id in an IndexResource attached to this agent. + */ + @Generated + private final String indexConnectionId; + + /* + * The name of an index in an IndexResource attached to this agent. + */ + @Generated + private final String indexName; + + /** + * Creates an instance of IndexResource class. + * + * @param indexConnectionId the indexConnectionId value to set. + * @param indexName the indexName value to set. + */ + @Generated + public IndexResource(String indexConnectionId, String indexName) { + this.indexConnectionId = indexConnectionId; + this.indexName = indexName; + } + + /** + * Get the indexConnectionId property: An index connection id in an IndexResource attached to this agent. + * + * @return the indexConnectionId value. + */ + @Generated + public String getIndexConnectionId() { + return this.indexConnectionId; + } + + /** + * Get the indexName property: The name of an index in an IndexResource attached to this agent. + * + * @return the indexName value. + */ + @Generated + public String getIndexName() { + return this.indexName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("index_connection_id", this.indexConnectionId); + jsonWriter.writeStringField("index_name", this.indexName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IndexResource. + */ + @Generated + public static IndexResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String indexConnectionId = null; + String indexName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index_connection_id".equals(fieldName)) { + indexConnectionId = reader.getString(); + } else if ("index_name".equals(fieldName)) { + indexName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new IndexResource(indexConnectionId, indexName); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputData.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputData.java new file mode 100644 index 000000000000..c8f70a119d78 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputData.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Abstract data class for input data configuration. + */ +@Immutable +public class InputData implements JsonSerializable { + + /* + * Type of the data. + */ + @Generated + private String type = "InputData"; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setInputDataAccessor(new JsonMergePatchHelper.InputDataAccessor() { + + @Override + public InputData prepareModelForJsonMergePatch(InputData model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(InputData model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of InputData class. + */ + @Generated + public InputData() { + } + + /** + * Get the type property: Type of the data. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InputData. + */ + @Generated + public static InputData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("app_insights".equals(discriminatorValue)) { + return ApplicationInsightsConfiguration.fromJson(readerToUse.reset()); + } else if ("dataset".equals(discriminatorValue)) { + return Dataset.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static InputData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InputData deserializedInputData = new InputData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedInputData.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedInputData; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListSortOrder.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListSortOrder.java new file mode 100644 index 000000000000..fd0053f34730 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListSortOrder.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MAASModelConfig.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MAASModelConfig.java new file mode 100644 index 000000000000..04525d6942b7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MAASModelConfig.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * MaaS model configuration. The API version would be selected by the service for querying the model. + */ +@Fluent +public final class MAASModelConfig extends TargetModelConfig { + + /* + * Type of the model configuration. + */ + @Generated + private String type = "MAAS"; + + /* + * Endpoint targetURI for MAAS model. + */ + @Generated + private String azureEndpoint; + + /* + * API Key for MAAS model. + */ + @Generated + private String apiKey; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of MAASModelConfig class. + */ + @Generated + public MAASModelConfig() { + } + + /** + * Get the type property: Type of the model configuration. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the azureEndpoint property: Endpoint targetURI for MAAS model. + * + * @return the azureEndpoint value. + */ + @Generated + public String getAzureEndpoint() { + return this.azureEndpoint; + } + + /** + * Set the azureEndpoint property: Endpoint targetURI for MAAS model. + *

Required when create the resource.

+ * + * @param azureEndpoint the azureEndpoint value to set. + * @return the MAASModelConfig object itself. + */ + @Generated + public MAASModelConfig setAzureEndpoint(String azureEndpoint) { + this.azureEndpoint = azureEndpoint; + this.updatedProperties.add("azureEndpoint"); + return this; + } + + /** + * Get the apiKey property: API Key for MAAS model. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API Key for MAAS model. + *

Required when create the resource.

+ * + * @param apiKey the apiKey value to set. + * @return the MAASModelConfig object itself. + */ + @Generated + public MAASModelConfig setApiKey(String apiKey) { + this.apiKey = apiKey; + this.updatedProperties.add("apiKey"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getTargetModelConfigAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("azureEndpoint", this.azureEndpoint); + jsonWriter.writeStringField("apiKey", this.apiKey); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + if (updatedProperties.contains("azureEndpoint")) { + if (this.azureEndpoint == null) { + jsonWriter.writeNullField("azureEndpoint"); + } else { + jsonWriter.writeStringField("azureEndpoint", this.azureEndpoint); + } + } + if (updatedProperties.contains("apiKey")) { + if (this.apiKey == null) { + jsonWriter.writeNullField("apiKey"); + } else { + jsonWriter.writeStringField("apiKey", this.apiKey); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MAASModelConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MAASModelConfig if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MAASModelConfig. + */ + @Generated + public static MAASModelConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MAASModelConfig deserializedMAASModelConfig = new MAASModelConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedMAASModelConfig.type = reader.getString(); + } else if ("azureEndpoint".equals(fieldName)) { + deserializedMAASModelConfig.azureEndpoint = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedMAASModelConfig.apiKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedMAASModelConfig; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageAttachment.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageAttachment.java new file mode 100644 index 000000000000..eed694ea390a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageAttachment.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * This describes to which tools a file has been attached. + */ +@Fluent +public final class MessageAttachment implements JsonSerializable { + + /* + * The ID of the file to attach to the message. + */ + @Generated + private String fileId; + + /* + * Azure asset ID. + */ + @Generated + private VectorStoreDataSource dataSource; + + /* + * The tools to add to this file. + */ + @Generated + private final List tools; + + /** + * Creates an instance of MessageAttachment class. + * + * @param tools the tools value to set. + */ + @Generated + public MessageAttachment(List tools) { + this.tools = tools; + } + + /** + * Get the fileId property: The ID of the file to attach to the message. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Set the fileId property: The ID of the file to attach to the message. + * + * @param fileId the fileId value to set. + * @return the MessageAttachment object itself. + */ + @Generated + public MessageAttachment setFileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the dataSource property: Azure asset ID. + * + * @return the dataSource value. + */ + @Generated + public VectorStoreDataSource getDataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: Azure asset ID. + * + * @param dataSource the dataSource value to set. + * @return the MessageAttachment object itself. + */ + @Generated + public MessageAttachment setDataSource(VectorStoreDataSource dataSource) { + this.dataSource = dataSource; + return this; + } + + /** + * Get the tools property: The tools to add to this file. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tools", this.tools, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeJsonField("data_source", this.dataSource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageAttachment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageAttachment if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageAttachment. + */ + @Generated + public static MessageAttachment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List tools = null; + String fileId = null; + VectorStoreDataSource dataSource = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else if ("data_source".equals(fieldName)) { + dataSource = VectorStoreDataSource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + MessageAttachment deserializedMessageAttachment = new MessageAttachment(tools); + deserializedMessageAttachment.fileId = fileId; + deserializedMessageAttachment.dataSource = dataSource; + return deserializedMessageAttachment; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageBlockType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageBlockType.java new file mode 100644 index 000000000000..ca85471c945e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageBlockType.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the kind of content block within a message. Could be text, an image file, an external image URL, or an + * unknown future type. + */ +public final class MessageBlockType extends ExpandableStringEnum { + + /** + * Indicates a block containing text content. + */ + @Generated + public static final MessageBlockType TEXT = fromString("text"); + + /** + * Indicates a block referencing an internally uploaded image file. + */ + @Generated + public static final MessageBlockType IMAGE_FILE = fromString("image_file"); + + /** + * Indicates a block referencing an external image URL. + */ + @Generated + public static final MessageBlockType IMAGE_URL = fromString("image_url"); + + /** + * Creates a new instance of MessageBlockType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MessageBlockType() { + } + + /** + * Creates or finds a MessageBlockType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageBlockType. + */ + @Generated + public static MessageBlockType fromString(String name) { + return fromString(name, MessageBlockType.class); + } + + /** + * Gets known MessageBlockType values. + * + * @return known MessageBlockType values. + */ + @Generated + public static Collection values() { + return values(MessageBlockType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageContent.java new file mode 100644 index 000000000000..783a86afd440 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageContent.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a single item of thread message content. + */ +@Immutable +public class MessageContent implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "MessageContent"; + + /** + * Creates an instance of MessageContent class. + */ + @Generated + protected MessageContent() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageContent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageContent. + */ + @Generated + public static MessageContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("text".equals(discriminatorValue)) { + return MessageTextContent.fromJson(readerToUse.reset()); + } else if ("image_file".equals(discriminatorValue)) { + return MessageImageFileContent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static MessageContent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageContent deserializedMessageContent = new MessageContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedMessageContent.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedMessageContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDelta.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDelta.java new file mode 100644 index 000000000000..a0a234d65a4b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDelta.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents the typed 'delta' payload within a streaming message delta chunk. + */ +@Immutable +public final class MessageDelta implements JsonSerializable { + + /* + * The entity that produced the message. + */ + @Generated + private final MessageRole role; + + /* + * The content of the message as an array of text and/or images. + */ + @Generated + private final List content; + + /** + * Creates an instance of MessageDelta class. + * + * @param role the role value to set. + * @param content the content value to set. + */ + @Generated + private MessageDelta(MessageRole role, List content) { + this.role = role; + this.content = content; + } + + /** + * Get the role property: The entity that produced the message. + * + * @return the role value. + */ + @Generated + public MessageRole getRole() { + return this.role; + } + + /** + * Get the content property: The content of the message as an array of text and/or images. + * + * @return the content value. + */ + @Generated + public List getContent() { + return this.content; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeArrayField("content", this.content, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDelta from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDelta if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDelta. + */ + @Generated + public static MessageDelta fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageRole role = null; + List content = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("role".equals(fieldName)) { + role = MessageRole.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + content = reader.readArray(reader1 -> MessageDeltaContent.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new MessageDelta(role, content); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaChunk.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaChunk.java new file mode 100644 index 000000000000..9c95eebf7b57 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaChunk.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a message delta i.e. any changed fields on a message during streaming. + */ +@Immutable +public final class MessageDeltaChunk implements JsonSerializable { + + /* + * The identifier of the message, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always `thread.message.delta`. + */ + @Generated + private final String object = "thread.message.delta"; + + /* + * The delta containing the fields that have changed on the Message. + */ + @Generated + private final MessageDelta delta; + + /** + * Creates an instance of MessageDeltaChunk class. + * + * @param id the id value to set. + * @param delta the delta value to set. + */ + @Generated + private MessageDeltaChunk(String id, MessageDelta delta) { + this.id = id; + this.delta = delta; + } + + /** + * Get the id property: The identifier of the message, 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.delta`. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the delta property: The delta containing the fields that have changed on the Message. + * + * @return the delta value. + */ + @Generated + public MessageDelta getDelta() { + return this.delta; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeJsonField("delta", this.delta); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaChunk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaChunk if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaChunk. + */ + @Generated + public static MessageDeltaChunk fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + MessageDelta delta = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("delta".equals(fieldName)) { + delta = MessageDelta.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new MessageDeltaChunk(id, delta); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaContent.java new file mode 100644 index 000000000000..96dc43fed5a9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaContent.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The abstract base representation of a partial streamed message content payload. + */ +@Immutable +public class MessageDeltaContent implements JsonSerializable { + + /* + * The type of content for this content part. + */ + @Generated + private String type = "MessageDeltaContent"; + + /* + * The index of the content part of the message. + */ + @Generated + private final int index; + + /** + * Creates an instance of MessageDeltaContent class. + * + * @param index the index value to set. + */ + @Generated + protected MessageDeltaContent(int index) { + this.index = index; + } + + /** + * Get the type property: The type of content for this content part. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the index property: The index of the content part of the message. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaContent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaContent. + */ + @Generated + public static MessageDeltaContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("image_file".equals(discriminatorValue)) { + return MessageDeltaImageFileContent.fromJson(readerToUse.reset()); + } else if ("text".equals(discriminatorValue)) { + return MessageDeltaTextContent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static MessageDeltaContent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageDeltaContent deserializedMessageDeltaContent = new MessageDeltaContent(index); + deserializedMessageDeltaContent.type = type; + return deserializedMessageDeltaContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContent.java new file mode 100644 index 000000000000..a6e28941bc62 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContent.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a streamed image file content part within a streaming message delta chunk. + */ +@Immutable +public final class MessageDeltaImageFileContent extends MessageDeltaContent { + + /* + * The type of content for this content part. + */ + @Generated + private String type = "image_file"; + + /* + * The image_file data. + */ + @Generated + private MessageDeltaImageFileContentObject imageFile; + + /** + * Creates an instance of MessageDeltaImageFileContent class. + * + * @param index the index value to set. + */ + @Generated + private MessageDeltaImageFileContent(int index) { + super(index); + } + + /** + * Get the type property: The type of content for this content part. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the imageFile property: The image_file data. + * + * @return the imageFile value. + */ + @Generated + public MessageDeltaImageFileContentObject getImageFile() { + return this.imageFile; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("image_file", this.imageFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaImageFileContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaImageFileContent if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaImageFileContent. + */ + @Generated + public static MessageDeltaImageFileContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "image_file"; + MessageDeltaImageFileContentObject imageFile = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("image_file".equals(fieldName)) { + imageFile = MessageDeltaImageFileContentObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + MessageDeltaImageFileContent deserializedMessageDeltaImageFileContent + = new MessageDeltaImageFileContent(index); + deserializedMessageDeltaImageFileContent.type = type; + deserializedMessageDeltaImageFileContent.imageFile = imageFile; + return deserializedMessageDeltaImageFileContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContentObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContentObject.java new file mode 100644 index 000000000000..f962f60c09b4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaImageFileContentObject.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the 'image_file' payload within streaming image file content. + */ +@Immutable +public final class MessageDeltaImageFileContentObject implements JsonSerializable { + + /* + * The file ID of the image in the message content. + */ + @Generated + private String fileId; + + /** + * Creates an instance of MessageDeltaImageFileContentObject class. + */ + @Generated + private MessageDeltaImageFileContentObject() { + } + + /** + * Get the fileId property: The file ID of the image in the message content. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaImageFileContentObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaImageFileContentObject if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageDeltaImageFileContentObject. + */ + @Generated + public static MessageDeltaImageFileContentObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageDeltaImageFileContentObject deserializedMessageDeltaImageFileContentObject + = new MessageDeltaImageFileContentObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + deserializedMessageDeltaImageFileContentObject.fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedMessageDeltaImageFileContentObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextAnnotation.java new file mode 100644 index 000000000000..11fe2e033100 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextAnnotation.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The abstract base representation of a streamed text content part's text annotation. + */ +@Immutable +public class MessageDeltaTextAnnotation implements JsonSerializable { + + /* + * The type of the text content annotation. + */ + @Generated + private String type = "MessageDeltaTextAnnotation"; + + /* + * The index of the annotation within a text content part. + */ + @Generated + private final int index; + + /** + * Creates an instance of MessageDeltaTextAnnotation class. + * + * @param index the index value to set. + */ + @Generated + protected MessageDeltaTextAnnotation(int index) { + this.index = index; + } + + /** + * Get the type property: The type of the text content annotation. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the index property: The index of the annotation within a text content part. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextAnnotation if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextAnnotation. + */ + @Generated + public static MessageDeltaTextAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("url_citation".equals(discriminatorValue)) { + return MessageDeltaTextUrlCitationAnnotation.fromJson(readerToUse.reset()); + } else if ("file_citation".equals(discriminatorValue)) { + return MessageDeltaTextFileCitationAnnotation.fromJson(readerToUse.reset()); + } else if ("file_path".equals(discriminatorValue)) { + return MessageDeltaTextFilePathAnnotation.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static MessageDeltaTextAnnotation fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextAnnotation deserializedMessageDeltaTextAnnotation = new MessageDeltaTextAnnotation(index); + deserializedMessageDeltaTextAnnotation.type = type; + return deserializedMessageDeltaTextAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContent.java new file mode 100644 index 000000000000..ddcb60f67b41 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContent.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a streamed text content part within a streaming message delta chunk. + */ +@Immutable +public final class MessageDeltaTextContent extends MessageDeltaContent { + + /* + * The type of content for this content part. + */ + @Generated + private String type = "text"; + + /* + * The text content details. + */ + @Generated + private MessageDeltaTextContentObject text; + + /** + * Creates an instance of MessageDeltaTextContent class. + * + * @param index the index value to set. + */ + @Generated + private MessageDeltaTextContent(int index) { + super(index); + } + + /** + * Get the type property: The type of content for this content part. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the text property: The text content details. + * + * @return the text value. + */ + @Generated + public MessageDeltaTextContentObject getText() { + return this.text; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("text", this.text); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextContent if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextContent. + */ + @Generated + public static MessageDeltaTextContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "text"; + MessageDeltaTextContentObject text = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("text".equals(fieldName)) { + text = MessageDeltaTextContentObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextContent deserializedMessageDeltaTextContent = new MessageDeltaTextContent(index); + deserializedMessageDeltaTextContent.type = type; + deserializedMessageDeltaTextContent.text = text; + return deserializedMessageDeltaTextContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContentObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContentObject.java new file mode 100644 index 000000000000..15c0a01b1748 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextContentObject.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents the data of a streamed text content part within a streaming message delta chunk. + */ +@Immutable +public final class MessageDeltaTextContentObject implements JsonSerializable { + + /* + * The data that makes up the text. + */ + @Generated + private String value; + + /* + * Annotations for the text. + */ + @Generated + private List annotations; + + /** + * Creates an instance of MessageDeltaTextContentObject class. + */ + @Generated + private MessageDeltaTextContentObject() { + } + + /** + * Get the value property: The data that makes up the text. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Get the annotations property: Annotations for the text. + * + * @return the annotations value. + */ + @Generated + public List getAnnotations() { + return this.annotations; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeArrayField("annotations", this.annotations, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextContentObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextContentObject if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageDeltaTextContentObject. + */ + @Generated + public static MessageDeltaTextContentObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageDeltaTextContentObject deserializedMessageDeltaTextContentObject + = new MessageDeltaTextContentObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("value".equals(fieldName)) { + deserializedMessageDeltaTextContentObject.value = reader.getString(); + } else if ("annotations".equals(fieldName)) { + List annotations + = reader.readArray(reader1 -> MessageDeltaTextAnnotation.fromJson(reader1)); + deserializedMessageDeltaTextContentObject.annotations = annotations; + } else { + reader.skipChildren(); + } + } + return deserializedMessageDeltaTextContentObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotation.java new file mode 100644 index 000000000000..e56c719d8b99 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotation.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a streamed file citation applied to a streaming text content part. + */ +@Immutable +public final class MessageDeltaTextFileCitationAnnotation extends MessageDeltaTextAnnotation { + + /* + * The type of the text content annotation. + */ + @Generated + private String type = "file_citation"; + + /* + * The file citation information. + */ + @Generated + private MessageDeltaTextFileCitationAnnotationObject fileCitation; + + /* + * The text in the message content that needs to be replaced + */ + @Generated + private String text; + + /* + * The start index of this annotation in the content text. + */ + @Generated + private Integer startIndex; + + /* + * The end index of this annotation in the content text. + */ + @Generated + private Integer endIndex; + + /** + * Creates an instance of MessageDeltaTextFileCitationAnnotation class. + * + * @param index the index value to set. + */ + @Generated + private MessageDeltaTextFileCitationAnnotation(int index) { + super(index); + } + + /** + * Get the type property: The type of the text content annotation. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fileCitation property: The file citation information. + * + * @return the fileCitation value. + */ + @Generated + public MessageDeltaTextFileCitationAnnotationObject getFileCitation() { + return this.fileCitation; + } + + /** + * Get the text property: The text in the message content that needs to be replaced. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the startIndex property: The start index of this annotation in the content text. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The end index of this annotation in the content text. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("file_citation", this.fileCitation); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextFileCitationAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextFileCitationAnnotation if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextFileCitationAnnotation. + */ + @Generated + public static MessageDeltaTextFileCitationAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "file_citation"; + MessageDeltaTextFileCitationAnnotationObject fileCitation = null; + String text = null; + Integer startIndex = null; + Integer endIndex = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("file_citation".equals(fieldName)) { + fileCitation = MessageDeltaTextFileCitationAnnotationObject.fromJson(reader); + } else if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextFileCitationAnnotation deserializedMessageDeltaTextFileCitationAnnotation + = new MessageDeltaTextFileCitationAnnotation(index); + deserializedMessageDeltaTextFileCitationAnnotation.type = type; + deserializedMessageDeltaTextFileCitationAnnotation.fileCitation = fileCitation; + deserializedMessageDeltaTextFileCitationAnnotation.text = text; + deserializedMessageDeltaTextFileCitationAnnotation.startIndex = startIndex; + deserializedMessageDeltaTextFileCitationAnnotation.endIndex = endIndex; + return deserializedMessageDeltaTextFileCitationAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotationObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotationObject.java new file mode 100644 index 000000000000..f9b6800150d4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFileCitationAnnotationObject.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the data of a streamed file citation as applied to a streaming text content part. + */ +@Immutable +public final class MessageDeltaTextFileCitationAnnotationObject + implements JsonSerializable { + + /* + * The ID of the specific file the citation is from. + */ + @Generated + private String fileId; + + /* + * The specific quote in the cited file. + */ + @Generated + private String quote; + + /** + * Creates an instance of MessageDeltaTextFileCitationAnnotationObject class. + */ + @Generated + private MessageDeltaTextFileCitationAnnotationObject() { + } + + /** + * Get the fileId property: The ID of the specific file the citation is from. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Get the quote property: The specific quote in the cited file. + * + * @return the quote value. + */ + @Generated + public String getQuote() { + return this.quote; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeStringField("quote", this.quote); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextFileCitationAnnotationObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextFileCitationAnnotationObject if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageDeltaTextFileCitationAnnotationObject. + */ + @Generated + public static MessageDeltaTextFileCitationAnnotationObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageDeltaTextFileCitationAnnotationObject deserializedMessageDeltaTextFileCitationAnnotationObject + = new MessageDeltaTextFileCitationAnnotationObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + deserializedMessageDeltaTextFileCitationAnnotationObject.fileId = reader.getString(); + } else if ("quote".equals(fieldName)) { + deserializedMessageDeltaTextFileCitationAnnotationObject.quote = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedMessageDeltaTextFileCitationAnnotationObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotation.java new file mode 100644 index 000000000000..4968036e22a6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotation.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a streamed file path annotation applied to a streaming text content part. + */ +@Immutable +public final class MessageDeltaTextFilePathAnnotation extends MessageDeltaTextAnnotation { + + /* + * The type of the text content annotation. + */ + @Generated + private String type = "file_path"; + + /* + * The file path information. + */ + @Generated + private MessageDeltaTextFilePathAnnotationObject filePath; + + /* + * The start index of this annotation in the content text. + */ + @Generated + private Integer startIndex; + + /* + * The end index of this annotation in the content text. + */ + @Generated + private Integer endIndex; + + /* + * The text in the message content that needs to be replaced + */ + @Generated + private String text; + + /** + * Creates an instance of MessageDeltaTextFilePathAnnotation class. + * + * @param index the index value to set. + */ + @Generated + private MessageDeltaTextFilePathAnnotation(int index) { + super(index); + } + + /** + * Get the type property: The type of the text content annotation. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the filePath property: The file path information. + * + * @return the filePath value. + */ + @Generated + public MessageDeltaTextFilePathAnnotationObject getFilePath() { + return this.filePath; + } + + /** + * Get the startIndex property: The start index of this annotation in the content text. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The end index of this annotation in the content text. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * Get the text property: The text in the message content that needs to be replaced. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("file_path", this.filePath); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + jsonWriter.writeStringField("text", this.text); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextFilePathAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextFilePathAnnotation if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextFilePathAnnotation. + */ + @Generated + public static MessageDeltaTextFilePathAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "file_path"; + MessageDeltaTextFilePathAnnotationObject filePath = null; + Integer startIndex = null; + Integer endIndex = null; + String text = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("file_path".equals(fieldName)) { + filePath = MessageDeltaTextFilePathAnnotationObject.fromJson(reader); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else if ("text".equals(fieldName)) { + text = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextFilePathAnnotation deserializedMessageDeltaTextFilePathAnnotation + = new MessageDeltaTextFilePathAnnotation(index); + deserializedMessageDeltaTextFilePathAnnotation.type = type; + deserializedMessageDeltaTextFilePathAnnotation.filePath = filePath; + deserializedMessageDeltaTextFilePathAnnotation.startIndex = startIndex; + deserializedMessageDeltaTextFilePathAnnotation.endIndex = endIndex; + deserializedMessageDeltaTextFilePathAnnotation.text = text; + return deserializedMessageDeltaTextFilePathAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotationObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotationObject.java new file mode 100644 index 000000000000..e03e731b4abf --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextFilePathAnnotationObject.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the data of a streamed file path annotation as applied to a streaming text content part. + */ +@Immutable +public final class MessageDeltaTextFilePathAnnotationObject + implements JsonSerializable { + + /* + * The file ID for the annotation. + */ + @Generated + private String fileId; + + /** + * Creates an instance of MessageDeltaTextFilePathAnnotationObject class. + */ + @Generated + private MessageDeltaTextFilePathAnnotationObject() { + } + + /** + * Get the fileId property: The file ID for the annotation. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextFilePathAnnotationObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextFilePathAnnotationObject if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageDeltaTextFilePathAnnotationObject. + */ + @Generated + public static MessageDeltaTextFilePathAnnotationObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageDeltaTextFilePathAnnotationObject deserializedMessageDeltaTextFilePathAnnotationObject + = new MessageDeltaTextFilePathAnnotationObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + deserializedMessageDeltaTextFilePathAnnotationObject.fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedMessageDeltaTextFilePathAnnotationObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationAnnotation.java new file mode 100644 index 000000000000..b53ff56fedf2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationAnnotation.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A citation within the message that points to a specific URL associated with the message. Generated when the agent + * uses tools such as 'bing_grounding' to search the Internet. + */ +@Immutable +public final class MessageDeltaTextUrlCitationAnnotation extends MessageDeltaTextAnnotation { + + /* + * The type of the text content annotation. + */ + @Generated + private String type = "url_citation"; + + /* + * The details of the URL citation. + */ + @Generated + private final MessageDeltaTextUrlCitationDetails urlCitation; + + /* + * The first text index associated with this text annotation. + */ + @Generated + private Integer startIndex; + + /* + * The last text index associated with this text annotation. + */ + @Generated + private Integer endIndex; + + /** + * Creates an instance of MessageDeltaTextUrlCitationAnnotation class. + * + * @param index the index value to set. + * @param urlCitation the urlCitation value to set. + */ + @Generated + private MessageDeltaTextUrlCitationAnnotation(int index, MessageDeltaTextUrlCitationDetails urlCitation) { + super(index); + this.urlCitation = urlCitation; + } + + /** + * Get the type property: The type of the text content annotation. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the urlCitation property: The details of the URL citation. + * + * @return the urlCitation value. + */ + @Generated + public MessageDeltaTextUrlCitationDetails getUrlCitation() { + return this.urlCitation; + } + + /** + * Get the startIndex property: The first text index associated with this text annotation. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The last text index associated with this text annotation. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeJsonField("url_citation", this.urlCitation); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextUrlCitationAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextUrlCitationAnnotation if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextUrlCitationAnnotation. + */ + @Generated + public static MessageDeltaTextUrlCitationAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + MessageDeltaTextUrlCitationDetails urlCitation = null; + String type = "url_citation"; + Integer startIndex = null; + Integer endIndex = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("url_citation".equals(fieldName)) { + urlCitation = MessageDeltaTextUrlCitationDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextUrlCitationAnnotation deserializedMessageDeltaTextUrlCitationAnnotation + = new MessageDeltaTextUrlCitationAnnotation(index, urlCitation); + deserializedMessageDeltaTextUrlCitationAnnotation.type = type; + deserializedMessageDeltaTextUrlCitationAnnotation.startIndex = startIndex; + deserializedMessageDeltaTextUrlCitationAnnotation.endIndex = endIndex; + return deserializedMessageDeltaTextUrlCitationAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationDetails.java new file mode 100644 index 000000000000..656ca7fe14da --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageDeltaTextUrlCitationDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of a URL citation, as used in text thread message content. + */ +@Immutable +public final class MessageDeltaTextUrlCitationDetails implements JsonSerializable { + + /* + * The URL associated with this citation. + */ + @Generated + private final String url; + + /* + * The title of the URL. + */ + @Generated + private String title; + + /** + * Creates an instance of MessageDeltaTextUrlCitationDetails class. + * + * @param url the url value to set. + */ + @Generated + private MessageDeltaTextUrlCitationDetails(String url) { + this.url = url; + } + + /** + * Get the url property: The URL associated with this citation. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the title property: The title of the URL. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("title", this.title); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageDeltaTextUrlCitationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageDeltaTextUrlCitationDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageDeltaTextUrlCitationDetails. + */ + @Generated + public static MessageDeltaTextUrlCitationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String url = null; + String title = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("url".equals(fieldName)) { + url = reader.getString(); + } else if ("title".equals(fieldName)) { + title = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageDeltaTextUrlCitationDetails deserializedMessageDeltaTextUrlCitationDetails + = new MessageDeltaTextUrlCitationDetails(url); + deserializedMessageDeltaTextUrlCitationDetails.title = title; + return deserializedMessageDeltaTextUrlCitationDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileContent.java new file mode 100644 index 000000000000..e96cf0ee7a5f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileContent.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of image file content in a thread message. + */ +@Immutable +public final class MessageImageFileContent extends MessageContent { + + /* + * The object type. + */ + @Generated + private String type = "image_file"; + + /* + * The image file for this thread message content item. + */ + @Generated + private final MessageImageFileDetails imageFile; + + /** + * Creates an instance of MessageImageFileContent class. + * + * @param imageFile the imageFile value to set. + */ + @Generated + private MessageImageFileContent(MessageImageFileDetails imageFile) { + this.imageFile = imageFile; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the imageFile property: The image file for this thread message content item. + * + * @return the imageFile value. + */ + @Generated + public MessageImageFileDetails getImageFile() { + return this.imageFile; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("image_file", this.imageFile); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageImageFileContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageImageFileContent if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageImageFileContent. + */ + @Generated + public static MessageImageFileContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageImageFileDetails imageFile = null; + String type = "image_file"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("image_file".equals(fieldName)) { + imageFile = MessageImageFileDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageImageFileContent deserializedMessageImageFileContent = new MessageImageFileContent(imageFile); + deserializedMessageImageFileContent.type = type; + return deserializedMessageImageFileContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileDetails.java new file mode 100644 index 000000000000..6fb027d92a96 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileDetails.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An image reference, as represented in thread message content. + */ +@Immutable +public final class MessageImageFileDetails implements JsonSerializable { + + /* + * The ID for the file associated with this image. + */ + @Generated + private final String fileId; + + /** + * Creates an instance of MessageImageFileDetails class. + * + * @param fileId the fileId value to set. + */ + @Generated + private MessageImageFileDetails(String fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID for the file associated with this image. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageImageFileDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageImageFileDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageImageFileDetails. + */ + @Generated + public static MessageImageFileDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new MessageImageFileDetails(fileId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileParam.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileParam.java new file mode 100644 index 000000000000..5f246b7ab1b7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageFileParam.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines how an internally uploaded image file is referenced when creating an image-file block. + */ +@Fluent +public final class MessageImageFileParam implements JsonSerializable { + + /* + * The ID of the previously uploaded image file. + */ + @Generated + private final String fileId; + + /* + * Optional detail level for the image (auto, low, or high). + */ + @Generated + private ImageDetailLevel detail; + + /** + * Creates an instance of MessageImageFileParam class. + * + * @param fileId the fileId value to set. + */ + @Generated + public MessageImageFileParam(String fileId) { + this.fileId = fileId; + } + + /** + * Get the fileId property: The ID of the previously uploaded image file. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Get the detail property: Optional detail level for the image (auto, low, or high). + * + * @return the detail value. + */ + @Generated + public ImageDetailLevel getDetail() { + return this.detail; + } + + /** + * Set the detail property: Optional detail level for the image (auto, low, or high). + * + * @param detail the detail value to set. + * @return the MessageImageFileParam object itself. + */ + @Generated + public MessageImageFileParam setDetail(ImageDetailLevel detail) { + this.detail = detail; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeStringField("detail", this.detail == null ? null : this.detail.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageImageFileParam from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageImageFileParam if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageImageFileParam. + */ + @Generated + public static MessageImageFileParam fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + ImageDetailLevel detail = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else if ("detail".equals(fieldName)) { + detail = ImageDetailLevel.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MessageImageFileParam deserializedMessageImageFileParam = new MessageImageFileParam(fileId); + deserializedMessageImageFileParam.detail = detail; + return deserializedMessageImageFileParam; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageUrlParam.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageUrlParam.java new file mode 100644 index 000000000000..48b728755e87 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageImageUrlParam.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines how an external image URL is referenced when creating an image-URL block. + */ +@Fluent +public final class MessageImageUrlParam implements JsonSerializable { + + /* + * The publicly accessible URL of the external image. + */ + @Generated + private final String url; + + /* + * Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not specified. + */ + @Generated + private ImageDetailLevel detail; + + /** + * Creates an instance of MessageImageUrlParam class. + * + * @param url the url value to set. + */ + @Generated + public MessageImageUrlParam(String url) { + this.url = url; + } + + /** + * Get the url property: The publicly accessible URL of the external image. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the detail property: Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not + * specified. + * + * @return the detail value. + */ + @Generated + public ImageDetailLevel getDetail() { + return this.detail; + } + + /** + * Set the detail property: Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not + * specified. + * + * @param detail the detail value to set. + * @return the MessageImageUrlParam object itself. + */ + @Generated + public MessageImageUrlParam setDetail(ImageDetailLevel detail) { + this.detail = detail; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("detail", this.detail == null ? null : this.detail.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageImageUrlParam from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageImageUrlParam if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageImageUrlParam. + */ + @Generated + public static MessageImageUrlParam fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String url = null; + ImageDetailLevel detail = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("url".equals(fieldName)) { + url = reader.getString(); + } else if ("detail".equals(fieldName)) { + detail = ImageDetailLevel.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MessageImageUrlParam deserializedMessageImageUrlParam = new MessageImageUrlParam(url); + deserializedMessageImageUrlParam.detail = detail; + return deserializedMessageImageUrlParam; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetails.java new file mode 100644 index 000000000000..e16ca94f6a64 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetails.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information providing additional detail about a message entering an incomplete status. + */ +@Immutable +public final class MessageIncompleteDetails implements JsonSerializable { + + /* + * The provided reason describing why the message was marked as incomplete. + */ + @Generated + private final MessageIncompleteDetailsReason reason; + + /** + * Creates an instance of MessageIncompleteDetails class. + * + * @param reason the reason value to set. + */ + @Generated + private MessageIncompleteDetails(MessageIncompleteDetailsReason reason) { + this.reason = reason; + } + + /** + * Get the reason property: The provided reason describing why the message was marked as incomplete. + * + * @return the reason value. + */ + @Generated + public MessageIncompleteDetailsReason getReason() { + return this.reason; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageIncompleteDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageIncompleteDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageIncompleteDetails. + */ + @Generated + public static MessageIncompleteDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageIncompleteDetailsReason reason = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("reason".equals(fieldName)) { + reason = MessageIncompleteDetailsReason.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new MessageIncompleteDetails(reason); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetailsReason.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetailsReason.java new file mode 100644 index 000000000000..61f5ac5e9893 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageIncompleteDetailsReason.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A set of reasons describing why a message is marked as incomplete. + */ +public final class MessageIncompleteDetailsReason extends ExpandableStringEnum { + + /** + * The run generating the message was terminated due to content filter flagging. + */ + @Generated + public static final MessageIncompleteDetailsReason CONTENT_FILTER = fromString("content_filter"); + + /** + * The run generating the message exhausted available tokens before completion. + */ + @Generated + public static final MessageIncompleteDetailsReason MAX_TOKENS = fromString("max_tokens"); + + /** + * The run generating the message was cancelled before completion. + */ + @Generated + public static final MessageIncompleteDetailsReason RUN_CANCELLED = fromString("run_cancelled"); + + /** + * The run generating the message failed. + */ + @Generated + public static final MessageIncompleteDetailsReason RUN_FAILED = fromString("run_failed"); + + /** + * The run generating the message expired. + */ + @Generated + public static final MessageIncompleteDetailsReason RUN_EXPIRED = fromString("run_expired"); + + /** + * Creates a new instance of MessageIncompleteDetailsReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MessageIncompleteDetailsReason() { + } + + /** + * Creates or finds a MessageIncompleteDetailsReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageIncompleteDetailsReason. + */ + @Generated + public static MessageIncompleteDetailsReason fromString(String name) { + return fromString(name, MessageIncompleteDetailsReason.class); + } + + /** + * Gets known MessageIncompleteDetailsReason values. + * + * @return known MessageIncompleteDetailsReason values. + */ + @Generated + public static Collection values() { + return values(MessageIncompleteDetailsReason.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputContentBlock.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputContentBlock.java new file mode 100644 index 000000000000..1905ea35ec73 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputContentBlock.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a single content block when creating a message. The 'type' field determines whether it is text, an image + * file, or an external image URL, etc. + */ +@Immutable +public class MessageInputContentBlock implements JsonSerializable { + + /* + * Specifies which kind of content block this is (text, image_file, image_url, etc.). + */ + @Generated + private MessageBlockType type = MessageBlockType.fromString("MessageInputContentBlock"); + + /** + * Creates an instance of MessageInputContentBlock class. + */ + @Generated + public MessageInputContentBlock() { + } + + /** + * Get the type property: Specifies which kind of content block this is (text, image_file, image_url, etc.). + * + * @return the type value. + */ + @Generated + public MessageBlockType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageInputContentBlock from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageInputContentBlock if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MessageInputContentBlock. + */ + @Generated + public static MessageInputContentBlock fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("text".equals(discriminatorValue)) { + return MessageInputTextBlock.fromJson(readerToUse.reset()); + } else if ("image_file".equals(discriminatorValue)) { + return MessageInputImageFileBlock.fromJson(readerToUse.reset()); + } else if ("image_url".equals(discriminatorValue)) { + return MessageInputImageUrlBlock.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static MessageInputContentBlock fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageInputContentBlock deserializedMessageInputContentBlock = new MessageInputContentBlock(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedMessageInputContentBlock.type = MessageBlockType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedMessageInputContentBlock; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageFileBlock.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageFileBlock.java new file mode 100644 index 000000000000..8289ee749bd3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageFileBlock.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An image-file block in a new message, referencing an internally uploaded image by file ID. + */ +@Immutable +public final class MessageInputImageFileBlock extends MessageInputContentBlock { + + /* + * Specifies which kind of content block this is (text, image_file, image_url, etc.). + */ + @Generated + private MessageBlockType type = MessageBlockType.IMAGE_FILE; + + /* + * Information about the referenced image file, including file ID and optional detail level. + */ + @Generated + private final MessageImageFileParam imageFile; + + /** + * Creates an instance of MessageInputImageFileBlock class. + * + * @param imageFile the imageFile value to set. + */ + @Generated + public MessageInputImageFileBlock(MessageImageFileParam imageFile) { + this.imageFile = imageFile; + } + + /** + * Get the type property: Specifies which kind of content block this is (text, image_file, image_url, etc.). + * + * @return the type value. + */ + @Generated + @Override + public MessageBlockType getType() { + return this.type; + } + + /** + * Get the imageFile property: Information about the referenced image file, including file ID and optional detail + * level. + * + * @return the imageFile value. + */ + @Generated + public MessageImageFileParam getImageFile() { + return this.imageFile; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("image_file", this.imageFile); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageInputImageFileBlock from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageInputImageFileBlock if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageInputImageFileBlock. + */ + @Generated + public static MessageInputImageFileBlock fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageImageFileParam imageFile = null; + MessageBlockType type = MessageBlockType.IMAGE_FILE; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("image_file".equals(fieldName)) { + imageFile = MessageImageFileParam.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = MessageBlockType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MessageInputImageFileBlock deserializedMessageInputImageFileBlock + = new MessageInputImageFileBlock(imageFile); + deserializedMessageInputImageFileBlock.type = type; + return deserializedMessageInputImageFileBlock; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageUrlBlock.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageUrlBlock.java new file mode 100644 index 000000000000..fb202cc1b08f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputImageUrlBlock.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An image-URL block in a new message, referencing an external image by URL. + */ +@Immutable +public final class MessageInputImageUrlBlock extends MessageInputContentBlock { + + /* + * Specifies which kind of content block this is (text, image_file, image_url, etc.). + */ + @Generated + private MessageBlockType type = MessageBlockType.IMAGE_URL; + + /* + * Information about the external image URL, including the URL and optional detail level. + */ + @Generated + private final MessageImageUrlParam imageUrl; + + /** + * Creates an instance of MessageInputImageUrlBlock class. + * + * @param imageUrl the imageUrl value to set. + */ + @Generated + public MessageInputImageUrlBlock(MessageImageUrlParam imageUrl) { + this.imageUrl = imageUrl; + } + + /** + * Get the type property: Specifies which kind of content block this is (text, image_file, image_url, etc.). + * + * @return the type value. + */ + @Generated + @Override + public MessageBlockType getType() { + return this.type; + } + + /** + * Get the imageUrl property: Information about the external image URL, including the URL and optional detail level. + * + * @return the imageUrl value. + */ + @Generated + public MessageImageUrlParam getImageUrl() { + return this.imageUrl; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("image_url", this.imageUrl); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageInputImageUrlBlock from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageInputImageUrlBlock if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageInputImageUrlBlock. + */ + @Generated + public static MessageInputImageUrlBlock fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageImageUrlParam imageUrl = null; + MessageBlockType type = MessageBlockType.IMAGE_URL; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("image_url".equals(fieldName)) { + imageUrl = MessageImageUrlParam.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = MessageBlockType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MessageInputImageUrlBlock deserializedMessageInputImageUrlBlock = new MessageInputImageUrlBlock(imageUrl); + deserializedMessageInputImageUrlBlock.type = type; + return deserializedMessageInputImageUrlBlock; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputTextBlock.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputTextBlock.java new file mode 100644 index 000000000000..1b63109c3b65 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageInputTextBlock.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A text block in a new message, containing plain text content. + */ +@Immutable +public final class MessageInputTextBlock extends MessageInputContentBlock { + + /* + * Specifies which kind of content block this is (text, image_file, image_url, etc.). + */ + @Generated + private MessageBlockType type = MessageBlockType.TEXT; + + /* + * The plain text content for this block. + */ + @Generated + private final String text; + + /** + * Creates an instance of MessageInputTextBlock class. + * + * @param text the text value to set. + */ + @Generated + public MessageInputTextBlock(String text) { + this.text = text; + } + + /** + * Get the type property: Specifies which kind of content block this is (text, image_file, image_url, etc.). + * + * @return the type value. + */ + @Generated + @Override + public MessageBlockType getType() { + return this.type; + } + + /** + * Get the text property: The plain text content for this block. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageInputTextBlock from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageInputTextBlock if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageInputTextBlock. + */ + @Generated + public static MessageInputTextBlock fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + MessageBlockType type = MessageBlockType.TEXT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("type".equals(fieldName)) { + type = MessageBlockType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MessageInputTextBlock deserializedMessageInputTextBlock = new MessageInputTextBlock(text); + deserializedMessageInputTextBlock.type = type; + return deserializedMessageInputTextBlock; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageRole.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageRole.java new file mode 100644 index 000000000000..4081a8a0b7a9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageRole.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 agent. + */ + @Generated + public static final MessageRole AGENT = 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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStatus.java new file mode 100644 index 000000000000..dbabd0bac511 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStatus.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The possible execution status values for a thread message. + */ +public final class MessageStatus extends ExpandableStringEnum { + + /** + * A run is currently creating this message. + */ + @Generated + public static final MessageStatus IN_PROGRESS = fromString("in_progress"); + + /** + * This message is incomplete. See incomplete_details for more information. + */ + @Generated + public static final MessageStatus INCOMPLETE = fromString("incomplete"); + + /** + * This message was successfully completed by a run. + */ + @Generated + public static final MessageStatus COMPLETED = fromString("completed"); + + /** + * Creates a new instance of MessageStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MessageStatus() { + } + + /** + * Creates or finds a MessageStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageStatus. + */ + @Generated + public static MessageStatus fromString(String name) { + return fromString(name, MessageStatus.class); + } + + /** + * Gets known MessageStatus values. + * + * @return known MessageStatus values. + */ + @Generated + public static Collection values() { + return values(MessageStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStreamEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStreamEvent.java new file mode 100644 index 000000000000..dc39753a5e70 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageStreamEvent.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Message operation related streaming events. + */ +public final class MessageStreamEvent extends ExpandableStringEnum { + + /** + * Event sent when a new message is created. The data of this event is of type ThreadMessage. + */ + @Generated + public static final MessageStreamEvent THREAD_MESSAGE_CREATED = fromString("thread.message.created"); + + /** + * Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. + */ + @Generated + public static final MessageStreamEvent THREAD_MESSAGE_IN_PROGRESS = fromString("thread.message.in_progress"); + + /** + * Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. + */ + @Generated + public static final MessageStreamEvent THREAD_MESSAGE_DELTA = fromString("thread.message.delta"); + + /** + * Event sent when a message is completed. The data of this event is of type ThreadMessage. + */ + @Generated + public static final MessageStreamEvent THREAD_MESSAGE_COMPLETED = fromString("thread.message.completed"); + + /** + * Event sent before a message is completed. The data of this event is of type ThreadMessage. + */ + @Generated + public static final MessageStreamEvent THREAD_MESSAGE_INCOMPLETE = fromString("thread.message.incomplete"); + + /** + * Creates a new instance of MessageStreamEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MessageStreamEvent() { + } + + /** + * Creates or finds a MessageStreamEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageStreamEvent. + */ + @Generated + public static MessageStreamEvent fromString(String name) { + return fromString(name, MessageStreamEvent.class); + } + + /** + * Gets known MessageStreamEvent values. + * + * @return known MessageStreamEvent values. + */ + @Generated + public static Collection values() { + return values(MessageStreamEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextAnnotation.java new file mode 100644 index 000000000000..bc7e4d7e419a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextAnnotation.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of an annotation to text thread message content. + */ +@Immutable +public class MessageTextAnnotation implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "MessageTextAnnotation"; + + /* + * The textual content associated with this text annotation item. + */ + @Generated + private final String text; + + /** + * Creates an instance of MessageTextAnnotation class. + * + * @param text the text value to set. + */ + @Generated + protected MessageTextAnnotation(String text) { + this.text = text; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the text property: The textual content associated with this text annotation item. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextAnnotation if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextAnnotation. + */ + @Generated + public static MessageTextAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("url_citation".equals(discriminatorValue)) { + return MessageTextUrlCitationAnnotation.fromJson(readerToUse.reset()); + } else if ("file_citation".equals(discriminatorValue)) { + return MessageTextFileCitationAnnotation.fromJson(readerToUse.reset()); + } else if ("file_path".equals(discriminatorValue)) { + return MessageTextFilePathAnnotation.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static MessageTextAnnotation fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageTextAnnotation deserializedMessageTextAnnotation = new MessageTextAnnotation(text); + deserializedMessageTextAnnotation.type = type; + return deserializedMessageTextAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextContent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextContent.java new file mode 100644 index 000000000000..f79b7befeea5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextContent.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of a textual item of thread message content. + */ +@Immutable +public final class MessageTextContent extends MessageContent { + + /* + * The object type. + */ + @Generated + private String type = "text"; + + /* + * The text and associated annotations for this thread message content item. + */ + @Generated + private final MessageTextDetails text; + + /** + * Creates an instance of MessageTextContent class. + * + * @param text the text value to set. + */ + @Generated + private MessageTextContent(MessageTextDetails text) { + this.text = text; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("text", this.text); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextContent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextContent. + */ + @Generated + public static MessageTextContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageTextDetails text = null; + String type = "text"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = MessageTextDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageTextContent deserializedMessageTextContent = new MessageTextContent(text); + deserializedMessageTextContent.type = type; + return deserializedMessageTextContent; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextDetails.java new file mode 100644 index 000000000000..bcdc0a69b524 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The text and associated annotations for a single item of agent thread message content. + */ +@Immutable +public final class MessageTextDetails implements JsonSerializable { + + /* + * The text data. + */ + @Generated + private final String value; + + /* + * A list of annotations associated with this text. + */ + @Generated + private final List annotations; + + /** + * Creates an instance of MessageTextDetails class. + * + * @param value the value value to set. + * @param annotations the annotations value to set. + */ + @Generated + private MessageTextDetails(String value, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeArrayField("annotations", this.annotations, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextDetails. + */ + @Generated + public static MessageTextDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String value = null; + List annotations = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("value".equals(fieldName)) { + value = reader.getString(); + } else if ("annotations".equals(fieldName)) { + annotations = reader.readArray(reader1 -> MessageTextAnnotation.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new MessageTextDetails(value, annotations); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationAnnotation.java new file mode 100644 index 000000000000..bbd7cda1666a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationAnnotation.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A citation within the message that points to a specific quote from a specific File associated with the agent or the + * message. Generated when the agent uses the 'file_search' tool to search files. + */ +@Immutable +public final class MessageTextFileCitationAnnotation extends MessageTextAnnotation { + + /* + * The object type. + */ + @Generated + private String type = "file_citation"; + + /* + * A citation within the message that points to a specific quote from a specific file. + * Generated when the agent uses the "file_search" tool to search files. + */ + @Generated + private final MessageTextFileCitationDetails fileCitation; + + /* + * The first text index associated with this text annotation. + */ + @Generated + private Integer startIndex; + + /* + * The last text index associated with this text annotation. + */ + @Generated + private Integer endIndex; + + /** + * Creates an instance of MessageTextFileCitationAnnotation class. + * + * @param text the text value to set. + * @param fileCitation the fileCitation value to set. + */ + @Generated + private MessageTextFileCitationAnnotation(String text, MessageTextFileCitationDetails fileCitation) { + super(text); + this.fileCitation = fileCitation; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fileCitation property: A citation within the message that points to a specific quote from a specific + * file. + * Generated when the agent uses the "file_search" tool to search files. + * + * @return the fileCitation value. + */ + @Generated + public MessageTextFileCitationDetails getFileCitation() { + return this.fileCitation; + } + + /** + * Get the startIndex property: The first text index associated with this text annotation. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The last text index associated with this text annotation. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", getText()); + jsonWriter.writeJsonField("file_citation", this.fileCitation); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextFileCitationAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextFileCitationAnnotation if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextFileCitationAnnotation. + */ + @Generated + public static MessageTextFileCitationAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + MessageTextFileCitationDetails fileCitation = null; + String type = "file_citation"; + Integer startIndex = null; + Integer endIndex = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("file_citation".equals(fieldName)) { + fileCitation = MessageTextFileCitationDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + MessageTextFileCitationAnnotation deserializedMessageTextFileCitationAnnotation + = new MessageTextFileCitationAnnotation(text, fileCitation); + deserializedMessageTextFileCitationAnnotation.type = type; + deserializedMessageTextFileCitationAnnotation.startIndex = startIndex; + deserializedMessageTextFileCitationAnnotation.endIndex = endIndex; + return deserializedMessageTextFileCitationAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationDetails.java new file mode 100644 index 000000000000..543015785863 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFileCitationDetails.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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 implements JsonSerializable { + + /* + * The ID of the file associated with this citation. + */ + @Generated + private final String fileId; + + /* + * The specific quote cited in the associated file. + */ + @Generated + private final String quote; + + /** + * Creates an instance of MessageTextFileCitationDetails class. + * + * @param fileId the fileId value to set. + * @param quote the quote value to set. + */ + @Generated + private MessageTextFileCitationDetails(String fileId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeStringField("quote", this.quote); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextFileCitationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextFileCitationDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextFileCitationDetails. + */ + @Generated + public static MessageTextFileCitationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + String quote = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else if ("quote".equals(fieldName)) { + quote = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new MessageTextFileCitationDetails(fileId, quote); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathAnnotation.java new file mode 100644 index 000000000000..cc34c7f7bbaf --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathAnnotation.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A citation within the message that points to a file located at a specific path. + */ +@Immutable +public final class MessageTextFilePathAnnotation extends MessageTextAnnotation { + + /* + * The object type. + */ + @Generated + private String type = "file_path"; + + /* + * A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. + */ + @Generated + private final MessageTextFilePathDetails filePath; + + /* + * The first text index associated with this text annotation. + */ + @Generated + private Integer startIndex; + + /* + * The last text index associated with this text annotation. + */ + @Generated + private Integer endIndex; + + /** + * Creates an instance of MessageTextFilePathAnnotation class. + * + * @param text the text value to set. + * @param filePath the filePath value to set. + */ + @Generated + private MessageTextFilePathAnnotation(String text, MessageTextFilePathDetails filePath) { + super(text); + this.filePath = filePath; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the filePath property: A URL for the file that's generated when the agent used the code_interpreter tool to + * generate a file. + * + * @return the filePath value. + */ + @Generated + public MessageTextFilePathDetails getFilePath() { + return this.filePath; + } + + /** + * Get the startIndex property: The first text index associated with this text annotation. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The last text index associated with this text annotation. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", getText()); + jsonWriter.writeJsonField("file_path", this.filePath); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextFilePathAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextFilePathAnnotation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextFilePathAnnotation. + */ + @Generated + public static MessageTextFilePathAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + MessageTextFilePathDetails filePath = null; + String type = "file_path"; + Integer startIndex = null; + Integer endIndex = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("file_path".equals(fieldName)) { + filePath = MessageTextFilePathDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + MessageTextFilePathAnnotation deserializedMessageTextFilePathAnnotation + = new MessageTextFilePathAnnotation(text, filePath); + deserializedMessageTextFilePathAnnotation.type = type; + deserializedMessageTextFilePathAnnotation.startIndex = startIndex; + deserializedMessageTextFilePathAnnotation.endIndex = endIndex; + return deserializedMessageTextFilePathAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathDetails.java new file mode 100644 index 000000000000..09b761a0f044 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextFilePathDetails.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An encapsulation of an image file ID, as used by message image content. + */ +@Immutable +public final class MessageTextFilePathDetails implements JsonSerializable { + + /* + * The ID of the specific file that the citation is from. + */ + @Generated + private final String fileId; + + /** + * Creates an instance of MessageTextFilePathDetails class. + * + * @param fileId the fileId value to set. + */ + @Generated + private MessageTextFilePathDetails(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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextFilePathDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextFilePathDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextFilePathDetails. + */ + @Generated + public static MessageTextFilePathDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new MessageTextFilePathDetails(fileId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationAnnotation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationAnnotation.java new file mode 100644 index 000000000000..77cd10f3eb58 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationAnnotation.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A citation within the message that points to a specific URL associated with the message. Generated when the agent + * uses tools such as 'bing_grounding' to search the Internet. + */ +@Immutable +public final class MessageTextUrlCitationAnnotation extends MessageTextAnnotation { + + /* + * The object type. + */ + @Generated + private String type = "url_citation"; + + /* + * The details of the URL citation. + */ + @Generated + private final MessageTextUrlCitationDetails urlCitation; + + /* + * The first text index associated with this text annotation. + */ + @Generated + private Integer startIndex; + + /* + * The last text index associated with this text annotation. + */ + @Generated + private Integer endIndex; + + /** + * Creates an instance of MessageTextUrlCitationAnnotation class. + * + * @param text the text value to set. + * @param urlCitation the urlCitation value to set. + */ + @Generated + private MessageTextUrlCitationAnnotation(String text, MessageTextUrlCitationDetails urlCitation) { + super(text); + this.urlCitation = urlCitation; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the urlCitation property: The details of the URL citation. + * + * @return the urlCitation value. + */ + @Generated + public MessageTextUrlCitationDetails getUrlCitation() { + return this.urlCitation; + } + + /** + * Get the startIndex property: The first text index associated with this text annotation. + * + * @return the startIndex value. + */ + @Generated + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Get the endIndex property: The last text index associated with this text annotation. + * + * @return the endIndex value. + */ + @Generated + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", getText()); + jsonWriter.writeJsonField("url_citation", this.urlCitation); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("start_index", this.startIndex); + jsonWriter.writeNumberField("end_index", this.endIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextUrlCitationAnnotation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextUrlCitationAnnotation if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextUrlCitationAnnotation. + */ + @Generated + public static MessageTextUrlCitationAnnotation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + MessageTextUrlCitationDetails urlCitation = null; + String type = "url_citation"; + Integer startIndex = null; + Integer endIndex = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("url_citation".equals(fieldName)) { + urlCitation = MessageTextUrlCitationDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("start_index".equals(fieldName)) { + startIndex = reader.getNullable(JsonReader::getInt); + } else if ("end_index".equals(fieldName)) { + endIndex = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + MessageTextUrlCitationAnnotation deserializedMessageTextUrlCitationAnnotation + = new MessageTextUrlCitationAnnotation(text, urlCitation); + deserializedMessageTextUrlCitationAnnotation.type = type; + deserializedMessageTextUrlCitationAnnotation.startIndex = startIndex; + deserializedMessageTextUrlCitationAnnotation.endIndex = endIndex; + return deserializedMessageTextUrlCitationAnnotation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationDetails.java new file mode 100644 index 000000000000..6ab637236aa9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MessageTextUrlCitationDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of a URL citation, as used in text thread message content. + */ +@Immutable +public final class MessageTextUrlCitationDetails implements JsonSerializable { + + /* + * The URL associated with this citation. + */ + @Generated + private final String url; + + /* + * The title of the URL. + */ + @Generated + private String title; + + /** + * Creates an instance of MessageTextUrlCitationDetails class. + * + * @param url the url value to set. + */ + @Generated + private MessageTextUrlCitationDetails(String url) { + this.url = url; + } + + /** + * Get the url property: The URL associated with this citation. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the title property: The title of the URL. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("title", this.title); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageTextUrlCitationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageTextUrlCitationDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageTextUrlCitationDetails. + */ + @Generated + public static MessageTextUrlCitationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String url = null; + String title = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("url".equals(fieldName)) { + url = reader.getString(); + } else if ("title".equals(fieldName)) { + title = reader.getString(); + } else { + reader.skipChildren(); + } + } + MessageTextUrlCitationDetails deserializedMessageTextUrlCitationDetails + = new MessageTextUrlCitationDetails(url); + deserializedMessageTextUrlCitationDetails.title = title; + return deserializedMessageTextUrlCitationDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MicrosoftFabricToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MicrosoftFabricToolDefinition.java new file mode 100644 index 000000000000..6a16035b5b07 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MicrosoftFabricToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a Microsoft Fabric tool as used to configure an agent. + */ +@Immutable +public final class MicrosoftFabricToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "fabric_dataagent"; + + /* + * The list of connections used by the Microsoft Fabric tool. + */ + @Generated + private final ToolConnectionList fabricDataagent; + + /** + * Creates an instance of MicrosoftFabricToolDefinition class. + * + * @param fabricDataagent the fabricDataagent value to set. + */ + @Generated + public MicrosoftFabricToolDefinition(ToolConnectionList fabricDataagent) { + this.fabricDataagent = fabricDataagent; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fabricDataagent property: The list of connections used by the Microsoft Fabric tool. + * + * @return the fabricDataagent value. + */ + @Generated + public ToolConnectionList getFabricDataagent() { + return this.fabricDataagent; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("fabric_dataagent", this.fabricDataagent); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftFabricToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftFabricToolDefinition if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MicrosoftFabricToolDefinition. + */ + @Generated + public static MicrosoftFabricToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolConnectionList fabricDataagent = null; + String type = "fabric_dataagent"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("fabric_dataagent".equals(fieldName)) { + fabricDataagent = ToolConnectionList.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + MicrosoftFabricToolDefinition deserializedMicrosoftFabricToolDefinition + = new MicrosoftFabricToolDefinition(fabricDataagent); + deserializedMicrosoftFabricToolDefinition.type = type; + return deserializedMicrosoftFabricToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIFile.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIFile.java new file mode 100644 index 000000000000..3d6d7bd23451 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIFile.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Represents an agent that can call the model and use tools. + */ +@Immutable +public final class OpenAIFile implements JsonSerializable { + + /* + * The object type, which is always 'file'. + */ + @Generated + private final String object = "file"; + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The size of the file, in bytes. + */ + @Generated + private final int bytes; + + /* + * The name of the file. + */ + @Generated + private final String filename; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * The intended purpose of a file. + */ + @Generated + private final FilePurpose purpose; + + /* + * The state of the file. This field is available in Azure OpenAI only. + */ + @Generated + private FileState status; + + /* + * The error message with details in case processing of this file failed. This field is available in Azure OpenAI + * only. + */ + @Generated + private String statusDetails; + + /** + * 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; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.purpose = 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; + } + + /** + * Get the status property: The state of the file. This field is available in Azure OpenAI only. + * + * @return the status value. + */ + @Generated + public FileState getStatus() { + return this.status; + } + + /** + * Get the statusDetails property: The error message with details in case processing of this file failed. This field + * is available in Azure OpenAI only. + * + * @return the statusDetails value. + */ + @Generated + public String getStatusDetails() { + return this.statusDetails; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeIntField("bytes", this.bytes); + jsonWriter.writeStringField("filename", this.filename); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("purpose", this.purpose == null ? null : this.purpose.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("status_details", this.statusDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIFile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIFile if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIFile. + */ + @Generated + public static OpenAIFile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + int bytes = 0; + String filename = null; + OffsetDateTime createdAt = null; + FilePurpose purpose = null; + FileState status = null; + String statusDetails = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("bytes".equals(fieldName)) { + bytes = reader.getInt(); + } else if ("filename".equals(fieldName)) { + filename = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("purpose".equals(fieldName)) { + purpose = FilePurpose.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + status = FileState.fromString(reader.getString()); + } else if ("status_details".equals(fieldName)) { + statusDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + OpenAIFile deserializedOpenAIFile = new OpenAIFile(id, bytes, filename, createdAt, purpose); + deserializedOpenAIFile.status = status; + deserializedOpenAIFile.statusDetails = statusDetails; + return deserializedOpenAIFile; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgent.java new file mode 100644 index 000000000000..3bfd025dc63e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgent.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfAgent implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfAgent 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 + private OpenAIPageableListOfAgent(List data, String firstId, String lastId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfAgent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfAgent if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfAgent. + */ + @Generated + public static OpenAIPageableListOfAgent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> Agent.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfAgent(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgentThread.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgentThread.java new file mode 100644 index 000000000000..78a44af9e6ce --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfAgentThread.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfAgentThread implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfAgentThread 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 + private OpenAIPageableListOfAgentThread(List data, String firstId, String lastId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfAgentThread from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfAgentThread if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfAgentThread. + */ + @Generated + public static OpenAIPageableListOfAgentThread fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> AgentThread.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfAgentThread(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfRunStep.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfRunStep.java new file mode 100644 index 000000000000..5ce910ddb535 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfRunStep.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfRunStep implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final 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 + private OpenAIPageableListOfRunStep(List data, String firstId, String lastId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfRunStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfRunStep if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfRunStep. + */ + @Generated + public static OpenAIPageableListOfRunStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> RunStep.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfRunStep(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadMessage.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadMessage.java new file mode 100644 index 000000000000..62a54167f253 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadMessage.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfThreadMessage implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final 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 + private OpenAIPageableListOfThreadMessage(List data, String firstId, String lastId, + 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfThreadMessage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfThreadMessage if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfThreadMessage. + */ + @Generated + public static OpenAIPageableListOfThreadMessage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> ThreadMessage.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfThreadMessage(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadRun.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadRun.java new file mode 100644 index 000000000000..70018b85d040 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfThreadRun.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfThreadRun implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final 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 + private OpenAIPageableListOfThreadRun(List data, String firstId, String lastId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfThreadRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfThreadRun if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfThreadRun. + */ + @Generated + public static OpenAIPageableListOfThreadRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> ThreadRun.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfThreadRun(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStore.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStore.java new file mode 100644 index 000000000000..8652e37a131e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStore.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfVectorStore implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfVectorStore 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 + private OpenAIPageableListOfVectorStore(List data, String firstId, String lastId, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfVectorStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfVectorStore if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfVectorStore. + */ + @Generated + public static OpenAIPageableListOfVectorStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> VectorStore.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfVectorStore(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStoreFile.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStoreFile.java new file mode 100644 index 000000000000..516a55094b0e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenAIPageableListOfVectorStoreFile.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response data for a requested list of items. + */ +@Immutable +public final class OpenAIPageableListOfVectorStoreFile + implements JsonSerializable { + + /* + * The object type, which is always list. + */ + @Generated + private final String object = "list"; + + /* + * The requested list of items. + */ + @Generated + private final List data; + + /* + * The first ID represented in this list. + */ + @Generated + private final String firstId; + + /* + * The last ID represented in this list. + */ + @Generated + private final String lastId; + + /* + * A value indicating whether there are additional values available not captured in this list. + */ + @Generated + private final boolean hasMore; + + /** + * Creates an instance of OpenAIPageableListOfVectorStoreFile 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 + private OpenAIPageableListOfVectorStoreFile(List data, String firstId, String lastId, + 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("first_id", this.firstId); + jsonWriter.writeStringField("last_id", this.lastId); + jsonWriter.writeBooleanField("has_more", this.hasMore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenAIPageableListOfVectorStoreFile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenAIPageableListOfVectorStoreFile if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenAIPageableListOfVectorStoreFile. + */ + @Generated + public static OpenAIPageableListOfVectorStoreFile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + String firstId = null; + String lastId = null; + boolean hasMore = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> VectorStoreFile.fromJson(reader1)); + } else if ("first_id".equals(fieldName)) { + firstId = reader.getString(); + } else if ("last_id".equals(fieldName)) { + lastId = reader.getString(); + } else if ("has_more".equals(fieldName)) { + hasMore = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new OpenAIPageableListOfVectorStoreFile(data, firstId, lastId, hasMore); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAnonymousAuthDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAnonymousAuthDetails.java new file mode 100644 index 000000000000..a02007371b52 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAnonymousAuthDetails.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Security details for OpenApi anonymous authentication. + */ +@Immutable +public final class OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { + + /* + * The type of authentication, must be anonymous/connection/managed_identity + */ + @Generated + private OpenApiAuthType type = OpenApiAuthType.ANONYMOUS; + + /** + * Creates an instance of OpenApiAnonymousAuthDetails class. + */ + @Generated + public OpenApiAnonymousAuthDetails() { + } + + /** + * Get the type property: The type of authentication, must be anonymous/connection/managed_identity. + * + * @return the type value. + */ + @Generated + @Override + public OpenApiAuthType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiAnonymousAuthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiAnonymousAuthDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OpenApiAnonymousAuthDetails. + */ + @Generated + public static OpenApiAnonymousAuthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OpenApiAnonymousAuthDetails deserializedOpenApiAnonymousAuthDetails = new OpenApiAnonymousAuthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedOpenApiAnonymousAuthDetails.type = OpenApiAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedOpenApiAnonymousAuthDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthDetails.java new file mode 100644 index 000000000000..25cc470a8bce --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthDetails.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * authentication details for OpenApiFunctionDefinition. + */ +@Immutable +public class OpenApiAuthDetails implements JsonSerializable { + + /* + * The type of authentication, must be anonymous/connection/managed_identity + */ + @Generated + private OpenApiAuthType type = OpenApiAuthType.fromString("OpenApiAuthDetails"); + + /** + * Creates an instance of OpenApiAuthDetails class. + */ + @Generated + public OpenApiAuthDetails() { + } + + /** + * Get the type property: The type of authentication, must be anonymous/connection/managed_identity. + * + * @return the type value. + */ + @Generated + public OpenApiAuthType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiAuthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiAuthDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OpenApiAuthDetails. + */ + @Generated + public static OpenApiAuthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("anonymous".equals(discriminatorValue)) { + return OpenApiAnonymousAuthDetails.fromJson(readerToUse.reset()); + } else if ("connection".equals(discriminatorValue)) { + return OpenApiConnectionAuthDetails.fromJson(readerToUse.reset()); + } else if ("managed_identity".equals(discriminatorValue)) { + return OpenApiManagedAuthDetails.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static OpenApiAuthDetails fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OpenApiAuthDetails deserializedOpenApiAuthDetails = new OpenApiAuthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedOpenApiAuthDetails.type = OpenApiAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedOpenApiAuthDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthType.java new file mode 100644 index 000000000000..5108da9a09f1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiAuthType.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Authentication type for OpenApi endpoint. Allowed types are: + * - Anonymous (no authentication required) + * - Connection (requires connection_id to endpoint, as setup in AI Foundry) + * - Managed_Identity (requires audience for identity based auth). + */ +public final class OpenApiAuthType extends ExpandableStringEnum { + + /** + * Static value anonymous for OpenApiAuthType. + */ + @Generated + public static final OpenApiAuthType ANONYMOUS = fromString("anonymous"); + + /** + * Static value connection for OpenApiAuthType. + */ + @Generated + public static final OpenApiAuthType CONNECTION = fromString("connection"); + + /** + * Static value managed_identity for OpenApiAuthType. + */ + @Generated + public static final OpenApiAuthType MANAGED_IDENTITY = fromString("managed_identity"); + + /** + * Creates a new instance of OpenApiAuthType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OpenApiAuthType() { + } + + /** + * Creates or finds a OpenApiAuthType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OpenApiAuthType. + */ + @Generated + public static OpenApiAuthType fromString(String name) { + return fromString(name, OpenApiAuthType.class); + } + + /** + * Gets known OpenApiAuthType values. + * + * @return known OpenApiAuthType values. + */ + @Generated + public static Collection values() { + return values(OpenApiAuthType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionAuthDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionAuthDetails.java new file mode 100644 index 000000000000..6c40d5749be6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionAuthDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Security details for OpenApi connection authentication. + */ +@Immutable +public final class OpenApiConnectionAuthDetails extends OpenApiAuthDetails { + + /* + * The type of authentication, must be anonymous/connection/managed_identity + */ + @Generated + private OpenApiAuthType type = OpenApiAuthType.CONNECTION; + + /* + * Connection auth security details + */ + @Generated + private final OpenApiConnectionSecurityScheme securityScheme; + + /** + * Creates an instance of OpenApiConnectionAuthDetails class. + * + * @param securityScheme the securityScheme value to set. + */ + @Generated + public OpenApiConnectionAuthDetails(OpenApiConnectionSecurityScheme securityScheme) { + this.securityScheme = securityScheme; + } + + /** + * Get the type property: The type of authentication, must be anonymous/connection/managed_identity. + * + * @return the type value. + */ + @Generated + @Override + public OpenApiAuthType getType() { + return this.type; + } + + /** + * Get the securityScheme property: Connection auth security details. + * + * @return the securityScheme value. + */ + @Generated + public OpenApiConnectionSecurityScheme getSecurityScheme() { + return this.securityScheme; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("security_scheme", this.securityScheme); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiConnectionAuthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiConnectionAuthDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiConnectionAuthDetails. + */ + @Generated + public static OpenApiConnectionAuthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OpenApiConnectionSecurityScheme securityScheme = null; + OpenApiAuthType type = OpenApiAuthType.CONNECTION; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("security_scheme".equals(fieldName)) { + securityScheme = OpenApiConnectionSecurityScheme.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = OpenApiAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + OpenApiConnectionAuthDetails deserializedOpenApiConnectionAuthDetails + = new OpenApiConnectionAuthDetails(securityScheme); + deserializedOpenApiConnectionAuthDetails.type = type; + return deserializedOpenApiConnectionAuthDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionSecurityScheme.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionSecurityScheme.java new file mode 100644 index 000000000000..d747c131bae5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiConnectionSecurityScheme.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Security scheme for OpenApi managed_identity authentication. + */ +@Immutable +public final class OpenApiConnectionSecurityScheme implements JsonSerializable { + + /* + * Connection id for Connection auth type + */ + @Generated + private final String connectionId; + + /** + * Creates an instance of OpenApiConnectionSecurityScheme class. + * + * @param connectionId the connectionId value to set. + */ + @Generated + public OpenApiConnectionSecurityScheme(String connectionId) { + this.connectionId = connectionId; + } + + /** + * Get the connectionId property: Connection id for Connection auth type. + * + * @return the connectionId value. + */ + @Generated + public String getConnectionId() { + return this.connectionId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connection_id", this.connectionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiConnectionSecurityScheme from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiConnectionSecurityScheme if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiConnectionSecurityScheme. + */ + @Generated + public static OpenApiConnectionSecurityScheme fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String connectionId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("connection_id".equals(fieldName)) { + connectionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OpenApiConnectionSecurityScheme(connectionId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiFunctionDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiFunctionDefinition.java new file mode 100644 index 000000000000..eacfeee3351d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiFunctionDefinition.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The input definition information for an openapi function. + */ +@Fluent +public final class OpenApiFunctionDefinition implements JsonSerializable { + + /* + * The name of the function to be called. + */ + @Generated + private final String name; + + /* + * A description of what the function does, used by the model to choose when and how to call the function. + */ + @Generated + private String description; + + /* + * The openapi function shape, described as a JSON Schema object. + */ + @Generated + private final BinaryData spec; + + /* + * Open API authentication details + */ + @Generated + private final OpenApiAuthDetails auth; + + /** + * Creates an instance of OpenApiFunctionDefinition class. + * + * @param name the name value to set. + * @param spec the spec value to set. + * @param auth the auth value to set. + */ + @Generated + public OpenApiFunctionDefinition(String name, BinaryData spec, OpenApiAuthDetails auth) { + this.name = name; + this.spec = spec; + this.auth = auth; + } + + /** + * 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 OpenApiFunctionDefinition object itself. + */ + @Generated + public OpenApiFunctionDefinition setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the spec property: The openapi function shape, described as a JSON Schema object. + * + * @return the spec value. + */ + @Generated + public BinaryData getSpec() { + return this.spec; + } + + /** + * Get the auth property: Open API authentication details. + * + * @return the auth value. + */ + @Generated + public OpenApiAuthDetails getAuth() { + return this.auth; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeFieldName("spec"); + this.spec.writeTo(jsonWriter); + jsonWriter.writeJsonField("auth", this.auth); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("default_params", this.defaultParams, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiFunctionDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiFunctionDefinition if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiFunctionDefinition. + */ + @Generated + public static OpenApiFunctionDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData spec = null; + OpenApiAuthDetails auth = null; + String description = null; + List defaultParams = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("spec".equals(fieldName)) { + spec = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("auth".equals(fieldName)) { + auth = OpenApiAuthDetails.fromJson(reader); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("default_params".equals(fieldName)) { + defaultParams = reader.readArray(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + OpenApiFunctionDefinition deserializedOpenApiFunctionDefinition + = new OpenApiFunctionDefinition(name, spec, auth); + deserializedOpenApiFunctionDefinition.description = description; + deserializedOpenApiFunctionDefinition.defaultParams = defaultParams; + return deserializedOpenApiFunctionDefinition; + }); + } + + /* + * List of OpenAPI spec parameters that will use user-provided defaults + */ + @Generated + private List defaultParams; + + /** + * Get the defaultParams property: List of OpenAPI spec parameters that will use user-provided defaults. + * + * @return the defaultParams value. + */ + @Generated + public List getDefaultParams() { + return this.defaultParams; + } + + /** + * Set the defaultParams property: List of OpenAPI spec parameters that will use user-provided defaults. + * + * @param defaultParams the defaultParams value to set. + * @return the OpenApiFunctionDefinition object itself. + */ + @Generated + public OpenApiFunctionDefinition setDefaultParams(List defaultParams) { + this.defaultParams = defaultParams; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedAuthDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedAuthDetails.java new file mode 100644 index 000000000000..ae1066963997 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedAuthDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Security details for OpenApi managed_identity authentication. + */ +@Immutable +public final class OpenApiManagedAuthDetails extends OpenApiAuthDetails { + + /* + * The type of authentication, must be anonymous/connection/managed_identity + */ + @Generated + private OpenApiAuthType type = OpenApiAuthType.MANAGED_IDENTITY; + + /* + * Connection auth security details + */ + @Generated + private final OpenApiManagedSecurityScheme securityScheme; + + /** + * Creates an instance of OpenApiManagedAuthDetails class. + * + * @param securityScheme the securityScheme value to set. + */ + @Generated + public OpenApiManagedAuthDetails(OpenApiManagedSecurityScheme securityScheme) { + this.securityScheme = securityScheme; + } + + /** + * Get the type property: The type of authentication, must be anonymous/connection/managed_identity. + * + * @return the type value. + */ + @Generated + @Override + public OpenApiAuthType getType() { + return this.type; + } + + /** + * Get the securityScheme property: Connection auth security details. + * + * @return the securityScheme value. + */ + @Generated + public OpenApiManagedSecurityScheme getSecurityScheme() { + return this.securityScheme; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("security_scheme", this.securityScheme); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiManagedAuthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiManagedAuthDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiManagedAuthDetails. + */ + @Generated + public static OpenApiManagedAuthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OpenApiManagedSecurityScheme securityScheme = null; + OpenApiAuthType type = OpenApiAuthType.MANAGED_IDENTITY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("security_scheme".equals(fieldName)) { + securityScheme = OpenApiManagedSecurityScheme.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = OpenApiAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + OpenApiManagedAuthDetails deserializedOpenApiManagedAuthDetails + = new OpenApiManagedAuthDetails(securityScheme); + deserializedOpenApiManagedAuthDetails.type = type; + return deserializedOpenApiManagedAuthDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedSecurityScheme.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedSecurityScheme.java new file mode 100644 index 000000000000..02624e18c55c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiManagedSecurityScheme.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Security scheme for OpenApi managed_identity authentication. + */ +@Immutable +public final class OpenApiManagedSecurityScheme implements JsonSerializable { + + /* + * Authentication scope for managed_identity auth type + */ + @Generated + private final String audience; + + /** + * Creates an instance of OpenApiManagedSecurityScheme class. + * + * @param audience the audience value to set. + */ + @Generated + public OpenApiManagedSecurityScheme(String audience) { + this.audience = audience; + } + + /** + * Get the audience property: Authentication scope for managed_identity auth type. + * + * @return the audience value. + */ + @Generated + public String getAudience() { + return this.audience; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("audience", this.audience); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiManagedSecurityScheme from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiManagedSecurityScheme if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiManagedSecurityScheme. + */ + @Generated + public static OpenApiManagedSecurityScheme fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String audience = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("audience".equals(fieldName)) { + audience = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OpenApiManagedSecurityScheme(audience); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiToolDefinition.java new file mode 100644 index 000000000000..a5781f661671 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OpenApiToolDefinition.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for an OpenAPI tool as used to configure an agent. + */ +@Immutable +public final class OpenApiToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "openapi"; + + /* + * The openapi function definition. + */ + @Generated + private final OpenApiFunctionDefinition openapi; + + /** + * Creates an instance of OpenApiToolDefinition class. + * + * @param openapi the openapi value to set. + */ + @Generated + public OpenApiToolDefinition(OpenApiFunctionDefinition openapi) { + this.openapi = openapi; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the openapi property: The openapi function definition. + * + * @return the openapi value. + */ + @Generated + public OpenApiFunctionDefinition getOpenapi() { + return this.openapi; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("openapi", this.openapi); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OpenApiToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OpenApiToolDefinition if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OpenApiToolDefinition. + */ + @Generated + public static OpenApiToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OpenApiFunctionDefinition openapi = null; + String type = "openapi"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("openapi".equals(fieldName)) { + openapi = OpenApiFunctionDefinition.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + OpenApiToolDefinition deserializedOpenApiToolDefinition = new OpenApiToolDefinition(openapi); + deserializedOpenApiToolDefinition.type = type; + return deserializedOpenApiToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceSchedule.java new file mode 100644 index 000000000000..19808780fb55 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceSchedule.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * RecurrenceSchedule Definition. + */ +@Fluent +public final class RecurrenceSchedule implements JsonSerializable { + + /* + * List of hours for the schedule. + */ + @Generated + private final List hours; + + /* + * List of minutes for the schedule. + */ + @Generated + private final List minutes; + + /* + * List of days for the schedule. + */ + @Generated + private List weekDays; + + /* + * List of month days for the schedule + */ + @Generated + private List monthDays; + + /** + * Creates an instance of RecurrenceSchedule class. + * + * @param hours the hours value to set. + * @param minutes the minutes value to set. + */ + @Generated + public RecurrenceSchedule(List hours, List minutes) { + this.hours = hours; + this.minutes = minutes; + } + + /** + * Get the hours property: List of hours for the schedule. + * + * @return the hours value. + */ + @Generated + public List getHours() { + return this.hours; + } + + /** + * Get the minutes property: List of minutes for the schedule. + * + * @return the minutes value. + */ + @Generated + public List getMinutes() { + return this.minutes; + } + + /** + * Get the weekDays property: List of days for the schedule. + * + * @return the weekDays value. + */ + @Generated + public List getWeekDays() { + return this.weekDays; + } + + /** + * Set the weekDays property: List of days for the schedule. + * + * @param weekDays the weekDays value to set. + * @return the RecurrenceSchedule object itself. + */ + @Generated + public RecurrenceSchedule setWeekDays(List weekDays) { + this.weekDays = weekDays; + return this; + } + + /** + * Get the monthDays property: List of month days for the schedule. + * + * @return the monthDays value. + */ + @Generated + public List getMonthDays() { + return this.monthDays; + } + + /** + * Set the monthDays property: List of month days for the schedule. + * + * @param monthDays the monthDays value to set. + * @return the RecurrenceSchedule object itself. + */ + @Generated + public RecurrenceSchedule setMonthDays(List monthDays) { + this.monthDays = monthDays; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("hours", this.hours, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeArrayField("minutes", this.minutes, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeArrayField("weekDays", this.weekDays, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("monthDays", this.monthDays, (writer, element) -> writer.writeInt(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecurrenceSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecurrenceSchedule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecurrenceSchedule. + */ + @Generated + public static RecurrenceSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List hours = null; + List minutes = null; + List weekDays = null; + List monthDays = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("hours".equals(fieldName)) { + hours = reader.readArray(reader1 -> reader1.getInt()); + } else if ("minutes".equals(fieldName)) { + minutes = reader.readArray(reader1 -> reader1.getInt()); + } else if ("weekDays".equals(fieldName)) { + weekDays = reader.readArray(reader1 -> WeekDays.fromString(reader1.getString())); + } else if ("monthDays".equals(fieldName)) { + monthDays = reader.readArray(reader1 -> reader1.getInt()); + } else { + reader.skipChildren(); + } + } + RecurrenceSchedule deserializedRecurrenceSchedule = new RecurrenceSchedule(hours, minutes); + deserializedRecurrenceSchedule.weekDays = weekDays; + deserializedRecurrenceSchedule.monthDays = monthDays; + return deserializedRecurrenceSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java new file mode 100644 index 000000000000..6fc11c3b0e06 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Recurrence Trigger Definition. + */ +@Fluent +public final class RecurrenceTrigger extends Trigger { + + /* + * Type of the trigger. + */ + @Generated + private String type = "Recurrence"; + + /* + * The frequency to trigger schedule. + */ + @Generated + private final Frequency frequency; + + /* + * Specifies schedule interval in conjunction with frequency + */ + @Generated + private final int interval; + + /* + * The recurrence schedule. + */ + @Generated + private RecurrenceSchedule schedule; + + /** + * Creates an instance of RecurrenceTrigger class. + * + * @param frequency the frequency value to set. + * @param interval the interval value to set. + */ + @Generated + public RecurrenceTrigger(Frequency frequency, int interval) { + this.frequency = frequency; + this.interval = interval; + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the frequency property: The frequency to trigger schedule. + * + * @return the frequency value. + */ + @Generated + public Frequency getFrequency() { + return this.frequency; + } + + /** + * Get the interval property: Specifies schedule interval in conjunction with frequency. + * + * @return the interval value. + */ + @Generated + public int getInterval() { + return this.interval; + } + + /** + * Get the schedule property: The recurrence schedule. + * + * @return the schedule value. + */ + @Generated + public RecurrenceSchedule getSchedule() { + return this.schedule; + } + + /** + * Set the schedule property: The recurrence schedule. + * + * @param schedule the schedule value to set. + * @return the RecurrenceTrigger object itself. + */ + @Generated + public RecurrenceTrigger setSchedule(RecurrenceSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString()); + jsonWriter.writeIntField("interval", this.interval); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("schedule", this.schedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecurrenceTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecurrenceTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecurrenceTrigger. + */ + @Generated + public static RecurrenceTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Frequency frequency = null; + int interval = 0; + String type = "Recurrence"; + RecurrenceSchedule schedule = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("frequency".equals(fieldName)) { + frequency = Frequency.fromString(reader.getString()); + } else if ("interval".equals(fieldName)) { + interval = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("schedule".equals(fieldName)) { + schedule = RecurrenceSchedule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RecurrenceTrigger deserializedRecurrenceTrigger = new RecurrenceTrigger(frequency, interval); + deserializedRecurrenceTrigger.type = type; + deserializedRecurrenceTrigger.schedule = schedule; + return deserializedRecurrenceTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredAction.java new file mode 100644 index 000000000000..58bdf58c8c8d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredAction.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a required action for an agent thread run to continue. + */ +@Immutable +public class RequiredAction implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "RequiredAction"; + + /** + * Creates an instance of RequiredAction class. + */ + @Generated + protected RequiredAction() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RequiredAction. + */ + @Generated + public static RequiredAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("submit_tool_outputs".equals(discriminatorValue)) { + return SubmitToolOutputsAction.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RequiredAction fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequiredAction deserializedRequiredAction = new RequiredAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRequiredAction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRequiredAction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCall.java new file mode 100644 index 000000000000..5e0bb23b09fa --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCall.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. + */ +@Immutable +public final class RequiredFunctionToolCall extends RequiredToolCall { + + /* + * The object type for the required tool call. + */ + @Generated + private String type = "function"; + + /* + * Detailed information about the function to be executed by the tool that includes name and arguments. + */ + @Generated + private final RequiredFunctionToolCallDetails function; + + /** + * Creates an instance of RequiredFunctionToolCall class. + * + * @param id the id value to set. + * @param function the function value to set. + */ + @Generated + private RequiredFunctionToolCall(String id, RequiredFunctionToolCallDetails function) { + super(id); + this.function = function; + } + + /** + * Get the type property: The object type for the required tool call. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the function property: Detailed information about the function to be executed by the tool that includes name + * and arguments. + * + * @return the function value. + */ + @Generated + public RequiredFunctionToolCallDetails getFunction() { + return this.function; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeJsonField("function", this.function); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredFunctionToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredFunctionToolCall if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequiredFunctionToolCall. + */ + @Generated + public static RequiredFunctionToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RequiredFunctionToolCallDetails function = null; + String type = "function"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("function".equals(fieldName)) { + function = RequiredFunctionToolCallDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RequiredFunctionToolCall deserializedRequiredFunctionToolCall = new RequiredFunctionToolCall(id, function); + deserializedRequiredFunctionToolCall.type = type; + return deserializedRequiredFunctionToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCallDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCallDetails.java new file mode 100644 index 000000000000..9d79b0d39c99 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredFunctionToolCallDetails.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The detailed information for a function invocation, as provided by a required action invoking a function tool, that + * includes the name of and arguments to the function. + */ +@Immutable +public final class RequiredFunctionToolCallDetails implements JsonSerializable { + + /* + * The name of the function. + */ + @Generated + private final String name; + + /* + * The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a + * JSON document that should be validated and parsed for evaluation. + */ + @Generated + private final String arguments; + + /** + * Creates an instance of RequiredFunctionToolCallDetails class. + * + * @param name the name value to set. + * @param arguments the arguments value to set. + */ + @Generated + private RequiredFunctionToolCallDetails(String name, String arguments) { + this.name = name; + this.arguments = arguments; + } + + /** + * 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 to use when invoking the named function, as provided by the model. + * Arguments are presented as a JSON document that should be validated and parsed for evaluation. + * + * @return the arguments value. + */ + @Generated + public String getArguments() { + return this.arguments; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("arguments", this.arguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredFunctionToolCallDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredFunctionToolCallDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequiredFunctionToolCallDetails. + */ + @Generated + public static RequiredFunctionToolCallDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String arguments = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("arguments".equals(fieldName)) { + arguments = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RequiredFunctionToolCallDetails(name, arguments); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredToolCall.java new file mode 100644 index 000000000000..4dd6b012a781 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RequiredToolCall.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a tool invocation needed by the model to continue a run. + */ +@Immutable +public class RequiredToolCall implements JsonSerializable { + + /* + * The object type for the required tool call. + */ + @Generated + private String type = "RequiredToolCall"; + + /* + * The ID of the tool call. This ID must be referenced when submitting tool outputs. + */ + @Generated + private final String id; + + /** + * Creates an instance of RequiredToolCall class. + * + * @param id the id value to set. + */ + @Generated + protected RequiredToolCall(String id) { + this.id = id; + } + + /** + * Get the type property: The object type for the required tool call. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the id property: The ID of the tool call. This ID must be referenced when submitting tool outputs. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredToolCall if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequiredToolCall. + */ + @Generated + public static RequiredToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("function".equals(discriminatorValue)) { + return RequiredFunctionToolCall.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RequiredToolCall fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RequiredToolCall deserializedRequiredToolCall = new RequiredToolCall(id); + deserializedRequiredToolCall.type = type; + return deserializedRequiredToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormat.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormat.java new file mode 100644 index 000000000000..9f5c8ecbe6dc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormat.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible API response formats. + */ +public final class ResponseFormat extends ExpandableStringEnum { + + /** + * `text` format should be used for requests involving any sort of ToolCall. + */ + @Generated + public static final ResponseFormat TEXT = fromString("text"); + + /** + * Using `json_object` format will limit the usage of ToolCall to only functions. + */ + @Generated + public static final ResponseFormat JSON_OBJECT = fromString("json_object"); + + /** + * Creates a new instance of ResponseFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ResponseFormat() { + } + + /** + * Creates or finds a ResponseFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResponseFormat. + */ + @Generated + public static ResponseFormat fromString(String name) { + return fromString(name, ResponseFormat.class); + } + + /** + * Gets known ResponseFormat values. + * + * @return known ResponseFormat values. + */ + @Generated + public static Collection values() { + return values(ResponseFormat.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchema.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchema.java new file mode 100644 index 000000000000..864b4c7f45a6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchema.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A description of what the response format is for, used by the model to determine how to respond in the format. + */ +@Fluent +public final class ResponseFormatJsonSchema implements JsonSerializable { + + /* + * A description of what the response format is for, used by the model to determine how to respond in the format. + */ + @Generated + private String description; + + /* + * The name of a schema. + */ + @Generated + private final String name; + + /* + * The JSON schema object, describing the response format. + */ + @Generated + private final BinaryData schema; + + /** + * Creates an instance of ResponseFormatJsonSchema class. + * + * @param name the name value to set. + * @param schema the schema value to set. + */ + @Generated + public ResponseFormatJsonSchema(String name, BinaryData schema) { + this.name = name; + this.schema = schema; + } + + /** + * Get the description property: A description of what the response format is for, used by the model to determine + * how to respond in the format. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A description of what the response format is for, used by the model to determine + * how to respond in the format. + * + * @param description the description value to set. + * @return the ResponseFormatJsonSchema object itself. + */ + @Generated + public ResponseFormatJsonSchema setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the name property: The name of a schema. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the schema property: The JSON schema object, describing the response format. + * + * @return the schema value. + */ + @Generated + public BinaryData getSchema() { + return this.schema; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeFieldName("schema"); + this.schema.writeTo(jsonWriter); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResponseFormatJsonSchema from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResponseFormatJsonSchema if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResponseFormatJsonSchema. + */ + @Generated + public static ResponseFormatJsonSchema fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData schema = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("schema".equals(fieldName)) { + schema = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResponseFormatJsonSchema deserializedResponseFormatJsonSchema = new ResponseFormatJsonSchema(name, schema); + deserializedResponseFormatJsonSchema.description = description; + return deserializedResponseFormatJsonSchema; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchemaType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchemaType.java new file mode 100644 index 000000000000..0bc3401f7c27 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ResponseFormatJsonSchemaType.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The type of response format being defined: `json_schema`. + */ +@Immutable +public final class ResponseFormatJsonSchemaType implements JsonSerializable { + + /* + * Type + */ + @Generated + private final String type = "json_schema"; + + /* + * The JSON schema, describing response format. + */ + @Generated + private final ResponseFormatJsonSchema jsonSchema; + + /** + * Creates an instance of ResponseFormatJsonSchemaType class. + * + * @param jsonSchema the jsonSchema value to set. + */ + @Generated + public ResponseFormatJsonSchemaType(ResponseFormatJsonSchema jsonSchema) { + this.jsonSchema = jsonSchema; + } + + /** + * Get the type property: Type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the jsonSchema property: The JSON schema, describing response format. + * + * @return the jsonSchema value. + */ + @Generated + public ResponseFormatJsonSchema getJsonSchema() { + return this.jsonSchema; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("json_schema", this.jsonSchema); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResponseFormatJsonSchemaType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResponseFormatJsonSchemaType if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResponseFormatJsonSchemaType. + */ + @Generated + public static ResponseFormatJsonSchemaType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResponseFormatJsonSchema jsonSchema = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("json_schema".equals(fieldName)) { + jsonSchema = ResponseFormatJsonSchema.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new ResponseFormatJsonSchemaType(jsonSchema); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunAdditionalFieldList.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunAdditionalFieldList.java new file mode 100644 index 000000000000..5148954a2188 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunAdditionalFieldList.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A list of additional fields to include in the response. + */ +public final class RunAdditionalFieldList extends ExpandableStringEnum { + + /** + * File search result content. + */ + @Generated + public static final RunAdditionalFieldList FILE_SEARCH_CONTENTS + = fromString("step_details.tool_calls[*].file_search.results[*].content"); + + /** + * Creates a new instance of RunAdditionalFieldList value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunAdditionalFieldList() { + } + + /** + * Creates or finds a RunAdditionalFieldList from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunAdditionalFieldList. + */ + @Generated + public static RunAdditionalFieldList fromString(String name) { + return fromString(name, RunAdditionalFieldList.class); + } + + /** + * Gets known RunAdditionalFieldList values. + * + * @return known RunAdditionalFieldList values. + */ + @Generated + public static Collection values() { + return values(RunAdditionalFieldList.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunCompletionUsage.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunCompletionUsage.java new file mode 100644 index 000000000000..e7b4b328c0e9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunCompletionUsage.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. + * `in_progress`, `queued`, etc.). + */ +@Immutable +public final class RunCompletionUsage implements JsonSerializable { + + /* + * Number of completion tokens used over the course of the run. + */ + @Generated + private final long completionTokens; + + /* + * Number of prompt tokens used over the course of the run. + */ + @Generated + private final long promptTokens; + + /* + * Total number of tokens used (prompt + completion). + */ + @Generated + private final long totalTokens; + + /** + * Creates an instance of RunCompletionUsage class. + * + * @param completionTokens the completionTokens value to set. + * @param promptTokens the promptTokens value to set. + * @param totalTokens the totalTokens value to set. + */ + @Generated + private RunCompletionUsage(long completionTokens, long promptTokens, long totalTokens) { + this.completionTokens = completionTokens; + this.promptTokens = promptTokens; + this.totalTokens = totalTokens; + } + + /** + * Get the completionTokens property: Number of completion tokens used over the course of the run. + * + * @return the completionTokens value. + */ + @Generated + public long getCompletionTokens() { + return this.completionTokens; + } + + /** + * Get the promptTokens property: Number of prompt tokens used over the course of the run. + * + * @return the promptTokens value. + */ + @Generated + public long getPromptTokens() { + return this.promptTokens; + } + + /** + * Get the totalTokens property: Total number of tokens used (prompt + completion). + * + * @return the totalTokens value. + */ + @Generated + public long getTotalTokens() { + return this.totalTokens; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("completion_tokens", this.completionTokens); + jsonWriter.writeLongField("prompt_tokens", this.promptTokens); + jsonWriter.writeLongField("total_tokens", this.totalTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunCompletionUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunCompletionUsage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunCompletionUsage. + */ + @Generated + public static RunCompletionUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + long completionTokens = 0L; + long promptTokens = 0L; + long totalTokens = 0L; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("completion_tokens".equals(fieldName)) { + completionTokens = reader.getLong(); + } else if ("prompt_tokens".equals(fieldName)) { + promptTokens = reader.getLong(); + } else if ("total_tokens".equals(fieldName)) { + totalTokens = reader.getLong(); + } else { + reader.skipChildren(); + } + } + return new RunCompletionUsage(completionTokens, promptTokens, totalTokens); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunError.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunError.java new file mode 100644 index 000000000000..f236f45c09f5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunError.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The details of an error as encountered by an agent thread run. + */ +@Immutable +public final class RunError implements JsonSerializable { + + /* + * The status for the error. + */ + @Generated + private final String code; + + /* + * The human-readable text associated with the error. + */ + @Generated + private final String message; + + /** + * Creates an instance of RunError class. + * + * @param code the code value to set. + * @param message the message value to set. + */ + @Generated + private RunError(String code, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunError. + */ + @Generated + public static RunError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String code = null; + String message = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("code".equals(fieldName)) { + code = reader.getString(); + } else if ("message".equals(fieldName)) { + message = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RunError(code, message); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStatus.java new file mode 100644 index 000000000000..476ecd7879af --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStatus.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible values for the status of an agent 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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStep.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStep.java new file mode 100644 index 000000000000..4406d9c0bfad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStep.java @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Detailed information about a single step of an agent thread run. + */ +@Immutable +public final class RunStep implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always 'thread.run.step'. + */ + @Generated + private final String object = "thread.run.step"; + + /* + * The type of run step, which can be either message_creation or tool_calls. + */ + @Generated + private final RunStepType type; + + /* + * The ID of the agent associated with the run step. + */ + @Generated + private final String assistantId; + + /* + * The ID of the thread that was run. + */ + @Generated + private final String threadId; + + /* + * The ID of the run that this run step is a part of. + */ + @Generated + private final String runId; + + /* + * The status of this run step. + */ + @Generated + private final RunStepStatus status; + + /* + * The details for this run step. + */ + @Generated + private final RunStepDetails stepDetails; + + /* + * If applicable, information about the last error encountered by this run step. + */ + @Generated + private final RunStepError lastError; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * The Unix timestamp, in seconds, representing when this item expired. + */ + @Generated + private final Long expiredAt; + + /* + * The Unix timestamp, in seconds, representing when this completed. + */ + @Generated + private final Long completedAt; + + /* + * The Unix timestamp, in seconds, representing when this was cancelled. + */ + @Generated + private final Long cancelledAt; + + /* + * The Unix timestamp, in seconds, representing when this failed. + */ + @Generated + private final Long failedAt; + + /* + * Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + */ + @Generated + private RunStepCompletionUsage usage; + + /* + * 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 + private final 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; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + if (expiredAt == null) { + this.expiredAt = null; + } else { + this.expiredAt = expiredAt.toEpochSecond(); + } + if (completedAt == null) { + this.completedAt = null; + } else { + this.completedAt = completedAt.toEpochSecond(); + } + if (cancelledAt == null) { + this.cancelledAt = null; + } else { + this.cancelledAt = cancelledAt.toEpochSecond(); + } + if (failedAt == null) { + this.failedAt = null; + } else { + this.failedAt = failedAt.toEpochSecond(); + } + this.metadata = 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 agent 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() { + if (this.expiredAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.expiredAt), ZoneOffset.UTC); + } + + /** + * Get the completedAt property: The Unix timestamp, in seconds, representing when this completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + if (this.completedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.completedAt), ZoneOffset.UTC); + } + + /** + * Get the cancelledAt property: The Unix timestamp, in seconds, representing when this was cancelled. + * + * @return the cancelledAt value. + */ + @Generated + public OffsetDateTime getCancelledAt() { + if (this.cancelledAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.cancelledAt), ZoneOffset.UTC); + } + + /** + * Get the failedAt property: The Unix timestamp, in seconds, representing when this failed. + * + * @return the failedAt value. + */ + @Generated + public OffsetDateTime getFailedAt() { + if (this.failedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.failedAt), ZoneOffset.UTC); + } + + /** + * Get the usage property: Usage statistics related to the run step. This value will be `null` while the run step's + * status is `in_progress`. + * + * @return the usage value. + */ + @Generated + public RunStepCompletionUsage getUsage() { + return this.usage; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("assistant_id", this.assistantId); + jsonWriter.writeStringField("thread_id", this.threadId); + jsonWriter.writeStringField("run_id", this.runId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("step_details", this.stepDetails); + jsonWriter.writeJsonField("last_error", this.lastError); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeNumberField("expired_at", this.expiredAt); + jsonWriter.writeNumberField("completed_at", this.completedAt); + jsonWriter.writeNumberField("cancelled_at", this.cancelledAt); + jsonWriter.writeNumberField("failed_at", this.failedAt); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("usage", this.usage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStep if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStep. + */ + @Generated + public static RunStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RunStepType type = null; + String assistantId = null; + String threadId = null; + String runId = null; + RunStepStatus status = null; + RunStepDetails stepDetails = null; + RunStepError lastError = null; + OffsetDateTime createdAt = null; + OffsetDateTime expiredAt = null; + OffsetDateTime completedAt = null; + OffsetDateTime cancelledAt = null; + OffsetDateTime failedAt = null; + Map metadata = null; + RunStepCompletionUsage usage = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = RunStepType.fromString(reader.getString()); + } else if ("assistant_id".equals(fieldName)) { + assistantId = reader.getString(); + } else if ("thread_id".equals(fieldName)) { + threadId = reader.getString(); + } else if ("run_id".equals(fieldName)) { + runId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = RunStepStatus.fromString(reader.getString()); + } else if ("step_details".equals(fieldName)) { + stepDetails = RunStepDetails.fromJson(reader); + } else if ("last_error".equals(fieldName)) { + lastError = RunStepError.fromJson(reader); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("expired_at".equals(fieldName)) { + Long expiredAtHolder = reader.getNullable(JsonReader::getLong); + if (expiredAtHolder != null) { + expiredAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(expiredAtHolder), ZoneOffset.UTC); + } + } else if ("completed_at".equals(fieldName)) { + Long completedAtHolder = reader.getNullable(JsonReader::getLong); + if (completedAtHolder != null) { + completedAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(completedAtHolder), ZoneOffset.UTC); + } + } else if ("cancelled_at".equals(fieldName)) { + Long cancelledAtHolder = reader.getNullable(JsonReader::getLong); + if (cancelledAtHolder != null) { + cancelledAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(cancelledAtHolder), ZoneOffset.UTC); + } + } else if ("failed_at".equals(fieldName)) { + Long failedAtHolder = reader.getNullable(JsonReader::getLong); + if (failedAtHolder != null) { + failedAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(failedAtHolder), ZoneOffset.UTC); + } + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else if ("usage".equals(fieldName)) { + usage = RunStepCompletionUsage.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStep deserializedRunStep = new RunStep(id, type, assistantId, threadId, runId, status, stepDetails, + lastError, createdAt, expiredAt, completedAt, cancelledAt, failedAt, metadata); + deserializedRunStep.usage = usage; + return deserializedRunStep; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepAzureAISearchToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepAzureAISearchToolCall.java new file mode 100644 index 000000000000..f0ee1dc8de8b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepAzureAISearchToolCall.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to an Azure AI Search tool, issued by the model in evaluation of a defined tool, that represents + * executed Azure AI search. + */ +@Immutable +public final class RunStepAzureAISearchToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "azure_ai_search"; + + /* + * Reserved for future use. + */ + @Generated + private final Map azureAISearch; + + /** + * Creates an instance of RunStepAzureAISearchToolCall class. + * + * @param id the id value to set. + * @param azureAISearch the azureAISearch value to set. + */ + @Generated + private RunStepAzureAISearchToolCall(String id, Map azureAISearch) { + super(id); + this.azureAISearch = azureAISearch; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the azureAISearch property: Reserved for future use. + * + * @return the azureAISearch value. + */ + @Generated + public Map getAzureAISearch() { + return this.azureAISearch; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("azure_ai_search", this.azureAISearch, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepAzureAISearchToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepAzureAISearchToolCall if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepAzureAISearchToolCall. + */ + @Generated + public static RunStepAzureAISearchToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map azureAISearch = null; + String type = "azure_ai_search"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("azure_ai_search".equals(fieldName)) { + azureAISearch = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepAzureAISearchToolCall deserializedRunStepAzureAISearchToolCall + = new RunStepAzureAISearchToolCall(id, azureAISearch); + deserializedRunStepAzureAISearchToolCall.type = type; + return deserializedRunStepAzureAISearchToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepBingGroundingToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepBingGroundingToolCall.java new file mode 100644 index 000000000000..d91ba0ddfdb5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepBingGroundingToolCall.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to a bing grounding tool, issued by the model in evaluation of a defined tool, that represents + * executed search with bing grounding. + */ +@Immutable +public final class RunStepBingGroundingToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "bing_grounding"; + + /* + * Reserved for future use. + */ + @Generated + private final Map bingGrounding; + + /** + * Creates an instance of RunStepBingGroundingToolCall class. + * + * @param id the id value to set. + * @param bingGrounding the bingGrounding value to set. + */ + @Generated + private RunStepBingGroundingToolCall(String id, Map bingGrounding) { + super(id); + this.bingGrounding = bingGrounding; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the bingGrounding property: Reserved for future use. + * + * @return the bingGrounding value. + */ + @Generated + public Map getBingGrounding() { + return this.bingGrounding; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("bing_grounding", this.bingGrounding, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepBingGroundingToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepBingGroundingToolCall if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepBingGroundingToolCall. + */ + @Generated + public static RunStepBingGroundingToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map bingGrounding = null; + String type = "bing_grounding"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("bing_grounding".equals(fieldName)) { + bingGrounding = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepBingGroundingToolCall deserializedRunStepBingGroundingToolCall + = new RunStepBingGroundingToolCall(id, bingGrounding); + deserializedRunStepBingGroundingToolCall.type = type; + return deserializedRunStepBingGroundingToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageOutput.java new file mode 100644 index 000000000000..f4fb9d637599 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageOutput.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. + */ +@Immutable +public final class RunStepCodeInterpreterImageOutput extends RunStepCodeInterpreterToolCallOutput { + + /* + * The object type. + */ + @Generated + private String type = "image"; + + /* + * Referential information for the image associated with this output. + */ + @Generated + private final RunStepCodeInterpreterImageReference image; + + /** + * Creates an instance of RunStepCodeInterpreterImageOutput class. + * + * @param image the image value to set. + */ + @Generated + private RunStepCodeInterpreterImageOutput(RunStepCodeInterpreterImageReference image) { + this.image = image; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the image property: Referential information for the image associated with this output. + * + * @return the image value. + */ + @Generated + public RunStepCodeInterpreterImageReference getImage() { + return this.image; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("image", this.image); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterImageOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterImageOutput if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterImageOutput. + */ + @Generated + public static RunStepCodeInterpreterImageOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepCodeInterpreterImageReference image = null; + String type = "image"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("image".equals(fieldName)) { + image = RunStepCodeInterpreterImageReference.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepCodeInterpreterImageOutput deserializedRunStepCodeInterpreterImageOutput + = new RunStepCodeInterpreterImageOutput(image); + deserializedRunStepCodeInterpreterImageOutput.type = type; + return deserializedRunStepCodeInterpreterImageOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageReference.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageReference.java new file mode 100644 index 000000000000..b2c331a52fa3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterImageReference.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An image reference emitted by a code interpreter tool in response to a tool call by the model. + */ +@Immutable +public final class RunStepCodeInterpreterImageReference + implements JsonSerializable { + + /* + * The ID of the file associated with this image. + */ + @Generated + private final String fileId; + + /** + * Creates an instance of RunStepCodeInterpreterImageReference class. + * + * @param fileId the fileId value to set. + */ + @Generated + private RunStepCodeInterpreterImageReference(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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterImageReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterImageReference if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterImageReference. + */ + @Generated + public static RunStepCodeInterpreterImageReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RunStepCodeInterpreterImageReference(fileId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterLogOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterLogOutput.java new file mode 100644 index 000000000000..58ea9fbad493 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterLogOutput.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. + */ +@Immutable +public final class RunStepCodeInterpreterLogOutput extends RunStepCodeInterpreterToolCallOutput { + + /* + * The object type. + */ + @Generated + private String type = "logs"; + + /* + * The serialized log output emitted by the code interpreter. + */ + @Generated + private final String logs; + + /** + * Creates an instance of RunStepCodeInterpreterLogOutput class. + * + * @param logs the logs value to set. + */ + @Generated + private RunStepCodeInterpreterLogOutput(String logs) { + this.logs = logs; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the logs property: The serialized log output emitted by the code interpreter. + * + * @return the logs value. + */ + @Generated + public String getLogs() { + return this.logs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("logs", this.logs); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterLogOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterLogOutput if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterLogOutput. + */ + @Generated + public static RunStepCodeInterpreterLogOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String logs = null; + String type = "logs"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("logs".equals(fieldName)) { + logs = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepCodeInterpreterLogOutput deserializedRunStepCodeInterpreterLogOutput + = new RunStepCodeInterpreterLogOutput(logs); + deserializedRunStepCodeInterpreterLogOutput.type = type; + return deserializedRunStepCodeInterpreterLogOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCall.java new file mode 100644 index 000000000000..5c877d5370eb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCall.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that + * represents inputs and outputs consumed and emitted by the code interpreter. + */ +@Immutable +public final class RunStepCodeInterpreterToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "code_interpreter"; + + /* + * The details of the tool call to the code interpreter tool. + */ + @Generated + private final RunStepCodeInterpreterToolCallDetails codeInterpreter; + + /** + * Creates an instance of RunStepCodeInterpreterToolCall class. + * + * @param id the id value to set. + * @param codeInterpreter the codeInterpreter value to set. + */ + @Generated + private RunStepCodeInterpreterToolCall(String id, RunStepCodeInterpreterToolCallDetails codeInterpreter) { + super(id); + this.codeInterpreter = codeInterpreter; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the codeInterpreter property: The details of the tool call to the code interpreter tool. + * + * @return the codeInterpreter value. + */ + @Generated + public RunStepCodeInterpreterToolCallDetails getCodeInterpreter() { + return this.codeInterpreter; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeJsonField("code_interpreter", this.codeInterpreter); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterToolCall if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterToolCall. + */ + @Generated + public static RunStepCodeInterpreterToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RunStepCodeInterpreterToolCallDetails codeInterpreter = null; + String type = "code_interpreter"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("code_interpreter".equals(fieldName)) { + codeInterpreter = RunStepCodeInterpreterToolCallDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepCodeInterpreterToolCall deserializedRunStepCodeInterpreterToolCall + = new RunStepCodeInterpreterToolCall(id, codeInterpreter); + deserializedRunStepCodeInterpreterToolCall.type = type; + return deserializedRunStepCodeInterpreterToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallDetails.java new file mode 100644 index 000000000000..de4780fa9402 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallDetails.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The detailed information about a code interpreter invocation by the model. + */ +@Immutable +public final class RunStepCodeInterpreterToolCallDetails + implements JsonSerializable { + + /* + * The input provided by the model to the code interpreter tool. + */ + @Generated + private final String input; + + /* + * The outputs produced by the code interpreter tool back to the model in response to the tool call. + */ + @Generated + private final List outputs; + + /** + * Creates an instance of RunStepCodeInterpreterToolCallDetails class. + * + * @param input the input value to set. + * @param outputs the outputs value to set. + */ + @Generated + private RunStepCodeInterpreterToolCallDetails(String input, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("input", this.input); + jsonWriter.writeArrayField("outputs", this.outputs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterToolCallDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterToolCallDetails if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterToolCallDetails. + */ + @Generated + public static RunStepCodeInterpreterToolCallDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String input = null; + List outputs = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("input".equals(fieldName)) { + input = reader.getString(); + } else if ("outputs".equals(fieldName)) { + outputs = reader.readArray(reader1 -> RunStepCodeInterpreterToolCallOutput.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new RunStepCodeInterpreterToolCallDetails(input, outputs); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallOutput.java new file mode 100644 index 000000000000..fbaa70185caa --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCodeInterpreterToolCallOutput.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of an emitted output from a code interpreter tool. + */ +@Immutable +public class RunStepCodeInterpreterToolCallOutput implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "RunStepCodeInterpreterToolCallOutput"; + + /** + * Creates an instance of RunStepCodeInterpreterToolCallOutput class. + */ + @Generated + protected RunStepCodeInterpreterToolCallOutput() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCodeInterpreterToolCallOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCodeInterpreterToolCallOutput if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepCodeInterpreterToolCallOutput. + */ + @Generated + public static RunStepCodeInterpreterToolCallOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("logs".equals(discriminatorValue)) { + return RunStepCodeInterpreterLogOutput.fromJson(readerToUse.reset()); + } else if ("image".equals(discriminatorValue)) { + return RunStepCodeInterpreterImageOutput.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepCodeInterpreterToolCallOutput fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepCodeInterpreterToolCallOutput deserializedRunStepCodeInterpreterToolCallOutput + = new RunStepCodeInterpreterToolCallOutput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRunStepCodeInterpreterToolCallOutput.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepCodeInterpreterToolCallOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCompletionUsage.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCompletionUsage.java new file mode 100644 index 000000000000..44a65febefdd --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCompletionUsage.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Usage statistics related to the run step. + */ +@Immutable +public final class RunStepCompletionUsage implements JsonSerializable { + + /* + * Number of completion tokens used over the course of the run step. + */ + @Generated + private final long completionTokens; + + /* + * Number of prompt tokens used over the course of the run step. + */ + @Generated + private final long promptTokens; + + /* + * Total number of tokens used (prompt + completion). + */ + @Generated + private final long totalTokens; + + /** + * Creates an instance of RunStepCompletionUsage class. + * + * @param completionTokens the completionTokens value to set. + * @param promptTokens the promptTokens value to set. + * @param totalTokens the totalTokens value to set. + */ + @Generated + private RunStepCompletionUsage(long completionTokens, long promptTokens, long totalTokens) { + this.completionTokens = completionTokens; + this.promptTokens = promptTokens; + this.totalTokens = totalTokens; + } + + /** + * Get the completionTokens property: Number of completion tokens used over the course of the run step. + * + * @return the completionTokens value. + */ + @Generated + public long getCompletionTokens() { + return this.completionTokens; + } + + /** + * Get the promptTokens property: Number of prompt tokens used over the course of the run step. + * + * @return the promptTokens value. + */ + @Generated + public long getPromptTokens() { + return this.promptTokens; + } + + /** + * Get the totalTokens property: Total number of tokens used (prompt + completion). + * + * @return the totalTokens value. + */ + @Generated + public long getTotalTokens() { + return this.totalTokens; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("completion_tokens", this.completionTokens); + jsonWriter.writeLongField("prompt_tokens", this.promptTokens); + jsonWriter.writeLongField("total_tokens", this.totalTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCompletionUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCompletionUsage if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCompletionUsage. + */ + @Generated + public static RunStepCompletionUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + long completionTokens = 0L; + long promptTokens = 0L; + long totalTokens = 0L; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("completion_tokens".equals(fieldName)) { + completionTokens = reader.getLong(); + } else if ("prompt_tokens".equals(fieldName)) { + promptTokens = reader.getLong(); + } else if ("total_tokens".equals(fieldName)) { + totalTokens = reader.getLong(); + } else { + reader.skipChildren(); + } + } + return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCustomSearchToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCustomSearchToolCall.java new file mode 100644 index 000000000000..833e38b7b951 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepCustomSearchToolCall.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to a bing custom search tool, issued by the model in evaluation of a defined tool, that represents + * executed search with bing custom search. + */ +@Immutable +public final class RunStepCustomSearchToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "bing_custom_search"; + + /* + * Reserved for future use. + */ + @Generated + private final Map bingCustomSearch; + + /** + * Creates an instance of RunStepCustomSearchToolCall class. + * + * @param id the id value to set. + * @param bingCustomSearch the bingCustomSearch value to set. + */ + @Generated + private RunStepCustomSearchToolCall(String id, Map bingCustomSearch) { + super(id); + this.bingCustomSearch = bingCustomSearch; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the bingCustomSearch property: Reserved for future use. + * + * @return the bingCustomSearch value. + */ + @Generated + public Map getBingCustomSearch() { + return this.bingCustomSearch; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("bing_custom_search", this.bingCustomSearch, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepCustomSearchToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepCustomSearchToolCall if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepCustomSearchToolCall. + */ + @Generated + public static RunStepCustomSearchToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map bingCustomSearch = null; + String type = "bing_custom_search"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("bing_custom_search".equals(fieldName)) { + bingCustomSearch = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepCustomSearchToolCall deserializedRunStepCustomSearchToolCall + = new RunStepCustomSearchToolCall(id, bingCustomSearch); + deserializedRunStepCustomSearchToolCall.type = type; + return deserializedRunStepCustomSearchToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDelta.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDelta.java new file mode 100644 index 000000000000..c341fd9a2815 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDelta.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the delta payload in a streaming run step delta chunk. + */ +@Immutable +public final class RunStepDelta implements JsonSerializable { + + /* + * The details of the run step. + */ + @Generated + private RunStepDeltaDetail stepDetails; + + /** + * Creates an instance of RunStepDelta class. + */ + @Generated + private RunStepDelta() { + } + + /** + * Get the stepDetails property: The details of the run step. + * + * @return the stepDetails value. + */ + @Generated + public RunStepDeltaDetail getStepDetails() { + return this.stepDetails; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("step_details", this.stepDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDelta from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDelta if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDelta. + */ + @Generated + public static RunStepDelta fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDelta deserializedRunStepDelta = new RunStepDelta(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("step_details".equals(fieldName)) { + deserializedRunStepDelta.stepDetails = RunStepDeltaDetail.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDelta; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaChunk.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaChunk.java new file mode 100644 index 000000000000..3cd12c9b23c9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaChunk.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a run step delta i.e. any changed fields on a run step during streaming. + */ +@Immutable +public final class RunStepDeltaChunk implements JsonSerializable { + + /* + * The identifier of the run step, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always `thread.run.step.delta`. + */ + @Generated + private final String object = "thread.run.step.delta"; + + /* + * The delta containing the fields that have changed on the run step. + */ + @Generated + private final RunStepDelta delta; + + /** + * Creates an instance of RunStepDeltaChunk class. + * + * @param id the id value to set. + * @param delta the delta value to set. + */ + @Generated + private RunStepDeltaChunk(String id, RunStepDelta delta) { + this.id = id; + this.delta = delta; + } + + /** + * Get the id property: The identifier of the run step, 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.delta`. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the delta property: The delta containing the fields that have changed on the run step. + * + * @return the delta value. + */ + @Generated + public RunStepDelta getDelta() { + return this.delta; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeJsonField("delta", this.delta); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaChunk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaChunk if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaChunk. + */ + @Generated + public static RunStepDeltaChunk fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RunStepDelta delta = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("delta".equals(fieldName)) { + delta = RunStepDelta.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new RunStepDeltaChunk(id, delta); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterDetailItemObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterDetailItemObject.java new file mode 100644 index 000000000000..6813a9356125 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterDetailItemObject.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents the Code Interpreter tool call data in a streaming run step's tool calls. + */ +@Immutable +public final class RunStepDeltaCodeInterpreterDetailItemObject + implements JsonSerializable { + + /* + * The input into the Code Interpreter tool call. + */ + @Generated + private String input; + + /* + * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more + * items, including text (`logs`) or images (`image`). Each of these are represented by a + * different object type. + */ + @Generated + private List outputs; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterDetailItemObject class. + */ + @Generated + private RunStepDeltaCodeInterpreterDetailItemObject() { + } + + /** + * Get the input property: The input into the Code Interpreter tool call. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the outputs property: The outputs from the Code Interpreter tool call. Code Interpreter can output one or + * more + * items, including text (`logs`) or images (`image`). Each of these are represented by a + * different object type. + * + * @return the outputs value. + */ + @Generated + public List getOutputs() { + return this.outputs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("input", this.input); + jsonWriter.writeArrayField("outputs", this.outputs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterDetailItemObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterDetailItemObject if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterDetailItemObject. + */ + @Generated + public static RunStepDeltaCodeInterpreterDetailItemObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaCodeInterpreterDetailItemObject deserializedRunStepDeltaCodeInterpreterDetailItemObject + = new RunStepDeltaCodeInterpreterDetailItemObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("input".equals(fieldName)) { + deserializedRunStepDeltaCodeInterpreterDetailItemObject.input = reader.getString(); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> RunStepDeltaCodeInterpreterOutput.fromJson(reader1)); + deserializedRunStepDeltaCodeInterpreterDetailItemObject.outputs = outputs; + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaCodeInterpreterDetailItemObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutput.java new file mode 100644 index 000000000000..cf18ddf0a6ff --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutput.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta + * tool calls collection. + */ +@Immutable +public final class RunStepDeltaCodeInterpreterImageOutput extends RunStepDeltaCodeInterpreterOutput { + + /* + * The type of the streaming run step tool call's Code Interpreter output. + */ + @Generated + private String type = "image"; + + /* + * The image data for the Code Interpreter tool call output. + */ + @Generated + private RunStepDeltaCodeInterpreterImageOutputObject image; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterImageOutput class. + * + * @param index the index value to set. + */ + @Generated + private RunStepDeltaCodeInterpreterImageOutput(int index) { + super(index); + } + + /** + * Get the type property: The type of the streaming run step tool call's Code Interpreter output. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the image property: The image data for the Code Interpreter tool call output. + * + * @return the image value. + */ + @Generated + public RunStepDeltaCodeInterpreterImageOutputObject getImage() { + return this.image; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("image", this.image); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterImageOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterImageOutput if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterImageOutput. + */ + @Generated + public static RunStepDeltaCodeInterpreterImageOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "image"; + RunStepDeltaCodeInterpreterImageOutputObject image = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("image".equals(fieldName)) { + image = RunStepDeltaCodeInterpreterImageOutputObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStepDeltaCodeInterpreterImageOutput deserializedRunStepDeltaCodeInterpreterImageOutput + = new RunStepDeltaCodeInterpreterImageOutput(index); + deserializedRunStepDeltaCodeInterpreterImageOutput.type = type; + deserializedRunStepDeltaCodeInterpreterImageOutput.image = image; + return deserializedRunStepDeltaCodeInterpreterImageOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutputObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutputObject.java new file mode 100644 index 000000000000..a4d1d18e0c2c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterImageOutputObject.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the data for a streaming run step's Code Interpreter tool call image output. + */ +@Immutable +public final class RunStepDeltaCodeInterpreterImageOutputObject + implements JsonSerializable { + + /* + * The file ID for the image. + */ + @Generated + private String fileId; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterImageOutputObject class. + */ + @Generated + private RunStepDeltaCodeInterpreterImageOutputObject() { + } + + /** + * Get the fileId property: The file ID for the image. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterImageOutputObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterImageOutputObject if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterImageOutputObject. + */ + @Generated + public static RunStepDeltaCodeInterpreterImageOutputObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaCodeInterpreterImageOutputObject deserializedRunStepDeltaCodeInterpreterImageOutputObject + = new RunStepDeltaCodeInterpreterImageOutputObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + deserializedRunStepDeltaCodeInterpreterImageOutputObject.fileId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaCodeInterpreterImageOutputObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterLogOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterLogOutput.java new file mode 100644 index 000000000000..dc4c4d469d92 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterLogOutput.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta + * tool calls collection. + */ +@Immutable +public final class RunStepDeltaCodeInterpreterLogOutput extends RunStepDeltaCodeInterpreterOutput { + + /* + * The type of the streaming run step tool call's Code Interpreter output. + */ + @Generated + private String type = "logs"; + + /* + * The text output from the Code Interpreter tool call. + */ + @Generated + private String logs; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterLogOutput class. + * + * @param index the index value to set. + */ + @Generated + private RunStepDeltaCodeInterpreterLogOutput(int index) { + super(index); + } + + /** + * Get the type property: The type of the streaming run step tool call's Code Interpreter output. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the logs property: The text output from the Code Interpreter tool call. + * + * @return the logs value. + */ + @Generated + public String getLogs() { + return this.logs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterLogOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterLogOutput if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterLogOutput. + */ + @Generated + public static RunStepDeltaCodeInterpreterLogOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = "logs"; + String logs = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("logs".equals(fieldName)) { + logs = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepDeltaCodeInterpreterLogOutput deserializedRunStepDeltaCodeInterpreterLogOutput + = new RunStepDeltaCodeInterpreterLogOutput(index); + deserializedRunStepDeltaCodeInterpreterLogOutput.type = type; + deserializedRunStepDeltaCodeInterpreterLogOutput.logs = logs; + return deserializedRunStepDeltaCodeInterpreterLogOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterOutput.java new file mode 100644 index 000000000000..f2afd908bed5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterOutput.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The abstract base representation of a streaming run step tool call's Code Interpreter tool output. + */ +@Immutable +public class RunStepDeltaCodeInterpreterOutput implements JsonSerializable { + + /* + * The type of the streaming run step tool call's Code Interpreter output. + */ + @Generated + private String type = "RunStepDeltaCodeInterpreterOutput"; + + /* + * The index of the output in the streaming run step tool call's Code Interpreter outputs array. + */ + @Generated + private final int index; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterOutput class. + * + * @param index the index value to set. + */ + @Generated + protected RunStepDeltaCodeInterpreterOutput(int index) { + this.index = index; + } + + /** + * Get the type property: The type of the streaming run step tool call's Code Interpreter output. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the index property: The index of the output in the streaming run step tool call's Code Interpreter outputs + * array. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterOutput if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterOutput. + */ + @Generated + public static RunStepDeltaCodeInterpreterOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("logs".equals(discriminatorValue)) { + return RunStepDeltaCodeInterpreterLogOutput.fromJson(readerToUse.reset()); + } else if ("image".equals(discriminatorValue)) { + return RunStepDeltaCodeInterpreterImageOutput.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepDeltaCodeInterpreterOutput fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepDeltaCodeInterpreterOutput deserializedRunStepDeltaCodeInterpreterOutput + = new RunStepDeltaCodeInterpreterOutput(index); + deserializedRunStepDeltaCodeInterpreterOutput.type = type; + return deserializedRunStepDeltaCodeInterpreterOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterToolCall.java new file mode 100644 index 000000000000..b240f97c26f6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaCodeInterpreterToolCall.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a Code Interpreter tool call within a streaming run step's tool call details. + */ +@Immutable +public final class RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall { + + /* + * The type of the tool call detail item in a streaming run step's details. + */ + @Generated + private String type = "code_interpreter"; + + /* + * The Code Interpreter data for the tool call. + */ + @Generated + private RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter; + + /** + * Creates an instance of RunStepDeltaCodeInterpreterToolCall class. + * + * @param index the index value to set. + * @param id the id value to set. + */ + @Generated + private RunStepDeltaCodeInterpreterToolCall(int index, String id) { + super(index, id); + } + + /** + * Get the type property: The type of the tool call detail item in a streaming run step's details. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the codeInterpreter property: The Code Interpreter data for the tool call. + * + * @return the codeInterpreter value. + */ + @Generated + public RunStepDeltaCodeInterpreterDetailItemObject getCodeInterpreter() { + return this.codeInterpreter; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("code_interpreter", this.codeInterpreter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaCodeInterpreterToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaCodeInterpreterToolCall if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaCodeInterpreterToolCall. + */ + @Generated + public static RunStepDeltaCodeInterpreterToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String id = null; + String type = "code_interpreter"; + RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("code_interpreter".equals(fieldName)) { + codeInterpreter = RunStepDeltaCodeInterpreterDetailItemObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStepDeltaCodeInterpreterToolCall deserializedRunStepDeltaCodeInterpreterToolCall + = new RunStepDeltaCodeInterpreterToolCall(index, id); + deserializedRunStepDeltaCodeInterpreterToolCall.type = type; + deserializedRunStepDeltaCodeInterpreterToolCall.codeInterpreter = codeInterpreter; + return deserializedRunStepDeltaCodeInterpreterToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaDetail.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaDetail.java new file mode 100644 index 000000000000..0c26191f98ad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaDetail.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a single run step detail item in a streaming run step's delta payload. + */ +@Immutable +public class RunStepDeltaDetail implements JsonSerializable { + + /* + * The object type for the run step detail object. + */ + @Generated + private String type = "RunStepDeltaDetail"; + + /** + * Creates an instance of RunStepDeltaDetail class. + */ + @Generated + protected RunStepDeltaDetail() { + } + + /** + * Get the type property: The object type for the run step detail object. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaDetail if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaDetail. + */ + @Generated + public static RunStepDeltaDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("message_creation".equals(discriminatorValue)) { + return RunStepDeltaMessageCreation.fromJson(readerToUse.reset()); + } else if ("tool_calls".equals(discriminatorValue)) { + return RunStepDeltaToolCallObject.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepDeltaDetail fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaDetail deserializedRunStepDeltaDetail = new RunStepDeltaDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRunStepDeltaDetail.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaDetail; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFileSearchToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFileSearchToolCall.java new file mode 100644 index 000000000000..644666da468b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFileSearchToolCall.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a file search tool call within a streaming run step's tool call details. + */ +@Immutable +public final class RunStepDeltaFileSearchToolCall extends RunStepDeltaToolCall { + + /* + * The type of the tool call detail item in a streaming run step's details. + */ + @Generated + private String type = "file_search"; + + /* + * Reserved for future use. + */ + @Generated + private RunStepFileSearchToolCallResults fileSearch; + + /** + * Creates an instance of RunStepDeltaFileSearchToolCall class. + * + * @param index the index value to set. + * @param id the id value to set. + */ + @Generated + private RunStepDeltaFileSearchToolCall(int index, String id) { + super(index, id); + } + + /** + * Get the type property: The type of the tool call detail item in a streaming run step's details. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fileSearch property: Reserved for future use. + * + * @return the fileSearch value. + */ + @Generated + public RunStepFileSearchToolCallResults getFileSearch() { + return this.fileSearch; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("file_search", this.fileSearch); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaFileSearchToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaFileSearchToolCall if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaFileSearchToolCall. + */ + @Generated + public static RunStepDeltaFileSearchToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String id = null; + String type = "file_search"; + RunStepFileSearchToolCallResults fileSearch = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("file_search".equals(fieldName)) { + fileSearch = RunStepFileSearchToolCallResults.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStepDeltaFileSearchToolCall deserializedRunStepDeltaFileSearchToolCall + = new RunStepDeltaFileSearchToolCall(index, id); + deserializedRunStepDeltaFileSearchToolCall.type = type; + deserializedRunStepDeltaFileSearchToolCall.fileSearch = fileSearch; + return deserializedRunStepDeltaFileSearchToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunction.java new file mode 100644 index 000000000000..4b53b292b010 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunction.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the function data in a streaming run step delta's function tool call. + */ +@Immutable +public final class RunStepDeltaFunction implements JsonSerializable { + + /* + * The name of the function. + */ + @Generated + private String name; + + /* + * The arguments passed to the function as input. + */ + @Generated + private String arguments; + + /* + * The output of the function, null if outputs have not yet been submitted. + */ + @Generated + private String output; + + /** + * Creates an instance of RunStepDeltaFunction class. + */ + @Generated + private RunStepDeltaFunction() { + } + + /** + * 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 passed to the function as input. + * + * @return the arguments value. + */ + @Generated + public String getArguments() { + return this.arguments; + } + + /** + * Get the output property: The output of the function, null if outputs have not yet been submitted. + * + * @return the output value. + */ + @Generated + public String getOutput() { + return this.output; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("arguments", this.arguments); + jsonWriter.writeStringField("output", this.output); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaFunction if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaFunction. + */ + @Generated + public static RunStepDeltaFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaFunction deserializedRunStepDeltaFunction = new RunStepDeltaFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + deserializedRunStepDeltaFunction.name = reader.getString(); + } else if ("arguments".equals(fieldName)) { + deserializedRunStepDeltaFunction.arguments = reader.getString(); + } else if ("output".equals(fieldName)) { + deserializedRunStepDeltaFunction.output = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaFunction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunctionToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunctionToolCall.java new file mode 100644 index 000000000000..13eabbedf1e6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaFunctionToolCall.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a function tool call within a streaming run step's tool call details. + */ +@Immutable +public final class RunStepDeltaFunctionToolCall extends RunStepDeltaToolCall { + + /* + * The type of the tool call detail item in a streaming run step's details. + */ + @Generated + private String type = "function"; + + /* + * The function data for the tool call. + */ + @Generated + private RunStepDeltaFunction function; + + /** + * Creates an instance of RunStepDeltaFunctionToolCall class. + * + * @param index the index value to set. + * @param id the id value to set. + */ + @Generated + private RunStepDeltaFunctionToolCall(int index, String id) { + super(index, id); + } + + /** + * Get the type property: The type of the tool call detail item in a streaming run step's details. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the function property: The function data for the tool call. + * + * @return the function value. + */ + @Generated + public RunStepDeltaFunction getFunction() { + return this.function; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", getIndex()); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("function", this.function); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaFunctionToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaFunctionToolCall if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaFunctionToolCall. + */ + @Generated + public static RunStepDeltaFunctionToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String id = null; + String type = "function"; + RunStepDeltaFunction function = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("function".equals(fieldName)) { + function = RunStepDeltaFunction.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStepDeltaFunctionToolCall deserializedRunStepDeltaFunctionToolCall + = new RunStepDeltaFunctionToolCall(index, id); + deserializedRunStepDeltaFunctionToolCall.type = type; + deserializedRunStepDeltaFunctionToolCall.function = function; + return deserializedRunStepDeltaFunctionToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreation.java new file mode 100644 index 000000000000..86be60be5460 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreation.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a message creation within a streaming run step delta. + */ +@Immutable +public final class RunStepDeltaMessageCreation extends RunStepDeltaDetail { + + /* + * The object type for the run step detail object. + */ + @Generated + private String type = "message_creation"; + + /* + * The message creation data. + */ + @Generated + private RunStepDeltaMessageCreationObject messageCreation; + + /** + * Creates an instance of RunStepDeltaMessageCreation class. + */ + @Generated + private RunStepDeltaMessageCreation() { + } + + /** + * Get the type property: The object type for the run step detail object. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the messageCreation property: The message creation data. + * + * @return the messageCreation value. + */ + @Generated + public RunStepDeltaMessageCreationObject getMessageCreation() { + return this.messageCreation; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("message_creation", this.messageCreation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaMessageCreation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaMessageCreation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaMessageCreation. + */ + @Generated + public static RunStepDeltaMessageCreation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaMessageCreation deserializedRunStepDeltaMessageCreation = new RunStepDeltaMessageCreation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRunStepDeltaMessageCreation.type = reader.getString(); + } else if ("message_creation".equals(fieldName)) { + deserializedRunStepDeltaMessageCreation.messageCreation + = RunStepDeltaMessageCreationObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaMessageCreation; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreationObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreationObject.java new file mode 100644 index 000000000000..adcea38a6f59 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaMessageCreationObject.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the data within a streaming run step message creation response object. + */ +@Immutable +public final class RunStepDeltaMessageCreationObject implements JsonSerializable { + + /* + * The ID of the newly-created message. + */ + @Generated + private String messageId; + + /** + * Creates an instance of RunStepDeltaMessageCreationObject class. + */ + @Generated + private RunStepDeltaMessageCreationObject() { + } + + /** + * Get the messageId property: The ID of the newly-created message. + * + * @return the messageId value. + */ + @Generated + public String getMessageId() { + return this.messageId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message_id", this.messageId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaMessageCreationObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaMessageCreationObject if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaMessageCreationObject. + */ + @Generated + public static RunStepDeltaMessageCreationObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaMessageCreationObject deserializedRunStepDeltaMessageCreationObject + = new RunStepDeltaMessageCreationObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("message_id".equals(fieldName)) { + deserializedRunStepDeltaMessageCreationObject.messageId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaMessageCreationObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCall.java new file mode 100644 index 000000000000..3571d5923b8a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCall.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The abstract base representation of a single tool call within a streaming run step's delta tool call details. + */ +@Immutable +public class RunStepDeltaToolCall implements JsonSerializable { + + /* + * The type of the tool call detail item in a streaming run step's details. + */ + @Generated + private String type = "RunStepDeltaToolCall"; + + /* + * The index of the tool call detail in the run step's tool_calls array. + */ + @Generated + private final int index; + + /* + * The ID of the tool call, used when submitting outputs to the run. + */ + @Generated + private final String id; + + /** + * Creates an instance of RunStepDeltaToolCall class. + * + * @param index the index value to set. + * @param id the id value to set. + */ + @Generated + protected RunStepDeltaToolCall(int index, String id) { + this.index = index; + this.id = id; + } + + /** + * Get the type property: The type of the tool call detail item in a streaming run step's details. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the index property: The index of the tool call detail in the run step's tool_calls array. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the id property: The ID of the tool call, used when submitting outputs to the run. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaToolCall if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepDeltaToolCall. + */ + @Generated + public static RunStepDeltaToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("function".equals(discriminatorValue)) { + return RunStepDeltaFunctionToolCall.fromJson(readerToUse.reset()); + } else if ("file_search".equals(discriminatorValue)) { + return RunStepDeltaFileSearchToolCall.fromJson(readerToUse.reset()); + } else if ("code_interpreter".equals(discriminatorValue)) { + return RunStepDeltaCodeInterpreterToolCall.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepDeltaToolCall fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int index = 0; + String id = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepDeltaToolCall deserializedRunStepDeltaToolCall = new RunStepDeltaToolCall(index, id); + deserializedRunStepDeltaToolCall.type = type; + return deserializedRunStepDeltaToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCallObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCallObject.java new file mode 100644 index 000000000000..6f68f7a5576c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDeltaToolCallObject.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents an invocation of tool calls as part of a streaming run step. + */ +@Immutable +public final class RunStepDeltaToolCallObject extends RunStepDeltaDetail { + + /* + * The object type for the run step detail object. + */ + @Generated + private String type = "tool_calls"; + + /* + * The collection of tool calls for the tool call detail item. + */ + @Generated + private List toolCalls; + + /** + * Creates an instance of RunStepDeltaToolCallObject class. + */ + @Generated + private RunStepDeltaToolCallObject() { + } + + /** + * Get the type property: The object type for the run step detail object. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the toolCalls property: The collection of tool calls for the tool call detail item. + * + * @return the toolCalls value. + */ + @Generated + public List getToolCalls() { + return this.toolCalls; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeArrayField("tool_calls", this.toolCalls, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDeltaToolCallObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDeltaToolCallObject if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDeltaToolCallObject. + */ + @Generated + public static RunStepDeltaToolCallObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDeltaToolCallObject deserializedRunStepDeltaToolCallObject = new RunStepDeltaToolCallObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRunStepDeltaToolCallObject.type = reader.getString(); + } else if ("tool_calls".equals(fieldName)) { + List toolCalls + = reader.readArray(reader1 -> RunStepDeltaToolCall.fromJson(reader1)); + deserializedRunStepDeltaToolCallObject.toolCalls = toolCalls; + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDeltaToolCallObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDetails.java new file mode 100644 index 000000000000..b1d4a31f7d9f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepDetails.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of the details for a run step. + */ +@Immutable +public class RunStepDetails implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private RunStepType type = RunStepType.fromString("RunStepDetails"); + + /** + * Creates an instance of RunStepDetails class. + */ + @Generated + protected RunStepDetails() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public RunStepType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunStepDetails. + */ + @Generated + public static RunStepDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("message_creation".equals(discriminatorValue)) { + return RunStepMessageCreationDetails.fromJson(readerToUse.reset()); + } else if ("tool_calls".equals(discriminatorValue)) { + return RunStepToolCallDetails.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepDetails fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepDetails deserializedRunStepDetails = new RunStepDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRunStepDetails.type = RunStepType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedRunStepDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepError.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepError.java new file mode 100644 index 000000000000..10425a7a323f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepError.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The error information associated with a failed run step. + */ +@Immutable +public final class RunStepError implements JsonSerializable { + + /* + * The error code for this error. + */ + @Generated + private final RunStepErrorCode code; + + /* + * The human-readable text associated with this error. + */ + @Generated + private final String message; + + /** + * Creates an instance of RunStepError class. + * + * @param code the code value to set. + * @param message the message value to set. + */ + @Generated + private RunStepError(RunStepErrorCode code, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepError. + */ + @Generated + public static RunStepError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepErrorCode code = null; + String message = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("code".equals(fieldName)) { + code = RunStepErrorCode.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + message = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RunStepError(code, message); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepErrorCode.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepErrorCode.java new file mode 100644 index 000000000000..fc717d09ed63 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepErrorCode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCall.java new file mode 100644 index 000000000000..036cd11fa281 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCall.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents + * executed file search. + */ +@Immutable +public final class RunStepFileSearchToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "file_search"; + + /* + * For now, this is always going to be an empty object. + */ + @Generated + private final RunStepFileSearchToolCallResults fileSearch; + + /** + * Creates an instance of RunStepFileSearchToolCall class. + * + * @param id the id value to set. + * @param fileSearch the fileSearch value to set. + */ + @Generated + private RunStepFileSearchToolCall(String id, RunStepFileSearchToolCallResults fileSearch) { + super(id); + this.fileSearch = fileSearch; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the fileSearch property: For now, this is always going to be an empty object. + * + * @return the fileSearch value. + */ + @Generated + public RunStepFileSearchToolCallResults getFileSearch() { + return this.fileSearch; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeJsonField("file_search", this.fileSearch); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepFileSearchToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepFileSearchToolCall if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepFileSearchToolCall. + */ + @Generated + public static RunStepFileSearchToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RunStepFileSearchToolCallResults fileSearch = null; + String type = "file_search"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("file_search".equals(fieldName)) { + fileSearch = RunStepFileSearchToolCallResults.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepFileSearchToolCall deserializedRunStepFileSearchToolCall + = new RunStepFileSearchToolCall(id, fileSearch); + deserializedRunStepFileSearchToolCall.type = type; + return deserializedRunStepFileSearchToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResult.java new file mode 100644 index 000000000000..5dbc394f5c55 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResult.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * File search tool call result. + */ +@Immutable +public final class RunStepFileSearchToolCallResult implements JsonSerializable { + + /* + * The ID of the file that result was found in. + */ + @Generated + private final String fileId; + + /* + * The name of the file that result was found in. + */ + @Generated + private final String fileName; + + /* + * The score of the result. All values must be a floating point number between 0 and 1. + */ + @Generated + private final double score; + + /* + * The content of the result that was found. The content is only included if requested via the include query + * parameter. + */ + @Generated + private List content; + + /** + * Creates an instance of RunStepFileSearchToolCallResult class. + * + * @param fileId the fileId value to set. + * @param fileName the fileName value to set. + * @param score the score value to set. + */ + @Generated + private RunStepFileSearchToolCallResult(String fileId, String fileName, double score) { + this.fileId = fileId; + this.fileName = fileName; + this.score = score; + } + + /** + * Get the fileId property: The ID of the file that result was found in. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Get the fileName property: The name of the file that result was found in. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the score property: The score of the result. All values must be a floating point number between 0 and 1. + * + * @return the score value. + */ + @Generated + public double getScore() { + return this.score; + } + + /** + * Get the content property: The content of the result that was found. The content is only included if requested via + * the include query parameter. + * + * @return the content value. + */ + @Generated + public List getContent() { + return this.content; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileId); + jsonWriter.writeStringField("file_name", this.fileName); + jsonWriter.writeDoubleField("score", this.score); + jsonWriter.writeArrayField("content", this.content, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepFileSearchToolCallResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepFileSearchToolCallResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepFileSearchToolCallResult. + */ + @Generated + public static RunStepFileSearchToolCallResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileId = null; + String fileName = null; + double score = 0.0; + List content = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_id".equals(fieldName)) { + fileId = reader.getString(); + } else if ("file_name".equals(fieldName)) { + fileName = reader.getString(); + } else if ("score".equals(fieldName)) { + score = reader.getDouble(); + } else if ("content".equals(fieldName)) { + content = reader.readArray(reader1 -> FileSearchToolCallContent.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + RunStepFileSearchToolCallResult deserializedRunStepFileSearchToolCallResult + = new RunStepFileSearchToolCallResult(fileId, fileName, score); + deserializedRunStepFileSearchToolCallResult.content = content; + return deserializedRunStepFileSearchToolCallResult; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResults.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResults.java new file mode 100644 index 000000000000..092c2edda464 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFileSearchToolCallResults.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The results of the file search. + */ +@Immutable +public final class RunStepFileSearchToolCallResults implements JsonSerializable { + + /* + * Ranking options for file search. + */ + @Generated + private FileSearchRankingOptions rankingOptions; + + /* + * The array of a file search results + */ + @Generated + private final List results; + + /** + * Creates an instance of RunStepFileSearchToolCallResults class. + * + * @param results the results value to set. + */ + @Generated + private RunStepFileSearchToolCallResults(List results) { + this.results = results; + } + + /** + * Get the rankingOptions property: Ranking options for file search. + * + * @return the rankingOptions value. + */ + @Generated + public FileSearchRankingOptions getRankingOptions() { + return this.rankingOptions; + } + + /** + * Get the results property: The array of a file search results. + * + * @return the results value. + */ + @Generated + public List getResults() { + return this.results; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("ranking_options", this.rankingOptions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepFileSearchToolCallResults from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepFileSearchToolCallResults if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepFileSearchToolCallResults. + */ + @Generated + public static RunStepFileSearchToolCallResults fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List results = null; + FileSearchRankingOptions rankingOptions = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("results".equals(fieldName)) { + results = reader.readArray(reader1 -> RunStepFileSearchToolCallResult.fromJson(reader1)); + } else if ("ranking_options".equals(fieldName)) { + rankingOptions = FileSearchRankingOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunStepFileSearchToolCallResults deserializedRunStepFileSearchToolCallResults + = new RunStepFileSearchToolCallResults(results); + deserializedRunStepFileSearchToolCallResults.rankingOptions = rankingOptions; + return deserializedRunStepFileSearchToolCallResults; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCall.java new file mode 100644 index 000000000000..c6d84db57596 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCall.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the + * inputs + * and output consumed and emitted by the specified function. + */ +@Immutable +public final class RunStepFunctionToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "function"; + + /* + * The detailed information about the function called by the model. + */ + @Generated + private final RunStepFunctionToolCallDetails function; + + /** + * Creates an instance of RunStepFunctionToolCall class. + * + * @param id the id value to set. + * @param function the function value to set. + */ + @Generated + private RunStepFunctionToolCall(String id, RunStepFunctionToolCallDetails function) { + super(id); + this.function = function; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the function property: The detailed information about the function called by the model. + * + * @return the function value. + */ + @Generated + public RunStepFunctionToolCallDetails getFunction() { + return this.function; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeJsonField("function", this.function); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepFunctionToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepFunctionToolCall if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepFunctionToolCall. + */ + @Generated + public static RunStepFunctionToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + RunStepFunctionToolCallDetails function = null; + String type = "function"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("function".equals(fieldName)) { + function = RunStepFunctionToolCallDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepFunctionToolCall deserializedRunStepFunctionToolCall = new RunStepFunctionToolCall(id, function); + deserializedRunStepFunctionToolCall.type = type; + return deserializedRunStepFunctionToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCallDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCallDetails.java new file mode 100644 index 000000000000..1de20ee6e607 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepFunctionToolCallDetails.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The detailed information about the function called by the model. + */ +@Immutable +public final class RunStepFunctionToolCallDetails implements JsonSerializable { + + /* + * The name of the function. + */ + @Generated + private final String name; + + /* + * The arguments that the model requires are provided to the named function. + */ + @Generated + private final String arguments; + + /* + * The output of the function, only populated for function calls that have already have had their outputs submitted. + */ + @Generated + private final String output; + + /** + * Creates an instance of RunStepFunctionToolCallDetails class. + * + * @param name the name value to set. + * @param arguments the arguments value to set. + * @param output the output value to set. + */ + @Generated + private RunStepFunctionToolCallDetails(String name, String arguments, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("arguments", this.arguments); + jsonWriter.writeStringField("output", this.output); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepFunctionToolCallDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepFunctionToolCallDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepFunctionToolCallDetails. + */ + @Generated + public static RunStepFunctionToolCallDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String arguments = null; + String output = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("arguments".equals(fieldName)) { + arguments = reader.getString(); + } else if ("output".equals(fieldName)) { + output = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RunStepFunctionToolCallDetails(name, arguments, output); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationDetails.java new file mode 100644 index 000000000000..65d2c80928c2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The detailed information associated with a message creation run step. + */ +@Immutable +public final class RunStepMessageCreationDetails extends RunStepDetails { + + /* + * The object type. + */ + @Generated + private RunStepType type = RunStepType.MESSAGE_CREATION; + + /* + * Information about the message creation associated with this run step. + */ + @Generated + private final RunStepMessageCreationReference messageCreation; + + /** + * Creates an instance of RunStepMessageCreationDetails class. + * + * @param messageCreation the messageCreation value to set. + */ + @Generated + private RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation) { + this.messageCreation = messageCreation; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public RunStepType getType() { + return this.type; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("message_creation", this.messageCreation); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepMessageCreationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepMessageCreationDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepMessageCreationDetails. + */ + @Generated + public static RunStepMessageCreationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunStepMessageCreationReference messageCreation = null; + RunStepType type = RunStepType.MESSAGE_CREATION; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("message_creation".equals(fieldName)) { + messageCreation = RunStepMessageCreationReference.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = RunStepType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + RunStepMessageCreationDetails deserializedRunStepMessageCreationDetails + = new RunStepMessageCreationDetails(messageCreation); + deserializedRunStepMessageCreationDetails.type = type; + return deserializedRunStepMessageCreationDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationReference.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationReference.java new file mode 100644 index 000000000000..a38d59749b02 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMessageCreationReference.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The details of a message created as a part of a run step. + */ +@Immutable +public final class RunStepMessageCreationReference implements JsonSerializable { + + /* + * The ID of the message created by this run step. + */ + @Generated + private final String messageId; + + /** + * Creates an instance of RunStepMessageCreationReference class. + * + * @param messageId the messageId value to set. + */ + @Generated + private RunStepMessageCreationReference(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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message_id", this.messageId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepMessageCreationReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepMessageCreationReference if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepMessageCreationReference. + */ + @Generated + public static RunStepMessageCreationReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String messageId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("message_id".equals(fieldName)) { + messageId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RunStepMessageCreationReference(messageId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMicrosoftFabricToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMicrosoftFabricToolCall.java new file mode 100644 index 000000000000..4847296c62e4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepMicrosoftFabricToolCall.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined tool, that represents + * executed Microsoft Fabric operations. + */ +@Immutable +public final class RunStepMicrosoftFabricToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "fabric_dataagent"; + + /* + * Reserved for future use. + */ + @Generated + private final Map microsoftFabric; + + /** + * Creates an instance of RunStepMicrosoftFabricToolCall class. + * + * @param id the id value to set. + * @param microsoftFabric the microsoftFabric value to set. + */ + @Generated + private RunStepMicrosoftFabricToolCall(String id, Map microsoftFabric) { + super(id); + this.microsoftFabric = microsoftFabric; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the microsoftFabric property: Reserved for future use. + * + * @return the microsoftFabric value. + */ + @Generated + public Map getMicrosoftFabric() { + return this.microsoftFabric; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("fabric_dataagent", this.microsoftFabric, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepMicrosoftFabricToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepMicrosoftFabricToolCall if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepMicrosoftFabricToolCall. + */ + @Generated + public static RunStepMicrosoftFabricToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map microsoftFabric = null; + String type = "fabric_dataagent"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("fabric_dataagent".equals(fieldName)) { + microsoftFabric = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepMicrosoftFabricToolCall deserializedRunStepMicrosoftFabricToolCall + = new RunStepMicrosoftFabricToolCall(id, microsoftFabric); + deserializedRunStepMicrosoftFabricToolCall.type = type; + return deserializedRunStepMicrosoftFabricToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepOpenApiToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepOpenApiToolCall.java new file mode 100644 index 000000000000..8771777b6548 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepOpenApiToolCall.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to an OpenAPI tool, issued by the model in evaluation of a defined tool, that represents + * executed OpenAPI operations. + */ +@Immutable +public final class RunStepOpenApiToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "openapi"; + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("openapi", this.openApi, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepOpenApiToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepOpenApiToolCall if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepOpenApiToolCall. + */ + @Generated + public static RunStepOpenApiToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map openApi = null; + String type = "openapi"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("openapi".equals(fieldName)) { + openApi = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepOpenApiToolCall deserializedRunStepOpenApiToolCall = new RunStepOpenApiToolCall(id, openApi); + deserializedRunStepOpenApiToolCall.type = type; + return deserializedRunStepOpenApiToolCall; + }); + } + + /** + * Creates an instance of RunStepOpenApiToolCall class. + * + * @param id the id value to set. + * @param openApi the openApi value to set. + */ + @Generated + private RunStepOpenApiToolCall(String id, Map openApi) { + super(id); + this.openApi = openApi; + } + + /* + * Reserved for future use. + */ + @Generated + private final Map openApi; + + /** + * Get the openApi property: Reserved for future use. + * + * @return the openApi value. + */ + @Generated + public Map getOpenApi() { + return this.openApi; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepSharepointToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepSharepointToolCall.java new file mode 100644 index 000000000000..56339e2a684f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepSharepointToolCall.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A record of a call to a SharePoint tool, issued by the model in evaluation of a defined tool, that represents + * executed SharePoint actions. + */ +@Immutable +public final class RunStepSharepointToolCall extends RunStepToolCall { + + /* + * The object type. + */ + @Generated + private String type = "sharepoint_grounding"; + + /* + * Reserved for future use. + */ + @Generated + private final Map sharePoint; + + /** + * Creates an instance of RunStepSharepointToolCall class. + * + * @param id the id value to set. + * @param sharePoint the sharePoint value to set. + */ + @Generated + private RunStepSharepointToolCall(String id, Map sharePoint) { + super(id); + this.sharePoint = sharePoint; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the sharePoint property: Reserved for future use. + * + * @return the sharePoint value. + */ + @Generated + public Map getSharePoint() { + return this.sharePoint; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("sharepoint_grounding", this.sharePoint, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepSharepointToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepSharepointToolCall if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepSharepointToolCall. + */ + @Generated + public static RunStepSharepointToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map sharePoint = null; + String type = "sharepoint_grounding"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("sharepoint_grounding".equals(fieldName)) { + sharePoint = reader.readMap(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepSharepointToolCall deserializedRunStepSharepointToolCall + = new RunStepSharepointToolCall(id, sharePoint); + deserializedRunStepSharepointToolCall.type = type; + return deserializedRunStepSharepointToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStatus.java new file mode 100644 index 000000000000..e44d8a257fc1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStatus.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStreamEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStreamEvent.java new file mode 100644 index 000000000000..2f8f6bb6bb4d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepStreamEvent.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Run step operation related streaming events. + */ +public final class RunStepStreamEvent extends ExpandableStringEnum { + + /** + * Event sent when a new thread run step is created. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_CREATED = fromString("thread.run.step.created"); + + /** + * Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_IN_PROGRESS = fromString("thread.run.step.in_progress"); + + /** + * Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_DELTA = fromString("thread.run.step.delta"); + + /** + * Event sent when a run step is completed. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_COMPLETED = fromString("thread.run.step.completed"); + + /** + * Event sent when a run step fails. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_FAILED = fromString("thread.run.step.failed"); + + /** + * Event sent when a run step is cancelled. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_CANCELLED = fromString("thread.run.step.cancelled"); + + /** + * Event sent when a run step is expired. The data of this event is of type RunStep. + */ + @Generated + public static final RunStepStreamEvent THREAD_RUN_STEP_EXPIRED = fromString("thread.run.step.expired"); + + /** + * Creates a new instance of RunStepStreamEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStepStreamEvent() { + } + + /** + * Creates or finds a RunStepStreamEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStepStreamEvent. + */ + @Generated + public static RunStepStreamEvent fromString(String name) { + return fromString(name, RunStepStreamEvent.class); + } + + /** + * Gets known RunStepStreamEvent values. + * + * @return known RunStepStreamEvent values. + */ + @Generated + public static Collection values() { + return values(RunStepStreamEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCall.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCall.java new file mode 100644 index 000000000000..53f32e8135a4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCall.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a detailed tool call as recorded within a run step for an existing run. + */ +@Immutable +public class RunStepToolCall implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "RunStepToolCall"; + + /* + * The ID of the tool call. This ID must be referenced when you submit tool outputs. + */ + @Generated + private final String id; + + /** + * Creates an instance of RunStepToolCall class. + * + * @param id the id value to set. + */ + @Generated + protected RunStepToolCall(String id) { + this.id = id; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepToolCall from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepToolCall if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepToolCall. + */ + @Generated + public static RunStepToolCall fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("code_interpreter".equals(discriminatorValue)) { + return RunStepCodeInterpreterToolCall.fromJson(readerToUse.reset()); + } else if ("file_search".equals(discriminatorValue)) { + return RunStepFileSearchToolCall.fromJson(readerToUse.reset()); + } else if ("bing_grounding".equals(discriminatorValue)) { + return RunStepBingGroundingToolCall.fromJson(readerToUse.reset()); + } else if ("azure_ai_search".equals(discriminatorValue)) { + return RunStepAzureAISearchToolCall.fromJson(readerToUse.reset()); + } else if ("sharepoint_grounding".equals(discriminatorValue)) { + return RunStepSharepointToolCall.fromJson(readerToUse.reset()); + } else if ("fabric_dataagent".equals(discriminatorValue)) { + return RunStepMicrosoftFabricToolCall.fromJson(readerToUse.reset()); + } else if ("bing_custom_search".equals(discriminatorValue)) { + return RunStepCustomSearchToolCall.fromJson(readerToUse.reset()); + } else if ("function".equals(discriminatorValue)) { + return RunStepFunctionToolCall.fromJson(readerToUse.reset()); + } else if ("openapi".equals(discriminatorValue)) { + return RunStepOpenApiToolCall.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RunStepToolCall fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunStepToolCall deserializedRunStepToolCall = new RunStepToolCall(id); + deserializedRunStepToolCall.type = type; + return deserializedRunStepToolCall; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCallDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCallDetails.java new file mode 100644 index 000000000000..39db9a7f137f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepToolCallDetails.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The detailed information associated with a run step calling tools. + */ +@Immutable +public final class RunStepToolCallDetails extends RunStepDetails { + + /* + * The object type. + */ + @Generated + private RunStepType type = RunStepType.TOOL_CALLS; + + /* + * A list of tool call details for this run step. + */ + @Generated + private final List toolCalls; + + /** + * Creates an instance of RunStepToolCallDetails class. + * + * @param toolCalls the toolCalls value to set. + */ + @Generated + private RunStepToolCallDetails(List toolCalls) { + this.toolCalls = toolCalls; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public RunStepType getType() { + return this.type; + } + + /** + * Get the toolCalls property: A list of tool call details for this run step. + * + * @return the toolCalls value. + */ + @Generated + public List getToolCalls() { + return this.toolCalls; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tool_calls", this.toolCalls, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunStepToolCallDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunStepToolCallDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunStepToolCallDetails. + */ + @Generated + public static RunStepToolCallDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List toolCalls = null; + RunStepType type = RunStepType.TOOL_CALLS; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_calls".equals(fieldName)) { + toolCalls = reader.readArray(reader1 -> RunStepToolCall.fromJson(reader1)); + } else if ("type".equals(fieldName)) { + type = RunStepType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + RunStepToolCallDetails deserializedRunStepToolCallDetails = new RunStepToolCallDetails(toolCalls); + deserializedRunStepToolCallDetails.type = type; + return deserializedRunStepToolCallDetails; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepType.java new file mode 100644 index 000000000000..677e94c5a520 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStepType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +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 + 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/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStreamEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStreamEvent.java new file mode 100644 index 000000000000..34735cf340fa --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RunStreamEvent.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Run operation related streaming events. + */ +public final class RunStreamEvent extends ExpandableStringEnum { + + /** + * Event sent when a new run is created. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_CREATED = fromString("thread.run.created"); + + /** + * Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_QUEUED = fromString("thread.run.queued"); + + /** + * Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_IN_PROGRESS = fromString("thread.run.in_progress"); + + /** + * Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_REQUIRES_ACTION = fromString("thread.run.requires_action"); + + /** + * Event sent when a run is completed. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_COMPLETED = fromString("thread.run.completed"); + + /** + * Event sent when a run ends incomplete. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_INCOMPLETE = fromString("thread.run.incomplete"); + + /** + * Event sent when a run fails. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_FAILED = fromString("thread.run.failed"); + + /** + * Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_CANCELLING = fromString("thread.run.cancelling"); + + /** + * Event sent when a run is cancelled. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_CANCELLED = fromString("thread.run.cancelled"); + + /** + * Event sent when a run is expired. The data of this event is of type ThreadRun. + */ + @Generated + public static final RunStreamEvent THREAD_RUN_EXPIRED = fromString("thread.run.expired"); + + /** + * Creates a new instance of RunStreamEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStreamEvent() { + } + + /** + * Creates or finds a RunStreamEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStreamEvent. + */ + @Generated + public static RunStreamEvent fromString(String name) { + return fromString(name, RunStreamEvent.class); + } + + /** + * Gets known RunStreamEvent values. + * + * @return known RunStreamEvent values. + */ + @Generated + public static Collection values() { + return values(RunStreamEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfiguration.java new file mode 100644 index 000000000000..732396440ea6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfiguration.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A custom search configuration. + */ +@Immutable +public final class SearchConfiguration implements JsonSerializable { + + /* + * A connection in a ToolConnectionList attached to this tool. + */ + @Generated + private final String connectionId; + + /* + * Name of the custom configuration instance given to config. + */ + @Generated + private final String instanceName; + + /** + * Creates an instance of SearchConfiguration class. + * + * @param connectionId the connectionId value to set. + * @param instanceName the instanceName value to set. + */ + @Generated + public SearchConfiguration(String connectionId, String instanceName) { + this.connectionId = connectionId; + this.instanceName = instanceName; + } + + /** + * Get the connectionId property: A connection in a ToolConnectionList attached to this tool. + * + * @return the connectionId value. + */ + @Generated + public String getConnectionId() { + return this.connectionId; + } + + /** + * Get the instanceName property: Name of the custom configuration instance given to config. + * + * @return the instanceName value. + */ + @Generated + public String getInstanceName() { + return this.instanceName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connection_id", this.connectionId); + jsonWriter.writeStringField("instance_name", this.instanceName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchConfiguration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchConfiguration. + */ + @Generated + public static SearchConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String connectionId = null; + String instanceName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("connection_id".equals(fieldName)) { + connectionId = reader.getString(); + } else if ("instance_name".equals(fieldName)) { + instanceName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SearchConfiguration(connectionId, instanceName); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfigurationList.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfigurationList.java new file mode 100644 index 000000000000..6d44ca7adc1f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SearchConfigurationList.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of search configurations currently used by the `bing_custom_search` tool. + */ +@Immutable +public final class SearchConfigurationList implements JsonSerializable { + + /* + * The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + @Generated + private final List searchConfigurations; + + /** + * Creates an instance of SearchConfigurationList class. + * + * @param searchConfigurations the searchConfigurations value to set. + */ + @Generated + public SearchConfigurationList(List searchConfigurations) { + this.searchConfigurations = searchConfigurations; + } + + /** + * Get the searchConfigurations property: The connections attached to this tool. There can be a maximum of 1 + * connection + * resource attached to the tool. + * + * @return the searchConfigurations value. + */ + @Generated + public List getSearchConfigurations() { + return this.searchConfigurations; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("search_configurations", this.searchConfigurations, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchConfigurationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchConfigurationList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchConfigurationList. + */ + @Generated + public static SearchConfigurationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List searchConfigurations = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("search_configurations".equals(fieldName)) { + searchConfigurations = reader.readArray(reader1 -> SearchConfiguration.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new SearchConfigurationList(searchConfigurations); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SharepointToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SharepointToolDefinition.java new file mode 100644 index 000000000000..7f3ab5f0972c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SharepointToolDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The input definition information for a sharepoint tool as used to configure an agent. + */ +@Immutable +public final class SharepointToolDefinition extends ToolDefinition { + + /* + * The object type. + */ + @Generated + private String type = "sharepoint_grounding"; + + /* + * The list of connections used by the SharePoint tool. + */ + @Generated + private final ToolConnectionList sharepointGrounding; + + /** + * Creates an instance of SharepointToolDefinition class. + * + * @param sharepointGrounding the sharepointGrounding value to set. + */ + @Generated + public SharepointToolDefinition(ToolConnectionList sharepointGrounding) { + this.sharepointGrounding = sharepointGrounding; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the sharepointGrounding property: The list of connections used by the SharePoint tool. + * + * @return the sharepointGrounding value. + */ + @Generated + public ToolConnectionList getSharepointGrounding() { + return this.sharepointGrounding; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sharepoint_grounding", this.sharepointGrounding); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SharepointToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharepointToolDefinition if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SharepointToolDefinition. + */ + @Generated + public static SharepointToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolConnectionList sharepointGrounding = null; + String type = "sharepoint_grounding"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("sharepoint_grounding".equals(fieldName)) { + sharepointGrounding = ToolConnectionList.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + SharepointToolDefinition deserializedSharepointToolDefinition + = new SharepointToolDefinition(sharepointGrounding); + deserializedSharepointToolDefinition.type = type; + return deserializedSharepointToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsAction.java new file mode 100644 index 000000000000..107479bcdf71 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsAction.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The details for required tool calls that must be submitted for an agent thread run to continue. + */ +@Immutable +public final class SubmitToolOutputsAction extends RequiredAction { + + /* + * The object type. + */ + @Generated + private String type = "submit_tool_outputs"; + + /* + * The details describing tools that should be called to submit tool outputs. + */ + @Generated + private final SubmitToolOutputsDetails submitToolOutputs; + + /** + * Creates an instance of SubmitToolOutputsAction class. + * + * @param submitToolOutputs the submitToolOutputs value to set. + */ + @Generated + private SubmitToolOutputsAction(SubmitToolOutputsDetails submitToolOutputs) { + this.submitToolOutputs = submitToolOutputs; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("submit_tool_outputs", this.submitToolOutputs); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitToolOutputsAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitToolOutputsAction if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitToolOutputsAction. + */ + @Generated + public static SubmitToolOutputsAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubmitToolOutputsDetails submitToolOutputs = null; + String type = "submit_tool_outputs"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("submit_tool_outputs".equals(fieldName)) { + submitToolOutputs = SubmitToolOutputsDetails.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + SubmitToolOutputsAction deserializedSubmitToolOutputsAction + = new SubmitToolOutputsAction(submitToolOutputs); + deserializedSubmitToolOutputsAction.type = type; + return deserializedSubmitToolOutputsAction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsDetails.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsDetails.java new file mode 100644 index 000000000000..fa072bccf84a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SubmitToolOutputsDetails.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The details describing tools that should be called to submit tool outputs. + */ +@Immutable +public final class SubmitToolOutputsDetails implements JsonSerializable { + + /* + * The list of tool calls that must be resolved for the agent thread run to continue. + */ + @Generated + private final List toolCalls; + + /** + * Creates an instance of SubmitToolOutputsDetails class. + * + * @param toolCalls the toolCalls value to set. + */ + @Generated + private SubmitToolOutputsDetails(List toolCalls) { + this.toolCalls = toolCalls; + } + + /** + * Get the toolCalls property: The list of tool calls that must be resolved for the agent thread run to continue. + * + * @return the toolCalls value. + */ + @Generated + public List getToolCalls() { + return this.toolCalls; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tool_calls", this.toolCalls, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitToolOutputsDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitToolOutputsDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitToolOutputsDetails. + */ + @Generated + public static SubmitToolOutputsDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List toolCalls = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_calls".equals(fieldName)) { + toolCalls = reader.readArray(reader1 -> RequiredToolCall.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new SubmitToolOutputsDetails(toolCalls); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SystemData.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SystemData.java new file mode 100644 index 000000000000..06e99927ff04 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SystemData.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Metadata pertaining to creation and last modification of the resource. + */ +@Immutable +public final class SystemData implements JsonSerializable { + + /* + * The timestamp the resource was created at. + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The identity that created the resource. + */ + @Generated + private String createdBy; + + /* + * The identity type that created the resource. + */ + @Generated + private String createdByType; + + /* + * The timestamp of resource last modification (UTC) + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /** + * Creates an instance of SystemData class. + */ + @Generated + private SystemData() { + } + + /** + * Get the createdAt property: The timestamp the resource was created at. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: The identity type that created the resource. + * + * @return the createdByType value. + */ + @Generated + public String getCreatedByType() { + return this.createdByType; + } + + /** + * Get the lastModifiedAt property: The timestamp of resource last modification (UTC). + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the SystemData. + */ + @Generated + public static SystemData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemData deserializedSystemData = new SystemData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("createdAt".equals(fieldName)) { + deserializedSystemData.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedSystemData.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedSystemData.createdByType = reader.getString(); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedSystemData.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return deserializedSystemData; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TargetModelConfig.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TargetModelConfig.java new file mode 100644 index 000000000000..e6ccb0dac31f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TargetModelConfig.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.ai.projects.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Abstract class for model configuration. + */ +@Immutable +public class TargetModelConfig implements JsonSerializable { + + /* + * Type of the model configuration. + */ + @Generated + private String type = "TargetModelConfig"; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTargetModelConfigAccessor(new JsonMergePatchHelper.TargetModelConfigAccessor() { + + @Override + public TargetModelConfig prepareModelForJsonMergePatch(TargetModelConfig model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TargetModelConfig model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TargetModelConfig class. + */ + @Generated + public TargetModelConfig() { + } + + /** + * Get the type property: Type of the model configuration. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetModelConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetModelConfig if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetModelConfig. + */ + @Generated + public static TargetModelConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AOAI".equals(discriminatorValue)) { + return AOAIModelConfig.fromJson(readerToUse.reset()); + } else if ("MAAS".equals(discriminatorValue)) { + return MAASModelConfig.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static TargetModelConfig fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetModelConfig deserializedTargetModelConfig = new TargetModelConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedTargetModelConfig.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedTargetModelConfig; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadDeletionStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadDeletionStatus.java new file mode 100644 index 000000000000..3bc71cdc9d9d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadDeletionStatus.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The status of a thread deletion operation. + */ +@Immutable +public final class ThreadDeletionStatus implements JsonSerializable { + + /* + * The ID of the resource specified for deletion. + */ + @Generated + private final String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + private final boolean deleted; + + /* + * The object type, which is always 'thread.deleted'. + */ + @Generated + private final 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 + private ThreadDeletionStatus(String id, 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("deleted", this.deleted); + jsonWriter.writeStringField("object", this.object); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreadDeletionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreadDeletionStatus if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreadDeletionStatus. + */ + @Generated + public static ThreadDeletionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean deleted = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("deleted".equals(fieldName)) { + deleted = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new ThreadDeletionStatus(id, deleted); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessage.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessage.java new file mode 100644 index 000000000000..7624af06c3ad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessage.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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 agent thread. + */ +@Immutable +public final class ThreadMessage implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always 'thread.message'. + */ + @Generated + private final String object = "thread.message"; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * The ID of the thread that this message belongs to. + */ + @Generated + private final String threadId; + + /* + * The status of the message. + */ + @Generated + private final MessageStatus status; + + /* + * On an incomplete message, details about why the message is incomplete. + */ + @Generated + private final MessageIncompleteDetails incompleteDetails; + + /* + * The Unix timestamp (in seconds) for when the message was completed. + */ + @Generated + private final Long completedAt; + + /* + * The Unix timestamp (in seconds) for when the message was marked as incomplete. + */ + @Generated + private final Long incompleteAt; + + /* + * The role associated with the agent thread message. + */ + @Generated + private final MessageRole role; + + /* + * The list of content items associated with the agent thread message. + */ + @Generated + private final List content; + + /* + * If applicable, the ID of the agent that authored this message. + */ + @Generated + private final String assistantId; + + /* + * If applicable, the ID of the run associated with the authoring of this message. + */ + @Generated + private final String runId; + + /* + * A list of files attached to the message, and the tools they were added to. + */ + @Generated + private final List attachments; + + /* + * 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 + private final 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 status the status value to set. + * @param incompleteDetails the incompleteDetails value to set. + * @param completedAt the completedAt value to set. + * @param incompleteAt the incompleteAt value to set. + * @param role the role value to set. + * @param content the content value to set. + * @param assistantId the assistantId value to set. + * @param runId the runId value to set. + * @param attachments the attachments value to set. + * @param metadata the metadata value to set. + */ + @Generated + private ThreadMessage(String id, OffsetDateTime createdAt, String threadId, MessageStatus status, + MessageIncompleteDetails incompleteDetails, OffsetDateTime completedAt, OffsetDateTime incompleteAt, + MessageRole role, List content, String assistantId, String runId, + List attachments, Map metadata) { + this.id = id; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.threadId = threadId; + this.status = status; + this.incompleteDetails = incompleteDetails; + if (completedAt == null) { + this.completedAt = null; + } else { + this.completedAt = completedAt.toEpochSecond(); + } + if (incompleteAt == null) { + this.incompleteAt = null; + } else { + this.incompleteAt = incompleteAt.toEpochSecond(); + } + this.role = role; + this.content = content; + this.assistantId = assistantId; + this.runId = runId; + this.attachments = attachments; + this.metadata = 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 status property: The status of the message. + * + * @return the status value. + */ + @Generated + public MessageStatus getStatus() { + return this.status; + } + + /** + * Get the incompleteDetails property: On an incomplete message, details about why the message is incomplete. + * + * @return the incompleteDetails value. + */ + @Generated + public MessageIncompleteDetails getIncompleteDetails() { + return this.incompleteDetails; + } + + /** + * Get the completedAt property: The Unix timestamp (in seconds) for when the message was completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + if (this.completedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.completedAt), ZoneOffset.UTC); + } + + /** + * Get the incompleteAt property: The Unix timestamp (in seconds) for when the message was marked as incomplete. + * + * @return the incompleteAt value. + */ + @Generated + public OffsetDateTime getIncompleteAt() { + if (this.incompleteAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.incompleteAt), ZoneOffset.UTC); + } + + /** + * Get the role property: The role associated with the agent 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 agent thread message. + * + * @return the content value. + */ + @Generated + public List getContent() { + return this.content; + } + + /** + * Get the assistantId property: If applicable, the ID of the agent 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 attachments property: A list of files attached to the message, and the tools they were added to. + * + * @return the attachments value. + */ + @Generated + public List getAttachments() { + return this.attachments; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("thread_id", this.threadId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("incomplete_details", this.incompleteDetails); + jsonWriter.writeNumberField("completed_at", this.completedAt); + jsonWriter.writeNumberField("incomplete_at", this.incompleteAt); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeArrayField("content", this.content, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("assistant_id", this.assistantId); + jsonWriter.writeStringField("run_id", this.runId); + jsonWriter.writeArrayField("attachments", this.attachments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreadMessage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreadMessage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreadMessage. + */ + @Generated + public static ThreadMessage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdAt = null; + String threadId = null; + MessageStatus status = null; + MessageIncompleteDetails incompleteDetails = null; + OffsetDateTime completedAt = null; + OffsetDateTime incompleteAt = null; + MessageRole role = null; + List content = null; + String assistantId = null; + String runId = null; + List attachments = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("thread_id".equals(fieldName)) { + threadId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = MessageStatus.fromString(reader.getString()); + } else if ("incomplete_details".equals(fieldName)) { + incompleteDetails = MessageIncompleteDetails.fromJson(reader); + } else if ("completed_at".equals(fieldName)) { + Long completedAtHolder = reader.getNullable(JsonReader::getLong); + if (completedAtHolder != null) { + completedAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(completedAtHolder), ZoneOffset.UTC); + } + } else if ("incomplete_at".equals(fieldName)) { + Long incompleteAtHolder = reader.getNullable(JsonReader::getLong); + if (incompleteAtHolder != null) { + incompleteAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(incompleteAtHolder), ZoneOffset.UTC); + } + } else if ("role".equals(fieldName)) { + role = MessageRole.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + content = reader.readArray(reader1 -> MessageContent.fromJson(reader1)); + } else if ("assistant_id".equals(fieldName)) { + assistantId = reader.getString(); + } else if ("run_id".equals(fieldName)) { + runId = reader.getString(); + } else if ("attachments".equals(fieldName)) { + attachments = reader.readArray(reader1 -> MessageAttachment.fromJson(reader1)); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new ThreadMessage(id, createdAt, threadId, status, incompleteDetails, completedAt, incompleteAt, + role, content, assistantId, runId, attachments, metadata); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessageOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessageOptions.java new file mode 100644 index 000000000000..fcb110e815cb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadMessageOptions.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A single message within an agent thread, + * as provided during that thread's creation for its initial state. + */ +@Fluent +public final class ThreadMessageOptions implements JsonSerializable { + + /* + * The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + */ + @Generated + private final MessageRole role; + + /* + * The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + */ + @Generated + private final BinaryData content; + + /* + * A list of files attached to the message, and the tools they should be added to. + */ + @Generated + private List attachments; + + /* + * 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 + private Map metadata; + + /** + * Get the role property: The role of the entity that is creating the message. Allowed values include: + * `user`, which indicates the message is sent by an actual user (and should be + * used in most cases to represent user-generated messages), and `assistant`, + * which indicates the message is generated by the agent (use this value to insert + * messages from the agent into the conversation). + * + * @return the role value. + */ + @Generated + public MessageRole getRole() { + return this.role; + } + + /** + * Get the content property: The content of the initial message. This may be a basic string (if you only + * need text) or an array of typed content blocks (for example, text, image_file, + * image_url, and so on). + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the attachments property: A list of files attached to the message, and the tools they should be added to. + * + * @return the attachments value. + */ + @Generated + public List getAttachments() { + return this.attachments; + } + + /** + * Set the attachments property: A list of files attached to the message, and the tools they should be added to. + * + * @param attachments the attachments value to set. + * @return the ThreadMessageOptions object itself. + */ + @Generated + public ThreadMessageOptions setAttachments(List attachments) { + this.attachments = attachments; + 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 ThreadMessageOptions object itself. + */ + @Generated + public ThreadMessageOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeFieldName("content"); + this.content.writeTo(jsonWriter); + jsonWriter.writeArrayField("attachments", this.attachments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreadMessageOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreadMessageOptions if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreadMessageOptions. + */ + @Generated + public static ThreadMessageOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageRole role = null; + BinaryData content = null; + List attachments = null; + Map metadata = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("role".equals(fieldName)) { + role = MessageRole.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + content = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("attachments".equals(fieldName)) { + attachments = reader.readArray(reader1 -> MessageAttachment.fromJson(reader1)); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + ThreadMessageOptions deserializedThreadMessageOptions = new ThreadMessageOptions(role, content); + deserializedThreadMessageOptions.attachments = attachments; + deserializedThreadMessageOptions.metadata = metadata; + return deserializedThreadMessageOptions; + }); + } + + /** + * Creates an instance of ThreadMessageOptions class. + * + * @param role the role value to set. + * @param content the content value to set. + */ + @Generated + public ThreadMessageOptions(MessageRole role, BinaryData content) { + this.role = role; + this.content = content; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadRun.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadRun.java new file mode 100644 index 000000000000..4a2ec62589dc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadRun.java @@ -0,0 +1,753 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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 agent thread. + */ +@Immutable +public final class ThreadRun implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always 'thread.run'. + */ + @Generated + private final String object = "thread.run"; + + /* + * The ID of the thread associated with this run. + */ + @Generated + private final String threadId; + + /* + * The ID of the agent associated with the thread this run was performed against. + */ + @Generated + private final String assistantId; + + /* + * The status of the agent thread run. + */ + @Generated + private final RunStatus status; + + /* + * The details of the action required for the agent thread run to continue. + */ + @Generated + private RequiredAction requiredAction; + + /* + * The last error, if any, encountered by this agent thread run. + */ + @Generated + private final RunError lastError; + + /* + * The ID of the model to use. + */ + @Generated + private final String model; + + /* + * The overridden system instructions used for this agent thread run. + */ + @Generated + private final String instructions; + + /* + * The overridden enabled tools used for this agent thread run. + */ + @Generated + private final List tools; + + /* + * The Unix timestamp, in seconds, representing when this object was created. + */ + @Generated + private final long createdAt; + + /* + * The Unix timestamp, in seconds, representing when this item expires. + */ + @Generated + private final Long expiresAt; + + /* + * The Unix timestamp, in seconds, representing when this item was started. + */ + @Generated + private final Long startedAt; + + /* + * The Unix timestamp, in seconds, representing when this completed. + */ + @Generated + private final Long completedAt; + + /* + * The Unix timestamp, in seconds, representing when this was cancelled. + */ + @Generated + private final Long cancelledAt; + + /* + * The Unix timestamp, in seconds, representing when this failed. + */ + @Generated + private final Long failedAt; + + /* + * Details on why the run is incomplete. Will be `null` if the run is not incomplete. + */ + @Generated + private final IncompleteRunDetails incompleteDetails; + + /* + * Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. + * `in_progress`, `queued`, etc.). + */ + @Generated + private final RunCompletionUsage usage; + + /* + * The sampling temperature used for this run. If not set, defaults to 1. + */ + @Generated + private Double temperature; + + /* + * The nucleus sampling value used for this run. If not set, defaults to 1. + */ + @Generated + private Double topP; + + /* + * The maximum number of prompt tokens specified to have been used over the course of the run. + */ + @Generated + private final Integer maxPromptTokens; + + /* + * The maximum number of completion tokens specified to have been used over the course of the run. + */ + @Generated + private final Integer maxCompletionTokens; + + /* + * The strategy to use for dropping messages as the context windows moves forward. + */ + @Generated + private final TruncationObject truncationStrategy; + + /* + * Controls whether or not and which tool is called by the model. + */ + @Generated + private final BinaryData toolChoice; + + /* + * The response format of the tool calls used in this run. + */ + @Generated + private final BinaryData responseFormat; + + /* + * 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 + private final Map metadata; + + /* + * Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis + */ + @Generated + private UpdateToolResourcesOptions toolResources; + + /* + * Determines if tools can be executed in parallel within the run. + */ + @Generated + private final boolean parallelToolCalls; + + /** + * 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 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 incompleteDetails the incompleteDetails value to set. + * @param usage the usage value to set. + * @param maxPromptTokens the maxPromptTokens value to set. + * @param maxCompletionTokens the maxCompletionTokens value to set. + * @param truncationStrategy the truncationStrategy value to set. + * @param toolChoice the toolChoice value to set. + * @param responseFormat the responseFormat value to set. + * @param metadata the metadata value to set. + * @param parallelToolCalls the parallelToolCalls value to set. + */ + @Generated + private ThreadRun(String id, String threadId, String assistantId, RunStatus status, RunError lastError, + String model, String instructions, List tools, OffsetDateTime createdAt, + OffsetDateTime expiresAt, OffsetDateTime startedAt, OffsetDateTime completedAt, OffsetDateTime cancelledAt, + OffsetDateTime failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, + Integer maxPromptTokens, Integer maxCompletionTokens, TruncationObject truncationStrategy, + BinaryData toolChoice, BinaryData responseFormat, Map metadata, boolean parallelToolCalls) { + this.id = id; + this.threadId = threadId; + this.assistantId = assistantId; + this.status = status; + this.lastError = lastError; + this.model = model; + this.instructions = instructions; + this.tools = tools; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + if (expiresAt == null) { + this.expiresAt = null; + } else { + this.expiresAt = expiresAt.toEpochSecond(); + } + if (startedAt == null) { + this.startedAt = null; + } else { + this.startedAt = startedAt.toEpochSecond(); + } + if (completedAt == null) { + this.completedAt = null; + } else { + this.completedAt = completedAt.toEpochSecond(); + } + if (cancelledAt == null) { + this.cancelledAt = null; + } else { + this.cancelledAt = cancelledAt.toEpochSecond(); + } + if (failedAt == null) { + this.failedAt = null; + } else { + this.failedAt = failedAt.toEpochSecond(); + } + this.incompleteDetails = incompleteDetails; + this.usage = usage; + this.maxPromptTokens = maxPromptTokens; + this.maxCompletionTokens = maxCompletionTokens; + this.truncationStrategy = truncationStrategy; + this.toolChoice = toolChoice; + this.responseFormat = responseFormat; + this.metadata = metadata; + this.parallelToolCalls = parallelToolCalls; + } + + /** + * 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 agent 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 agent 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 agent 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 agent 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 agent thread run. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Get the tools property: The overridden enabled tools used for this agent thread run. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * 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() { + if (this.expiresAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.expiresAt), ZoneOffset.UTC); + } + + /** + * Get the startedAt property: The Unix timestamp, in seconds, representing when this item was started. + * + * @return the startedAt value. + */ + @Generated + public OffsetDateTime getStartedAt() { + if (this.startedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.startedAt), ZoneOffset.UTC); + } + + /** + * Get the completedAt property: The Unix timestamp, in seconds, representing when this completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + if (this.completedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.completedAt), ZoneOffset.UTC); + } + + /** + * Get the cancelledAt property: The Unix timestamp, in seconds, representing when this was cancelled. + * + * @return the cancelledAt value. + */ + @Generated + public OffsetDateTime getCancelledAt() { + if (this.cancelledAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.cancelledAt), ZoneOffset.UTC); + } + + /** + * Get the failedAt property: The Unix timestamp, in seconds, representing when this failed. + * + * @return the failedAt value. + */ + @Generated + public OffsetDateTime getFailedAt() { + if (this.failedAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.failedAt), ZoneOffset.UTC); + } + + /** + * Get the incompleteDetails property: Details on why the run is incomplete. Will be `null` if the run is not + * incomplete. + * + * @return the incompleteDetails value. + */ + @Generated + public IncompleteRunDetails getIncompleteDetails() { + return this.incompleteDetails; + } + + /** + * Get the usage property: Usage statistics related to the run. This value will be `null` if the run is not in a + * terminal state (i.e. `in_progress`, `queued`, etc.). + * + * @return the usage value. + */ + @Generated + public RunCompletionUsage getUsage() { + return this.usage; + } + + /** + * Get the temperature property: The sampling temperature used for this run. If not set, defaults to 1. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Get the topP property: The nucleus sampling value used for this run. If not set, defaults to 1. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Get the maxPromptTokens property: The maximum number of prompt tokens specified to have been used over the course + * of the run. + * + * @return the maxPromptTokens value. + */ + @Generated + public Integer getMaxPromptTokens() { + return this.maxPromptTokens; + } + + /** + * Get the maxCompletionTokens property: The maximum number of completion tokens specified to have been used over + * the course of the run. + * + * @return the maxCompletionTokens value. + */ + @Generated + public Integer getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * Get the truncationStrategy property: The strategy to use for dropping messages as the context windows moves + * forward. + * + * @return the truncationStrategy value. + */ + @Generated + public TruncationObject getTruncationStrategy() { + return this.truncationStrategy; + } + + /** + * Get the toolChoice property: Controls whether or not and which tool is called by the model. + * + * @return the toolChoice value. + */ + @Generated + public BinaryData getToolChoice() { + return this.toolChoice; + } + + /** + * Get the responseFormat property: The response format of the tool calls used in this run. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * 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; + } + + /** + * Get the toolResources property: Override the tools the agent can use for this run. This is useful for modifying + * the behavior on a per-run basis. + * + * @return the toolResources value. + */ + @Generated + public UpdateToolResourcesOptions getToolResources() { + return this.toolResources; + } + + /** + * Get the parallelToolCalls property: Determines if tools can be executed in parallel within the run. + * + * @return the parallelToolCalls value. + */ + @Generated + public boolean isParallelToolCalls() { + return this.parallelToolCalls; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeStringField("thread_id", this.threadId); + jsonWriter.writeStringField("assistant_id", this.assistantId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("last_error", this.lastError); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("instructions", this.instructions); + jsonWriter.writeArrayField("tools", this.tools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeNumberField("expires_at", this.expiresAt); + jsonWriter.writeNumberField("started_at", this.startedAt); + jsonWriter.writeNumberField("completed_at", this.completedAt); + jsonWriter.writeNumberField("cancelled_at", this.cancelledAt); + jsonWriter.writeNumberField("failed_at", this.failedAt); + jsonWriter.writeJsonField("incomplete_details", this.incompleteDetails); + jsonWriter.writeJsonField("usage", this.usage); + jsonWriter.writeNumberField("max_prompt_tokens", this.maxPromptTokens); + jsonWriter.writeNumberField("max_completion_tokens", this.maxCompletionTokens); + jsonWriter.writeJsonField("truncation_strategy", this.truncationStrategy); + jsonWriter.writeFieldName("tool_choice"); + this.toolChoice.writeTo(jsonWriter); + jsonWriter.writeFieldName("response_format"); + this.responseFormat.writeTo(jsonWriter); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("parallel_tool_calls", this.parallelToolCalls); + jsonWriter.writeJsonField("required_action", this.requiredAction); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("top_p", this.topP); + jsonWriter.writeJsonField("tool_resources", this.toolResources); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreadRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreadRun if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreadRun. + */ + @Generated + public static ThreadRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String threadId = null; + String assistantId = null; + RunStatus status = null; + RunError lastError = null; + String model = null; + String instructions = null; + List tools = null; + OffsetDateTime createdAt = null; + OffsetDateTime expiresAt = null; + OffsetDateTime startedAt = null; + OffsetDateTime completedAt = null; + OffsetDateTime cancelledAt = null; + OffsetDateTime failedAt = null; + IncompleteRunDetails incompleteDetails = null; + RunCompletionUsage usage = null; + Integer maxPromptTokens = null; + Integer maxCompletionTokens = null; + TruncationObject truncationStrategy = null; + BinaryData toolChoice = null; + BinaryData responseFormat = null; + Map metadata = null; + boolean parallelToolCalls = false; + RequiredAction requiredAction = null; + Double temperature = null; + Double topP = null; + UpdateToolResourcesOptions toolResources = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("thread_id".equals(fieldName)) { + threadId = reader.getString(); + } else if ("assistant_id".equals(fieldName)) { + assistantId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = RunStatus.fromString(reader.getString()); + } else if ("last_error".equals(fieldName)) { + lastError = RunError.fromJson(reader); + } else if ("model".equals(fieldName)) { + model = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = reader.getString(); + } else if ("tools".equals(fieldName)) { + tools = reader.readArray(reader1 -> ToolDefinition.fromJson(reader1)); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("expires_at".equals(fieldName)) { + Long expiresAtHolder = reader.getNullable(JsonReader::getLong); + if (expiresAtHolder != null) { + expiresAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(expiresAtHolder), ZoneOffset.UTC); + } + } else if ("started_at".equals(fieldName)) { + Long startedAtHolder = reader.getNullable(JsonReader::getLong); + if (startedAtHolder != null) { + startedAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(startedAtHolder), ZoneOffset.UTC); + } + } else if ("completed_at".equals(fieldName)) { + Long completedAtHolder = reader.getNullable(JsonReader::getLong); + if (completedAtHolder != null) { + completedAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(completedAtHolder), ZoneOffset.UTC); + } + } else if ("cancelled_at".equals(fieldName)) { + Long cancelledAtHolder = reader.getNullable(JsonReader::getLong); + if (cancelledAtHolder != null) { + cancelledAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(cancelledAtHolder), ZoneOffset.UTC); + } + } else if ("failed_at".equals(fieldName)) { + Long failedAtHolder = reader.getNullable(JsonReader::getLong); + if (failedAtHolder != null) { + failedAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(failedAtHolder), ZoneOffset.UTC); + } + } else if ("incomplete_details".equals(fieldName)) { + incompleteDetails = IncompleteRunDetails.fromJson(reader); + } else if ("usage".equals(fieldName)) { + usage = RunCompletionUsage.fromJson(reader); + } else if ("max_prompt_tokens".equals(fieldName)) { + maxPromptTokens = reader.getNullable(JsonReader::getInt); + } else if ("max_completion_tokens".equals(fieldName)) { + maxCompletionTokens = reader.getNullable(JsonReader::getInt); + } else if ("truncation_strategy".equals(fieldName)) { + truncationStrategy = TruncationObject.fromJson(reader); + } else if ("tool_choice".equals(fieldName)) { + toolChoice + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("response_format".equals(fieldName)) { + responseFormat + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else if ("parallel_tool_calls".equals(fieldName)) { + parallelToolCalls = reader.getBoolean(); + } else if ("required_action".equals(fieldName)) { + requiredAction = RequiredAction.fromJson(reader); + } else if ("temperature".equals(fieldName)) { + temperature = reader.getNullable(JsonReader::getDouble); + } else if ("top_p".equals(fieldName)) { + topP = reader.getNullable(JsonReader::getDouble); + } else if ("tool_resources".equals(fieldName)) { + toolResources = UpdateToolResourcesOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + ThreadRun deserializedThreadRun + = new ThreadRun(id, threadId, assistantId, status, lastError, model, instructions, tools, createdAt, + expiresAt, startedAt, completedAt, cancelledAt, failedAt, incompleteDetails, usage, maxPromptTokens, + maxCompletionTokens, truncationStrategy, toolChoice, responseFormat, metadata, parallelToolCalls); + deserializedThreadRun.requiredAction = requiredAction; + deserializedThreadRun.temperature = temperature; + deserializedThreadRun.topP = topP; + deserializedThreadRun.toolResources = toolResources; + return deserializedThreadRun; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadStreamEvent.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadStreamEvent.java new file mode 100644 index 000000000000..e898150cfaf3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ThreadStreamEvent.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Thread operation related streaming events. + */ +public final class ThreadStreamEvent extends ExpandableStringEnum { + + /** + * Event sent when a new thread is created. The data of this event is of type AgentThread. + */ + @Generated + public static final ThreadStreamEvent THREAD_CREATED = fromString("thread.created"); + + /** + * Creates a new instance of ThreadStreamEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ThreadStreamEvent() { + } + + /** + * Creates or finds a ThreadStreamEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding ThreadStreamEvent. + */ + @Generated + public static ThreadStreamEvent fromString(String name) { + return fromString(name, ThreadStreamEvent.class); + } + + /** + * Gets known ThreadStreamEvent values. + * + * @return known ThreadStreamEvent values. + */ + @Generated + public static Collection values() { + return values(ThreadStreamEvent.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnection.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnection.java new file mode 100644 index 000000000000..da26b732cbed --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnection.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A connection resource. + */ +@Immutable +public final class ToolConnection implements JsonSerializable { + + /* + * A connection in a ToolConnectionList attached to this tool. + */ + @Generated + private final String connectionId; + + /** + * Creates an instance of ToolConnection class. + * + * @param connectionId the connectionId value to set. + */ + @Generated + public ToolConnection(String connectionId) { + this.connectionId = connectionId; + } + + /** + * Get the connectionId property: A connection in a ToolConnectionList attached to this tool. + * + * @return the connectionId value. + */ + @Generated + public String getConnectionId() { + return this.connectionId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connection_id", this.connectionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolConnection if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ToolConnection. + */ + @Generated + public static ToolConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String connectionId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("connection_id".equals(fieldName)) { + connectionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ToolConnection(connectionId); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnectionList.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnectionList.java new file mode 100644 index 000000000000..64891c9f8297 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolConnectionList.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A set of connection resources currently used by either the `bing_grounding`, `fabric_dataagent`, or + * `sharepoint_grounding` tools. + */ +@Fluent +public final class ToolConnectionList implements JsonSerializable { + + /* + * The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + @Generated + private List connectionList; + + /** + * Creates an instance of ToolConnectionList class. + */ + @Generated + public ToolConnectionList() { + } + + /** + * Get the connectionList property: The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + * + * @return the connectionList value. + */ + @Generated + public List getConnectionList() { + return this.connectionList; + } + + /** + * Set the connectionList property: The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + * + * @param connectionList the connectionList value to set. + * @return the ToolConnectionList object itself. + */ + @Generated + public ToolConnectionList setConnectionList(List connectionList) { + this.connectionList = connectionList; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("connections", this.connectionList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolConnectionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolConnectionList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ToolConnectionList. + */ + @Generated + public static ToolConnectionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolConnectionList deserializedToolConnectionList = new ToolConnectionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("connections".equals(fieldName)) { + List connectionList = reader.readArray(reader1 -> ToolConnection.fromJson(reader1)); + deserializedToolConnectionList.connectionList = connectionList; + } else { + reader.skipChildren(); + } + } + return deserializedToolConnectionList; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDefinition.java new file mode 100644 index 000000000000..8957a15da0ef --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDefinition.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of an input tool definition that an agent can use. + */ +@Immutable +public class ToolDefinition implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private String type = "ToolDefinition"; + + /** + * Creates an instance of ToolDefinition class. + */ + @Generated + public ToolDefinition() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolDefinition if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ToolDefinition. + */ + @Generated + public static ToolDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("code_interpreter".equals(discriminatorValue)) { + return CodeInterpreterToolDefinition.fromJson(readerToUse.reset()); + } else if ("file_search".equals(discriminatorValue)) { + return FileSearchToolDefinition.fromJson(readerToUse.reset()); + } else if ("function".equals(discriminatorValue)) { + return FunctionToolDefinition.fromJson(readerToUse.reset()); + } else if ("bing_grounding".equals(discriminatorValue)) { + return BingGroundingToolDefinition.fromJson(readerToUse.reset()); + } else if ("fabric_dataagent".equals(discriminatorValue)) { + return MicrosoftFabricToolDefinition.fromJson(readerToUse.reset()); + } else if ("sharepoint_grounding".equals(discriminatorValue)) { + return SharepointToolDefinition.fromJson(readerToUse.reset()); + } else if ("azure_ai_search".equals(discriminatorValue)) { + return AzureAISearchToolDefinition.fromJson(readerToUse.reset()); + } else if ("openapi".equals(discriminatorValue)) { + return OpenApiToolDefinition.fromJson(readerToUse.reset()); + } else if ("bing_custom_search".equals(discriminatorValue)) { + return BingCustomSearchToolDefinition.fromJson(readerToUse.reset()); + } else if ("connected_agent".equals(discriminatorValue)) { + return ConnectedAgentToolDefinition.fromJson(readerToUse.reset()); + } else if ("azure_function".equals(discriminatorValue)) { + return AzureFunctionToolDefinition.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ToolDefinition fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolDefinition deserializedToolDefinition = new ToolDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedToolDefinition.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedToolDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolOutput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolOutput.java new file mode 100644 index 000000000000..0b30c69cc7ad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolOutput.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. + */ +@Fluent +public final class ToolOutput implements JsonSerializable { + + /* + * The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + */ + @Generated + private String toolCallId; + + /* + * The output from the tool to be submitted. + */ + @Generated + 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tool_call_id", this.toolCallId); + jsonWriter.writeStringField("output", this.output); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolOutput if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ToolOutput. + */ + @Generated + public static ToolOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolOutput deserializedToolOutput = new ToolOutput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_call_id".equals(fieldName)) { + deserializedToolOutput.toolCallId = reader.getString(); + } else if ("output".equals(fieldName)) { + deserializedToolOutput.output = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedToolOutput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolResources.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolResources.java new file mode 100644 index 000000000000..30f3307f2fab --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolResources.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A set of resources that are used by the agent's tools. The resources are specific to the type of + * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + * tool requires a list of vector store IDs. + */ +@Fluent +public final class ToolResources implements JsonSerializable { + + /* + * Resources to be used by the `code_interpreter` tool consisting of file IDs. + */ + @Generated + private CodeInterpreterToolResource codeInterpreter; + + /* + * Resources to be used by the `file_search` tool consisting of vector store IDs. + */ + @Generated + private FileSearchToolResource fileSearch; + + /* + * Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + */ + @Generated + private AzureAISearchResource azureAISearch; + + /** + * Creates an instance of ToolResources class. + */ + @Generated + public ToolResources() { + } + + /** + * Get the codeInterpreter property: Resources to be used by the `code_interpreter` tool consisting of file IDs. + * + * @return the codeInterpreter value. + */ + @Generated + public CodeInterpreterToolResource getCodeInterpreter() { + return this.codeInterpreter; + } + + /** + * Set the codeInterpreter property: Resources to be used by the `code_interpreter` tool consisting of file IDs. + * + * @param codeInterpreter the codeInterpreter value to set. + * @return the ToolResources object itself. + */ + @Generated + public ToolResources setCodeInterpreter(CodeInterpreterToolResource codeInterpreter) { + this.codeInterpreter = codeInterpreter; + return this; + } + + /** + * Get the fileSearch property: Resources to be used by the `file_search` tool consisting of vector store IDs. + * + * @return the fileSearch value. + */ + @Generated + public FileSearchToolResource getFileSearch() { + return this.fileSearch; + } + + /** + * Set the fileSearch property: Resources to be used by the `file_search` tool consisting of vector store IDs. + * + * @param fileSearch the fileSearch value to set. + * @return the ToolResources object itself. + */ + @Generated + public ToolResources setFileSearch(FileSearchToolResource fileSearch) { + this.fileSearch = fileSearch; + return this; + } + + /** + * Get the azureAISearch property: Resources to be used by the `azure_ai_search` tool consisting of index IDs and + * names. + * + * @return the azureAISearch value. + */ + @Generated + public AzureAISearchResource getAzureAISearch() { + return this.azureAISearch; + } + + /** + * Set the azureAISearch property: Resources to be used by the `azure_ai_search` tool consisting of index IDs and + * names. + * + * @param azureAISearch the azureAISearch value to set. + * @return the ToolResources object itself. + */ + @Generated + public ToolResources setAzureAISearch(AzureAISearchResource azureAISearch) { + this.azureAISearch = azureAISearch; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("code_interpreter", this.codeInterpreter); + jsonWriter.writeJsonField("file_search", this.fileSearch); + jsonWriter.writeJsonField("azure_ai_search", this.azureAISearch); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolResources from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolResources if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ToolResources. + */ + @Generated + public static ToolResources fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolResources deserializedToolResources = new ToolResources(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("code_interpreter".equals(fieldName)) { + deserializedToolResources.codeInterpreter = CodeInterpreterToolResource.fromJson(reader); + } else if ("file_search".equals(fieldName)) { + deserializedToolResources.fileSearch = FileSearchToolResource.fromJson(reader); + } else if ("azure_ai_search".equals(fieldName)) { + deserializedToolResources.azureAISearch = AzureAISearchResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedToolResources; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Trigger.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Trigger.java new file mode 100644 index 000000000000..876aaf3e9152 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Trigger.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Abstract data class for input data configuration. + */ +@Immutable +public class Trigger implements JsonSerializable { + + /* + * Type of the trigger. + */ + @Generated + private String type = "Trigger"; + + /** + * Creates an instance of Trigger class. + */ + @Generated + public Trigger() { + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Trigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Trigger if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Trigger. + */ + @Generated + public static Trigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Recurrence".equals(discriminatorValue)) { + return RecurrenceTrigger.fromJson(readerToUse.reset()); + } else if ("Cron".equals(discriminatorValue)) { + return CronTrigger.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Trigger fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Trigger deserializedTrigger = new Trigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedTrigger.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationObject.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationObject.java new file mode 100644 index 000000000000..5be84d36f06b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationObject.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Controls for how a thread will be truncated prior to the run. Use this to control the initial + * context window of the run. + */ +@Fluent +public final class TruncationObject implements JsonSerializable { + + /* + * The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + * be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the + * middle of the thread + * will be dropped to fit the context length of the model, `max_prompt_tokens`. + */ + @Generated + private final TruncationStrategy type; + + /* + * The number of most recent messages from the thread when constructing the context for the run. + */ + @Generated + private Integer lastMessages; + + /** + * Creates an instance of TruncationObject class. + * + * @param type the type value to set. + */ + @Generated + public TruncationObject(TruncationStrategy type) { + this.type = type; + } + + /** + * Get the type property: The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will + * be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the + * middle of the thread + * will be dropped to fit the context length of the model, `max_prompt_tokens`. + * + * @return the type value. + */ + @Generated + public TruncationStrategy getType() { + return this.type; + } + + /** + * Get the lastMessages property: The number of most recent messages from the thread when constructing the context + * for the run. + * + * @return the lastMessages value. + */ + @Generated + public Integer getLastMessages() { + return this.lastMessages; + } + + /** + * Set the lastMessages property: The number of most recent messages from the thread when constructing the context + * for the run. + * + * @param lastMessages the lastMessages value to set. + * @return the TruncationObject object itself. + */ + @Generated + public TruncationObject setLastMessages(Integer lastMessages) { + this.lastMessages = lastMessages; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeNumberField("last_messages", this.lastMessages); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TruncationObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TruncationObject if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TruncationObject. + */ + @Generated + public static TruncationObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TruncationStrategy type = null; + Integer lastMessages = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + type = TruncationStrategy.fromString(reader.getString()); + } else if ("last_messages".equals(fieldName)) { + lastMessages = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + TruncationObject deserializedTruncationObject = new TruncationObject(type); + deserializedTruncationObject.lastMessages = lastMessages; + return deserializedTruncationObject; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationStrategy.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationStrategy.java new file mode 100644 index 000000000000..19b5d2fcd641 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TruncationStrategy.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible truncation strategies for the thread. + */ +public final class TruncationStrategy extends ExpandableStringEnum { + + /** + * Default value. Messages in the middle of the thread will be dropped to fit the context length of the model. + */ + @Generated + public static final TruncationStrategy AUTO = fromString("auto"); + + /** + * The thread will truncate to the `lastMessages` count of recent messages. + */ + @Generated + public static final TruncationStrategy LAST_MESSAGES = fromString("last_messages"); + + /** + * Creates a new instance of TruncationStrategy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TruncationStrategy() { + } + + /** + * Creates or finds a TruncationStrategy from its string representation. + * + * @param name a name to look for. + * @return the corresponding TruncationStrategy. + */ + @Generated + public static TruncationStrategy fromString(String name) { + return fromString(name, TruncationStrategy.class); + } + + /** + * Gets known TruncationStrategy values. + * + * @return known TruncationStrategy values. + */ + @Generated + public static Collection values() { + return values(TruncationStrategy.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateAgentOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateAgentOptions.java new file mode 100644 index 000000000000..66bd89d3fc68 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateAgentOptions.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import java.util.List; +import java.util.Map; + +/** + * Options for updateAgent API. + */ +@Fluent +public final class UpdateAgentOptions { + + /* + * The ID of the agent to modify. + */ + @Generated + private final String assistantId; + + /* + * The ID of the model to use. + */ + @Generated + private String model; + + /* + * The modified name for the agent to use. + */ + @Generated + private String name; + + /* + * The modified description for the agent to use. + */ + @Generated + private String description; + + /* + * The modified system instructions for the new agent to use. + */ + @Generated + private String instructions; + + /* + * The modified collection of tools to enable for the agent. + */ + @Generated + private List tools; + + /* + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For + * example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + */ + @Generated + private ToolResources toolResources; + + /* + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + @Generated + private Double temperature; + + /* + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of + * the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + @Generated + private Double topP; + + /* + * The response format of the tool calls used by this agent. + */ + @Generated + private BinaryData responseFormat; + + /* + * 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 + private Map metadata; + + /** + * Creates an instance of UpdateAgentOptions class. + * + * @param assistantId the assistantId value to set. + */ + @Generated + public UpdateAgentOptions(String assistantId) { + this.assistantId = assistantId; + } + + /** + * Get the assistantId property: The ID of the agent to modify. + * + * @return the assistantId value. + */ + @Generated + public String getAssistantId() { + return this.assistantId; + } + + /** + * 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 UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the name property: The modified name for the agent to use. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The modified name for the agent to use. + * + * @param name the name value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The modified description for the agent to use. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The modified description for the agent to use. + * + * @param description the description value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: The modified system instructions for the new agent to use. + * + * @return the instructions value. + */ + @Generated + public String getInstructions() { + return this.instructions; + } + + /** + * Set the instructions property: The modified system instructions for the new agent to use. + * + * @param instructions the instructions value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the tools property: The modified collection of tools to enable for the agent. + * + * @return the tools value. + */ + @Generated + public List getTools() { + return this.tools; + } + + /** + * Set the tools property: The modified collection of tools to enable for the agent. + * + * @param tools the tools value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setTools(List tools) { + this.tools = tools; + return this; + } + + /** + * Get the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + * + * @return the toolResources value. + */ + @Generated + public ToolResources getToolResources() { + return this.toolResources; + } + + /** + * Set the toolResources property: A set of resources that are used by the agent's tools. The resources are specific + * to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector + * store IDs. + * + * @param toolResources the toolResources value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setToolResources(ToolResources toolResources) { + this.toolResources = toolResources; + return this; + } + + /** + * Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make + * the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * + * @param temperature the temperature value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + * + * @param topP the topP value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the responseFormat property: The response format of the tool calls used by this agent. + * + * @return the responseFormat value. + */ + @Generated + public BinaryData getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The response format of the tool calls used by this agent. + * + * @param responseFormat the responseFormat value to set. + * @return the UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setResponseFormat(BinaryData responseFormat) { + this.responseFormat = responseFormat; + 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 UpdateAgentOptions object itself. + */ + @Generated + public UpdateAgentOptions setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateCodeInterpreterToolResourceOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateCodeInterpreterToolResourceOptions.java new file mode 100644 index 000000000000..eb4abc35489d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateCodeInterpreterToolResourceOptions.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Request object to update `code_interpreted` tool resources. + */ +@Fluent +public final class UpdateCodeInterpreterToolResourceOptions + implements JsonSerializable { + + /* + * A list of file IDs to override the current list of the agent. + */ + @Generated + private List fileIds; + + /** + * Creates an instance of UpdateCodeInterpreterToolResourceOptions class. + */ + @Generated + public UpdateCodeInterpreterToolResourceOptions() { + } + + /** + * Get the fileIds property: A list of file IDs to override the current list of the agent. + * + * @return the fileIds value. + */ + @Generated + public List getFileIds() { + return this.fileIds; + } + + /** + * Set the fileIds property: A list of file IDs to override the current list of the agent. + * + * @param fileIds the fileIds value to set. + * @return the UpdateCodeInterpreterToolResourceOptions object itself. + */ + @Generated + public UpdateCodeInterpreterToolResourceOptions setFileIds(List fileIds) { + this.fileIds = fileIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("file_ids", this.fileIds, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateCodeInterpreterToolResourceOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateCodeInterpreterToolResourceOptions if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateCodeInterpreterToolResourceOptions. + */ + @Generated + public static UpdateCodeInterpreterToolResourceOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateCodeInterpreterToolResourceOptions deserializedUpdateCodeInterpreterToolResourceOptions + = new UpdateCodeInterpreterToolResourceOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("file_ids".equals(fieldName)) { + List fileIds = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateCodeInterpreterToolResourceOptions.fileIds = fileIds; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateCodeInterpreterToolResourceOptions; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateFileSearchToolResourceOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateFileSearchToolResourceOptions.java new file mode 100644 index 000000000000..c1c402ad2ff5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateFileSearchToolResourceOptions.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.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Request object to update `file_search` tool resources. + */ +@Fluent +public final class UpdateFileSearchToolResourceOptions + implements JsonSerializable { + + /* + * A list of vector store IDs to override the current list of the agent. + */ + @Generated + private List vectorStoreIds; + + /** + * Creates an instance of UpdateFileSearchToolResourceOptions class. + */ + @Generated + public UpdateFileSearchToolResourceOptions() { + } + + /** + * Get the vectorStoreIds property: A list of vector store IDs to override the current list of the agent. + * + * @return the vectorStoreIds value. + */ + @Generated + public List getVectorStoreIds() { + return this.vectorStoreIds; + } + + /** + * Set the vectorStoreIds property: A list of vector store IDs to override the current list of the agent. + * + * @param vectorStoreIds the vectorStoreIds value to set. + * @return the UpdateFileSearchToolResourceOptions object itself. + */ + @Generated + public UpdateFileSearchToolResourceOptions setVectorStoreIds(List vectorStoreIds) { + this.vectorStoreIds = vectorStoreIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("vector_store_ids", this.vectorStoreIds, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateFileSearchToolResourceOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateFileSearchToolResourceOptions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateFileSearchToolResourceOptions. + */ + @Generated + public static UpdateFileSearchToolResourceOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateFileSearchToolResourceOptions deserializedUpdateFileSearchToolResourceOptions + = new UpdateFileSearchToolResourceOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("vector_store_ids".equals(fieldName)) { + List vectorStoreIds = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateFileSearchToolResourceOptions.vectorStoreIds = vectorStoreIds; + } else { + reader.skipChildren(); + } + } + return deserializedUpdateFileSearchToolResourceOptions; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateToolResourcesOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateToolResourcesOptions.java new file mode 100644 index 000000000000..18a750ab1494 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UpdateToolResourcesOptions.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of + * tool. + * For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of + * vector store IDs. + */ +@Fluent +public final class UpdateToolResourcesOptions implements JsonSerializable { + + /* + * Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + @Generated + private UpdateCodeInterpreterToolResourceOptions codeInterpreter; + + /* + * Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the + * agent. + */ + @Generated + private UpdateFileSearchToolResourceOptions fileSearch; + + /* + * Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + */ + @Generated + private AzureAISearchResource azureAISearch; + + /** + * Creates an instance of UpdateToolResourcesOptions class. + */ + @Generated + public UpdateToolResourcesOptions() { + } + + /** + * Get the codeInterpreter property: Overrides the list of file IDs made available to the `code_interpreter` tool. + * There can be a maximum of 20 files + * associated with the tool. + * + * @return the codeInterpreter value. + */ + @Generated + public UpdateCodeInterpreterToolResourceOptions getCodeInterpreter() { + return this.codeInterpreter; + } + + /** + * Set the codeInterpreter property: Overrides the list of file IDs made available to the `code_interpreter` tool. + * There can be a maximum of 20 files + * associated with the tool. + * + * @param codeInterpreter the codeInterpreter value to set. + * @return the UpdateToolResourcesOptions object itself. + */ + @Generated + public UpdateToolResourcesOptions setCodeInterpreter(UpdateCodeInterpreterToolResourceOptions codeInterpreter) { + this.codeInterpreter = codeInterpreter; + return this; + } + + /** + * Get the fileSearch property: Overrides the vector store attached to this agent. There can be a maximum of 1 + * vector store attached to the agent. + * + * @return the fileSearch value. + */ + @Generated + public UpdateFileSearchToolResourceOptions getFileSearch() { + return this.fileSearch; + } + + /** + * Set the fileSearch property: Overrides the vector store attached to this agent. There can be a maximum of 1 + * vector store attached to the agent. + * + * @param fileSearch the fileSearch value to set. + * @return the UpdateToolResourcesOptions object itself. + */ + @Generated + public UpdateToolResourcesOptions setFileSearch(UpdateFileSearchToolResourceOptions fileSearch) { + this.fileSearch = fileSearch; + return this; + } + + /** + * Get the azureAISearch property: Overrides the resources to be used by the `azure_ai_search` tool consisting of + * index IDs and names. + * + * @return the azureAISearch value. + */ + @Generated + public AzureAISearchResource getAzureAISearch() { + return this.azureAISearch; + } + + /** + * Set the azureAISearch property: Overrides the resources to be used by the `azure_ai_search` tool consisting of + * index IDs and names. + * + * @param azureAISearch the azureAISearch value to set. + * @return the UpdateToolResourcesOptions object itself. + */ + @Generated + public UpdateToolResourcesOptions setAzureAISearch(AzureAISearchResource azureAISearch) { + this.azureAISearch = azureAISearch; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("code_interpreter", this.codeInterpreter); + jsonWriter.writeJsonField("file_search", this.fileSearch); + jsonWriter.writeJsonField("azure_ai_search", this.azureAISearch); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateToolResourcesOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateToolResourcesOptions if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateToolResourcesOptions. + */ + @Generated + public static UpdateToolResourcesOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateToolResourcesOptions deserializedUpdateToolResourcesOptions = new UpdateToolResourcesOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("code_interpreter".equals(fieldName)) { + deserializedUpdateToolResourcesOptions.codeInterpreter + = UpdateCodeInterpreterToolResourceOptions.fromJson(reader); + } else if ("file_search".equals(fieldName)) { + deserializedUpdateToolResourcesOptions.fileSearch + = UpdateFileSearchToolResourceOptions.fromJson(reader); + } else if ("azure_ai_search".equals(fieldName)) { + deserializedUpdateToolResourcesOptions.azureAISearch = AzureAISearchResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedUpdateToolResourcesOptions; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UploadFileRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UploadFileRequest.java new file mode 100644 index 000000000000..7e2b8dbf5c01 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/UploadFileRequest.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.projects.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The UploadFileRequest model. + */ +@Fluent +public final class UploadFileRequest { + + /* + * The file data, in bytes. + */ + @Generated + private final FileDetails file; + + /* + * The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents + * image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + */ + @Generated + private final FilePurpose purpose; + + /* + * The name of the file. + */ + @Generated + private String filename; + + /** + * Creates an instance of UploadFileRequest class. + * + * @param file the file value to set. + * @param purpose the purpose value to set. + */ + @Generated + public UploadFileRequest(FileDetails file, FilePurpose purpose) { + this.file = file; + this.purpose = purpose; + } + + /** + * Get the file property: The file data, in bytes. + * + * @return the file value. + */ + @Generated + public FileDetails getFile() { + return this.file; + } + + /** + * Get the purpose property: The intended purpose of the uploaded file. Use `assistants` for Agents and Message + * files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + * + * @return the purpose value. + */ + @Generated + public FilePurpose getPurpose() { + return this.purpose; + } + + /** + * Get the filename property: The name of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The name of the file. + * + * @param filename the filename value to set. + * @return the UploadFileRequest object itself. + */ + @Generated + public UploadFileRequest setFilename(String filename) { + this.filename = filename; + return this; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStore.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStore.java new file mode 100644 index 000000000000..1a67d5a281ea --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStore.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * A vector store is a collection of processed files can be used by the `file_search` tool. + */ +@Immutable +public final class VectorStore implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always `vector_store` + */ + @Generated + private final String object = "vector_store"; + + /* + * The Unix timestamp (in seconds) for when the vector store was created. + */ + @Generated + private final long createdAt; + + /* + * The name of the vector store. + */ + @Generated + private final String name; + + /* + * The total number of bytes used by the files in the vector store. + */ + @Generated + private final int usageBytes; + + /* + * Files count grouped by status processed or being processed by this vector store. + */ + @Generated + private final VectorStoreFileCount fileCounts; + + /* + * The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of + * `completed` indicates that the vector store is ready for use. + */ + @Generated + private final VectorStoreStatus status; + + /* + * Details on when this vector store expires + */ + @Generated + private VectorStoreExpirationPolicy expiresAfter; + + /* + * The Unix timestamp (in seconds) for when the vector store will expire. + */ + @Generated + private Long expiresAt; + + /* + * The Unix timestamp (in seconds) for when the vector store was last active. + */ + @Generated + private final Long lastActiveAt; + + /* + * 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 + private final Map metadata; + + /** + * Creates an instance of VectorStore class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param name the name value to set. + * @param usageBytes the usageBytes value to set. + * @param fileCounts the fileCounts value to set. + * @param status the status value to set. + * @param lastActiveAt the lastActiveAt value to set. + * @param metadata the metadata value to set. + */ + @Generated + private VectorStore(String id, OffsetDateTime createdAt, String name, int usageBytes, + VectorStoreFileCount fileCounts, VectorStoreStatus status, OffsetDateTime lastActiveAt, + Map metadata) { + this.id = id; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.name = name; + this.usageBytes = usageBytes; + this.fileCounts = fileCounts; + this.status = status; + if (lastActiveAt == null) { + this.lastActiveAt = null; + } else { + this.lastActiveAt = lastActiveAt.toEpochSecond(); + } + this.metadata = 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 `vector_store`. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp (in seconds) for when the vector store 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 vector store. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the usageBytes property: The total number of bytes used by the files in the vector store. + * + * @return the usageBytes value. + */ + @Generated + public int getUsageBytes() { + return this.usageBytes; + } + + /** + * Get the fileCounts property: Files count grouped by status processed or being processed by this vector store. + * + * @return the fileCounts value. + */ + @Generated + public VectorStoreFileCount getFileCounts() { + return this.fileCounts; + } + + /** + * Get the status property: The status of the vector store, which can be either `expired`, `in_progress`, or + * `completed`. A status of `completed` indicates that the vector store is ready for use. + * + * @return the status value. + */ + @Generated + public VectorStoreStatus getStatus() { + return this.status; + } + + /** + * Get the expiresAfter property: Details on when this vector store expires. + * + * @return the expiresAfter value. + */ + @Generated + public VectorStoreExpirationPolicy getExpiresAfter() { + return this.expiresAfter; + } + + /** + * Get the expiresAt property: The Unix timestamp (in seconds) for when the vector store will expire. + * + * @return the expiresAt value. + */ + @Generated + public OffsetDateTime getExpiresAt() { + if (this.expiresAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.expiresAt), ZoneOffset.UTC); + } + + /** + * Get the lastActiveAt property: The Unix timestamp (in seconds) for when the vector store was last active. + * + * @return the lastActiveAt value. + */ + @Generated + public OffsetDateTime getLastActiveAt() { + if (this.lastActiveAt == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.lastActiveAt), 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; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeIntField("usage_bytes", this.usageBytes); + jsonWriter.writeJsonField("file_counts", this.fileCounts); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeNumberField("last_active_at", this.lastActiveAt); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("expires_after", this.expiresAfter); + jsonWriter.writeNumberField("expires_at", this.expiresAt); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStore if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStore. + */ + @Generated + public static VectorStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdAt = null; + String name = null; + int usageBytes = 0; + VectorStoreFileCount fileCounts = null; + VectorStoreStatus status = null; + OffsetDateTime lastActiveAt = null; + Map metadata = null; + VectorStoreExpirationPolicy expiresAfter = null; + Long expiresAt = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("usage_bytes".equals(fieldName)) { + usageBytes = reader.getInt(); + } else if ("file_counts".equals(fieldName)) { + fileCounts = VectorStoreFileCount.fromJson(reader); + } else if ("status".equals(fieldName)) { + status = VectorStoreStatus.fromString(reader.getString()); + } else if ("last_active_at".equals(fieldName)) { + Long lastActiveAtHolder = reader.getNullable(JsonReader::getLong); + if (lastActiveAtHolder != null) { + lastActiveAt + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(lastActiveAtHolder), ZoneOffset.UTC); + } + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else if ("expires_after".equals(fieldName)) { + expiresAfter = VectorStoreExpirationPolicy.fromJson(reader); + } else if ("expires_at".equals(fieldName)) { + expiresAt = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + VectorStore deserializedVectorStore + = new VectorStore(id, createdAt, name, usageBytes, fileCounts, status, lastActiveAt, metadata); + deserializedVectorStore.expiresAfter = expiresAfter; + deserializedVectorStore.expiresAt = expiresAt; + return deserializedVectorStore; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyRequest.java new file mode 100644 index 000000000000..864d36457177 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyRequest.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400. + */ +@Immutable +public final class VectorStoreAutoChunkingStrategyRequest extends VectorStoreChunkingStrategyRequest { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyRequestType type = VectorStoreChunkingStrategyRequestType.AUTO; + + /** + * Creates an instance of VectorStoreAutoChunkingStrategyRequest class. + */ + @Generated + public VectorStoreAutoChunkingStrategyRequest() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public VectorStoreChunkingStrategyRequestType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreAutoChunkingStrategyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreAutoChunkingStrategyRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorStoreAutoChunkingStrategyRequest. + */ + @Generated + public static VectorStoreAutoChunkingStrategyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreAutoChunkingStrategyRequest deserializedVectorStoreAutoChunkingStrategyRequest + = new VectorStoreAutoChunkingStrategyRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedVectorStoreAutoChunkingStrategyRequest.type + = VectorStoreChunkingStrategyRequestType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedVectorStoreAutoChunkingStrategyRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyResponse.java new file mode 100644 index 000000000000..477598b29918 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreAutoChunkingStrategyResponse.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the + * chunking_strategy concept was introduced in the API. + */ +@Immutable +public final class VectorStoreAutoChunkingStrategyResponse extends VectorStoreChunkingStrategyResponse { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyResponseType type = VectorStoreChunkingStrategyResponseType.OTHER; + + /** + * Creates an instance of VectorStoreAutoChunkingStrategyResponse class. + */ + @Generated + private VectorStoreAutoChunkingStrategyResponse() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public VectorStoreChunkingStrategyResponseType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreAutoChunkingStrategyResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreAutoChunkingStrategyResponse if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorStoreAutoChunkingStrategyResponse. + */ + @Generated + public static VectorStoreAutoChunkingStrategyResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreAutoChunkingStrategyResponse deserializedVectorStoreAutoChunkingStrategyResponse + = new VectorStoreAutoChunkingStrategyResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedVectorStoreAutoChunkingStrategyResponse.type + = VectorStoreChunkingStrategyResponseType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedVectorStoreAutoChunkingStrategyResponse; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequest.java new file mode 100644 index 000000000000..36978632ba8e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequest.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a vector store chunking strategy configuration. + */ +@Immutable +public class VectorStoreChunkingStrategyRequest implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyRequestType type + = VectorStoreChunkingStrategyRequestType.fromString("VectorStoreChunkingStrategyRequest"); + + /** + * Creates an instance of VectorStoreChunkingStrategyRequest class. + */ + @Generated + public VectorStoreChunkingStrategyRequest() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public VectorStoreChunkingStrategyRequestType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreChunkingStrategyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreChunkingStrategyRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorStoreChunkingStrategyRequest. + */ + @Generated + public static VectorStoreChunkingStrategyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("auto".equals(discriminatorValue)) { + return VectorStoreAutoChunkingStrategyRequest.fromJson(readerToUse.reset()); + } else if ("static".equals(discriminatorValue)) { + return VectorStoreStaticChunkingStrategyRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorStoreChunkingStrategyRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreChunkingStrategyRequest deserializedVectorStoreChunkingStrategyRequest + = new VectorStoreChunkingStrategyRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedVectorStoreChunkingStrategyRequest.type + = VectorStoreChunkingStrategyRequestType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedVectorStoreChunkingStrategyRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequestType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequestType.java new file mode 100644 index 000000000000..a2bb7135fdec --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyRequestType.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of chunking strategy. + */ +public final class VectorStoreChunkingStrategyRequestType + extends ExpandableStringEnum { + + /** + * Static value auto for VectorStoreChunkingStrategyRequestType. + */ + @Generated + public static final VectorStoreChunkingStrategyRequestType AUTO = fromString("auto"); + + /** + * Static value static for VectorStoreChunkingStrategyRequestType. + */ + @Generated + public static final VectorStoreChunkingStrategyRequestType STATIC = fromString("static"); + + /** + * Creates a new instance of VectorStoreChunkingStrategyRequestType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreChunkingStrategyRequestType() { + } + + /** + * Creates or finds a VectorStoreChunkingStrategyRequestType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreChunkingStrategyRequestType. + */ + @Generated + public static VectorStoreChunkingStrategyRequestType fromString(String name) { + return fromString(name, VectorStoreChunkingStrategyRequestType.class); + } + + /** + * Gets known VectorStoreChunkingStrategyRequestType values. + * + * @return known VectorStoreChunkingStrategyRequestType values. + */ + @Generated + public static Collection values() { + return values(VectorStoreChunkingStrategyRequestType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponse.java new file mode 100644 index 000000000000..ef6a294c9b0d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponse.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of a vector store chunking strategy configuration. + */ +@Immutable +public class VectorStoreChunkingStrategyResponse implements JsonSerializable { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyResponseType type + = VectorStoreChunkingStrategyResponseType.fromString("VectorStoreChunkingStrategyResponse"); + + /** + * Creates an instance of VectorStoreChunkingStrategyResponse class. + */ + @Generated + protected VectorStoreChunkingStrategyResponse() { + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + public VectorStoreChunkingStrategyResponseType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreChunkingStrategyResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreChunkingStrategyResponse if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorStoreChunkingStrategyResponse. + */ + @Generated + public static VectorStoreChunkingStrategyResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + // Prepare for reading + readerToUse.nextToken(); + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("other".equals(discriminatorValue)) { + return VectorStoreAutoChunkingStrategyResponse.fromJson(readerToUse.reset()); + } else if ("static".equals(discriminatorValue)) { + return VectorStoreStaticChunkingStrategyResponse.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorStoreChunkingStrategyResponse fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreChunkingStrategyResponse deserializedVectorStoreChunkingStrategyResponse + = new VectorStoreChunkingStrategyResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedVectorStoreChunkingStrategyResponse.type + = VectorStoreChunkingStrategyResponseType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedVectorStoreChunkingStrategyResponse; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponseType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponseType.java new file mode 100644 index 000000000000..260177d8f126 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreChunkingStrategyResponseType.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of chunking strategy. + */ +public final class VectorStoreChunkingStrategyResponseType + extends ExpandableStringEnum { + + /** + * Static value other for VectorStoreChunkingStrategyResponseType. + */ + @Generated + public static final VectorStoreChunkingStrategyResponseType OTHER = fromString("other"); + + /** + * Static value static for VectorStoreChunkingStrategyResponseType. + */ + @Generated + public static final VectorStoreChunkingStrategyResponseType STATIC = fromString("static"); + + /** + * Creates a new instance of VectorStoreChunkingStrategyResponseType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreChunkingStrategyResponseType() { + } + + /** + * Creates or finds a VectorStoreChunkingStrategyResponseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreChunkingStrategyResponseType. + */ + @Generated + public static VectorStoreChunkingStrategyResponseType fromString(String name) { + return fromString(name, VectorStoreChunkingStrategyResponseType.class); + } + + /** + * Gets known VectorStoreChunkingStrategyResponseType values. + * + * @return known VectorStoreChunkingStrategyResponseType values. + */ + @Generated + public static Collection values() { + return values(VectorStoreChunkingStrategyResponseType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfiguration.java new file mode 100644 index 000000000000..910612a8c884 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfiguration.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Vector storage configuration is the list of data sources, used when multiple + * files can be used for the enterprise file search. + */ +@Immutable +public final class VectorStoreConfiguration implements JsonSerializable { + + /* + * Data sources + */ + @Generated + private final List dataSources; + + /** + * Creates an instance of VectorStoreConfiguration class. + * + * @param dataSources the dataSources value to set. + */ + @Generated + public VectorStoreConfiguration(List dataSources) { + this.dataSources = dataSources; + } + + /** + * Get the dataSources property: Data sources. + * + * @return the dataSources value. + */ + @Generated + public List getDataSources() { + return this.dataSources; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("data_sources", this.dataSources, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreConfiguration if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreConfiguration. + */ + @Generated + public static VectorStoreConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List dataSources = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("data_sources".equals(fieldName)) { + dataSources = reader.readArray(reader1 -> VectorStoreDataSource.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new VectorStoreConfiguration(dataSources); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfigurations.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfigurations.java new file mode 100644 index 000000000000..3ce154cc1da7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreConfigurations.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. + */ +@Immutable +public final class VectorStoreConfigurations implements JsonSerializable { + + /* + * Name + */ + @Generated + private final String storeName; + + /* + * Configurations + */ + @Generated + private final VectorStoreConfiguration storeConfiguration; + + /** + * Creates an instance of VectorStoreConfigurations class. + * + * @param storeName the storeName value to set. + * @param storeConfiguration the storeConfiguration value to set. + */ + @Generated + public VectorStoreConfigurations(String storeName, VectorStoreConfiguration storeConfiguration) { + this.storeName = storeName; + this.storeConfiguration = storeConfiguration; + } + + /** + * Get the storeName property: Name. + * + * @return the storeName value. + */ + @Generated + public String getStoreName() { + return this.storeName; + } + + /** + * Get the storeConfiguration property: Configurations. + * + * @return the storeConfiguration value. + */ + @Generated + public VectorStoreConfiguration getStoreConfiguration() { + return this.storeConfiguration; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.storeName); + jsonWriter.writeJsonField("configuration", this.storeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreConfigurations from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreConfigurations if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreConfigurations. + */ + @Generated + public static VectorStoreConfigurations fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String storeName = null; + VectorStoreConfiguration storeConfiguration = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + storeName = reader.getString(); + } else if ("configuration".equals(fieldName)) { + storeConfiguration = VectorStoreConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new VectorStoreConfigurations(storeName, storeConfiguration); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSource.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSource.java new file mode 100644 index 000000000000..3bcc38847282 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSource.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The structure, containing Azure asset URI path and the asset type of the file used as a data source + * for the enterprise file search. + */ +@Immutable +public final class VectorStoreDataSource implements JsonSerializable { + + /* + * Asset URI. + */ + @Generated + private final String assetIdentifier; + + /* + * The asset type + */ + @Generated + private final VectorStoreDataSourceAssetType assetType; + + /** + * Creates an instance of VectorStoreDataSource class. + * + * @param assetIdentifier the assetIdentifier value to set. + * @param assetType the assetType value to set. + */ + @Generated + public VectorStoreDataSource(String assetIdentifier, VectorStoreDataSourceAssetType assetType) { + this.assetIdentifier = assetIdentifier; + this.assetType = assetType; + } + + /** + * Get the assetIdentifier property: Asset URI. + * + * @return the assetIdentifier value. + */ + @Generated + public String getAssetIdentifier() { + return this.assetIdentifier; + } + + /** + * Get the assetType property: The asset type. + * + * @return the assetType value. + */ + @Generated + public VectorStoreDataSourceAssetType getAssetType() { + return this.assetType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uri", this.assetIdentifier); + jsonWriter.writeStringField("type", this.assetType == null ? null : this.assetType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreDataSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreDataSource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreDataSource. + */ + @Generated + public static VectorStoreDataSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String assetIdentifier = null; + VectorStoreDataSourceAssetType assetType = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("uri".equals(fieldName)) { + assetIdentifier = reader.getString(); + } else if ("type".equals(fieldName)) { + assetType = VectorStoreDataSourceAssetType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new VectorStoreDataSource(assetIdentifier, assetType); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSourceAssetType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSourceAssetType.java new file mode 100644 index 000000000000..7081f5444285 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDataSourceAssetType.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of vector storage asset. Asset type may be a uri_asset, in this case it should contain asset URI ID, + * in the case of id_asset it should contain the data ID. + */ +public final class VectorStoreDataSourceAssetType extends ExpandableStringEnum { + + /** + * Azure URI. + */ + @Generated + public static final VectorStoreDataSourceAssetType URI_ASSET = fromString("uri_asset"); + + /** + * The data ID. + */ + @Generated + public static final VectorStoreDataSourceAssetType ID_ASSET = fromString("id_asset"); + + /** + * Creates a new instance of VectorStoreDataSourceAssetType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreDataSourceAssetType() { + } + + /** + * Creates or finds a VectorStoreDataSourceAssetType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreDataSourceAssetType. + */ + @Generated + public static VectorStoreDataSourceAssetType fromString(String name) { + return fromString(name, VectorStoreDataSourceAssetType.class); + } + + /** + * Gets known VectorStoreDataSourceAssetType values. + * + * @return known VectorStoreDataSourceAssetType values. + */ + @Generated + public static Collection values() { + return values(VectorStoreDataSourceAssetType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDeletionStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDeletionStatus.java new file mode 100644 index 000000000000..27be826f922b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreDeletionStatus.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response object for deleting a vector store. + */ +@Immutable +public final class VectorStoreDeletionStatus implements JsonSerializable { + + /* + * The ID of the resource specified for deletion. + */ + @Generated + private final String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + private final boolean deleted; + + /* + * The object type, which is always 'vector_store.deleted'. + */ + @Generated + private final String object = "vector_store.deleted"; + + /** + * Creates an instance of VectorStoreDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + private VectorStoreDeletionStatus(String id, 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 'vector_store.deleted'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("deleted", this.deleted); + jsonWriter.writeStringField("object", this.object); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreDeletionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreDeletionStatus if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreDeletionStatus. + */ + @Generated + public static VectorStoreDeletionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean deleted = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("deleted".equals(fieldName)) { + deleted = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreDeletionStatus(id, deleted); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicy.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicy.java new file mode 100644 index 000000000000..1660d8b8affa --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicy.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The expiration policy for a vector store. + */ +@Immutable +public final class VectorStoreExpirationPolicy implements JsonSerializable { + + /* + * Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. + */ + @Generated + private final VectorStoreExpirationPolicyAnchor anchor; + + /* + * The anchor timestamp after which the expiration policy applies. + */ + @Generated + private final int days; + + /** + * Creates an instance of VectorStoreExpirationPolicy class. + * + * @param anchor the anchor value to set. + * @param days the days value to set. + */ + @Generated + public VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor anchor, int days) { + this.anchor = anchor; + this.days = days; + } + + /** + * Get the anchor property: Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + * + * @return the anchor value. + */ + @Generated + public VectorStoreExpirationPolicyAnchor getAnchor() { + return this.anchor; + } + + /** + * Get the days property: The anchor timestamp after which the expiration policy applies. + * + * @return the days value. + */ + @Generated + public int getDays() { + return this.days; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("anchor", this.anchor == null ? null : this.anchor.toString()); + jsonWriter.writeIntField("days", this.days); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreExpirationPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreExpirationPolicy if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreExpirationPolicy. + */ + @Generated + public static VectorStoreExpirationPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreExpirationPolicyAnchor anchor = null; + int days = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("anchor".equals(fieldName)) { + anchor = VectorStoreExpirationPolicyAnchor.fromString(reader.getString()); + } else if ("days".equals(fieldName)) { + days = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreExpirationPolicy(anchor, days); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicyAnchor.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicyAnchor.java new file mode 100644 index 000000000000..ebdccc9dca53 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreExpirationPolicyAnchor.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the relationship between the days and the expiration of this vector store. + */ +public final class VectorStoreExpirationPolicyAnchor extends ExpandableStringEnum { + + /** + * The expiration policy is based on the last time the vector store was active. + */ + @Generated + public static final VectorStoreExpirationPolicyAnchor LAST_ACTIVE_AT = fromString("last_active_at"); + + /** + * Creates a new instance of VectorStoreExpirationPolicyAnchor value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreExpirationPolicyAnchor() { + } + + /** + * Creates or finds a VectorStoreExpirationPolicyAnchor from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreExpirationPolicyAnchor. + */ + @Generated + public static VectorStoreExpirationPolicyAnchor fromString(String name) { + return fromString(name, VectorStoreExpirationPolicyAnchor.class); + } + + /** + * Gets known VectorStoreExpirationPolicyAnchor values. + * + * @return known VectorStoreExpirationPolicyAnchor values. + */ + @Generated + public static Collection values() { + return values(VectorStoreExpirationPolicyAnchor.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFile.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFile.java new file mode 100644 index 000000000000..8659274f7f1a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFile.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Description of a file attached to a vector store. + */ +@Immutable +public final class VectorStoreFile implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always `vector_store.file`. + */ + @Generated + private final String object = "vector_store.file"; + + /* + * The total vector store usage in bytes. Note that this may be different from the original file + * size. + */ + @Generated + private final int usageBytes; + + /* + * The Unix timestamp (in seconds) for when the vector store file was created. + */ + @Generated + private final long createdAt; + + /* + * The ID of the vector store that the file is attached to. + */ + @Generated + private final String vectorStoreId; + + /* + * The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. + * The status `completed` indicates that the vector store file is ready for use. + */ + @Generated + private final VectorStoreFileStatus status; + + /* + * The last error associated with this vector store file. Will be `null` if there are no errors. + */ + @Generated + private final VectorStoreFileError lastError; + + /* + * The strategy used to chunk the file. + */ + @Generated + private final VectorStoreChunkingStrategyResponse chunkingStrategy; + + /** + * Creates an instance of VectorStoreFile class. + * + * @param id the id value to set. + * @param usageBytes the usageBytes value to set. + * @param createdAt the createdAt value to set. + * @param vectorStoreId the vectorStoreId value to set. + * @param status the status value to set. + * @param lastError the lastError value to set. + * @param chunkingStrategy the chunkingStrategy value to set. + */ + @Generated + private VectorStoreFile(String id, int usageBytes, OffsetDateTime createdAt, String vectorStoreId, + VectorStoreFileStatus status, VectorStoreFileError lastError, + VectorStoreChunkingStrategyResponse chunkingStrategy) { + this.id = id; + this.usageBytes = usageBytes; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.vectorStoreId = vectorStoreId; + this.status = status; + this.lastError = lastError; + this.chunkingStrategy = chunkingStrategy; + } + + /** + * 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 `vector_store.file`. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the usageBytes property: The total vector store usage in bytes. Note that this may be different from the + * original file + * size. + * + * @return the usageBytes value. + */ + @Generated + public int getUsageBytes() { + return this.usageBytes; + } + + /** + * Get the createdAt property: The Unix timestamp (in seconds) for when the vector store file was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the vectorStoreId property: The ID of the vector store that the file is attached to. + * + * @return the vectorStoreId value. + */ + @Generated + public String getVectorStoreId() { + return this.vectorStoreId; + } + + /** + * Get the status property: The status of the vector store file, which can be either `in_progress`, `completed`, + * `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + * + * @return the status value. + */ + @Generated + public VectorStoreFileStatus getStatus() { + return this.status; + } + + /** + * Get the lastError property: The last error associated with this vector store file. Will be `null` if there are no + * errors. + * + * @return the lastError value. + */ + @Generated + public VectorStoreFileError getLastError() { + return this.lastError; + } + + /** + * Get the chunkingStrategy property: The strategy used to chunk the file. + * + * @return the chunkingStrategy value. + */ + @Generated + public VectorStoreChunkingStrategyResponse getChunkingStrategy() { + return this.chunkingStrategy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeIntField("usage_bytes", this.usageBytes); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("vector_store_id", this.vectorStoreId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("last_error", this.lastError); + jsonWriter.writeJsonField("chunking_strategy", this.chunkingStrategy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreFile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreFile if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreFile. + */ + @Generated + public static VectorStoreFile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + int usageBytes = 0; + OffsetDateTime createdAt = null; + String vectorStoreId = null; + VectorStoreFileStatus status = null; + VectorStoreFileError lastError = null; + VectorStoreChunkingStrategyResponse chunkingStrategy = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("usage_bytes".equals(fieldName)) { + usageBytes = reader.getInt(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("vector_store_id".equals(fieldName)) { + vectorStoreId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = VectorStoreFileStatus.fromString(reader.getString()); + } else if ("last_error".equals(fieldName)) { + lastError = VectorStoreFileError.fromJson(reader); + } else if ("chunking_strategy".equals(fieldName)) { + chunkingStrategy = VectorStoreChunkingStrategyResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new VectorStoreFile(id, usageBytes, createdAt, vectorStoreId, status, lastError, chunkingStrategy); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatch.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatch.java new file mode 100644 index 000000000000..38486f4b2e47 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatch.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * A batch of files attached to a vector store. + */ +@Immutable +public final class VectorStoreFileBatch implements JsonSerializable { + + /* + * The identifier, which can be referenced in API endpoints. + */ + @Generated + private final String id; + + /* + * The object type, which is always `vector_store.file_batch`. + */ + @Generated + private final String object = "vector_store.files_batch"; + + /* + * The Unix timestamp (in seconds) for when the vector store files batch was created. + */ + @Generated + private final long createdAt; + + /* + * The ID of the vector store that the file is attached to. + */ + @Generated + private final String vectorStoreId; + + /* + * The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or + * `failed`. + */ + @Generated + private final VectorStoreFileBatchStatus status; + + /* + * Files count grouped by status processed or being processed by this vector store. + */ + @Generated + private final VectorStoreFileCount fileCounts; + + /** + * Creates an instance of VectorStoreFileBatch class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param vectorStoreId the vectorStoreId value to set. + * @param status the status value to set. + * @param fileCounts the fileCounts value to set. + */ + @Generated + private VectorStoreFileBatch(String id, OffsetDateTime createdAt, String vectorStoreId, + VectorStoreFileBatchStatus status, VectorStoreFileCount fileCounts) { + this.id = id; + if (createdAt == null) { + this.createdAt = 0L; + } else { + this.createdAt = createdAt.toEpochSecond(); + } + this.vectorStoreId = vectorStoreId; + this.status = status; + this.fileCounts = fileCounts; + } + + /** + * 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 `vector_store.file_batch`. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * Get the createdAt property: The Unix timestamp (in seconds) for when the vector store files batch was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the vectorStoreId property: The ID of the vector store that the file is attached to. + * + * @return the vectorStoreId value. + */ + @Generated + public String getVectorStoreId() { + return this.vectorStoreId; + } + + /** + * Get the status property: The status of the vector store files batch, which can be either `in_progress`, + * `completed`, `cancelled` or `failed`. + * + * @return the status value. + */ + @Generated + public VectorStoreFileBatchStatus getStatus() { + return this.status; + } + + /** + * Get the fileCounts property: Files count grouped by status processed or being processed by this vector store. + * + * @return the fileCounts value. + */ + @Generated + public VectorStoreFileCount getFileCounts() { + return this.fileCounts; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("object", this.object); + jsonWriter.writeLongField("created_at", this.createdAt); + jsonWriter.writeStringField("vector_store_id", this.vectorStoreId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("file_counts", this.fileCounts); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreFileBatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreFileBatch if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreFileBatch. + */ + @Generated + public static VectorStoreFileBatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdAt = null; + String vectorStoreId = null; + VectorStoreFileBatchStatus status = null; + VectorStoreFileCount fileCounts = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else if ("vector_store_id".equals(fieldName)) { + vectorStoreId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = VectorStoreFileBatchStatus.fromString(reader.getString()); + } else if ("file_counts".equals(fieldName)) { + fileCounts = VectorStoreFileCount.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new VectorStoreFileBatch(id, createdAt, vectorStoreId, status, fileCounts); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatchStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatchStatus.java new file mode 100644 index 000000000000..e4f8f63001cf --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileBatchStatus.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the vector store file batch. + */ +public final class VectorStoreFileBatchStatus extends ExpandableStringEnum { + + /** + * The vector store is still processing this file batch. + */ + @Generated + public static final VectorStoreFileBatchStatus IN_PROGRESS = fromString("in_progress"); + + /** + * the vector store file batch is ready for use. + */ + @Generated + public static final VectorStoreFileBatchStatus COMPLETED = fromString("completed"); + + /** + * The vector store file batch was cancelled. + */ + @Generated + public static final VectorStoreFileBatchStatus CANCELLED = fromString("cancelled"); + + /** + * The vector store file batch failed to process. + */ + @Generated + public static final VectorStoreFileBatchStatus FAILED = fromString("failed"); + + /** + * Creates a new instance of VectorStoreFileBatchStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreFileBatchStatus() { + } + + /** + * Creates or finds a VectorStoreFileBatchStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreFileBatchStatus. + */ + @Generated + public static VectorStoreFileBatchStatus fromString(String name) { + return fromString(name, VectorStoreFileBatchStatus.class); + } + + /** + * Gets known VectorStoreFileBatchStatus values. + * + * @return known VectorStoreFileBatchStatus values. + */ + @Generated + public static Collection values() { + return values(VectorStoreFileBatchStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileCount.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileCount.java new file mode 100644 index 000000000000..ed2faf482133 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileCount.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Counts of files processed or being processed by this vector store grouped by status. + */ +@Immutable +public final class VectorStoreFileCount implements JsonSerializable { + + /* + * The number of files that are currently being processed. + */ + @Generated + private final int inProgress; + + /* + * The number of files that have been successfully processed. + */ + @Generated + private final int completed; + + /* + * The number of files that have failed to process. + */ + @Generated + private final int failed; + + /* + * The number of files that were cancelled. + */ + @Generated + private final int cancelled; + + /* + * The total number of files. + */ + @Generated + private final int total; + + /** + * Creates an instance of VectorStoreFileCount class. + * + * @param inProgress the inProgress value to set. + * @param completed the completed value to set. + * @param failed the failed value to set. + * @param cancelled the cancelled value to set. + * @param total the total value to set. + */ + @Generated + private VectorStoreFileCount(int inProgress, int completed, int failed, int cancelled, int total) { + this.inProgress = inProgress; + this.completed = completed; + this.failed = failed; + this.cancelled = cancelled; + this.total = total; + } + + /** + * Get the inProgress property: The number of files that are currently being processed. + * + * @return the inProgress value. + */ + @Generated + public int getInProgress() { + return this.inProgress; + } + + /** + * Get the completed property: The number of files that have been successfully processed. + * + * @return the completed value. + */ + @Generated + public int getCompleted() { + return this.completed; + } + + /** + * Get the failed property: The number of files that have failed to process. + * + * @return the failed value. + */ + @Generated + public int getFailed() { + return this.failed; + } + + /** + * Get the cancelled property: The number of files that were cancelled. + * + * @return the cancelled value. + */ + @Generated + public int getCancelled() { + return this.cancelled; + } + + /** + * Get the total property: The total number of files. + * + * @return the total value. + */ + @Generated + public int getTotal() { + return this.total; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("in_progress", this.inProgress); + jsonWriter.writeIntField("completed", this.completed); + jsonWriter.writeIntField("failed", this.failed); + jsonWriter.writeIntField("cancelled", this.cancelled); + jsonWriter.writeIntField("total", this.total); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreFileCount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreFileCount if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreFileCount. + */ + @Generated + public static VectorStoreFileCount fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int inProgress = 0; + int completed = 0; + int failed = 0; + int cancelled = 0; + int total = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("in_progress".equals(fieldName)) { + inProgress = reader.getInt(); + } else if ("completed".equals(fieldName)) { + completed = reader.getInt(); + } else if ("failed".equals(fieldName)) { + failed = reader.getInt(); + } else if ("cancelled".equals(fieldName)) { + cancelled = reader.getInt(); + } else if ("total".equals(fieldName)) { + total = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreFileCount(inProgress, completed, failed, cancelled, total); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileDeletionStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileDeletionStatus.java new file mode 100644 index 000000000000..47574374f5d7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileDeletionStatus.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response object for deleting a vector store file relationship. + */ +@Immutable +public final class VectorStoreFileDeletionStatus implements JsonSerializable { + + /* + * The ID of the resource specified for deletion. + */ + @Generated + private final String id; + + /* + * A value indicating whether deletion was successful. + */ + @Generated + private final boolean deleted; + + /* + * The object type, which is always 'vector_store.deleted'. + */ + @Generated + private final String object = "vector_store.file.deleted"; + + /** + * Creates an instance of VectorStoreFileDeletionStatus class. + * + * @param id the id value to set. + * @param deleted the deleted value to set. + */ + @Generated + private VectorStoreFileDeletionStatus(String id, 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 'vector_store.deleted'. + * + * @return the object value. + */ + @Generated + public String getObject() { + return this.object; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("deleted", this.deleted); + jsonWriter.writeStringField("object", this.object); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreFileDeletionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreFileDeletionStatus if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreFileDeletionStatus. + */ + @Generated + public static VectorStoreFileDeletionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean deleted = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("deleted".equals(fieldName)) { + deleted = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreFileDeletionStatus(id, deleted); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileError.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileError.java new file mode 100644 index 000000000000..605afd030784 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileError.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details on the error that may have occurred while processing a file for this vector store. + */ +@Immutable +public final class VectorStoreFileError implements JsonSerializable { + + /* + * One of `server_error` or `rate_limit_exceeded`. + */ + @Generated + private final VectorStoreFileErrorCode code; + + /* + * A human-readable description of the error. + */ + @Generated + private final String message; + + /** + * Creates an instance of VectorStoreFileError class. + * + * @param code the code value to set. + * @param message the message value to set. + */ + @Generated + private VectorStoreFileError(VectorStoreFileErrorCode code, String message) { + this.code = code; + this.message = message; + } + + /** + * Get the code property: One of `server_error` or `rate_limit_exceeded`. + * + * @return the code value. + */ + @Generated + public VectorStoreFileErrorCode getCode() { + return this.code; + } + + /** + * Get the message property: A human-readable description of the error. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreFileError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreFileError if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreFileError. + */ + @Generated + public static VectorStoreFileError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreFileErrorCode code = null; + String message = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("code".equals(fieldName)) { + code = VectorStoreFileErrorCode.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + message = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreFileError(code, message); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileErrorCode.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileErrorCode.java new file mode 100644 index 000000000000..23fdbaca135c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileErrorCode.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Error code variants for vector store file processing. + */ +public final class VectorStoreFileErrorCode extends ExpandableStringEnum { + + /** + * An server error occurred. + */ + @Generated + public static final VectorStoreFileErrorCode SERVER_ERROR = fromString("server_error"); + + /** + * The file is not valid. + */ + @Generated + public static final VectorStoreFileErrorCode INVALID_FILE = fromString("invalid_file"); + + /** + * The file is of unsupported type. + */ + @Generated + public static final VectorStoreFileErrorCode UNSUPPORTED_FILE = fromString("unsupported_file"); + + /** + * Creates a new instance of VectorStoreFileErrorCode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreFileErrorCode() { + } + + /** + * Creates or finds a VectorStoreFileErrorCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreFileErrorCode. + */ + @Generated + public static VectorStoreFileErrorCode fromString(String name) { + return fromString(name, VectorStoreFileErrorCode.class); + } + + /** + * Gets known VectorStoreFileErrorCode values. + * + * @return known VectorStoreFileErrorCode values. + */ + @Generated + public static Collection values() { + return values(VectorStoreFileErrorCode.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatus.java new file mode 100644 index 000000000000..078c40f95681 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatus.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Vector store file status. + */ +public final class VectorStoreFileStatus extends ExpandableStringEnum { + + /** + * The file is currently being processed. + */ + @Generated + public static final VectorStoreFileStatus IN_PROGRESS = fromString("in_progress"); + + /** + * The file has been successfully processed. + */ + @Generated + public static final VectorStoreFileStatus COMPLETED = fromString("completed"); + + /** + * The file has failed to process. + */ + @Generated + public static final VectorStoreFileStatus FAILED = fromString("failed"); + + /** + * The file was cancelled. + */ + @Generated + public static final VectorStoreFileStatus CANCELLED = fromString("cancelled"); + + /** + * Creates a new instance of VectorStoreFileStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreFileStatus() { + } + + /** + * Creates or finds a VectorStoreFileStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreFileStatus. + */ + @Generated + public static VectorStoreFileStatus fromString(String name) { + return fromString(name, VectorStoreFileStatus.class); + } + + /** + * Gets known VectorStoreFileStatus values. + * + * @return known VectorStoreFileStatus values. + */ + @Generated + public static Collection values() { + return values(VectorStoreFileStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatusFilter.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatusFilter.java new file mode 100644 index 000000000000..4a68e1ccf28f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreFileStatusFilter.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Query parameter filter for vector store file retrieval endpoint. + */ +public final class VectorStoreFileStatusFilter extends ExpandableStringEnum { + + /** + * Retrieve only files that are currently being processed. + */ + @Generated + public static final VectorStoreFileStatusFilter IN_PROGRESS = fromString("in_progress"); + + /** + * Retrieve only files that have been successfully processed. + */ + @Generated + public static final VectorStoreFileStatusFilter COMPLETED = fromString("completed"); + + /** + * Retrieve only files that have failed to process. + */ + @Generated + public static final VectorStoreFileStatusFilter FAILED = fromString("failed"); + + /** + * Retrieve only files that were cancelled. + */ + @Generated + public static final VectorStoreFileStatusFilter CANCELLED = fromString("cancelled"); + + /** + * Creates a new instance of VectorStoreFileStatusFilter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreFileStatusFilter() { + } + + /** + * Creates or finds a VectorStoreFileStatusFilter from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreFileStatusFilter. + */ + @Generated + public static VectorStoreFileStatusFilter fromString(String name) { + return fromString(name, VectorStoreFileStatusFilter.class); + } + + /** + * Gets known VectorStoreFileStatusFilter values. + * + * @return known VectorStoreFileStatusFilter values. + */ + @Generated + public static Collection values() { + return values(VectorStoreFileStatusFilter.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyOptions.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyOptions.java new file mode 100644 index 000000000000..14ce7ceb757b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyOptions.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Options to configure a vector store static chunking strategy. + */ +@Immutable +public final class VectorStoreStaticChunkingStrategyOptions + implements JsonSerializable { + + /* + * The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum + * value is 4096. + */ + @Generated + private final int maxChunkSizeTokens; + + /* + * The number of tokens that overlap between chunks. The default value is 400. + * Note that the overlap must not exceed half of max_chunk_size_tokens. + */ + @Generated + private final int chunkOverlapTokens; + + /** + * Creates an instance of VectorStoreStaticChunkingStrategyOptions class. + * + * @param maxChunkSizeTokens the maxChunkSizeTokens value to set. + * @param chunkOverlapTokens the chunkOverlapTokens value to set. + */ + @Generated + public VectorStoreStaticChunkingStrategyOptions(int maxChunkSizeTokens, int chunkOverlapTokens) { + this.maxChunkSizeTokens = maxChunkSizeTokens; + this.chunkOverlapTokens = chunkOverlapTokens; + } + + /** + * Get the maxChunkSizeTokens property: The maximum number of tokens in each chunk. The default value is 800. The + * minimum value is 100 and the maximum value is 4096. + * + * @return the maxChunkSizeTokens value. + */ + @Generated + public int getMaxChunkSizeTokens() { + return this.maxChunkSizeTokens; + } + + /** + * Get the chunkOverlapTokens property: The number of tokens that overlap between chunks. The default value is 400. + * Note that the overlap must not exceed half of max_chunk_size_tokens. + * + * @return the chunkOverlapTokens value. + */ + @Generated + public int getChunkOverlapTokens() { + return this.chunkOverlapTokens; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("max_chunk_size_tokens", this.maxChunkSizeTokens); + jsonWriter.writeIntField("chunk_overlap_tokens", this.chunkOverlapTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreStaticChunkingStrategyOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreStaticChunkingStrategyOptions if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreStaticChunkingStrategyOptions. + */ + @Generated + public static VectorStoreStaticChunkingStrategyOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int maxChunkSizeTokens = 0; + int chunkOverlapTokens = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("max_chunk_size_tokens".equals(fieldName)) { + maxChunkSizeTokens = reader.getInt(); + } else if ("chunk_overlap_tokens".equals(fieldName)) { + chunkOverlapTokens = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new VectorStoreStaticChunkingStrategyOptions(maxChunkSizeTokens, chunkOverlapTokens); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyRequest.java new file mode 100644 index 000000000000..bf582e467568 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyRequest.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A statically configured chunking strategy. + */ +@Immutable +public final class VectorStoreStaticChunkingStrategyRequest extends VectorStoreChunkingStrategyRequest { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyRequestType type = VectorStoreChunkingStrategyRequestType.STATIC; + + /* + * The options for the static chunking strategy. + */ + @Generated + private final VectorStoreStaticChunkingStrategyOptions staticProperty; + + /** + * Creates an instance of VectorStoreStaticChunkingStrategyRequest class. + * + * @param staticProperty the staticProperty value to set. + */ + @Generated + public VectorStoreStaticChunkingStrategyRequest(VectorStoreStaticChunkingStrategyOptions staticProperty) { + this.staticProperty = staticProperty; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public VectorStoreChunkingStrategyRequestType getType() { + return this.type; + } + + /** + * Get the staticProperty property: The options for the static chunking strategy. + * + * @return the staticProperty value. + */ + @Generated + public VectorStoreStaticChunkingStrategyOptions getStaticProperty() { + return this.staticProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("static", this.staticProperty); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreStaticChunkingStrategyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreStaticChunkingStrategyRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreStaticChunkingStrategyRequest. + */ + @Generated + public static VectorStoreStaticChunkingStrategyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreStaticChunkingStrategyOptions staticProperty = null; + VectorStoreChunkingStrategyRequestType type = VectorStoreChunkingStrategyRequestType.STATIC; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("static".equals(fieldName)) { + staticProperty = VectorStoreStaticChunkingStrategyOptions.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = VectorStoreChunkingStrategyRequestType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + VectorStoreStaticChunkingStrategyRequest deserializedVectorStoreStaticChunkingStrategyRequest + = new VectorStoreStaticChunkingStrategyRequest(staticProperty); + deserializedVectorStoreStaticChunkingStrategyRequest.type = type; + return deserializedVectorStoreStaticChunkingStrategyRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyResponse.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyResponse.java new file mode 100644 index 000000000000..a2b9ec67055e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStaticChunkingStrategyResponse.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A statically configured chunking strategy. + */ +@Immutable +public final class VectorStoreStaticChunkingStrategyResponse extends VectorStoreChunkingStrategyResponse { + + /* + * The object type. + */ + @Generated + private VectorStoreChunkingStrategyResponseType type = VectorStoreChunkingStrategyResponseType.STATIC; + + /* + * The options for the static chunking strategy. + */ + @Generated + private final VectorStoreStaticChunkingStrategyOptions staticProperty; + + /** + * Creates an instance of VectorStoreStaticChunkingStrategyResponse class. + * + * @param staticProperty the staticProperty value to set. + */ + @Generated + private VectorStoreStaticChunkingStrategyResponse(VectorStoreStaticChunkingStrategyOptions staticProperty) { + this.staticProperty = staticProperty; + } + + /** + * Get the type property: The object type. + * + * @return the type value. + */ + @Generated + @Override + public VectorStoreChunkingStrategyResponseType getType() { + return this.type; + } + + /** + * Get the staticProperty property: The options for the static chunking strategy. + * + * @return the staticProperty value. + */ + @Generated + public VectorStoreStaticChunkingStrategyOptions getStaticProperty() { + return this.staticProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("static", this.staticProperty); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorStoreStaticChunkingStrategyResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorStoreStaticChunkingStrategyResponse if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorStoreStaticChunkingStrategyResponse. + */ + @Generated + public static VectorStoreStaticChunkingStrategyResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorStoreStaticChunkingStrategyOptions staticProperty = null; + VectorStoreChunkingStrategyResponseType type = VectorStoreChunkingStrategyResponseType.STATIC; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("static".equals(fieldName)) { + staticProperty = VectorStoreStaticChunkingStrategyOptions.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = VectorStoreChunkingStrategyResponseType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + VectorStoreStaticChunkingStrategyResponse deserializedVectorStoreStaticChunkingStrategyResponse + = new VectorStoreStaticChunkingStrategyResponse(staticProperty); + deserializedVectorStoreStaticChunkingStrategyResponse.type = type; + return deserializedVectorStoreStaticChunkingStrategyResponse; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStatus.java new file mode 100644 index 000000000000..54a9305b1415 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/VectorStoreStatus.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.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Vector store possible status. + */ +public final class VectorStoreStatus extends ExpandableStringEnum { + + /** + * expired status indicates that this vector store has expired and is no longer available for use. + */ + @Generated + public static final VectorStoreStatus EXPIRED = fromString("expired"); + + /** + * in_progress status indicates that this vector store is still processing files. + */ + @Generated + public static final VectorStoreStatus IN_PROGRESS = fromString("in_progress"); + + /** + * completed status indicates that this vector store is ready for use. + */ + @Generated + public static final VectorStoreStatus COMPLETED = fromString("completed"); + + /** + * Creates a new instance of VectorStoreStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorStoreStatus() { + } + + /** + * Creates or finds a VectorStoreStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorStoreStatus. + */ + @Generated + public static VectorStoreStatus fromString(String name) { + return fromString(name, VectorStoreStatus.class); + } + + /** + * Gets known VectorStoreStatus values. + * + * @return known VectorStoreStatus values. + */ + @Generated + public static Collection values() { + return values(VectorStoreStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeekDays.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeekDays.java new file mode 100644 index 000000000000..942c1405368a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeekDays.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.projects.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * WeekDay of the schedule - Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday. + */ +public final class WeekDays extends ExpandableStringEnum { + + /** + * Static value Monday for WeekDays. + */ + @Generated + public static final WeekDays MONDAY = fromString("Monday"); + + /** + * Static value Tuesday for WeekDays. + */ + @Generated + public static final WeekDays TUESDAY = fromString("Tuesday"); + + /** + * Static value Wednesday for WeekDays. + */ + @Generated + public static final WeekDays WEDNESDAY = fromString("Wednesday"); + + /** + * Static value Thursday for WeekDays. + */ + @Generated + public static final WeekDays THURSDAY = fromString("Thursday"); + + /** + * Static value Friday for WeekDays. + */ + @Generated + public static final WeekDays FRIDAY = fromString("Friday"); + + /** + * Static value Saturday for WeekDays. + */ + @Generated + public static final WeekDays SATURDAY = fromString("Saturday"); + + /** + * Static value Sunday for WeekDays. + */ + @Generated + public static final WeekDays SUNDAY = fromString("Sunday"); + + /** + * Creates a new instance of WeekDays value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public WeekDays() { + } + + /** + * Creates or finds a WeekDays from its string representation. + * + * @param name a name to look for. + * @return the corresponding WeekDays. + */ + @Generated + public static WeekDays fromString(String name) { + return fromString(name, WeekDays.class); + } + + /** + * Gets known WeekDays values. + * + * @return known WeekDays values. + */ + @Generated + public static Collection values() { + return values(WeekDays.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/package-info.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/package-info.java new file mode 100644 index 000000000000..9fa6fc53dccd --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/package-info.java @@ -0,0 +1,9 @@ +// 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 Projects. + * + */ +package com.azure.ai.projects.models; diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageCreation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageCreation.java new file mode 100644 index 000000000000..e0f813fa3fd7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageCreation.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.ThreadMessage; + +/** + * Represents a stream update indicating a message state change, e.g. creation, completion, etc. + */ +public final class StreamMessageCreation extends StreamUpdate { + + /** + * The stream update with the data about this message sent by the service. + */ + private final ThreadMessage message; + + /** + * Creates a new instance of StreamMessageCreation. + * + * @param threadMessage The {@link ThreadMessage} with the data about this message sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamMessageCreation(ThreadMessage threadMessage, AgentStreamEvent kind) { + super(kind); + this.message = threadMessage; + } + + /** + * Get the data of this message sent by the service. + * + * @return the update with the data about this message sent by the service. + */ + public ThreadMessage getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageUpdate.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageUpdate.java new file mode 100644 index 000000000000..bd366214f5ab --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamMessageUpdate.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.MessageDeltaChunk; + +/** + * Represents a stream event indicating an incremental service message update. + */ +public class StreamMessageUpdate extends StreamUpdate { + /** + * The message incremental delta update sent by the service. + */ + private final MessageDeltaChunk message; + + /** + * Creates a new instance of StreamMessageUpdate. + * + * @param messageDelta The {@link MessageDeltaChunk} with the incremental delta update sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamMessageUpdate(MessageDeltaChunk messageDelta, AgentStreamEvent kind) { + super(kind); + this.message = messageDelta; + } + + /** + * Get the message incremental delta update sent by the service. + * + * @return the message incremental delta update sent by the service. + */ + public MessageDeltaChunk getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRequiredAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRequiredAction.java new file mode 100644 index 000000000000..a27010a9556a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRequiredAction.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.ThreadRun; + +/** + * Represents a stream update indicating that input from the user is required. + */ +public class StreamRequiredAction extends StreamUpdate { + + /** + * The message detailing the action required by the service. + */ + private final ThreadRun message; + + /** + * Creates a new instance of StreamRequiredAction. + * + * @param action The {@link ThreadRun} with the action required by the service. + * @param kind The stream event type associated with this update. + */ + public StreamRequiredAction(ThreadRun action, AgentStreamEvent kind) { + super(kind); + this.message = action; + } + + /** + * Get the message detailing the action required by the service. + * + * @return the message detailing the action required by the service. + */ + public ThreadRun getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunCreation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunCreation.java new file mode 100644 index 000000000000..1a00a244cbf7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunCreation.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.RunStep; + +/** + * Represents a stream update indicating a change of state in a run step, e.g. creation, completion, etc. + */ +public class StreamRunCreation extends StreamUpdate { + /** + * The update with the data about this run step sent by the service. + */ + private final RunStep message; + + /** + * Creates a new instance of StreamRunCreation. + * + * @param run The {@link RunStep} with the data about this run step sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamRunCreation(RunStep run, AgentStreamEvent kind) { + super(kind); + this.message = run; + } + + /** + * Get the update with the data about this run step sent by the service. + * + * @return the update with the data about this run step sent by the service. + */ + public RunStep getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunStepUpdate.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunStepUpdate.java new file mode 100644 index 000000000000..ef1c1edd3982 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamRunStepUpdate.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.RunStepDeltaChunk; + +/** + * Represents a stream update indicating a change of state in a run step, e.g. creation, completion, etc. + */ +public class StreamRunStepUpdate extends StreamUpdate { + + /** + * The incremental update sent by the service. + */ + private final RunStepDeltaChunk message; + + /** + * Creates a new instance of StreamRunStepUpdate. + * + * @param runStepDelta The {@link RunStepDeltaChunk} with the update sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamRunStepUpdate(RunStepDeltaChunk runStepDelta, AgentStreamEvent kind) { + super(kind); + this.message = runStepDelta; + } + + /** + * Get the incremental update sent by the service. + * + * @return the incremental update sent by the service. + */ + public RunStepDeltaChunk getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadCreation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadCreation.java new file mode 100644 index 000000000000..13bbafd40773 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadCreation.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; + +/** + * Represents a stream update that indicating the creation of a new thread. + */ +public final class StreamThreadCreation extends StreamUpdate { + + /** + * The thread data sent in the update by the service. + */ + private final AgentStreamEvent message; + + /** + * Creates a new instance of StreamThreadCreation. + * + * @param thread The {@link AgentStreamEvent} in the update sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamThreadCreation(AgentStreamEvent thread, AgentStreamEvent kind) { + super(kind); + this.message = thread; + } + + /** + * Get the thread data sent in the update by the service. + * + * @return the thread data sent in the update by the service. + */ + public AgentStreamEvent getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadRunCreation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadRunCreation.java new file mode 100644 index 000000000000..f905b22d7f06 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamThreadRunCreation.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.ThreadRun; + +/** + * Represents a stream update indicating a change of state in a thread run, e.g. creation, completion, etc. + */ +public final class StreamThreadRunCreation extends StreamUpdate { + + /** + * The thread run with the update sent by the service. + */ + private final ThreadRun message; + + /** + * Creates a new instance of StreamThreadRunCreation. + * + * @param threadRun The {@link ThreadRun} with the update sent by the service. + * @param kind The stream event type associated with this update. + */ + public StreamThreadRunCreation(ThreadRun threadRun, AgentStreamEvent kind) { + super(kind); + this.message = threadRun; + } + + /** + * Get the thread run with the update sent by the service. + * + * @return the thread run with the update sent by the service. + */ + public ThreadRun getMessage() { + return message; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamTypeFactory.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamTypeFactory.java new file mode 100644 index 000000000000..c95337328d81 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamTypeFactory.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.MessageDeltaChunk; +import com.azure.ai.projects.models.RunStep; +import com.azure.ai.projects.models.RunStepDeltaChunk; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; + +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_CREATED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_MESSAGE_COMPLETED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_MESSAGE_CREATED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_MESSAGE_DELTA; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_MESSAGE_INCOMPLETE; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_MESSAGE_IN_PROGRESS; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_CANCELLED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_CANCELLING; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_COMPLETED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_CREATED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_EXPIRED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_FAILED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_IN_PROGRESS; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_QUEUED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_REQUIRES_ACTION; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_CANCELLED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_COMPLETED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_CREATED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_DELTA; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_EXPIRED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_FAILED; +import static com.azure.ai.projects.models.AgentStreamEvent.THREAD_RUN_STEP_IN_PROGRESS; + +/** + * Deserializes the server sent event into the appropriate type. Which subtype of {@link StreamUpdate} is used, is + * determined by the event {@link AgentStreamEvent}. The subtype is merely a wrapper around the actual deserialized + * data. + */ +public final class StreamTypeFactory { + private final ClientLogger logger = new ClientLogger(StreamTypeFactory.class); + + /** + * Default constructor for creating a new instance of StreamTypeFactory. + */ + public StreamTypeFactory() { + // Default constructor + } + + /** + * Deserializes the server sent event into the appropriate type. + * + * @param eventName The name of the event. + * @param eventJson The event data. + * @return The deserialized event. + * @throws IllegalArgumentException If the event type is unknown. + */ + public StreamUpdate deserializeEvent(String eventName, BinaryData eventJson) throws IllegalArgumentException { + AgentStreamEvent event = AgentStreamEvent.fromString(eventName); + + if (THREAD_CREATED.equals(event)) { + return new StreamThreadCreation(eventJson.toObject(AgentStreamEvent.class), event); + } else if (THREAD_RUN_CREATED.equals(event) + || THREAD_RUN_QUEUED.equals(event) + || THREAD_RUN_IN_PROGRESS.equals(event) + || THREAD_RUN_COMPLETED.equals(event) + || THREAD_RUN_CANCELLED.equals(event) + || THREAD_RUN_CANCELLING.equals(event) + || THREAD_RUN_FAILED.equals(event) + || THREAD_RUN_EXPIRED.equals(event)) { + return new StreamThreadRunCreation(eventJson.toObject(ThreadRun.class), event); + } else if (THREAD_RUN_STEP_CREATED.equals(event) + || THREAD_RUN_STEP_IN_PROGRESS.equals(event) + || THREAD_RUN_STEP_COMPLETED.equals(event) + || THREAD_RUN_STEP_FAILED.equals(event) + || THREAD_RUN_STEP_CANCELLED.equals(event) + || THREAD_RUN_STEP_EXPIRED.equals(event)) { + return new StreamRunCreation(eventJson.toObject(RunStep.class), event); + } else if (THREAD_MESSAGE_CREATED.equals(event) + || THREAD_MESSAGE_IN_PROGRESS.equals(event) + || THREAD_MESSAGE_COMPLETED.equals(event) + || THREAD_MESSAGE_INCOMPLETE.equals(event)) { + return new StreamMessageCreation(eventJson.toObject(ThreadMessage.class), event); + } else if (THREAD_MESSAGE_DELTA.equals(event)) { + return new StreamMessageUpdate(eventJson.toObject(MessageDeltaChunk.class), event); + } else if (THREAD_RUN_STEP_DELTA.equals(event)) { + return new StreamRunStepUpdate(eventJson.toObject(RunStepDeltaChunk.class), event); + } else if (THREAD_RUN_REQUIRES_ACTION.equals(event)) { + return new StreamRequiredAction(eventJson.toObject(ThreadRun.class), event); + } else { + throw logger.logExceptionAsError(new IllegalArgumentException("Unknown event type: " + event)); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamUpdate.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamUpdate.java new file mode 100644 index 000000000000..6b32297d6992 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/StreamUpdate.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.models.streaming; + +import com.azure.ai.projects.models.AgentStreamEvent; + +/** + * Parent class for all stream updates types. + */ +public abstract class StreamUpdate { + + /** + * The kind of stream update. This can take any value of the {@link AgentStreamEvent} enum. + */ + private final AgentStreamEvent kind; + + /** + * We always want to know to which {@link AgentStreamEvent} this StreamUpdate is associated, therefore we enforce + * any deriving class to supply it upon construction of a new instance. + * + * @param kind The kind of stream update. + */ + public StreamUpdate(AgentStreamEvent kind) { + this.kind = kind; + } + + /** + * Returns what kind of StreamUpdate this is. See {@link AgentStreamEvent} for possible values. + * + * @return the kind of stream update. + */ + public AgentStreamEvent getKind() { + return kind; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/package-info.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/package-info.java new file mode 100644 index 000000000000..896805e9a10c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/streaming/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing classes for handling streaming updates from AI Project services. + * This package provides models for different types of stream events and updates. + */ +package com.azure.ai.projects.models.streaming; diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/package-info.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/package-info.java new file mode 100644 index 000000000000..bfd5e37d8633 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/package-info.java @@ -0,0 +1,9 @@ +// 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 Projects. + * + */ +package com.azure.ai.projects; diff --git a/sdk/ai/azure-ai-projects/src/main/java/module-info.java b/sdk/ai/azure-ai-projects/src/main/java/module-info.java new file mode 100644 index 000000000000..22111b3106ed --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.ai.projects { + requires transitive com.azure.core; + + exports com.azure.ai.projects; + exports com.azure.ai.projects.models; + + opens com.azure.ai.projects.models to com.azure.core; + opens com.azure.ai.projects.implementation.models to com.azure.core; +} diff --git a/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_apiview_properties.json b/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_apiview_properties.json new file mode 100644 index 000000000000..f0e41ae49500 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_apiview_properties.json @@ -0,0 +1,483 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.ai.projects.AIProjectClientBuilder": "Azure.AI.Projects", + "com.azure.ai.projects.AgentsAsyncClient": "Azure.AI.Projects.Agents", + "com.azure.ai.projects.AgentsAsyncClient.cancelRun": "Azure.AI.Projects.Agents.cancelRun", + "com.azure.ai.projects.AgentsAsyncClient.cancelRunWithResponse": "Azure.AI.Projects.Agents.cancelRun", + "com.azure.ai.projects.AgentsAsyncClient.cancelVectorStoreFileBatch": "Azure.AI.Projects.Agents.cancelVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.cancelVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.cancelVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.createAgent": "Azure.AI.Projects.Agents.createAgent", + "com.azure.ai.projects.AgentsAsyncClient.createAgentWithResponse": "Azure.AI.Projects.Agents.createAgent", + "com.azure.ai.projects.AgentsAsyncClient.createMessage": "Azure.AI.Projects.Agents.createMessage", + "com.azure.ai.projects.AgentsAsyncClient.createMessageWithResponse": "Azure.AI.Projects.Agents.createMessage", + "com.azure.ai.projects.AgentsAsyncClient.createRun": "Azure.AI.Projects.Agents.createRun", + "com.azure.ai.projects.AgentsAsyncClient.createRunWithResponse": "Azure.AI.Projects.Agents.createRun", + "com.azure.ai.projects.AgentsAsyncClient.createThread": "Azure.AI.Projects.Agents.createThread", + "com.azure.ai.projects.AgentsAsyncClient.createThreadAndRun": "Azure.AI.Projects.Agents.createThreadAndRun", + "com.azure.ai.projects.AgentsAsyncClient.createThreadAndRunWithResponse": "Azure.AI.Projects.Agents.createThreadAndRun", + "com.azure.ai.projects.AgentsAsyncClient.createThreadWithResponse": "Azure.AI.Projects.Agents.createThread", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStore": "Azure.AI.Projects.Agents.createVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStoreFile": "Azure.AI.Projects.Agents.createVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStoreFileBatch": "Azure.AI.Projects.Agents.createVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.createVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.createVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.createVectorStoreWithResponse": "Azure.AI.Projects.Agents.createVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.deleteAgent": "Azure.AI.Projects.Agents.deleteAgent", + "com.azure.ai.projects.AgentsAsyncClient.deleteAgentWithResponse": "Azure.AI.Projects.Agents.deleteAgent", + "com.azure.ai.projects.AgentsAsyncClient.deleteFile": "Azure.AI.Projects.Agents.deleteFile", + "com.azure.ai.projects.AgentsAsyncClient.deleteFileWithResponse": "Azure.AI.Projects.Agents.deleteFile", + "com.azure.ai.projects.AgentsAsyncClient.deleteThread": "Azure.AI.Projects.Agents.deleteThread", + "com.azure.ai.projects.AgentsAsyncClient.deleteThreadWithResponse": "Azure.AI.Projects.Agents.deleteThread", + "com.azure.ai.projects.AgentsAsyncClient.deleteVectorStore": "Azure.AI.Projects.Agents.deleteVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.deleteVectorStoreFile": "Azure.AI.Projects.Agents.deleteVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.deleteVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.deleteVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.deleteVectorStoreWithResponse": "Azure.AI.Projects.Agents.deleteVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.getAgent": "Azure.AI.Projects.Agents.getAgent", + "com.azure.ai.projects.AgentsAsyncClient.getAgentWithResponse": "Azure.AI.Projects.Agents.getAgent", + "com.azure.ai.projects.AgentsAsyncClient.getFile": "Azure.AI.Projects.Agents.getFile", + "com.azure.ai.projects.AgentsAsyncClient.getFileContent": "Azure.AI.Projects.Agents.getFileContent", + "com.azure.ai.projects.AgentsAsyncClient.getFileContentWithResponse": "Azure.AI.Projects.Agents.getFileContent", + "com.azure.ai.projects.AgentsAsyncClient.getFileWithResponse": "Azure.AI.Projects.Agents.getFile", + "com.azure.ai.projects.AgentsAsyncClient.getMessage": "Azure.AI.Projects.Agents.getMessage", + "com.azure.ai.projects.AgentsAsyncClient.getMessageWithResponse": "Azure.AI.Projects.Agents.getMessage", + "com.azure.ai.projects.AgentsAsyncClient.getRun": "Azure.AI.Projects.Agents.getRun", + "com.azure.ai.projects.AgentsAsyncClient.getRunStep": "Azure.AI.Projects.Agents.getRunStep", + "com.azure.ai.projects.AgentsAsyncClient.getRunStepWithResponse": "Azure.AI.Projects.Agents.getRunStep", + "com.azure.ai.projects.AgentsAsyncClient.getRunWithResponse": "Azure.AI.Projects.Agents.getRun", + "com.azure.ai.projects.AgentsAsyncClient.getThread": "Azure.AI.Projects.Agents.getThread", + "com.azure.ai.projects.AgentsAsyncClient.getThreadWithResponse": "Azure.AI.Projects.Agents.getThread", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStore": "Azure.AI.Projects.Agents.getVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStoreFile": "Azure.AI.Projects.Agents.getVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStoreFileBatch": "Azure.AI.Projects.Agents.getVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.getVectorStoreFileBatch", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.getVectorStoreFile", + "com.azure.ai.projects.AgentsAsyncClient.getVectorStoreWithResponse": "Azure.AI.Projects.Agents.getVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.listAgents": "Azure.AI.Projects.Agents.listAgents", + "com.azure.ai.projects.AgentsAsyncClient.listAgentsWithResponse": "Azure.AI.Projects.Agents.listAgents", + "com.azure.ai.projects.AgentsAsyncClient.listFiles": "Azure.AI.Projects.Agents.listFiles", + "com.azure.ai.projects.AgentsAsyncClient.listFilesWithResponse": "Azure.AI.Projects.Agents.listFiles", + "com.azure.ai.projects.AgentsAsyncClient.listMessages": "Azure.AI.Projects.Agents.listMessages", + "com.azure.ai.projects.AgentsAsyncClient.listMessagesWithResponse": "Azure.AI.Projects.Agents.listMessages", + "com.azure.ai.projects.AgentsAsyncClient.listRunSteps": "Azure.AI.Projects.Agents.listRunSteps", + "com.azure.ai.projects.AgentsAsyncClient.listRunStepsWithResponse": "Azure.AI.Projects.Agents.listRunSteps", + "com.azure.ai.projects.AgentsAsyncClient.listRuns": "Azure.AI.Projects.Agents.listRuns", + "com.azure.ai.projects.AgentsAsyncClient.listRunsWithResponse": "Azure.AI.Projects.Agents.listRuns", + "com.azure.ai.projects.AgentsAsyncClient.listThreads": "Azure.AI.Projects.Agents.listThreads", + "com.azure.ai.projects.AgentsAsyncClient.listThreadsWithResponse": "Azure.AI.Projects.Agents.listThreads", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStoreFileBatchFiles": "Azure.AI.Projects.Agents.listVectorStoreFileBatchFiles", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStoreFileBatchFilesWithResponse": "Azure.AI.Projects.Agents.listVectorStoreFileBatchFiles", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStoreFiles": "Azure.AI.Projects.Agents.listVectorStoreFiles", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStoreFilesWithResponse": "Azure.AI.Projects.Agents.listVectorStoreFiles", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStores": "Azure.AI.Projects.Agents.listVectorStores", + "com.azure.ai.projects.AgentsAsyncClient.listVectorStoresWithResponse": "Azure.AI.Projects.Agents.listVectorStores", + "com.azure.ai.projects.AgentsAsyncClient.modifyVectorStore": "Azure.AI.Projects.Agents.modifyVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.modifyVectorStoreWithResponse": "Azure.AI.Projects.Agents.modifyVectorStore", + "com.azure.ai.projects.AgentsAsyncClient.submitToolOutputsToRun": "Azure.AI.Projects.Agents.submitToolOutputsToRun", + "com.azure.ai.projects.AgentsAsyncClient.submitToolOutputsToRunWithResponse": "Azure.AI.Projects.Agents.submitToolOutputsToRun", + "com.azure.ai.projects.AgentsAsyncClient.updateAgent": "Azure.AI.Projects.Agents.updateAgent", + "com.azure.ai.projects.AgentsAsyncClient.updateAgentWithResponse": "Azure.AI.Projects.Agents.updateAgent", + "com.azure.ai.projects.AgentsAsyncClient.updateMessage": "Azure.AI.Projects.Agents.updateMessage", + "com.azure.ai.projects.AgentsAsyncClient.updateMessageWithResponse": "Azure.AI.Projects.Agents.updateMessage", + "com.azure.ai.projects.AgentsAsyncClient.updateRun": "Azure.AI.Projects.Agents.updateRun", + "com.azure.ai.projects.AgentsAsyncClient.updateRunWithResponse": "Azure.AI.Projects.Agents.updateRun", + "com.azure.ai.projects.AgentsAsyncClient.updateThread": "Azure.AI.Projects.Agents.updateThread", + "com.azure.ai.projects.AgentsAsyncClient.updateThreadWithResponse": "Azure.AI.Projects.Agents.updateThread", + "com.azure.ai.projects.AgentsAsyncClient.uploadFile": "Azure.AI.Projects.Agents.uploadFile", + "com.azure.ai.projects.AgentsAsyncClient.uploadFileWithResponse": "Azure.AI.Projects.Agents.uploadFile", + "com.azure.ai.projects.AgentsClient": "Azure.AI.Projects.Agents", + "com.azure.ai.projects.AgentsClient.cancelRun": "Azure.AI.Projects.Agents.cancelRun", + "com.azure.ai.projects.AgentsClient.cancelRunWithResponse": "Azure.AI.Projects.Agents.cancelRun", + "com.azure.ai.projects.AgentsClient.cancelVectorStoreFileBatch": "Azure.AI.Projects.Agents.cancelVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.cancelVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.cancelVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.createAgent": "Azure.AI.Projects.Agents.createAgent", + "com.azure.ai.projects.AgentsClient.createAgentWithResponse": "Azure.AI.Projects.Agents.createAgent", + "com.azure.ai.projects.AgentsClient.createMessage": "Azure.AI.Projects.Agents.createMessage", + "com.azure.ai.projects.AgentsClient.createMessageWithResponse": "Azure.AI.Projects.Agents.createMessage", + "com.azure.ai.projects.AgentsClient.createRun": "Azure.AI.Projects.Agents.createRun", + "com.azure.ai.projects.AgentsClient.createRunWithResponse": "Azure.AI.Projects.Agents.createRun", + "com.azure.ai.projects.AgentsClient.createThread": "Azure.AI.Projects.Agents.createThread", + "com.azure.ai.projects.AgentsClient.createThreadAndRun": "Azure.AI.Projects.Agents.createThreadAndRun", + "com.azure.ai.projects.AgentsClient.createThreadAndRunWithResponse": "Azure.AI.Projects.Agents.createThreadAndRun", + "com.azure.ai.projects.AgentsClient.createThreadWithResponse": "Azure.AI.Projects.Agents.createThread", + "com.azure.ai.projects.AgentsClient.createVectorStore": "Azure.AI.Projects.Agents.createVectorStore", + "com.azure.ai.projects.AgentsClient.createVectorStoreFile": "Azure.AI.Projects.Agents.createVectorStoreFile", + "com.azure.ai.projects.AgentsClient.createVectorStoreFileBatch": "Azure.AI.Projects.Agents.createVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.createVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.createVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.createVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.createVectorStoreFile", + "com.azure.ai.projects.AgentsClient.createVectorStoreWithResponse": "Azure.AI.Projects.Agents.createVectorStore", + "com.azure.ai.projects.AgentsClient.deleteAgent": "Azure.AI.Projects.Agents.deleteAgent", + "com.azure.ai.projects.AgentsClient.deleteAgentWithResponse": "Azure.AI.Projects.Agents.deleteAgent", + "com.azure.ai.projects.AgentsClient.deleteFile": "Azure.AI.Projects.Agents.deleteFile", + "com.azure.ai.projects.AgentsClient.deleteFileWithResponse": "Azure.AI.Projects.Agents.deleteFile", + "com.azure.ai.projects.AgentsClient.deleteThread": "Azure.AI.Projects.Agents.deleteThread", + "com.azure.ai.projects.AgentsClient.deleteThreadWithResponse": "Azure.AI.Projects.Agents.deleteThread", + "com.azure.ai.projects.AgentsClient.deleteVectorStore": "Azure.AI.Projects.Agents.deleteVectorStore", + "com.azure.ai.projects.AgentsClient.deleteVectorStoreFile": "Azure.AI.Projects.Agents.deleteVectorStoreFile", + "com.azure.ai.projects.AgentsClient.deleteVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.deleteVectorStoreFile", + "com.azure.ai.projects.AgentsClient.deleteVectorStoreWithResponse": "Azure.AI.Projects.Agents.deleteVectorStore", + "com.azure.ai.projects.AgentsClient.getAgent": "Azure.AI.Projects.Agents.getAgent", + "com.azure.ai.projects.AgentsClient.getAgentWithResponse": "Azure.AI.Projects.Agents.getAgent", + "com.azure.ai.projects.AgentsClient.getFile": "Azure.AI.Projects.Agents.getFile", + "com.azure.ai.projects.AgentsClient.getFileContent": "Azure.AI.Projects.Agents.getFileContent", + "com.azure.ai.projects.AgentsClient.getFileContentWithResponse": "Azure.AI.Projects.Agents.getFileContent", + "com.azure.ai.projects.AgentsClient.getFileWithResponse": "Azure.AI.Projects.Agents.getFile", + "com.azure.ai.projects.AgentsClient.getMessage": "Azure.AI.Projects.Agents.getMessage", + "com.azure.ai.projects.AgentsClient.getMessageWithResponse": "Azure.AI.Projects.Agents.getMessage", + "com.azure.ai.projects.AgentsClient.getRun": "Azure.AI.Projects.Agents.getRun", + "com.azure.ai.projects.AgentsClient.getRunStep": "Azure.AI.Projects.Agents.getRunStep", + "com.azure.ai.projects.AgentsClient.getRunStepWithResponse": "Azure.AI.Projects.Agents.getRunStep", + "com.azure.ai.projects.AgentsClient.getRunWithResponse": "Azure.AI.Projects.Agents.getRun", + "com.azure.ai.projects.AgentsClient.getThread": "Azure.AI.Projects.Agents.getThread", + "com.azure.ai.projects.AgentsClient.getThreadWithResponse": "Azure.AI.Projects.Agents.getThread", + "com.azure.ai.projects.AgentsClient.getVectorStore": "Azure.AI.Projects.Agents.getVectorStore", + "com.azure.ai.projects.AgentsClient.getVectorStoreFile": "Azure.AI.Projects.Agents.getVectorStoreFile", + "com.azure.ai.projects.AgentsClient.getVectorStoreFileBatch": "Azure.AI.Projects.Agents.getVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.getVectorStoreFileBatchWithResponse": "Azure.AI.Projects.Agents.getVectorStoreFileBatch", + "com.azure.ai.projects.AgentsClient.getVectorStoreFileWithResponse": "Azure.AI.Projects.Agents.getVectorStoreFile", + "com.azure.ai.projects.AgentsClient.getVectorStoreWithResponse": "Azure.AI.Projects.Agents.getVectorStore", + "com.azure.ai.projects.AgentsClient.listAgents": "Azure.AI.Projects.Agents.listAgents", + "com.azure.ai.projects.AgentsClient.listAgentsWithResponse": "Azure.AI.Projects.Agents.listAgents", + "com.azure.ai.projects.AgentsClient.listFiles": "Azure.AI.Projects.Agents.listFiles", + "com.azure.ai.projects.AgentsClient.listFilesWithResponse": "Azure.AI.Projects.Agents.listFiles", + "com.azure.ai.projects.AgentsClient.listMessages": "Azure.AI.Projects.Agents.listMessages", + "com.azure.ai.projects.AgentsClient.listMessagesWithResponse": "Azure.AI.Projects.Agents.listMessages", + "com.azure.ai.projects.AgentsClient.listRunSteps": "Azure.AI.Projects.Agents.listRunSteps", + "com.azure.ai.projects.AgentsClient.listRunStepsWithResponse": "Azure.AI.Projects.Agents.listRunSteps", + "com.azure.ai.projects.AgentsClient.listRuns": "Azure.AI.Projects.Agents.listRuns", + "com.azure.ai.projects.AgentsClient.listRunsWithResponse": "Azure.AI.Projects.Agents.listRuns", + "com.azure.ai.projects.AgentsClient.listThreads": "Azure.AI.Projects.Agents.listThreads", + "com.azure.ai.projects.AgentsClient.listThreadsWithResponse": "Azure.AI.Projects.Agents.listThreads", + "com.azure.ai.projects.AgentsClient.listVectorStoreFileBatchFiles": "Azure.AI.Projects.Agents.listVectorStoreFileBatchFiles", + "com.azure.ai.projects.AgentsClient.listVectorStoreFileBatchFilesWithResponse": "Azure.AI.Projects.Agents.listVectorStoreFileBatchFiles", + "com.azure.ai.projects.AgentsClient.listVectorStoreFiles": "Azure.AI.Projects.Agents.listVectorStoreFiles", + "com.azure.ai.projects.AgentsClient.listVectorStoreFilesWithResponse": "Azure.AI.Projects.Agents.listVectorStoreFiles", + "com.azure.ai.projects.AgentsClient.listVectorStores": "Azure.AI.Projects.Agents.listVectorStores", + "com.azure.ai.projects.AgentsClient.listVectorStoresWithResponse": "Azure.AI.Projects.Agents.listVectorStores", + "com.azure.ai.projects.AgentsClient.modifyVectorStore": "Azure.AI.Projects.Agents.modifyVectorStore", + "com.azure.ai.projects.AgentsClient.modifyVectorStoreWithResponse": "Azure.AI.Projects.Agents.modifyVectorStore", + "com.azure.ai.projects.AgentsClient.submitToolOutputsToRun": "Azure.AI.Projects.Agents.submitToolOutputsToRun", + "com.azure.ai.projects.AgentsClient.submitToolOutputsToRunWithResponse": "Azure.AI.Projects.Agents.submitToolOutputsToRun", + "com.azure.ai.projects.AgentsClient.updateAgent": "Azure.AI.Projects.Agents.updateAgent", + "com.azure.ai.projects.AgentsClient.updateAgentWithResponse": "Azure.AI.Projects.Agents.updateAgent", + "com.azure.ai.projects.AgentsClient.updateMessage": "Azure.AI.Projects.Agents.updateMessage", + "com.azure.ai.projects.AgentsClient.updateMessageWithResponse": "Azure.AI.Projects.Agents.updateMessage", + "com.azure.ai.projects.AgentsClient.updateRun": "Azure.AI.Projects.Agents.updateRun", + "com.azure.ai.projects.AgentsClient.updateRunWithResponse": "Azure.AI.Projects.Agents.updateRun", + "com.azure.ai.projects.AgentsClient.updateThread": "Azure.AI.Projects.Agents.updateThread", + "com.azure.ai.projects.AgentsClient.updateThreadWithResponse": "Azure.AI.Projects.Agents.updateThread", + "com.azure.ai.projects.AgentsClient.uploadFile": "Azure.AI.Projects.Agents.uploadFile", + "com.azure.ai.projects.AgentsClient.uploadFileWithResponse": "Azure.AI.Projects.Agents.uploadFile", + "com.azure.ai.projects.ConnectionsAsyncClient": "Azure.AI.Projects.Connections", + "com.azure.ai.projects.ConnectionsAsyncClient.getConnection": "Azure.AI.Projects.Connections.getConnection", + "com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithResponse": "Azure.AI.Projects.Connections.getConnection", + "com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithSecrets": "Azure.AI.Projects.Connections.getConnectionWithSecrets", + "com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithSecretsWithResponse": "Azure.AI.Projects.Connections.getConnectionWithSecrets", + "com.azure.ai.projects.ConnectionsAsyncClient.getWorkspace": "Azure.AI.Projects.Connections.getWorkspace", + "com.azure.ai.projects.ConnectionsAsyncClient.getWorkspaceWithResponse": "Azure.AI.Projects.Connections.getWorkspace", + "com.azure.ai.projects.ConnectionsAsyncClient.listConnections": "Azure.AI.Projects.Connections.listConnections", + "com.azure.ai.projects.ConnectionsAsyncClient.listConnectionsWithResponse": "Azure.AI.Projects.Connections.listConnections", + "com.azure.ai.projects.ConnectionsClient": "Azure.AI.Projects.Connections", + "com.azure.ai.projects.ConnectionsClient.getConnection": "Azure.AI.Projects.Connections.getConnection", + "com.azure.ai.projects.ConnectionsClient.getConnectionWithResponse": "Azure.AI.Projects.Connections.getConnection", + "com.azure.ai.projects.ConnectionsClient.getConnectionWithSecrets": "Azure.AI.Projects.Connections.getConnectionWithSecrets", + "com.azure.ai.projects.ConnectionsClient.getConnectionWithSecretsWithResponse": "Azure.AI.Projects.Connections.getConnectionWithSecrets", + "com.azure.ai.projects.ConnectionsClient.getWorkspace": "Azure.AI.Projects.Connections.getWorkspace", + "com.azure.ai.projects.ConnectionsClient.getWorkspaceWithResponse": "Azure.AI.Projects.Connections.getWorkspace", + "com.azure.ai.projects.ConnectionsClient.listConnections": "Azure.AI.Projects.Connections.listConnections", + "com.azure.ai.projects.ConnectionsClient.listConnectionsWithResponse": "Azure.AI.Projects.Connections.listConnections", + "com.azure.ai.projects.EvaluationsAsyncClient": "Azure.AI.Projects.Evaluations", + "com.azure.ai.projects.EvaluationsAsyncClient.create": "Azure.AI.Projects.Evaluations.create", + "com.azure.ai.projects.EvaluationsAsyncClient.createOrReplaceSchedule": "Azure.AI.Projects.Evaluations.createOrReplaceSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.createOrReplaceScheduleWithResponse": "Azure.AI.Projects.Evaluations.createOrReplaceSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.createWithResponse": "Azure.AI.Projects.Evaluations.create", + "com.azure.ai.projects.EvaluationsAsyncClient.disableSchedule": "Azure.AI.Projects.Evaluations.disableSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.disableScheduleWithResponse": "Azure.AI.Projects.Evaluations.disableSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.get": "Azure.AI.Projects.Evaluations.get", + "com.azure.ai.projects.EvaluationsAsyncClient.getSchedule": "Azure.AI.Projects.Evaluations.getSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.getScheduleWithResponse": "Azure.AI.Projects.Evaluations.getSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.getWithResponse": "Azure.AI.Projects.Evaluations.get", + "com.azure.ai.projects.EvaluationsAsyncClient.list": "Azure.AI.Projects.Evaluations.list", + "com.azure.ai.projects.EvaluationsAsyncClient.listSchedule": "Azure.AI.Projects.Evaluations.listSchedule", + "com.azure.ai.projects.EvaluationsAsyncClient.update": "Azure.AI.Projects.Evaluations.update", + "com.azure.ai.projects.EvaluationsAsyncClient.updateWithResponse": "Azure.AI.Projects.Evaluations.update", + "com.azure.ai.projects.EvaluationsClient": "Azure.AI.Projects.Evaluations", + "com.azure.ai.projects.EvaluationsClient.create": "Azure.AI.Projects.Evaluations.create", + "com.azure.ai.projects.EvaluationsClient.createOrReplaceSchedule": "Azure.AI.Projects.Evaluations.createOrReplaceSchedule", + "com.azure.ai.projects.EvaluationsClient.createOrReplaceScheduleWithResponse": "Azure.AI.Projects.Evaluations.createOrReplaceSchedule", + "com.azure.ai.projects.EvaluationsClient.createWithResponse": "Azure.AI.Projects.Evaluations.create", + "com.azure.ai.projects.EvaluationsClient.disableSchedule": "Azure.AI.Projects.Evaluations.disableSchedule", + "com.azure.ai.projects.EvaluationsClient.disableScheduleWithResponse": "Azure.AI.Projects.Evaluations.disableSchedule", + "com.azure.ai.projects.EvaluationsClient.get": "Azure.AI.Projects.Evaluations.get", + "com.azure.ai.projects.EvaluationsClient.getSchedule": "Azure.AI.Projects.Evaluations.getSchedule", + "com.azure.ai.projects.EvaluationsClient.getScheduleWithResponse": "Azure.AI.Projects.Evaluations.getSchedule", + "com.azure.ai.projects.EvaluationsClient.getWithResponse": "Azure.AI.Projects.Evaluations.get", + "com.azure.ai.projects.EvaluationsClient.list": "Azure.AI.Projects.Evaluations.list", + "com.azure.ai.projects.EvaluationsClient.listSchedule": "Azure.AI.Projects.Evaluations.listSchedule", + "com.azure.ai.projects.EvaluationsClient.update": "Azure.AI.Projects.Evaluations.update", + "com.azure.ai.projects.EvaluationsClient.updateWithResponse": "Azure.AI.Projects.Evaluations.update", + "com.azure.ai.projects.TelemetryAsyncClient": "Azure.AI.Projects.Telemetry", + "com.azure.ai.projects.TelemetryAsyncClient.getAppInsights": "Azure.AI.Projects.Telemetry.getAppInsights", + "com.azure.ai.projects.TelemetryAsyncClient.getAppInsightsWithResponse": "Azure.AI.Projects.Telemetry.getAppInsights", + "com.azure.ai.projects.TelemetryClient": "Azure.AI.Projects.Telemetry", + "com.azure.ai.projects.TelemetryClient.getAppInsights": "Azure.AI.Projects.Telemetry.getAppInsights", + "com.azure.ai.projects.TelemetryClient.getAppInsightsWithResponse": "Azure.AI.Projects.Telemetry.getAppInsights", + "com.azure.ai.projects.implementation.models.AppInsightsProperties": "Azure.AI.Projects.AppInsightsProperties", + "com.azure.ai.projects.implementation.models.CreateAgentRequest": "Azure.AI.Projects.Agents.createAgent.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateMessageRequest": "Azure.AI.Projects.Agents.createMessage.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateRunRequest": "Azure.AI.Projects.Agents.createRun.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateThreadAndRunRequest": "Azure.AI.Projects.Agents.createThreadAndRun.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateThreadRequest": "Azure.AI.Projects.Agents.createThread.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateVectorStoreFileBatchRequest": "Azure.AI.Projects.Agents.createVectorStoreFileBatch.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateVectorStoreFileRequest": "Azure.AI.Projects.Agents.createVectorStoreFile.Request.anonymous", + "com.azure.ai.projects.implementation.models.CreateVectorStoreRequest": "Azure.AI.Projects.Agents.createVectorStore.Request.anonymous", + "com.azure.ai.projects.implementation.models.CredentialsApiKeyAuth": "Azure.AI.Projects.CredentialsApiKeyAuth", + "com.azure.ai.projects.implementation.models.CredentialsSASAuth": "Azure.AI.Projects.CredentialsSASAuth", + "com.azure.ai.projects.implementation.models.GetAppInsightsResponse": "Azure.AI.Projects.GetAppInsightsResponse", + "com.azure.ai.projects.implementation.models.GetConnectionResponse": "Azure.AI.Projects.GetConnectionResponse", + "com.azure.ai.projects.implementation.models.GetConnectionWithSecretsRequest": "Azure.AI.Projects.Connections.getConnectionWithSecrets.Request.anonymous", + "com.azure.ai.projects.implementation.models.GetWorkspaceResponse": "Azure.AI.Projects.GetWorkspaceResponse", + "com.azure.ai.projects.implementation.models.InternalConnectionProperties": "Azure.AI.Projects.InternalConnectionProperties", + "com.azure.ai.projects.implementation.models.InternalConnectionPropertiesAADAuth": "Azure.AI.Projects.InternalConnectionPropertiesAADAuth", + "com.azure.ai.projects.implementation.models.InternalConnectionPropertiesApiKeyAuth": "Azure.AI.Projects.InternalConnectionPropertiesApiKeyAuth", + "com.azure.ai.projects.implementation.models.InternalConnectionPropertiesCustomAuth": "Azure.AI.Projects.InternalConnectionPropertiesCustomAuth", + "com.azure.ai.projects.implementation.models.InternalConnectionPropertiesNoAuth": "Azure.AI.Projects.InternalConnectionPropertiesNoAuth", + "com.azure.ai.projects.implementation.models.InternalConnectionPropertiesSASAuth": "Azure.AI.Projects.InternalConnectionPropertiesSASAuth", + "com.azure.ai.projects.implementation.models.ListConnectionsResponse": "Azure.AI.Projects.ListConnectionsResponse", + "com.azure.ai.projects.implementation.models.ModifyVectorStoreRequest": "Azure.AI.Projects.Agents.modifyVectorStore.Request.anonymous", + "com.azure.ai.projects.implementation.models.SubmitToolOutputsToRunRequest": "Azure.AI.Projects.Agents.submitToolOutputsToRun.Request.anonymous", + "com.azure.ai.projects.implementation.models.UpdateAgentRequest": "Azure.AI.Projects.Agents.updateAgent.Request.anonymous", + "com.azure.ai.projects.implementation.models.UpdateMessageRequest": "Azure.AI.Projects.Agents.updateMessage.Request.anonymous", + "com.azure.ai.projects.implementation.models.UpdateRunRequest": "Azure.AI.Projects.Agents.updateRun.Request.anonymous", + "com.azure.ai.projects.implementation.models.UpdateThreadRequest": "Azure.AI.Projects.Agents.updateThread.Request.anonymous", + "com.azure.ai.projects.implementation.models.WorkspaceProperties": "Azure.AI.Projects.WorkspaceProperties", + "com.azure.ai.projects.models.AISearchIndexResource": "Azure.AI.Projects.Agents.AISearchIndexResource", + "com.azure.ai.projects.models.AOAIModelConfig": "Azure.AI.Projects.AOAIModelConfig", + "com.azure.ai.projects.models.Agent": "Azure.AI.Projects.Agents.Agent", + "com.azure.ai.projects.models.AgentDeletionStatus": "Azure.AI.Projects.Agents.AgentDeletionStatus", + "com.azure.ai.projects.models.AgentStreamEvent": "Azure.AI.Projects.Agents.AgentStreamEvent", + "com.azure.ai.projects.models.AgentThread": "Azure.AI.Projects.Agents.AgentThread", + "com.azure.ai.projects.models.AgentThreadCreationOptions": "Azure.AI.Projects.Agents.AgentThreadCreationOptions", + "com.azure.ai.projects.models.AgentsApiResponseFormat": "Azure.AI.Projects.Agents.AgentsApiResponseFormat", + "com.azure.ai.projects.models.AgentsApiResponseFormatMode": "Azure.AI.Projects.Agents.AgentsApiResponseFormatMode", + "com.azure.ai.projects.models.AgentsApiToolChoiceOptionMode": "Azure.AI.Projects.Agents.AgentsApiToolChoiceOptionMode", + "com.azure.ai.projects.models.AgentsNamedToolChoice": "Azure.AI.Projects.Agents.AgentsNamedToolChoice", + "com.azure.ai.projects.models.AgentsNamedToolChoiceType": "Azure.AI.Projects.Agents.AgentsNamedToolChoiceType", + "com.azure.ai.projects.models.ApplicationInsightsConfiguration": "Azure.AI.Projects.ApplicationInsightsConfiguration", + "com.azure.ai.projects.models.AuthenticationType": "Azure.AI.Projects.AuthenticationType", + "com.azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.Agents.AzureAISearchQueryType", + "com.azure.ai.projects.models.AzureAISearchResource": "Azure.AI.Projects.Agents.AzureAISearchResource", + "com.azure.ai.projects.models.AzureAISearchToolDefinition": "Azure.AI.Projects.Agents.AzureAISearchToolDefinition", + "com.azure.ai.projects.models.AzureFunctionBinding": "Azure.AI.Projects.Agents.AzureFunctionBinding", + "com.azure.ai.projects.models.AzureFunctionDefinition": "Azure.AI.Projects.Agents.AzureFunctionDefinition", + "com.azure.ai.projects.models.AzureFunctionStorageQueue": "Azure.AI.Projects.Agents.AzureFunctionStorageQueue", + "com.azure.ai.projects.models.AzureFunctionToolDefinition": "Azure.AI.Projects.Agents.AzureFunctionToolDefinition", + "com.azure.ai.projects.models.BingCustomSearchToolDefinition": "Azure.AI.Projects.Agents.BingCustomSearchToolDefinition", + "com.azure.ai.projects.models.BingGroundingToolDefinition": "Azure.AI.Projects.Agents.BingGroundingToolDefinition", + "com.azure.ai.projects.models.CodeInterpreterToolDefinition": "Azure.AI.Projects.Agents.CodeInterpreterToolDefinition", + "com.azure.ai.projects.models.CodeInterpreterToolResource": "Azure.AI.Projects.Agents.CodeInterpreterToolResource", + "com.azure.ai.projects.models.ConnectedAgentDetails": "Azure.AI.Projects.Agents.ConnectedAgentDetails", + "com.azure.ai.projects.models.ConnectedAgentToolDefinition": "Azure.AI.Projects.Agents.ConnectedAgentToolDefinition", + "com.azure.ai.projects.models.ConnectionType": "Azure.AI.Projects.ConnectionType", + "com.azure.ai.projects.models.CreateAgentOptions": null, + "com.azure.ai.projects.models.CreateRunOptions": null, + "com.azure.ai.projects.models.CreateThreadAndRunOptions": null, + "com.azure.ai.projects.models.CronTrigger": "Azure.AI.Projects.CronTrigger", + "com.azure.ai.projects.models.Dataset": "Azure.AI.Projects.Dataset", + "com.azure.ai.projects.models.DoneEvent": "Azure.AI.Projects.Agents.DoneEvent", + "com.azure.ai.projects.models.ErrorEvent": "Azure.AI.Projects.Agents.ErrorEvent", + "com.azure.ai.projects.models.Evaluation": "Azure.AI.Projects.Evaluation", + "com.azure.ai.projects.models.EvaluationSchedule": "Azure.AI.Projects.EvaluationSchedule", + "com.azure.ai.projects.models.EvaluationTarget": "Azure.AI.Projects.EvaluationTarget", + "com.azure.ai.projects.models.EvaluatorConfiguration": "Azure.AI.Projects.EvaluatorConfiguration", + "com.azure.ai.projects.models.FileDeletionStatus": "Azure.AI.Projects.Agents.FileDeletionStatus", + "com.azure.ai.projects.models.FileDetails": "TypeSpec.Http.File", + "com.azure.ai.projects.models.FileListResponse": "Azure.AI.Projects.Agents.FileListResponse", + "com.azure.ai.projects.models.FilePurpose": "Azure.AI.Projects.Agents.FilePurpose", + "com.azure.ai.projects.models.FileSearchRankingOptions": "Azure.AI.Projects.Agents.FileSearchRankingOptions", + "com.azure.ai.projects.models.FileSearchToolCallContent": "Azure.AI.Projects.Agents.FileSearchToolCallContent", + "com.azure.ai.projects.models.FileSearchToolDefinition": "Azure.AI.Projects.Agents.FileSearchToolDefinition", + "com.azure.ai.projects.models.FileSearchToolDefinitionDetails": "Azure.AI.Projects.Agents.FileSearchToolDefinitionDetails", + "com.azure.ai.projects.models.FileSearchToolResource": "Azure.AI.Projects.Agents.FileSearchToolResource", + "com.azure.ai.projects.models.FileState": "Azure.AI.Projects.Agents.FileState", + "com.azure.ai.projects.models.Frequency": "Azure.AI.Projects.Frequency", + "com.azure.ai.projects.models.FunctionDefinition": "Azure.AI.Projects.Agents.FunctionDefinition", + "com.azure.ai.projects.models.FunctionName": "Azure.AI.Projects.Agents.FunctionName", + "com.azure.ai.projects.models.FunctionToolDefinition": "Azure.AI.Projects.Agents.FunctionToolDefinition", + "com.azure.ai.projects.models.ImageDetailLevel": "Azure.AI.Projects.Agents.ImageDetailLevel", + "com.azure.ai.projects.models.IncompleteDetailsReason": "Azure.AI.Projects.Agents.IncompleteDetailsReason", + "com.azure.ai.projects.models.IncompleteRunDetails": "Azure.AI.Projects.Agents.IncompleteRunDetails", + "com.azure.ai.projects.models.InputData": "Azure.AI.Projects.InputData", + "com.azure.ai.projects.models.ListSortOrder": "Azure.AI.Projects.Agents.ListSortOrder", + "com.azure.ai.projects.models.MAASModelConfig": "Azure.AI.Projects.MAASModelConfig", + "com.azure.ai.projects.models.MessageAttachment": "Azure.AI.Projects.Agents.MessageAttachment", + "com.azure.ai.projects.models.MessageBlockType": "Azure.AI.Projects.Agents.MessageBlockType", + "com.azure.ai.projects.models.MessageContent": "Azure.AI.Projects.Agents.MessageContent", + "com.azure.ai.projects.models.MessageDelta": "Azure.AI.Projects.Agents.MessageDelta", + "com.azure.ai.projects.models.MessageDeltaChunk": "Azure.AI.Projects.Agents.MessageDeltaChunk", + "com.azure.ai.projects.models.MessageDeltaContent": "Azure.AI.Projects.Agents.MessageDeltaContent", + "com.azure.ai.projects.models.MessageDeltaImageFileContent": "Azure.AI.Projects.Agents.MessageDeltaImageFileContent", + "com.azure.ai.projects.models.MessageDeltaImageFileContentObject": "Azure.AI.Projects.Agents.MessageDeltaImageFileContentObject", + "com.azure.ai.projects.models.MessageDeltaTextAnnotation": "Azure.AI.Projects.Agents.MessageDeltaTextAnnotation", + "com.azure.ai.projects.models.MessageDeltaTextContent": "Azure.AI.Projects.Agents.MessageDeltaTextContent", + "com.azure.ai.projects.models.MessageDeltaTextContentObject": "Azure.AI.Projects.Agents.MessageDeltaTextContentObject", + "com.azure.ai.projects.models.MessageDeltaTextFileCitationAnnotation": "Azure.AI.Projects.Agents.MessageDeltaTextFileCitationAnnotation", + "com.azure.ai.projects.models.MessageDeltaTextFileCitationAnnotationObject": "Azure.AI.Projects.Agents.MessageDeltaTextFileCitationAnnotationObject", + "com.azure.ai.projects.models.MessageDeltaTextFilePathAnnotation": "Azure.AI.Projects.Agents.MessageDeltaTextFilePathAnnotation", + "com.azure.ai.projects.models.MessageDeltaTextFilePathAnnotationObject": "Azure.AI.Projects.Agents.MessageDeltaTextFilePathAnnotationObject", + "com.azure.ai.projects.models.MessageDeltaTextUrlCitationAnnotation": "Azure.AI.Projects.Agents.MessageDeltaTextUrlCitationAnnotation", + "com.azure.ai.projects.models.MessageDeltaTextUrlCitationDetails": "Azure.AI.Projects.Agents.MessageDeltaTextUrlCitationDetails", + "com.azure.ai.projects.models.MessageImageFileContent": "Azure.AI.Projects.Agents.MessageImageFileContent", + "com.azure.ai.projects.models.MessageImageFileDetails": "Azure.AI.Projects.Agents.MessageImageFileDetails", + "com.azure.ai.projects.models.MessageImageFileParam": "Azure.AI.Projects.Agents.MessageImageFileParam", + "com.azure.ai.projects.models.MessageImageUrlParam": "Azure.AI.Projects.Agents.MessageImageUrlParam", + "com.azure.ai.projects.models.MessageIncompleteDetails": "Azure.AI.Projects.Agents.MessageIncompleteDetails", + "com.azure.ai.projects.models.MessageIncompleteDetailsReason": "Azure.AI.Projects.Agents.MessageIncompleteDetailsReason", + "com.azure.ai.projects.models.MessageInputContentBlock": "Azure.AI.Projects.Agents.MessageInputContentBlock", + "com.azure.ai.projects.models.MessageInputImageFileBlock": "Azure.AI.Projects.Agents.MessageInputImageFileBlock", + "com.azure.ai.projects.models.MessageInputImageUrlBlock": "Azure.AI.Projects.Agents.MessageInputImageUrlBlock", + "com.azure.ai.projects.models.MessageInputTextBlock": "Azure.AI.Projects.Agents.MessageInputTextBlock", + "com.azure.ai.projects.models.MessageRole": "Azure.AI.Projects.Agents.MessageRole", + "com.azure.ai.projects.models.MessageStatus": "Azure.AI.Projects.Agents.MessageStatus", + "com.azure.ai.projects.models.MessageStreamEvent": "Azure.AI.Projects.Agents.MessageStreamEvent", + "com.azure.ai.projects.models.MessageTextAnnotation": "Azure.AI.Projects.Agents.MessageTextAnnotation", + "com.azure.ai.projects.models.MessageTextContent": "Azure.AI.Projects.Agents.MessageTextContent", + "com.azure.ai.projects.models.MessageTextDetails": "Azure.AI.Projects.Agents.MessageTextDetails", + "com.azure.ai.projects.models.MessageTextFileCitationAnnotation": "Azure.AI.Projects.Agents.MessageTextFileCitationAnnotation", + "com.azure.ai.projects.models.MessageTextFileCitationDetails": "Azure.AI.Projects.Agents.MessageTextFileCitationDetails", + "com.azure.ai.projects.models.MessageTextFilePathAnnotation": "Azure.AI.Projects.Agents.MessageTextFilePathAnnotation", + "com.azure.ai.projects.models.MessageTextFilePathDetails": "Azure.AI.Projects.Agents.MessageTextFilePathDetails", + "com.azure.ai.projects.models.MessageTextUrlCitationAnnotation": "Azure.AI.Projects.Agents.MessageTextUrlCitationAnnotation", + "com.azure.ai.projects.models.MessageTextUrlCitationDetails": "Azure.AI.Projects.Agents.MessageTextUrlCitationDetails", + "com.azure.ai.projects.models.MicrosoftFabricToolDefinition": "Azure.AI.Projects.Agents.MicrosoftFabricToolDefinition", + "com.azure.ai.projects.models.OpenAIFile": "Azure.AI.Projects.Agents.OpenAIFile", + "com.azure.ai.projects.models.OpenAIPageableListOfAgent": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfAgentThread": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfRunStep": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfThreadRun": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfVectorStore": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenAIPageableListOfVectorStoreFile": "Azure.AI.Projects.Agents.OpenAIPageableListOf", + "com.azure.ai.projects.models.OpenApiAnonymousAuthDetails": "Azure.AI.Projects.Agents.OpenApiAnonymousAuthDetails", + "com.azure.ai.projects.models.OpenApiAuthDetails": "Azure.AI.Projects.Agents.OpenApiAuthDetails", + "com.azure.ai.projects.models.OpenApiAuthType": "Azure.AI.Projects.Agents.OpenApiAuthType", + "com.azure.ai.projects.models.OpenApiConnectionAuthDetails": "Azure.AI.Projects.Agents.OpenApiConnectionAuthDetails", + "com.azure.ai.projects.models.OpenApiConnectionSecurityScheme": "Azure.AI.Projects.Agents.OpenApiConnectionSecurityScheme", + "com.azure.ai.projects.models.OpenApiFunctionDefinition": "Azure.AI.Projects.Agents.OpenApiFunctionDefinition", + "com.azure.ai.projects.models.OpenApiManagedAuthDetails": "Azure.AI.Projects.Agents.OpenApiManagedAuthDetails", + "com.azure.ai.projects.models.OpenApiManagedSecurityScheme": "Azure.AI.Projects.Agents.OpenApiManagedSecurityScheme", + "com.azure.ai.projects.models.OpenApiToolDefinition": "Azure.AI.Projects.Agents.OpenApiToolDefinition", + "com.azure.ai.projects.models.RecurrenceSchedule": "Azure.AI.Projects.RecurrenceSchedule", + "com.azure.ai.projects.models.RecurrenceTrigger": "Azure.AI.Projects.RecurrenceTrigger", + "com.azure.ai.projects.models.RequiredAction": "Azure.AI.Projects.Agents.RequiredAction", + "com.azure.ai.projects.models.RequiredFunctionToolCall": "Azure.AI.Projects.Agents.RequiredFunctionToolCall", + "com.azure.ai.projects.models.RequiredFunctionToolCallDetails": "Azure.AI.Projects.Agents.RequiredFunctionToolCallDetails", + "com.azure.ai.projects.models.RequiredToolCall": "Azure.AI.Projects.Agents.RequiredToolCall", + "com.azure.ai.projects.models.ResponseFormat": "Azure.AI.Projects.Agents.ResponseFormat", + "com.azure.ai.projects.models.ResponseFormatJsonSchema": "Azure.AI.Projects.Agents.ResponseFormatJsonSchema", + "com.azure.ai.projects.models.ResponseFormatJsonSchemaType": "Azure.AI.Projects.Agents.ResponseFormatJsonSchemaType", + "com.azure.ai.projects.models.RunAdditionalFieldList": "Azure.AI.Projects.Agents.RunAdditionalFieldList", + "com.azure.ai.projects.models.RunCompletionUsage": "Azure.AI.Projects.Agents.RunCompletionUsage", + "com.azure.ai.projects.models.RunError": "Azure.AI.Projects.Agents.RunError", + "com.azure.ai.projects.models.RunStatus": "Azure.AI.Projects.Agents.RunStatus", + "com.azure.ai.projects.models.RunStep": "Azure.AI.Projects.Agents.RunStep", + "com.azure.ai.projects.models.RunStepAzureAISearchToolCall": "Azure.AI.Projects.Agents.RunStepAzureAISearchToolCall", + "com.azure.ai.projects.models.RunStepBingGroundingToolCall": "Azure.AI.Projects.Agents.RunStepBingGroundingToolCall", + "com.azure.ai.projects.models.RunStepCodeInterpreterImageOutput": "Azure.AI.Projects.Agents.RunStepCodeInterpreterImageOutput", + "com.azure.ai.projects.models.RunStepCodeInterpreterImageReference": "Azure.AI.Projects.Agents.RunStepCodeInterpreterImageReference", + "com.azure.ai.projects.models.RunStepCodeInterpreterLogOutput": "Azure.AI.Projects.Agents.RunStepCodeInterpreterLogOutput", + "com.azure.ai.projects.models.RunStepCodeInterpreterToolCall": "Azure.AI.Projects.Agents.RunStepCodeInterpreterToolCall", + "com.azure.ai.projects.models.RunStepCodeInterpreterToolCallDetails": "Azure.AI.Projects.Agents.RunStepCodeInterpreterToolCallDetails", + "com.azure.ai.projects.models.RunStepCodeInterpreterToolCallOutput": "Azure.AI.Projects.Agents.RunStepCodeInterpreterToolCallOutput", + "com.azure.ai.projects.models.RunStepCompletionUsage": "Azure.AI.Projects.Agents.RunStepCompletionUsage", + "com.azure.ai.projects.models.RunStepCustomSearchToolCall": "Azure.AI.Projects.Agents.RunStepCustomSearchToolCall", + "com.azure.ai.projects.models.RunStepDelta": "Azure.AI.Projects.Agents.RunStepDelta", + "com.azure.ai.projects.models.RunStepDeltaChunk": "Azure.AI.Projects.Agents.RunStepDeltaChunk", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterDetailItemObject": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterDetailItemObject", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterImageOutput": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterImageOutput", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterImageOutputObject": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterImageOutputObject", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterLogOutput": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterLogOutput", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterOutput": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterOutput", + "com.azure.ai.projects.models.RunStepDeltaCodeInterpreterToolCall": "Azure.AI.Projects.Agents.RunStepDeltaCodeInterpreterToolCall", + "com.azure.ai.projects.models.RunStepDeltaDetail": "Azure.AI.Projects.Agents.RunStepDeltaDetail", + "com.azure.ai.projects.models.RunStepDeltaFileSearchToolCall": "Azure.AI.Projects.Agents.RunStepDeltaFileSearchToolCall", + "com.azure.ai.projects.models.RunStepDeltaFunction": "Azure.AI.Projects.Agents.RunStepDeltaFunction", + "com.azure.ai.projects.models.RunStepDeltaFunctionToolCall": "Azure.AI.Projects.Agents.RunStepDeltaFunctionToolCall", + "com.azure.ai.projects.models.RunStepDeltaMessageCreation": "Azure.AI.Projects.Agents.RunStepDeltaMessageCreation", + "com.azure.ai.projects.models.RunStepDeltaMessageCreationObject": "Azure.AI.Projects.Agents.RunStepDeltaMessageCreationObject", + "com.azure.ai.projects.models.RunStepDeltaToolCall": "Azure.AI.Projects.Agents.RunStepDeltaToolCall", + "com.azure.ai.projects.models.RunStepDeltaToolCallObject": "Azure.AI.Projects.Agents.RunStepDeltaToolCallObject", + "com.azure.ai.projects.models.RunStepDetails": "Azure.AI.Projects.Agents.RunStepDetails", + "com.azure.ai.projects.models.RunStepError": "Azure.AI.Projects.Agents.RunStepError", + "com.azure.ai.projects.models.RunStepErrorCode": "Azure.AI.Projects.Agents.RunStepErrorCode", + "com.azure.ai.projects.models.RunStepFileSearchToolCall": "Azure.AI.Projects.Agents.RunStepFileSearchToolCall", + "com.azure.ai.projects.models.RunStepFileSearchToolCallResult": "Azure.AI.Projects.Agents.RunStepFileSearchToolCallResult", + "com.azure.ai.projects.models.RunStepFileSearchToolCallResults": "Azure.AI.Projects.Agents.RunStepFileSearchToolCallResults", + "com.azure.ai.projects.models.RunStepFunctionToolCall": "Azure.AI.Projects.Agents.RunStepFunctionToolCall", + "com.azure.ai.projects.models.RunStepFunctionToolCallDetails": "Azure.AI.Projects.Agents.RunStepFunctionToolCallDetails", + "com.azure.ai.projects.models.RunStepMessageCreationDetails": "Azure.AI.Projects.Agents.RunStepMessageCreationDetails", + "com.azure.ai.projects.models.RunStepMessageCreationReference": "Azure.AI.Projects.Agents.RunStepMessageCreationReference", + "com.azure.ai.projects.models.RunStepMicrosoftFabricToolCall": "Azure.AI.Projects.Agents.RunStepMicrosoftFabricToolCall", + "com.azure.ai.projects.models.RunStepOpenApiToolCall": "Azure.AI.Projects.Agents.RunStepOpenAPIToolCall", + "com.azure.ai.projects.models.RunStepSharepointToolCall": "Azure.AI.Projects.Agents.RunStepSharepointToolCall", + "com.azure.ai.projects.models.RunStepStatus": "Azure.AI.Projects.Agents.RunStepStatus", + "com.azure.ai.projects.models.RunStepStreamEvent": "Azure.AI.Projects.Agents.RunStepStreamEvent", + "com.azure.ai.projects.models.RunStepToolCall": "Azure.AI.Projects.Agents.RunStepToolCall", + "com.azure.ai.projects.models.RunStepToolCallDetails": "Azure.AI.Projects.Agents.RunStepToolCallDetails", + "com.azure.ai.projects.models.RunStepType": "Azure.AI.Projects.Agents.RunStepType", + "com.azure.ai.projects.models.RunStreamEvent": "Azure.AI.Projects.Agents.RunStreamEvent", + "com.azure.ai.projects.models.SearchConfiguration": "Azure.AI.Projects.Agents.SearchConfiguration", + "com.azure.ai.projects.models.SearchConfigurationList": "Azure.AI.Projects.Agents.SearchConfigurationList", + "com.azure.ai.projects.models.SharepointToolDefinition": "Azure.AI.Projects.Agents.SharepointToolDefinition", + "com.azure.ai.projects.models.SubmitToolOutputsAction": "Azure.AI.Projects.Agents.SubmitToolOutputsAction", + "com.azure.ai.projects.models.SubmitToolOutputsDetails": "Azure.AI.Projects.Agents.SubmitToolOutputsDetails", + "com.azure.ai.projects.models.SystemData": "Azure.AI.Projects.SystemData", + "com.azure.ai.projects.models.TargetModelConfig": "Azure.AI.Projects.TargetModelConfig", + "com.azure.ai.projects.models.ThreadDeletionStatus": "Azure.AI.Projects.Agents.ThreadDeletionStatus", + "com.azure.ai.projects.models.ThreadMessage": "Azure.AI.Projects.Agents.ThreadMessage", + "com.azure.ai.projects.models.ThreadMessageOptions": "Azure.AI.Projects.Agents.ThreadMessageOptions", + "com.azure.ai.projects.models.ThreadRun": "Azure.AI.Projects.Agents.ThreadRun", + "com.azure.ai.projects.models.ThreadStreamEvent": "Azure.AI.Projects.Agents.ThreadStreamEvent", + "com.azure.ai.projects.models.ToolConnection": "Azure.AI.Projects.Agents.ToolConnection", + "com.azure.ai.projects.models.ToolConnectionList": "Azure.AI.Projects.Agents.ToolConnectionList", + "com.azure.ai.projects.models.ToolDefinition": "Azure.AI.Projects.Agents.ToolDefinition", + "com.azure.ai.projects.models.ToolOutput": "Azure.AI.Projects.Agents.ToolOutput", + "com.azure.ai.projects.models.ToolResources": "Azure.AI.Projects.Agents.ToolResources", + "com.azure.ai.projects.models.Trigger": "Azure.AI.Projects.Trigger", + "com.azure.ai.projects.models.TruncationObject": "Azure.AI.Projects.Agents.TruncationObject", + "com.azure.ai.projects.models.TruncationStrategy": "Azure.AI.Projects.Agents.TruncationStrategy", + "com.azure.ai.projects.models.UpdateAgentOptions": null, + "com.azure.ai.projects.models.UpdateCodeInterpreterToolResourceOptions": "Azure.AI.Projects.Agents.UpdateCodeInterpreterToolResourceOptions", + "com.azure.ai.projects.models.UpdateFileSearchToolResourceOptions": "Azure.AI.Projects.Agents.UpdateFileSearchToolResourceOptions", + "com.azure.ai.projects.models.UpdateToolResourcesOptions": "Azure.AI.Projects.Agents.UpdateToolResourcesOptions", + "com.azure.ai.projects.models.UploadFileRequest": "Azure.AI.Projects.Agents.uploadFile.Request.anonymous", + "com.azure.ai.projects.models.VectorStore": "Azure.AI.Projects.Agents.VectorStore", + "com.azure.ai.projects.models.VectorStoreAutoChunkingStrategyRequest": "Azure.AI.Projects.Agents.VectorStoreAutoChunkingStrategyRequest", + "com.azure.ai.projects.models.VectorStoreAutoChunkingStrategyResponse": "Azure.AI.Projects.Agents.VectorStoreAutoChunkingStrategyResponse", + "com.azure.ai.projects.models.VectorStoreChunkingStrategyRequest": "Azure.AI.Projects.Agents.VectorStoreChunkingStrategyRequest", + "com.azure.ai.projects.models.VectorStoreChunkingStrategyRequestType": "Azure.AI.Projects.Agents.VectorStoreChunkingStrategyRequestType", + "com.azure.ai.projects.models.VectorStoreChunkingStrategyResponse": "Azure.AI.Projects.Agents.VectorStoreChunkingStrategyResponse", + "com.azure.ai.projects.models.VectorStoreChunkingStrategyResponseType": "Azure.AI.Projects.Agents.VectorStoreChunkingStrategyResponseType", + "com.azure.ai.projects.models.VectorStoreConfiguration": "Azure.AI.Projects.Agents.VectorStoreConfiguration", + "com.azure.ai.projects.models.VectorStoreConfigurations": "Azure.AI.Projects.Agents.VectorStoreConfigurations", + "com.azure.ai.projects.models.VectorStoreDataSource": "Azure.AI.Projects.Agents.VectorStoreDataSource", + "com.azure.ai.projects.models.VectorStoreDataSourceAssetType": "Azure.AI.Projects.Agents.VectorStoreDataSourceAssetType", + "com.azure.ai.projects.models.VectorStoreDeletionStatus": "Azure.AI.Projects.Agents.VectorStoreDeletionStatus", + "com.azure.ai.projects.models.VectorStoreExpirationPolicy": "Azure.AI.Projects.Agents.VectorStoreExpirationPolicy", + "com.azure.ai.projects.models.VectorStoreExpirationPolicyAnchor": "Azure.AI.Projects.Agents.VectorStoreExpirationPolicyAnchor", + "com.azure.ai.projects.models.VectorStoreFile": "Azure.AI.Projects.Agents.VectorStoreFile", + "com.azure.ai.projects.models.VectorStoreFileBatch": "Azure.AI.Projects.Agents.VectorStoreFileBatch", + "com.azure.ai.projects.models.VectorStoreFileBatchStatus": "Azure.AI.Projects.Agents.VectorStoreFileBatchStatus", + "com.azure.ai.projects.models.VectorStoreFileCount": "Azure.AI.Projects.Agents.VectorStoreFileCount", + "com.azure.ai.projects.models.VectorStoreFileDeletionStatus": "Azure.AI.Projects.Agents.VectorStoreFileDeletionStatus", + "com.azure.ai.projects.models.VectorStoreFileError": "Azure.AI.Projects.Agents.VectorStoreFileError", + "com.azure.ai.projects.models.VectorStoreFileErrorCode": "Azure.AI.Projects.Agents.VectorStoreFileErrorCode", + "com.azure.ai.projects.models.VectorStoreFileStatus": "Azure.AI.Projects.Agents.VectorStoreFileStatus", + "com.azure.ai.projects.models.VectorStoreFileStatusFilter": "Azure.AI.Projects.Agents.VectorStoreFileStatusFilter", + "com.azure.ai.projects.models.VectorStoreStaticChunkingStrategyOptions": "Azure.AI.Projects.Agents.VectorStoreStaticChunkingStrategyOptions", + "com.azure.ai.projects.models.VectorStoreStaticChunkingStrategyRequest": "Azure.AI.Projects.Agents.VectorStoreStaticChunkingStrategyRequest", + "com.azure.ai.projects.models.VectorStoreStaticChunkingStrategyResponse": "Azure.AI.Projects.Agents.VectorStoreStaticChunkingStrategyResponse", + "com.azure.ai.projects.models.VectorStoreStatus": "Azure.AI.Projects.Agents.VectorStoreStatus", + "com.azure.ai.projects.models.WeekDays": "Azure.AI.Projects.WeekDays" + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/resources/azure-ai-projects.properties b/sdk/ai/azure-ai-projects/src/main/resources/azure-ai-projects.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/resources/azure-ai-projects.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ReadmeSamples.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ReadmeSamples.java new file mode 100644 index 000000000000..52d1b33e83df --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/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.projects; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.ai.projects.readme + // END: com.azure.ai.projects.readme + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAdditionalMessageSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAdditionalMessageSample.java new file mode 100644 index 000000000000..d0e9f48233ce --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAdditionalMessageSample.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public final class AgentAdditionalMessageSample { + + @Test + void additionalMessageExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String agentName = "additional_message_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a personal electronics tutor. Write and run code to answer questions.") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What is the impedance formula?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalMessages(Arrays.asList(new ThreadMessageOptions( + MessageRole.AGENT, BinaryData.fromString("E=mc^2") + ), new ThreadMessageOptions( + MessageRole.USER, BinaryData.fromString("What is the impedance formula?") + ))); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureAISearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureAISearchSample.java new file mode 100644 index 000000000000..b1eeba617141 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureAISearchSample.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.AISearchIndexResource; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.AzureAISearchResource; +import com.azure.ai.projects.models.AzureAISearchToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolResources; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentAzureAISearchSample { + + @Test + void aiSearchExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String aiSearchConnectionId = Configuration.getGlobalConfiguration().get("AI_SEARCH_CONNECTION_ID", ""); + + ToolResources toolResources = new ToolResources() + .setAzureAISearch(new AzureAISearchResource() + .setIndexList(Arrays.asList(new AISearchIndexResource(aiSearchConnectionId, "sample_index")))); + + String agentName = "ai_search_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new AzureAISearchToolDefinition())) + .setToolResources(toolResources); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "Hello, send an email with the datetime and weather information in New York?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureFunctionSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureFunctionSample.java new file mode 100644 index 000000000000..bf166bd1ffa3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentAzureFunctionSample.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.implementation.models.CreateAgentRequest; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.AzureFunctionBinding; +import com.azure.ai.projects.models.AzureFunctionDefinition; +import com.azure.ai.projects.models.AzureFunctionStorageQueue; +import com.azure.ai.projects.models.AzureFunctionToolDefinition; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FunctionDefinition; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class AgentAzureFunctionSample { + + @Test + @Disabled + void azureFunctionExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String storageQueueUri = Configuration.getGlobalConfiguration().get("STORAGE_QUEUE_URI", ""); + String azureFunctionName = Configuration.getGlobalConfiguration().get("AZURE_FUNCTION_NAME", ""); + + FunctionDefinition fnDef = new FunctionDefinition( + azureFunctionName, + BinaryData.fromObject( + mapOf( + "type", "object", + "properties", mapOf( + "location", + mapOf("type", "string", "description", "The location to look up") + ), + "required", new String[]{"location"} + ) + ) + ); + AzureFunctionDefinition azureFnDef = new AzureFunctionDefinition( + fnDef, + new AzureFunctionBinding(new AzureFunctionStorageQueue(storageQueueUri, "agent-input")), + new AzureFunctionBinding(new AzureFunctionStorageQueue(storageQueueUri, "agent-output")) + ); + AzureFunctionToolDefinition azureFnTool = new AzureFunctionToolDefinition(azureFnDef); + + String agentName = "azure_function_example"; + RequestOptions requestOptions = new RequestOptions() + .setHeader(HttpHeaderName.fromString("x-ms-enable-preview"), "true"); + CreateAgentRequest createAgentRequestObj = new CreateAgentRequest("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent. Use the provided function any time " + + "you are asked with the weather of any location") + .setTools(Arrays.asList(azureFnTool)); + BinaryData createAgentRequest = BinaryData.fromObject(createAgentRequestObj); + Agent agent = agentsClient.createAgentWithResponse(createAgentRequest, requestOptions) + .getValue().toObject(Agent.class); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What is the weather in Seattle, WA?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBasicSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBasicSample.java new file mode 100644 index 000000000000..a25b01f65b5a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBasicSample.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public final class AgentBasicSample { + + @Test + void basicExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String agentName = "basic_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBingGroundingSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBingGroundingSample.java new file mode 100644 index 000000000000..a87574ba4807 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentBingGroundingSample.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.BingGroundingToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolConnection; +import com.azure.ai.projects.models.ToolConnectionList; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentBingGroundingSample { + + @Test + void bingGroundingExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String bingConnectionId = Configuration.getGlobalConfiguration().get("BING_CONNECTION_ID", ""); + ToolConnectionList toolConnectionList = new ToolConnectionList() + .setConnectionList(Arrays.asList(new ToolConnection(bingConnectionId))); + BingGroundingToolDefinition bingGroundingTool = new BingGroundingToolDefinition(toolConnectionList); + + String agentName = "bing_grounding_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-35-turbo") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(bingGroundingTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "How does wikipedia explain Euler's Identity?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterEnterpriseFileSearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterEnterpriseFileSearchSample.java new file mode 100644 index 000000000000..fa8e43613cfe --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterEnterpriseFileSearchSample.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDataSourceAssetType; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentCodeInterpreterEnterpriseFileSearchSample { + + @Test + void codeInterpreterEnterpriseFileSearchExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String agentName = "code_interpreter_enterprise_file_search_example"; + CodeInterpreterToolDefinition ciTool = new CodeInterpreterToolDefinition(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(ciTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreDataSource vectorStoreDataSource = new VectorStoreDataSource( + dataUri, VectorStoreDataSourceAssetType.URI_ASSET); + + MessageAttachment messageAttachment = new MessageAttachment( + Arrays.asList(BinaryData.fromObject(ciTool)) + ).setDataSource(vectorStoreDataSource); + + AgentThread thread = agentsClient.createThread(); + + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What does the attachment say?", + Arrays.asList(messageAttachment), + null + ); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterFileAttachmentSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterFileAttachmentSample.java new file mode 100644 index 000000000000..f8936406d8ec --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentCodeInterpreterFileAttachmentSample.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FileDetails; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Path; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +public class AgentCodeInterpreterFileAttachmentSample { + + @Test + void codeInterpreterFileAttachmentExample() throws FileNotFoundException, URISyntaxException { + AgentsClient agentsClient = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")).subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")).resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")).projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")).credential(new DefaultAzureCredentialBuilder().build()).buildAgentsClient(); + + Path htmlFile = getFile("sample_test.html"); + + String agentName = "code_interpreter_file_attachment_example"; + CodeInterpreterToolDefinition ciTool = new CodeInterpreterToolDefinition(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName).setInstructions("You are a helpful agent").setTools(Arrays.asList(ciTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + OpenAIFile uploadedFile = agentsClient.uploadFile(new UploadFileRequest(new FileDetails(BinaryData.fromFile(htmlFile)).setFilename("sample_test.html"), FilePurpose.AGENTS)); + + MessageAttachment messageAttachment = new MessageAttachment(Arrays.asList(BinaryData.fromObject(ciTool))).setFileId(uploadedFile.getId()); + + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + ThreadMessage createdMessage = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What does the attachment say?", Arrays.asList(messageAttachment), null); + assertNotNull(createdMessage); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + assertNotNull(threadRun); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED || threadRun.getStatus() == RunStatus.IN_PROGRESS || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + private Path getFile(String fileName) throws FileNotFoundException, URISyntaxException { + URL resource = getClass().getClassLoader().getResource(fileName); + if (resource == null) { + throw new FileNotFoundException("File not found"); + } + File file = new File(resource.toURI()); + return file.toPath(); + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentEnterpriseFileSearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentEnterpriseFileSearchSample.java new file mode 100644 index 000000000000..b337e95710bb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentEnterpriseFileSearchSample.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FileSearchToolDefinition; +import com.azure.ai.projects.models.FileSearchToolResource; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDataSourceAssetType; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentEnterpriseFileSearchSample { + + @Test + void enterpriseFileSearchExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreDataSource vectorStoreDataSource = new VectorStoreDataSource( + dataUri, VectorStoreDataSourceAssetType.URI_ASSET); + + VectorStore vs = agentsClient.createVectorStore( + null, "sample_vector_store", + new VectorStoreConfiguration(Arrays.asList(vectorStoreDataSource)), + null, null, null + ); + + FileSearchToolResource fileSearchToolResource = new FileSearchToolResource() + .setVectorStoreIds(Arrays.asList(vs.getId())); + + String agentName = "enterprise_file_search_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new FileSearchToolDefinition())) + .setToolResources(new ToolResources().setFileSearch(fileSearchToolResource)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What is data about?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFileSearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFileSearchSample.java new file mode 100644 index 000000000000..ef8d030a1a52 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFileSearchSample.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FileDetails; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.FileSearchToolDefinition; +import com.azure.ai.projects.models.FileSearchToolResource; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreStatus; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentFileSearchSample { + + @Test + void fileSearchExample() throws InterruptedException { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + OpenAIFile uploadedAgentFile = agentsClient.uploadFile( + new UploadFileRequest( + new FileDetails( + BinaryData.fromString("The word `apple` uses the code 442345, while the word `banana` uses the code 673457.")) + .setFilename("sample_file_for_upload.txt"), + FilePurpose.AGENTS)); + + VectorStore vectorStore = agentsClient.createVectorStore( + Arrays.asList(uploadedAgentFile.getId()), + "my_vector_store", + null, null, null, null); + + do { + Thread.sleep(500); + vectorStore = agentsClient.getVectorStore(vectorStore.getId()); + } + while (vectorStore.getStatus() == VectorStoreStatus.IN_PROGRESS); + + FileSearchToolResource fileSearchToolResource = new FileSearchToolResource() + .setVectorStoreIds(Arrays.asList(vectorStore.getId())); + + String agentName = "file_search_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent that can help fetch data from files you know about.") + .setTools(Arrays.asList(new FileSearchToolDefinition())) + .setToolResources(new ToolResources().setFileSearch(fileSearchToolResource)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "Can you give me the documented codes for 'banana' and 'orange'?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsSample.java new file mode 100644 index 000000000000..24ec967953c0 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsSample.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FunctionDefinition; +import com.azure.ai.projects.models.FunctionToolDefinition; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RequiredFunctionToolCall; +import com.azure.ai.projects.models.RequiredToolCall; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.SubmitToolOutputsAction; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolOutput; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.junit.jupiter.api.Test; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; + +public class AgentFunctionsSample { + + @Test + void functionsExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + Supplier getUserFavoriteCity = () -> "Seattle, WA"; + FunctionToolDefinition getUserFavoriteCityTool = new FunctionToolDefinition( + new FunctionDefinition( + "getUserFavoriteCity", + BinaryData.fromObject( + new Object() + )) + ); + + Function getCityNickname = location -> { + return "The Emerald City"; + }; + + FunctionToolDefinition getCityNicknameTool = new FunctionToolDefinition( + new FunctionDefinition( + "getCityNickname", + BinaryData.fromObject( + mapOf( + "type", "object", + "properties", mapOf( + "location", + mapOf( + "type", "string", + "description", "The city and state, e.g. San Francisco, CA") + ), + "required", new String[]{"location"})) + ).setDescription("Get the nickname of a city") + ); + + Function getResolvedToolOutput = toolCall -> { + if (toolCall instanceof RequiredFunctionToolCall) { + RequiredFunctionToolCall functionToolCall = (RequiredFunctionToolCall) toolCall; + String functionName = functionToolCall.getFunction().getName(); + if (functionName.equals("getUserFavoriteCity")) { + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getUserFavoriteCity.get()); + } else if (functionName.equals("getCityNickname")) { + String args = functionToolCall.getFunction().getArguments(); + try { + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getCityNickname.apply(location)); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + } + return null; + }; + + String agentName = "functions_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a weather bot. Use the provided functions to help answer questions. " + + "Customize your responses to the user's preferences as much as possible and use friendly " + + "nicknames for cities whenever possible.") + .setTools(Arrays.asList(getUserFavoriteCityTool, getCityNicknameTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What's the nickname of my favorite city?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + if (threadRun.getStatus() == RunStatus.REQUIRES_ACTION + && threadRun.getRequiredAction() instanceof SubmitToolOutputsAction) { + SubmitToolOutputsAction submitToolsOutputAction = (SubmitToolOutputsAction) (threadRun.getRequiredAction()); + ArrayList toolOutputs = new ArrayList(); + for (RequiredToolCall toolCall : submitToolsOutputAction.getSubmitToolOutputs().getToolCalls()) { + toolOutputs.add(getResolvedToolOutput.apply(toolCall)); + } + threadRun = agentsClient.submitToolOutputsToRun(thread.getId(), threadRun.getId(), toolOutputs); + } + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsStreamingSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsStreamingSample.java new file mode 100644 index 000000000000..56605e08ea97 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentFunctionsStreamingSample.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FunctionDefinition; +import com.azure.ai.projects.models.FunctionToolDefinition; +import com.azure.ai.projects.models.MessageDeltaImageFileContent; +import com.azure.ai.projects.models.MessageDeltaTextContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.RequiredFunctionToolCall; +import com.azure.ai.projects.models.RequiredToolCall; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.SubmitToolOutputsAction; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolOutput; +import com.azure.ai.projects.models.streaming.StreamMessageUpdate; +import com.azure.ai.projects.models.streaming.StreamRequiredAction; +import com.azure.ai.projects.models.streaming.StreamThreadRunCreation; +import com.azure.ai.projects.models.streaming.StreamUpdate; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Supplier; + +public class AgentFunctionsStreamingSample { + + @Test + void functionsStreamingExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + // function tool definitions + FunctionToolDefinition getUserFavoriteCityTool = new FunctionToolDefinition( + new FunctionDefinition( + "getUserFavoriteCity", + BinaryData.fromObject( + new Object() + )).setDescription("Gets the user's favorite city.") + ); + + FunctionToolDefinition getCityNicknameTool = new FunctionToolDefinition( + new FunctionDefinition( + "getCityNickname", + BinaryData.fromObject( + mapOf( + "type", "object", + "properties", mapOf( + "location", mapOf( + "type", "string", + "description", "The city and state, e.g. San Francisco, CA") + ), + "required", new String[]{"location"})) + ).setDescription("Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.") + ); + + FunctionToolDefinition getCurrentWeatherAtLocationTool = new FunctionToolDefinition( + new FunctionDefinition( + "getCurrentWeatherAtLocation", + BinaryData.fromObject( + mapOf( + "type", "object", + "properties", mapOf( + "location", mapOf( + "type", "string", + "description", "The city and state, e.g. San Francisco, CA"), + "unit", mapOf( + "type", "string", + "description", "temperature unit as c or f", + "enum", new String[]{"c", "f"})), + "required", new String[]{"location", "unit"})) + ).setDescription("Gets the current weather at a provided location.") + ); + + // actual functions + Supplier getUserFavoriteCity = () -> "Seattle, WA"; + + Function getCityNickname = (location) -> { + switch (location) { + case "Seattle, WA": + return "The Emerald city"; + default: + return "No nickname available"; + } + }; + + BiFunction getCurrentWeatherAtLocation = (location, unit) -> { + switch (location) { + case "Seattle, WA": + return unit == "f" ? "70f" : "21c"; + default: + return "unknown"; + } + }; + + // function resolver + Function getResolvedToolOutput = toolCall -> { + if (toolCall instanceof RequiredFunctionToolCall) { + try { + RequiredFunctionToolCall functionToolCall = (RequiredFunctionToolCall) toolCall; + String functionName = functionToolCall.getFunction().getName(); + if (functionName.equals("getUserFavoriteCity")) { + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getUserFavoriteCity.get()); + } else if (functionName.equals("getCityNickname")) { + String args = functionToolCall.getFunction().getArguments(); + + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getCityNickname.apply(location)); + + } else if (functionName.equals("getCurrentWeatherAtLocation")) { + String args = functionToolCall.getFunction().getArguments(); + + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + String unit = String.valueOf(root.get("unit").asText()); + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getCurrentWeatherAtLocation.apply(location, unit)); + } + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + return null; + }; + + String agentName = "functions_streaming_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a weather bot. Use the provided functions to help answer questions. " + + "Customize your responses to the user's preferences as much as possible and use friendly " + + "nicknames for cities whenever possible.") + .setTools(Arrays.asList(getUserFavoriteCityTool, getCityNicknameTool, getCurrentWeatherAtLocationTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What's the weather like in my favorite city?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + + try { + Flux streamingUpdates = agentsClient.createRunStreaming(createRunOptions); + + + streamingUpdates.doOnNext( + streamUpdate -> { + if (streamUpdate.getKind() == AgentStreamEvent.THREAD_RUN_CREATED) { + System.out.println("----- Run started! -----"); + } else if (streamUpdate instanceof StreamRequiredAction) { + StreamRequiredAction actionUpdate = (StreamRequiredAction) streamUpdate; + AtomicReference streamRun = new AtomicReference<>(actionUpdate.getMessage()); + + while (streamRun.get().getStatus() == RunStatus.REQUIRES_ACTION) { + List toolOutputs = new ArrayList<>(); + + SubmitToolOutputsAction submitToolsOutputAction = (SubmitToolOutputsAction) (streamRun.get().getRequiredAction()); + for (RequiredToolCall toolCall : submitToolsOutputAction.getSubmitToolOutputs().getToolCalls()) { + toolOutputs.add(getResolvedToolOutput.apply(toolCall)); + } + + agentsClient.submitToolOutputsToRunStreaming( + streamRun.get().getThreadId(), + streamRun.get().getId(), + toolOutputs + ).doOnNext(update -> { + if (update instanceof StreamRequiredAction) { + streamRun.set(((StreamRequiredAction) update).getMessage()); + } else if (update instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) update; + printStreamUpdate(messageUpdate); + } else if (update.getKind() == AgentStreamEvent.THREAD_RUN_COMPLETED) { + streamRun.set(((StreamThreadRunCreation) update).getMessage()); + } + }).blockLast(); + } + } else if (streamUpdate instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) streamUpdate; + printStreamUpdate(messageUpdate); + } + } + ).blockLast(); + + System.out.println(); + } catch (Exception ex) { + throw ex; + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + void printStreamUpdate(StreamMessageUpdate messageUpdate) { + messageUpdate.getMessage().getDelta().getContent().stream().forEach(delta -> { + if (delta instanceof MessageDeltaImageFileContent) { + MessageDeltaImageFileContent imgContent = (MessageDeltaImageFileContent) delta; + System.out.println("Image fileId: " + imgContent.getImageFile().getFileId()); + } else if (delta instanceof MessageDeltaTextContent) { + MessageDeltaTextContent textContent = (MessageDeltaTextContent) delta; + System.out.print(textContent.getText().getValue()); + } + }); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentOpenApiSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentOpenApiSample.java new file mode 100644 index 000000000000..7f11d0a882b5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentOpenApiSample.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.OpenApiAnonymousAuthDetails; +import com.azure.ai.projects.models.OpenApiFunctionDefinition; +import com.azure.ai.projects.models.OpenApiToolDefinition; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; + +public class AgentOpenApiSample { + + @Test + void openApiExample() throws IOException, URISyntaxException { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + Path filePath = getFile("weather_openapi.json"); + JsonReader reader = JsonProviders.createReader(Files.readAllBytes(filePath)); + + OpenApiAnonymousAuthDetails oaiAuth = new OpenApiAnonymousAuthDetails(); + OpenApiToolDefinition openApiTool = new OpenApiToolDefinition(new OpenApiFunctionDefinition( + "openapitool", + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())), + oaiAuth + )); + + String agentName = "openAPI_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(openApiTool)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What's the weather in seattle?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + private Path getFile(String fileName) throws FileNotFoundException, URISyntaxException { + URL resource = getClass().getClassLoader().getResource(fileName); + if (resource == null) { + throw new FileNotFoundException("File not found"); + } + File file = new File(resource.toURI()); + return file.toPath(); + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentStreamingSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentStreamingSample.java new file mode 100644 index 000000000000..49e17c2b0cdc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentStreamingSample.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentStreamEvent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.MessageDeltaImageFileContent; +import com.azure.ai.projects.models.MessageDeltaTextContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.streaming.StreamMessageUpdate; +import com.azure.ai.projects.models.streaming.StreamUpdate; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import java.util.Arrays; + +public class AgentStreamingSample { + + @Test + void agentStreamingExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String agentName = "agent_streaming_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You politely help with math questions. Use the code interpreter tool when asked to visualize numbers.") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "Hi, Assistant! Draw a graph for a line with a slope of 4 and y-intercept of 9."); + + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + + try { + Flux streamingUpdates = agentsClient.createRunStreaming(createRunOptions); + + streamingUpdates.doOnNext( + streamUpdate -> { + if (streamUpdate.getKind() == AgentStreamEvent.THREAD_RUN_CREATED) { + System.out.println("----- Run started! -----"); + } else if (streamUpdate instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) streamUpdate; + messageUpdate.getMessage().getDelta().getContent().stream().forEach(delta -> { + if (delta instanceof MessageDeltaImageFileContent) { + MessageDeltaImageFileContent imgContent = (MessageDeltaImageFileContent) delta; + System.out.println("Image fileId: " + imgContent.getImageFile().getFileId()); + } else if (delta instanceof MessageDeltaTextContent) { + MessageDeltaTextContent textContent = (MessageDeltaTextContent) delta; + System.out.print(textContent.getText().getValue()); + } + }); + } + } + ).blockLast(); + + System.out.println(); + } catch (Exception ex) { + throw ex; + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchEnterpriseFileSearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchEnterpriseFileSearchSample.java new file mode 100644 index 000000000000..9418394888b9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchEnterpriseFileSearchSample.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FileSearchToolDefinition; +import com.azure.ai.projects.models.FileSearchToolResource; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDataSourceAssetType; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.util.Arrays; + +public class AgentVectorStoreBatchEnterpriseFileSearchSample { + + @Test + void vectorStoreBatchEnterpriseFileSearchExample() { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreDataSource vectorStoreDataSource = new VectorStoreDataSource( + dataUri, VectorStoreDataSourceAssetType.URI_ASSET); + + VectorStore vs = agentsClient.createVectorStore( + null, "sample_vector_store", + new VectorStoreConfiguration(Arrays.asList(vectorStoreDataSource)), + null, null, null + ); + + agentsClient.createVectorStoreFileBatch(vs.getId(), + null, Arrays.asList(vectorStoreDataSource), null); + + FileSearchToolResource fileSearchToolResource = new FileSearchToolResource() + .setVectorStoreIds(Arrays.asList(vs.getId())); + + String agentName = "vector_store_batch_enterprise_file_search_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new FileSearchToolDefinition())) + .setToolResources(new ToolResources().setFileSearch(fileSearchToolResource)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What feature does Smart Eyewear offer?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchFileSearchSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchFileSearchSample.java new file mode 100644 index 000000000000..5949f32d548f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/usage/agent/AgentVectorStoreBatchFileSearchSample.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.projects.usage.agent; + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.AgentThread; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.FileDetails; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.FileSearchToolDefinition; +import com.azure.ai.projects.models.FileSearchToolResource; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageImageFileContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.OpenAIPageableListOfThreadMessage; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolResources; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreFileBatch; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Path; +import java.util.Arrays; + +public class AgentVectorStoreBatchFileSearchSample { + @Test + void vectorStoreBatchFileSearchExample() throws FileNotFoundException, URISyntaxException { + AgentsClient agentsClient + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAgentsClient(); + + Path productFile = getFile("product_info_1.md"); + + VectorStore vectorStore = agentsClient.createVectorStore( + null, "my_vector_store", + null, null, null, null); + + OpenAIFile uploadedAgentFile = agentsClient.uploadFile(new UploadFileRequest( + new FileDetails( + BinaryData.fromFile(productFile)) + .setFilename("sample_product_info.md"), + FilePurpose.AGENTS)); + + VectorStoreFileBatch vectorStoreFileBatch = agentsClient.createVectorStoreFileBatch( + vectorStore.getId(), Arrays.asList(uploadedAgentFile.getId()), null, null); + + FileSearchToolResource fileSearchToolResource = new FileSearchToolResource() + .setVectorStoreIds(Arrays.asList(vectorStore.getId())); + + String agentName = "vector_store_batch_file_search_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") + .setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new FileSearchToolDefinition())) + .setToolResources(new ToolResources().setFileSearch(fileSearchToolResource)); + Agent agent = agentsClient.createAgent(createAgentOptions); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage( + thread.getId(), + MessageRole.USER, + "What feature does Smart Eyewear offer?"); + + //run agent + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()) + .setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } + while ( + threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println(threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + for (ThreadMessage message : runMessages.getData()) { + System.out.print(String.format("%1$s - %2$s : ", message.getCreatedAt(), message.getRole())); + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + System.out.print((((MessageTextContent) contentItem).getText().getValue())); + } else if (contentItem instanceof MessageImageFileContent) { + String imageFileId = (((MessageImageFileContent) contentItem).getImageFile().getFileId()); + System.out.print("Image from ID: " + imageFileId); + } + System.out.println(); + } + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + //cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + private Path getFile(String fileName) throws FileNotFoundException, URISyntaxException { + URL resource = getClass().getClassLoader().getResource(fileName); + if (resource == null) { + throw new FileNotFoundException("File not found"); + } + File file = new File(resource.toURI()); + return file.toPath(); + } +} diff --git a/sdk/ai/azure-ai-projects/src/samples/resources/product_info_1.md b/sdk/ai/azure-ai-projects/src/samples/resources/product_info_1.md new file mode 100644 index 000000000000..041155831d53 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/resources/product_info_1.md @@ -0,0 +1,51 @@ +# Information about product item_number: 1 + +## Brand +Contoso Galaxy Innovations + +## Category +Smart Eyewear + +## Features +- Augmented Reality interface +- Voice-controlled AI assistant +- HD video recording with 3D audio +- UV protection and blue light filtering +- Wireless charging with extended battery life + +## User Guide + +### 1. Introduction +Introduction to your new SmartView Glasses + +### 2. Product Overview +Overview of features and controls + +### 3. Sizing and Fit +Finding your perfect fit and style adjustments + +### 4. Proper Care and Maintenance +Cleaning and caring for your SmartView Glasses + +### 5. Break-in Period +Adjusting to the augmented reality experience + +### 6. Safety Tips +Safety guidelines for public and private spaces + +### 7. Troubleshooting +Quick fixes for common issues + +## Warranty Information +Two-year limited warranty on all electronic components + +## Contact Information +Customer Support at support@contoso-galaxy-innovations.com + +## Return Policy +30-day return policy with no questions asked + +## FAQ +- How to sync your SmartView Glasses with your devices +- Troubleshooting connection issues +- Customizing your augmented reality environment diff --git a/sdk/ai/azure-ai-projects/src/samples/resources/sample_test.html b/sdk/ai/azure-ai-projects/src/samples/resources/sample_test.html new file mode 100644 index 000000000000..a94253429cdb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/resources/sample_test.html @@ -0,0 +1,12 @@ + + + + + + Sample Document + + +

This is a sample document about Java

+

Java is an object oriented language

+ + diff --git a/sdk/ai/azure-ai-projects/src/samples/resources/weather_openapi.json b/sdk/ai/azure-ai-projects/src/samples/resources/weather_openapi.json new file mode 100644 index 000000000000..6cadfa516c19 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/samples/resources/weather_openapi.json @@ -0,0 +1,62 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "get weather data", + "description": "Retrieves current weather data for a location based on wttr.in.", + "version": "v1.0.0" + }, + "servers": [ + { + "url": "https://wttr.in" + } + ], + "auth": [], + "paths": { + "/{location}": { + "get": { + "description": "Get weather information for a specific location", + "operationId": "GetCurrentWeather", + "parameters": [ + { + "name": "location", + "in": "path", + "description": "City or location to retrieve the weather for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "format", + "in": "query", + "description": "Always use j1 value for this parameter", + "required": true, + "schema": { + "type": "string", + "default": "j1" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Location not found" + } + }, + "deprecated": false + } + } + }, + "components": { + "schemes": {} + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsAsyncClientTest.java new file mode 100644 index 000000000000..68fc8ed84bbd --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsAsyncClientTest.java @@ -0,0 +1,998 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.projects; + +import com.azure.ai.projects.generated.AIProjectClientTestBase; +import com.azure.ai.projects.models.Agent; +import com.azure.ai.projects.models.CodeInterpreterToolDefinition; +import com.azure.ai.projects.models.CreateAgentOptions; +import com.azure.ai.projects.models.CreateRunOptions; +import com.azure.ai.projects.models.CreateThreadAndRunOptions; +import com.azure.ai.projects.models.FileDetails; +import com.azure.ai.projects.models.FilePurpose; +import com.azure.ai.projects.models.FileSearchToolResource; +import com.azure.ai.projects.models.FunctionDefinition; +import com.azure.ai.projects.models.FunctionToolDefinition; +import com.azure.ai.projects.models.ListSortOrder; +import com.azure.ai.projects.models.MessageAttachment; +import com.azure.ai.projects.models.MessageContent; +import com.azure.ai.projects.models.MessageRole; +import com.azure.ai.projects.models.MessageTextContent; +import com.azure.ai.projects.models.OpenAIFile; +import com.azure.ai.projects.models.RequiredFunctionToolCall; +import com.azure.ai.projects.models.RequiredToolCall; +import com.azure.ai.projects.models.RunStatus; +import com.azure.ai.projects.models.SubmitToolOutputsAction; +import com.azure.ai.projects.models.ThreadMessage; +import com.azure.ai.projects.models.ThreadMessageOptions; +import com.azure.ai.projects.models.ThreadRun; +import com.azure.ai.projects.models.ToolOutput; +import com.azure.ai.projects.models.UpdateAgentOptions; +import com.azure.ai.projects.models.UploadFileRequest; +import com.azure.ai.projects.models.VectorStore; +import com.azure.ai.projects.models.VectorStoreConfiguration; +import com.azure.ai.projects.models.VectorStoreDataSource; +import com.azure.ai.projects.models.VectorStoreDataSourceAssetType; +import com.azure.ai.projects.models.VectorStoreFileStatusFilter; +import com.azure.ai.projects.models.VectorStoreStatus; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class AgentsAsyncClientTest extends AIProjectClientTestBase { + + @Test + void testCreateAgent() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + String agentName = "basic_example_async"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + StepVerifier.create(agentsAsyncClient.createAgent(createAgentOptions)).assertNext(agent -> { + assertNotNull(agent.getId()); + }).verifyComplete(); + } + + @Test + void testDeleteAgent() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + String agentName = "delete_agent_test_async"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + StepVerifier.create(agentsAsyncClient.createAgent(createAgentOptions) + .flatMap(agent -> agentsAsyncClient.deleteAgent(agent.getId()))).assertNext(deletionStatus -> { + assertNotNull(deletionStatus); + }).verifyComplete(); + } + + @Test + void testListAgents() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + // Create an agent first to ensure there's at least one to list + String agentName = "list_agents_test_async"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + StepVerifier.create(agentsAsyncClient.createAgent(createAgentOptions).then(agentsAsyncClient.listAgents())) + .assertNext(agents -> { + assertNotNull(agents); + }) + .verifyComplete(); + + // Test pagination and sorting + StepVerifier.create(agentsAsyncClient.listAgents(2, ListSortOrder.DESCENDING, null, null)) + .assertNext(agents -> { + assertNotNull(agents); + assertTrue(agents.getData().size() <= 2, "Should have 2 or fewer agents in the list"); + }) + .verifyComplete(); + } + + @Test + void testUpdateAgent() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + String agentName = "update_agent_test_async"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + String updatedInstructions = "You are a very helpful and efficient agent"; + + StepVerifier.create(agentsAsyncClient.createAgent(createAgentOptions).flatMap(agent -> { + UpdateAgentOptions updateOptions + = new UpdateAgentOptions(agent.getId()).setInstructions(updatedInstructions); + return agentsAsyncClient.updateAgent(updateOptions); + })).assertNext(agent -> { + assertNotNull(agent); + assertEquals(agentName, agent.getName()); + assertEquals(updatedInstructions, agent.getInstructions()); + }).verifyComplete(); + } + + @Test + void testCreateThread() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + StepVerifier.create(agentsAsyncClient.createThread()).assertNext(thread -> { + assertNotNull(thread); + assertNotNull(thread.getId()); + }).verifyComplete(); + } + + @Test + void testGetThread() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference threadId = new AtomicReference<>(); + + StepVerifier.create(agentsAsyncClient.createThread().flatMap(thread -> { + threadId.set(thread.getId()); + return agentsAsyncClient.getThread(thread.getId()); + })).assertNext(thread -> { + assertNotNull(thread); + assertEquals(threadId.get(), thread.getId()); + }).verifyComplete(); + } + + @Test + void testCreateMessageInThread() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference threadId = new AtomicReference<>(); + String messageContent = "Hello, this is a test message"; + + StepVerifier.create(agentsAsyncClient.createThread().flatMap(thread -> { + threadId.set(thread.getId()); + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + })).assertNext(message -> { + assertNotNull(message); + assertNotNull(message.getId()); + assertEquals(MessageRole.USER, message.getRole()); + }).verifyComplete(); + } + + @Test + void testCreateAndRunThread() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference agentId = new AtomicReference<>(); + AtomicReference threadId = new AtomicReference<>(); + + String agentName = "run_thread_test_async"; + String userMessage = "What is the current date?"; + + StepVerifier.create(createTestAgent(agentsAsyncClient, agentName).flatMap(agent -> { + agentId.set(agent.getId()); + + // Create a thread + return agentsAsyncClient.createThread(); + }).flatMap(thread -> { + threadId.set(thread.getId()); + + // Add a message to the thread + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + }).flatMap(message -> { + // Create a run using the agent + CreateRunOptions runOptions + = new CreateRunOptions(threadId.get(), agentId.get()).setAdditionalInstructions(""); + return agentsAsyncClient.createRun(runOptions); + }).flatMap(run -> { + assertNotNull(run.getId()); + assertEquals(threadId.get(), run.getThreadId()); + + // Get the run status + return agentsAsyncClient.getRun(threadId.get(), run.getId()); + })).assertNext(run -> { + assertNotNull(run); + assertNotNull(run.getStatus()); + }).verifyComplete(); + } + + @Test + void testThreadRunLifecycle() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference agentId = new AtomicReference<>(); + AtomicReference threadId = new AtomicReference<>(); + AtomicReference runId = new AtomicReference<>(); + + String agentName = "thread_lifecycle_test_async"; + String userMessage = "Write a hello world program in Python."; + + StepVerifier.create(createTestAgent(agentsAsyncClient, agentName).map(agent -> { + agentId.set(agent.getId()); + return agent; + }).flatMap(agent -> agentsAsyncClient.createThread()).map(thread -> { + threadId.set(thread.getId()); + return thread; + }).flatMap(thread -> { + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + }).flatMap(message -> { + CreateRunOptions runOptions + = new CreateRunOptions(threadId.get(), agentId.get()).setAdditionalInstructions(""); + return agentsAsyncClient.createRun(runOptions); + }).map(run -> { + runId.set(run.getId()); + return run; + })).expectNextCount(1).verifyComplete(); + + // Wait for the run to complete and check messages + Mono pollForCompletion = agentsAsyncClient.getRun(threadId.get(), runId.get()).expand(run -> { + if (run.getStatus() == RunStatus.COMPLETED + || run.getStatus() == RunStatus.FAILED + || run.getStatus() == RunStatus.CANCELLED) { + return Mono.empty(); + } + return Mono.delay(Duration.ofSeconds(2)).then(agentsAsyncClient.getRun(threadId.get(), run.getId())); + }).last(); + + StepVerifier.create(pollForCompletion).assertNext(run -> { + assertEquals(RunStatus.COMPLETED, run.getStatus()); + }).verifyComplete(); + + // Check that assistant messages were created + StepVerifier.create(agentsAsyncClient.listMessages(threadId.get())).assertNext(messages -> { + assertTrue(messages.getData().stream().count() >= 1); + }).verifyComplete(); + } + + @Test + void testFileOperations() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + // Upload a file + FileDetails fileDetails + = new FileDetails(BinaryData.fromString("This is test file content")).setFilename("test_file_async.txt"); + UploadFileRequest uploadRequest = new UploadFileRequest(fileDetails, FilePurpose.AGENTS); + + StepVerifier.create(agentsAsyncClient.uploadFile(uploadRequest).flatMap(file -> { + assertNotNull(file); + assertNotNull(file.getId()); + assertEquals("test_file_async.txt", file.getFilename()); + + // Get the file + return agentsAsyncClient.getFile(file.getId()).flatMap(retrievedFile -> { + assertNotNull(retrievedFile); + assertEquals(file.getId(), retrievedFile.getId()); + assertEquals(file.getFilename(), retrievedFile.getFilename()); + + // List files without parameters + return agentsAsyncClient.listFiles().flatMap(files -> { + assertNotNull(files); + assertFalse(files.getData().isEmpty(), "File list should not be empty"); + + boolean foundFile = false; + for (OpenAIFile listedFile : files.getData()) { + if (listedFile.getId().equals(file.getId())) { + foundFile = true; + break; + } + } + assertTrue(foundFile, "Uploaded file should be in the file list"); + + // List files with FilePurpose parameter + return agentsAsyncClient.listFiles(FilePurpose.AGENTS); + }).flatMap(filesWithPurpose -> { + assertNotNull(filesWithPurpose); + assertFalse(filesWithPurpose.getData().isEmpty(), "File list with purpose should not be empty"); + + boolean foundFile = false; + for (OpenAIFile listedFile : filesWithPurpose.getData()) { + if (listedFile.getId().equals(file.getId())) { + foundFile = true; + break; + } + } + assertTrue(foundFile, "Uploaded file should be in the filtered file list"); + + // Download file content + return agentsAsyncClient.getFile(file.getId()).flatMap(content -> { + assertNotNull(content); + + // Delete file and return the deletion status + return agentsAsyncClient.deleteFile(file.getId()); + }); + }); + }); + })).expectNextCount(1).verifyComplete(); + } + + @Test + void testFileAttachmentWithCodeInterpreter() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference agentIdRef = new AtomicReference<>(); + AtomicReference threadIdRef = new AtomicReference<>(); + AtomicReference fileIdRef = new AtomicReference<>(); + + StepVerifier.create( + // Create agent with code interpreter + createTestAgent(agentsAsyncClient, "code_interpreter_file_test_async").flatMap(agent -> { + agentIdRef.set(agent.getId()); + + // Upload file + FileDetails fileDetails = new FileDetails(BinaryData.fromString( + "

Test Content

This is sample data for testing.

")) + .setFilename("sample_test_async.html"); + return agentsAsyncClient.uploadFile(new UploadFileRequest(fileDetails, FilePurpose.AGENTS)); + }).flatMap(file -> { + fileIdRef.set(file.getId()); + + // Create thread + return agentsAsyncClient.createThread(); + }).flatMap(thread -> { + threadIdRef.set(thread.getId()); + + // Create attachment + CodeInterpreterToolDefinition ciTool = new CodeInterpreterToolDefinition(); + MessageAttachment attachment + = new MessageAttachment(Arrays.asList(BinaryData.fromObject(ciTool))).setFileId(fileIdRef.get()); + + // Create message with attachment + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "What does the attachment say?", Arrays.asList(attachment), null); + }).flatMap(message -> { + // Create run + CreateRunOptions runOptions + = new CreateRunOptions(threadIdRef.get(), agentIdRef.get()).setAdditionalInstructions(""); + return agentsAsyncClient.createRun(runOptions); + })).expectNextCount(1).verifyComplete(); + + // Cleanup in a separate step + StepVerifier + .create(agentsAsyncClient.deleteAgent(agentIdRef.get()) + .then(agentsAsyncClient.deleteThread(threadIdRef.get())) + .then(agentsAsyncClient.deleteFile(fileIdRef.get()))) + .assertNext(status -> assertNotNull(status)) + .verifyComplete(); + } + + @Test + void testAgentWithAdditionalMessages() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference agentIdRef = new AtomicReference<>(); + AtomicReference threadIdRef = new AtomicReference<>(); + + // Create agent with additional context messages + StepVerifier.create(createTestAgent(agentsAsyncClient, "additional_message_test_agent_async").flatMap(agent -> { + agentIdRef.set(agent.getId()); + return agentsAsyncClient.createThread(); + }).flatMap(thread -> { + threadIdRef.set(thread.getId()); + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, "What is the value of Pi?"); + }).flatMap(message -> { + // Create run with additional messages to influence response + CreateRunOptions runOptions + = new CreateRunOptions(threadIdRef.get(), agentIdRef.get()).setAdditionalMessages(Arrays.asList( + new ThreadMessageOptions(MessageRole.AGENT, BinaryData.fromString("Pi is exactly 3.")), + new ThreadMessageOptions(MessageRole.USER, BinaryData.fromString("Are you sure about Pi?")))); + + return agentsAsyncClient.createRun(runOptions); + })).expectNextCount(1).verifyComplete(); + } + + @Test + void testAgentProperties() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + // Test creating an agent with various properties + String agentName = "properties_test_agent_async"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setDescription("Agent for testing properties") + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())) + .setMetadata(mapOf("purpose", "testing")) + .setTemperature(0.5) + .setTopP(0.8); + + StepVerifier.create(agentsAsyncClient.createAgent(createAgentOptions).flatMap(agent -> { + // Verify all properties were set correctly + assertNotNull(agent.getId()); + assertEquals(agentName, agent.getName()); + assertEquals("Agent for testing properties", agent.getDescription()); + assertEquals("You are a helpful agent", agent.getInstructions()); + assertEquals("gpt-4o-mini", agent.getModel()); + assertEquals(0.5, agent.getTemperature()); + assertEquals(0.8, agent.getTopP()); + assertNotNull(agent.getMetadata()); + + // Get agent to verify properties persisted + return agentsAsyncClient.getAgent(agent.getId()).flatMap(retrievedAgent -> { + assertEquals(agent.getId(), retrievedAgent.getId()); + assertEquals(agent.getName(), retrievedAgent.getName()); + assertEquals(agent.getDescription(), retrievedAgent.getDescription()); + assertEquals(agent.getTemperature(), retrievedAgent.getTemperature()); + + // Cleanup + return agentsAsyncClient.deleteAgent(agent.getId()); + }); + })).expectNextCount(1).verifyComplete(); + } + + @Test + void testVectorStore() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference fileIdRef = new AtomicReference<>(); + AtomicReference vectorStoreIdWithConfigRef = new AtomicReference<>(); + AtomicReference vectorStoreIdWithFileRef = new AtomicReference<>(); + + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreDataSource vectorStoreDataSource + = new VectorStoreDataSource(dataUri, VectorStoreDataSourceAssetType.URI_ASSET); + + // Create vector store with data source config + StepVerifier.create(agentsAsyncClient + .createVectorStore(null, "sample_vector_store_async", + new VectorStoreConfiguration(Arrays.asList(vectorStoreDataSource)), null, null, null) + .flatMap(vectorStore -> { + assertNotNull(vectorStore); + assertNotNull(vectorStore.getId()); + assertNotNull(vectorStore.getStatus()); + assertNotNull(vectorStore.getName()); + assertNotNull(vectorStore.getFileCounts()); + assertEquals("sample_vector_store_async", vectorStore.getName()); + vectorStoreIdWithConfigRef.set(vectorStore.getId()); + + // Update vector store + return agentsAsyncClient.modifyVectorStore(vectorStore.getId()); + }) + .flatMap(updatedVectorStore -> { + // Upload a file + return agentsAsyncClient.uploadFile(new UploadFileRequest(new FileDetails(BinaryData + .fromString("The word `apple` uses the code 442345, while the word `banana` uses the code 673457.")) + .setFilename("sample_file_for_upload_async.txt"), + FilePurpose.AGENTS)); + }) + .flatMap(file -> { + fileIdRef.set(file.getId()); + assertNotNull(file); + assertNotNull(file.getId()); + assertEquals("sample_file_for_upload_async.txt", file.getFilename()); + + // Create vector store with file ID + return agentsAsyncClient.createVectorStore(Arrays.asList(file.getId()), "my_vector_store_async", null, + null, null, null); + })).assertNext(vectorStore -> { + assertNotNull(vectorStore); + assertNotNull(vectorStore.getId()); + assertEquals("my_vector_store_async", vectorStore.getName()); + vectorStoreIdWithFileRef.set(vectorStore.getId()); + }).verifyComplete(); + + // Poll until vector store is complete + Mono pollForCompletion + = agentsAsyncClient.getVectorStore(vectorStoreIdWithFileRef.get()).expand(vectorStore -> { + if (vectorStore.getStatus() == VectorStoreStatus.COMPLETED + || vectorStore.getStatus() == VectorStoreStatus.EXPIRED) { + return Mono.empty(); + } + return Mono.delay(Duration.ofMillis(500)).then(agentsAsyncClient.getVectorStore(vectorStore.getId())); + }).last(); + + StepVerifier.create(pollForCompletion).assertNext(vectorStore -> { + assertEquals(VectorStoreStatus.COMPLETED, vectorStore.getStatus()); + }).verifyComplete(); + + // List vector store files with pagination and sorting + StepVerifier.create(agentsAsyncClient.listVectorStoreFiles(vectorStoreIdWithFileRef.get()).flatMap(files -> { + assertFalse(files.getData().isEmpty()); + + // Test pagination and sorting options + return agentsAsyncClient.listVectorStoreFiles(vectorStoreIdWithFileRef.get(), + VectorStoreFileStatusFilter.COMPLETED, 1, ListSortOrder.ASCENDING, null, null); + })).assertNext(files -> { + assertFalse(files.getData().isEmpty()); + }).verifyComplete(); + + // List vector stores with pagination and sorting + StepVerifier.create(agentsAsyncClient.listVectorStores().flatMap(vectorStores -> { + assertFalse(vectorStores.getData().isEmpty()); + + // Test pagination and sorting options + return agentsAsyncClient.listVectorStores(1, ListSortOrder.ASCENDING, null, null); + })).assertNext(vectorStores -> { + assertFalse(vectorStores.getData().isEmpty()); + }).verifyComplete(); + + // Test with file search tool + StepVerifier + .create(Mono + .just(new FileSearchToolResource().setVectorStoreIds(Arrays.asList(vectorStoreIdWithFileRef.get())))) + .assertNext(fileSearchToolResource -> { + assertNotNull(fileSearchToolResource); + assertEquals(1, fileSearchToolResource.getVectorStoreIds().size()); + assertEquals(vectorStoreIdWithFileRef.get(), fileSearchToolResource.getVectorStoreIds().get(0)); + }) + .verifyComplete(); + + // Clean up resources + StepVerifier.create(agentsAsyncClient.deleteVectorStore(vectorStoreIdWithFileRef.get()) + .then(agentsAsyncClient.deleteVectorStore(vectorStoreIdWithConfigRef.get())) + .then(agentsAsyncClient.deleteFile(fileIdRef.get()))).expectNextCount(1).verifyComplete(); + } + + @Test + void testVectorStoreFileBatch() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference fileIdRef = new AtomicReference<>(); + AtomicReference vectorStoreIdRef = new AtomicReference<>(); + + StepVerifier.create( + // Upload a file + agentsAsyncClient.uploadFile( + new UploadFileRequest(new FileDetails(BinaryData.fromString("File batch content for vector store test")) + .setFilename("vector_store_batch_async_test.txt"), FilePurpose.AGENTS)) + .flatMap(file -> { + fileIdRef.set(file.getId()); + + // Create empty vector store + return agentsAsyncClient.createVectorStore(null, "async_vector_batch_test", null, null, null, null); + }) + .flatMap(vectorStore -> { + vectorStoreIdRef.set(vectorStore.getId()); + + // Create vector store file batch + return agentsAsyncClient.createVectorStoreFileBatch(vectorStore.getId(), + Arrays.asList(fileIdRef.get()), null, null); + })) + .assertNext(batch -> { + assertNotNull(batch); + assertNotNull(batch.getId()); + assertEquals(vectorStoreIdRef.get(), batch.getVectorStoreId()); + }) + .verifyComplete(); + + // Clean up resources + StepVerifier + .create(agentsAsyncClient.deleteVectorStore(vectorStoreIdRef.get()) + .then(agentsAsyncClient.deleteFile(fileIdRef.get()))) + .assertNext(status -> assertNotNull(status)) + .verifyComplete(); + } + + @Test + void testDeleteThread() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + StepVerifier.create(agentsAsyncClient.createThread().flatMap(thread -> { + assertNotNull(thread); + assertNotNull(thread.getId()); + return agentsAsyncClient.deleteThread(thread.getId()); + })).assertNext(status -> assertNotNull(status)).verifyComplete(); + } + + @Test + void testListMessages() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + AtomicReference threadId = new AtomicReference<>(); + + StepVerifier.create( + // Create a thread + agentsAsyncClient.createThread().flatMap(thread -> { + threadId.set(thread.getId()); + // Add multiple messages + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, "First message"); + }).flatMap(message -> { + return agentsAsyncClient.createMessage(threadId.get(), MessageRole.USER, "Second message"); + }).flatMap(message -> { + // List messages + return agentsAsyncClient.listMessages(threadId.get()); + })).assertNext(messageList -> { + assertNotNull(messageList); + assertEquals(2, messageList.getData().size()); + assertEquals(MessageRole.USER, messageList.getData().get(0).getRole()); + assertEquals(MessageRole.USER, messageList.getData().get(1).getRole()); + }).verifyComplete(); + + // Clean up + StepVerifier.create(agentsAsyncClient.deleteThread(threadId.get())).expectNextCount(1).verifyComplete(); + } + + @Test + void testGetMessage() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + AtomicReference threadId = new AtomicReference<>(); + AtomicReference messageId = new AtomicReference<>(); + + StepVerifier.create( + // Create a thread + agentsAsyncClient.createThread().flatMap(thread -> { + threadId.set(thread.getId()); + // Add a message + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, "Test message for retrieval"); + }).flatMap(message -> { + messageId.set(message.getId()); + // Get the message + return agentsAsyncClient.getMessage(threadId.get(), message.getId()); + })).assertNext(message -> { + assertNotNull(message); + assertEquals(messageId.get(), message.getId()); + assertEquals(MessageRole.USER, message.getRole()); + assertTrue(message.getContent().get(0) instanceof MessageTextContent); + assertEquals("Test message for retrieval", + ((MessageTextContent) message.getContent().get(0)).getText().getValue()); + }).verifyComplete(); + + // Clean up + StepVerifier.create(agentsAsyncClient.deleteThread(threadId.get())).expectNextCount(1).verifyComplete(); + } + + @Test + void testSubmitToolOutputsToRun() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference threadId = new AtomicReference<>(); + AtomicReference agentId = new AtomicReference<>(); + + FunctionToolDefinition getWeatherTool = new FunctionToolDefinition(new FunctionDefinition("getWeather", + BinaryData.fromObject(mapOf("type", "object", "properties", + mapOf("location", mapOf("type", "string", "description", "The city name")), "required", + new String[] { "location" }))).setDescription("Get weather for a location")); + + // Create agent with function tool + StepVerifier.create( + agentsAsyncClient.createAgent(new CreateAgentOptions("gpt-4o-mini").setName("tool_output_test_async") + .setInstructions("You help with weather information") + .setTools(Arrays.asList(getWeatherTool))).flatMap(agent -> { + agentId.set(agent.getId()); + return agentsAsyncClient.createThread(); + }).flatMap(thread -> { + threadId.set(thread.getId()); + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "What's the weather in Seattle?"); + }).flatMap(message -> { + CreateRunOptions runOptions = new CreateRunOptions(threadId.get(), agentId.get()); + return agentsAsyncClient.createRun(runOptions); + })) + .expectNextCount(1) + .verifyComplete(); + + // Poll until we get REQUIRES_ACTION status or completion + Mono waitForRequiresAction = Mono.defer(() -> agentsAsyncClient.getRun(threadId.get(), + agentsAsyncClient.listRuns(threadId.get()).block().getData().get(0).getId())).expand(run -> { + if (run.getStatus() == RunStatus.REQUIRES_ACTION + || run.getStatus() == RunStatus.COMPLETED + || run.getStatus() == RunStatus.FAILED) { + return Mono.empty(); + } + return Mono.delay(Duration.ofSeconds(1)).then(agentsAsyncClient.getRun(threadId.get(), run.getId())); + }).filter(run -> run.getStatus() == RunStatus.REQUIRES_ACTION).next(); + + // Test submitting tool outputs when the run requires action + StepVerifier.create(waitForRequiresAction.flatMap(run -> { + if (run.getRequiredAction() instanceof SubmitToolOutputsAction) { + SubmitToolOutputsAction action = (SubmitToolOutputsAction) run.getRequiredAction(); + List outputs = new ArrayList<>(); + + for (RequiredToolCall call : action.getSubmitToolOutputs().getToolCalls()) { + if (call instanceof RequiredFunctionToolCall) { + RequiredFunctionToolCall functionCall = (RequiredFunctionToolCall) call; + if ("getWeather".equals(functionCall.getFunction().getName())) { + outputs + .add(new ToolOutput().setToolCallId(functionCall.getId()).setOutput("72°F and sunny")); + } + } + } + + return agentsAsyncClient.submitToolOutputsToRun(threadId.get(), run.getId(), outputs); + } + return Mono.just(run); // No action required + })).assertNext(run -> { + assertNotNull(run); + }).verifyComplete(); + + // Clean up + StepVerifier + .create(agentsAsyncClient.deleteAgent(agentId.get()).then(agentsAsyncClient.deleteThread(threadId.get()))) + .expectNextCount(1) + .verifyComplete(); + } + + @Test + void testRunOperations() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + AtomicReference threadIdRef = new AtomicReference<>(); + AtomicReference runIdRef = new AtomicReference<>(); + AtomicReference agentIdRef = new AtomicReference<>(); + + // Create thread, send message and create run + StepVerifier.create(createTestAgent(agentsAsyncClient, "run_operations_test_async") + .doOnNext(agent -> agentIdRef.set(agent.getId())) + .flatMap(agent -> agentsAsyncClient.createThread()) + .flatMap(thread -> { + assertNotNull(thread); + threadIdRef.set(thread.getId()); + // Create first message + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "what is the value of y: x = 5; y = x + 1;"); + }) + .flatMap(message -> { + // Create run + CreateRunOptions runOptions = new CreateRunOptions(threadIdRef.get(), agentIdRef.get()); + return agentsAsyncClient.createRun(runOptions); + }) + .map(run -> { + runIdRef.set(run.getId()); + return run; + })).expectNextCount(1).verifyComplete(); + + // Wait for run to complete + Mono pollForCompletion = agentsAsyncClient.getRun(threadIdRef.get(), runIdRef.get()).expand(run -> { + if (run.getStatus() == RunStatus.COMPLETED + || run.getStatus() == RunStatus.FAILED + || run.getStatus() == RunStatus.CANCELLED) { + threadIdRef.set(run.getThreadId()); + runIdRef.set(run.getId()); + return Mono.empty(); + } + return Mono.delay(Duration.ofMillis(500)).then(agentsAsyncClient.getRun(run.getThreadId(), run.getId())); + }).last(); + + // Get specific run step + StepVerifier + .create(pollForCompletion.flatMap(run -> agentsAsyncClient.listRunSteps(threadIdRef.get(), runIdRef.get())) + .flatMap(runStepsList -> { + String stepId = runStepsList.getData().get(0).getId(); + // Get individual run step + return agentsAsyncClient.getRunStep(threadIdRef.get(), runIdRef.get(), stepId); + })) + .assertNext(runStep -> { + assertNotNull(runStep); + assertNotNull(runStep.getId()); + }) + .verifyComplete(); + + // List run steps with pagination and sorting + StepVerifier + .create(agentsAsyncClient.listRunSteps(threadIdRef.get(), runIdRef.get(), null, 1, ListSortOrder.ASCENDING, + null, null)) + .assertNext(runStepsList -> { + assertNotNull(runStepsList); + assertTrue(runStepsList.getData().size() > 0, "Should have run steps in paginated list"); + }) + .verifyComplete(); + + // Wait for run to complete and update it + StepVerifier + .create(pollForCompletion + .flatMap(completedRun -> agentsAsyncClient.updateRun(threadIdRef.get(), runIdRef.get()))) + .assertNext(updatedRun -> { + assertNotNull(updatedRun); + assertEquals(runIdRef.get(), updatedRun.getId()); + }) + .verifyComplete(); + + // List runs + StepVerifier.create(agentsAsyncClient.listRuns(threadIdRef.get())).assertNext(runsList -> { + assertNotNull(runsList); + assertEquals(1, runsList.getData().size(), "Should have 1 run in the thread"); + + boolean foundRun1 = false; + for (ThreadRun run : runsList.getData()) { + if (run.getId().equals(runIdRef.get())) { + foundRun1 = true; + break; + } + } + assertTrue(foundRun1, "Run 1 should be in the list"); + }).verifyComplete(); + + // List runs with pagination and sorting + StepVerifier.create(agentsAsyncClient.listRuns(threadIdRef.get(), 1, ListSortOrder.ASCENDING, null, null)) + .assertNext(runsList -> { + assertNotNull(runsList); + assertEquals(1, runsList.getData().size(), "Should have 1 run in paginated list"); + }) + .verifyComplete(); + + // Create thread and run in one operation + AtomicReference threadId2Ref = new AtomicReference<>(); + StepVerifier.create(agentsAsyncClient.createThreadAndRun(new CreateThreadAndRunOptions(agentIdRef.get()))) + .assertNext(run2 -> { + assertNotNull(run2); + assertNotNull(run2.getId()); + assertNotNull(run2.getThreadId()); + threadId2Ref.set(run2.getThreadId()); + }) + .verifyComplete(); + + // Clean up the second thread + if (threadId2Ref.get() != null) { + StepVerifier.create(agentsAsyncClient.deleteThread(threadId2Ref.get())).expectNextCount(1).verifyComplete(); + } + + // Clean up the first thread + StepVerifier.create(agentsAsyncClient.deleteThread(threadIdRef.get())).expectNextCount(1).verifyComplete(); + } + + @Test + void testCreateRunAndReadMessages() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference agentId = new AtomicReference<>(); + AtomicReference threadId = new AtomicReference<>(); + AtomicReference runId = new AtomicReference<>(); + + // Create a test agent first + StepVerifier.create(createTestAgent(agentsAsyncClient, "run_messages_test_async").flatMap(agent -> { + agentId.set(agent.getId()); + + // Create a thread + return agentsAsyncClient.createThread(); + }).flatMap(thread -> { + threadId.set(thread.getId()); + + // Add a message to the thread + return agentsAsyncClient.createMessage(thread.getId(), MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + }).flatMap(message -> { + // Create a run using the agent + CreateRunOptions runOptions + = new CreateRunOptions(threadId.get(), agentId.get()).setAdditionalInstructions(""); + return agentsAsyncClient.createRun(runOptions); + })).assertNext(run -> { + assertNotNull(run); + runId.set(run.getId()); + assertNotNull(run.getId()); + assertEquals(threadId.get(), run.getThreadId()); + }).verifyComplete(); + + // Wait for the run to complete + Mono pollForCompletion = agentsAsyncClient.getRun(threadId.get(), runId.get()).expand(run -> { + if (run.getStatus() == RunStatus.COMPLETED + || run.getStatus() == RunStatus.FAILED + || run.getStatus() == RunStatus.CANCELLED) { + return Mono.empty(); + } + return Mono.delay(Duration.ofMillis(500)).then(agentsAsyncClient.getRun(threadId.get(), runId.get())); + }).last(); + + // Verify run completed successfully + StepVerifier.create(pollForCompletion).assertNext(run -> { + assertEquals(RunStatus.COMPLETED, run.getStatus()); + }).verifyComplete(); + + // Test listing messages with pagination and sorting + StepVerifier + .create(agentsAsyncClient.listMessages(threadId.get(), runId.get(), 2, ListSortOrder.ASCENDING, null, null)) + .assertNext(messages -> { + assertNotNull(messages); + assertFalse(messages.getData().isEmpty(), "Messages list should not be empty"); + + // Verify we have the expected messages + boolean foundUserMessage = false; + boolean foundAgentMessage = false; + + for (ThreadMessage message : messages.getData()) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue(); + if (message.getRole() == MessageRole.USER && content.contains("3x + 11 = 14")) { + foundUserMessage = true; + } else if (message.getRole() == MessageRole.AGENT && content.contains("x = 1")) { + foundAgentMessage = true; + } + } + } + } + + assertTrue(foundUserMessage || foundAgentMessage, + "Should find user or agent message with expected content"); + }) + .verifyComplete(); + + // Clean up resources + StepVerifier + .create(agentsAsyncClient.deleteAgent(agentId.get()).then(agentsAsyncClient.deleteThread(threadId.get()))) + .expectNextCount(1) + .verifyComplete(); + } + + @Test + void testThreadOperations() { + AgentsAsyncClient agentsAsyncClient = getAIProjectClientBuilder().buildAgentsAsyncClient(); + + AtomicReference threadId = new AtomicReference<>(); + AtomicReference messageId1 = new AtomicReference<>(); + AtomicReference messageId2 = new AtomicReference<>(); + + // Create a new thread + StepVerifier.create(agentsAsyncClient.createThread().flatMap(thread -> { + assertNotNull(thread); + assertNotNull(thread.getId()); + threadId.set(thread.getId()); + + // Update thread + return agentsAsyncClient.updateThread(thread.getId()); + }).flatMap(updatedThread -> { + // Get thread to verify update + return agentsAsyncClient.getThread(threadId.get()); + }).flatMap(retrievedThread -> { + // Verify thread was retrieved correctly + assertEquals(threadId.get(), retrievedThread.getId()); + + // Create first message + return agentsAsyncClient.createMessage(threadId.get(), MessageRole.USER, "First message"); + }).flatMap(message1 -> { + messageId1.set(message1.getId()); + assertNotNull(message1); + + // Create second message + return agentsAsyncClient.createMessage(threadId.get(), MessageRole.USER, "Second message"); + }).flatMap(message2 -> { + messageId2.set(message2.getId()); + assertNotNull(message2); + assertNotEquals(messageId1.get(), message2.getId()); + + // List messages + return agentsAsyncClient.listMessages(threadId.get()); + })).assertNext(messages -> { + assertNotNull(messages); + assertEquals(2, messages.getData().size()); + }).verifyComplete(); + + // Get a specific message + StepVerifier.create(agentsAsyncClient.getMessage(threadId.get(), messageId1.get())) + .assertNext(retrievedMessage -> { + assertNotNull(retrievedMessage); + assertEquals(messageId1.get(), retrievedMessage.getId()); + }) + .verifyComplete(); + + // Delete thread and verify + StepVerifier.create(agentsAsyncClient.deleteThread(threadId.get())) + .assertNext(deletionStatus -> assertNotNull(deletionStatus)) + .verifyComplete(); + + // Verify deletion (should emit an error) + StepVerifier.create(agentsAsyncClient.getThread(threadId.get())).expectError().verify(); + } + + // Helper method to map objects + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } + + // Helper method to create test agents + private Mono createTestAgent(AgentsAsyncClient client, String name) { + CreateAgentOptions options + = new CreateAgentOptions("gpt-4o-mini").setName(name).setInstructions("Test agent for " + name); + return client.createAgent(options); + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsClientTest.java new file mode 100644 index 000000000000..f81ee96e55b8 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/AgentsClientTest.java @@ -0,0 +1,1486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.projects; + +import com.azure.ai.projects.generated.AIProjectClientTestBase; +import com.azure.ai.projects.implementation.models.CreateAgentRequest; +import com.azure.ai.projects.models.*; +import com.azure.ai.projects.models.streaming.StreamMessageUpdate; +import com.azure.ai.projects.models.streaming.StreamRequiredAction; +import com.azure.ai.projects.models.streaming.StreamThreadRunCreation; +import com.azure.ai.projects.models.streaming.StreamUpdate; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Supplier; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +class AgentsClientTest extends AIProjectClientTestBase { + + private Agent ciAgent = null; + + @BeforeEach + void setup() { + this.beforeTest(); + this.createCIAgent(); + } + + @Test + void testCreateAgent() { + String agentName = "basic_example"; + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())) + .setDescription("Test agent") + .setTemperature(0.5) + .setTopP(0.5); + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent.getId()); + assertNotNull(agent.getName()); + assertEquals(agentName, agent.getName()); + assertNotNull(agent.getCreatedAt()); + assertNotNull(agent.getMetadata()); + assertNotNull(agent.getDescription()); + assertNotNull(agent.getModel()); + assertEquals("You are a helpful agent", agent.getInstructions()); + + Agent retrievedAgent = agentsClient.getAgent(agent.getId()); + assertNotNull(retrievedAgent); + assertEquals(agent.getId(), retrievedAgent.getId()); + assertEquals(agent.getName(), retrievedAgent.getName()); + assertEquals(agent.getDescription(), retrievedAgent.getDescription()); + assertEquals(agent.getTopP(), retrievedAgent.getTopP()); + + agentsClient.deleteAgent(agent.getId()); + } + + @Test + void testListAgents() { + // Create a few agents for testing + String agentName1 = "list_test_agent_1_" + UUID.randomUUID(); + String agentName2 = "list_test_agent_2_" + UUID.randomUUID(); + + CreateAgentOptions createAgentOptions1 + = new CreateAgentOptions("gpt-4o-mini").setName(agentName1).setInstructions("Test agent 1"); + CreateAgentOptions createAgentOptions2 + = new CreateAgentOptions("gpt-4o-mini").setName(agentName2).setInstructions("Test agent 2"); + + Agent agent1 = agentsClient.createAgent(createAgentOptions1); + Agent agent2 = agentsClient.createAgent(createAgentOptions2); + + // List all agents + List agentList = agentsClient.listAgents().getData(); + + // Verify the list contains our agents + boolean foundAgent1 = false; + boolean foundAgent2 = false; + + for (Agent agent : agentList) { + if (agent.getId().equals(agent1.getId())) { + foundAgent1 = true; + } + if (agent.getId().equals(agent2.getId())) { + foundAgent2 = true; + } + } + + assertTrue(foundAgent1, "Agent 1 should be found in the list"); + assertTrue(foundAgent2, "Agent 2 should be found in the list"); + + // List all agents 2 + agentList = agentsClient.listAgents(2, ListSortOrder.DESCENDING, null, null).getData(); + + assertTrue(agentList.size() == 2, "2 Agents found in the list"); + + // Clean up + agentsClient.deleteAgent(agent1.getId()); + agentsClient.deleteAgent(agent2.getId()); + } + + @Test + void testUpdateAgent() { + String originalName = "update_test_agent_" + UUID.randomUUID(); + String updatedName = "updated_agent_" + UUID.randomUUID(); + + CreateAgentOptions createAgentOptions + = new CreateAgentOptions("gpt-4o-mini").setName(originalName).setInstructions("Original instructions"); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent.getId()); + assertEquals(originalName, agent.getName()); + + UpdateAgentOptions updateAgentOptions = new UpdateAgentOptions(agent.getId()); + updateAgentOptions.setName(updatedName).setInstructions("Updated instructions"); + + // Update the agent + Agent updatedAgent = agentsClient.updateAgent(updateAgentOptions); + + assertNotNull(updatedAgent); + assertEquals(agent.getId(), updatedAgent.getId()); + assertEquals(updatedName, updatedAgent.getName()); + assertEquals("Updated instructions", updatedAgent.getInstructions()); + + // Verify by getting the agent + Agent retrievedAgent = agentsClient.getAgent(agent.getId()); + assertEquals(updatedName, retrievedAgent.getName()); + assertEquals("Updated instructions", retrievedAgent.getInstructions()); + + // Clean up + agentsClient.deleteAgent(agent.getId()); + } + + @Test + void testCreateRunAndReadMessages() { + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + assertNotNull(thread.getId()); + + ThreadMessage createdMessage = agentsClient.createMessage(thread.getId(), MessageRole.USER, + "I need to solve the equation `3x + 11 = 14`. Can you help me?"); + assertNotNull(createdMessage); + assertEquals(MessageRole.USER, createdMessage.getRole()); + assertNotNull(createdMessage.getId()); + agentsClient.updateMessage(thread.getId(), createdMessage.getId()); + + //run agent + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), ciAgent.getId()).setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + assertNotNull(threadRun); + assertNotNull(threadRun.getId()); + assertEquals(thread.getId(), threadRun.getThreadId()); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + fail("Run failed: " + threadRun.getLastError().getMessage()); + } + + OpenAIPageableListOfThreadMessage runMessages = agentsClient.listMessages(thread.getId()); + assertNotNull(runMessages); + assertFalse(runMessages.getData().isEmpty(), "Messages list should not be empty"); + + runMessages + = agentsClient.listMessages(thread.getId(), threadRun.getId(), 2, ListSortOrder.ASCENDING, null, null); + assertNotNull(runMessages); + assertFalse(runMessages.getData().isEmpty(), "Messages list 2 should not be empty"); + + boolean foundUserMessage = false; + boolean foundAssistantMessage = false; + + for (ThreadMessage message : runMessages.getData()) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue(); + if (message.getRole() == MessageRole.USER && content.contains("3x + 11 = 14")) { + foundUserMessage = true; + } else if (message.getRole() == MessageRole.AGENT && content.contains("x = 1")) { + foundAssistantMessage = true; + } + } + } + } + + assertTrue(foundUserMessage, "Should find at least one user message"); + assertTrue(foundAssistantMessage, "Should find at least one assistant message"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + agentsClient.deleteThread(thread.getId()); + } + } + + @Test + void testThreadOperations() { + // Create a new thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + assertNotNull(thread.getId()); + agentsClient.updateThread(thread.getId()); + + // Get thread + AgentThread retrievedThread = agentsClient.getThread(thread.getId()); + assertNotNull(retrievedThread); + assertEquals(thread.getId(), retrievedThread.getId()); + + // Create multiple messages + ThreadMessage message1 = agentsClient.createMessage(thread.getId(), MessageRole.USER, "First message"); + ThreadMessage message2 = agentsClient.createMessage(thread.getId(), MessageRole.USER, "Second message"); + + assertNotNull(message1); + assertNotNull(message2); + assertNotEquals(message1.getId(), message2.getId()); + + // List messages + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertNotNull(messages); + assertEquals(2, messages.getData().size()); + + // Get a specific message + ThreadMessage retrievedMessage = agentsClient.getMessage(thread.getId(), message1.getId()); + assertNotNull(retrievedMessage); + assertEquals(message1.getId(), retrievedMessage.getId()); + + // Clean up + agentsClient.deleteThread(thread.getId()); + + // Verify deletion (should throw an exception) + try { + agentsClient.getThread(thread.getId()); + fail("Should have thrown an exception for deleted thread"); + } catch (Exception e) { + // Expected exception + } + } + + @Test + void testVectorStore() throws InterruptedException { + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreDataSource vectorStoreDataSource + = new VectorStoreDataSource(dataUri, VectorStoreDataSourceAssetType.URI_ASSET); + + VectorStore vectorStoreWithConfig = agentsClient.createVectorStore(null, "sample_vector_store", + new VectorStoreConfiguration(Arrays.asList(vectorStoreDataSource)), null, null, null); + assertNotNull(vectorStoreWithConfig); + assertNotNull(vectorStoreWithConfig.getId()); + assertNotNull(vectorStoreWithConfig.getStatus()); + assertNotNull(vectorStoreWithConfig.getName()); + assertNotNull(vectorStoreWithConfig.getFileCounts()); + assertEquals("sample_vector_store", vectorStoreWithConfig.getName()); + VectorStore vs2 = agentsClient.modifyVectorStore(vectorStoreWithConfig.getId()); + + OpenAIFile uploadedAgentFile = agentsClient.uploadFile(new UploadFileRequest(new FileDetails(BinaryData + .fromString("The word `apple` uses the code 442345, while the word `banana` uses the code 673457.")) + .setFilename("sample_file_for_upload.txt"), + FilePurpose.AGENTS)); + assertNotNull(uploadedAgentFile); + assertNotNull(uploadedAgentFile.getId()); + assertEquals("sample_file_for_upload.txt", uploadedAgentFile.getFilename()); + + VectorStore vectorStoreWithId = agentsClient.createVectorStore(Arrays.asList(uploadedAgentFile.getId()), + "my_vector_store", null, null, null, null); + assertNotNull(vectorStoreWithId); + assertNotNull(vectorStoreWithId.getId()); + assertEquals("my_vector_store", vectorStoreWithId.getName()); + + do { + Thread.sleep(500); + vectorStoreWithId = agentsClient.getVectorStore(vectorStoreWithId.getId()); + } while (vectorStoreWithId.getStatus() == VectorStoreStatus.IN_PROGRESS); + + assertEquals(VectorStoreStatus.COMPLETED, vectorStoreWithId.getStatus()); + + // List vector store files + List files = agentsClient.listVectorStoreFiles(vectorStoreWithId.getId()).getData(); + assertFalse(files.isEmpty()); + files + = agentsClient + .listVectorStoreFiles(vectorStoreWithId.getId(), VectorStoreFileStatusFilter.COMPLETED, 1, + ListSortOrder.ASCENDING, null, null) + .getData(); + assertFalse(files.isEmpty()); + + // List vector stores + List vectorStores = agentsClient.listVectorStores().getData(); + assertFalse(vectorStores.isEmpty()); + vectorStores = agentsClient.listVectorStores(1, ListSortOrder.ASCENDING, null, null).getData(); + assertFalse(vectorStores.isEmpty()); + + // Test with file search tool + FileSearchToolResource fileSearchToolResource + = new FileSearchToolResource().setVectorStoreIds(Arrays.asList(vectorStoreWithId.getId())); + assertNotNull(fileSearchToolResource); + assertEquals(1, fileSearchToolResource.getVectorStoreIds().size()); + assertEquals(vectorStoreWithId.getId(), fileSearchToolResource.getVectorStoreIds().get(0)); + + // Clean up + agentsClient.deleteVectorStore(vectorStoreWithId.getId()); + agentsClient.deleteVectorStore(vectorStoreWithConfig.getId()); + agentsClient.deleteFile(uploadedAgentFile.getId()); + } + + @Test + void testFileOperations() { + // Upload a file + OpenAIFile uploadedFile = agentsClient.uploadFile(new UploadFileRequest( + new FileDetails(BinaryData.fromString("This is test file content")).setFilename("test_file.txt"), + FilePurpose.AGENTS)); + + assertNotNull(uploadedFile); + assertNotNull(uploadedFile.getId()); + assertEquals("test_file.txt", uploadedFile.getFilename()); + + // Get the file + OpenAIFile retrievedFile = agentsClient.getFile(uploadedFile.getId()); + assertNotNull(retrievedFile); + assertEquals(uploadedFile.getId(), retrievedFile.getId()); + assertEquals(uploadedFile.getFilename(), retrievedFile.getFilename()); + + // List files + List files = agentsClient.listFiles().getData(); + assertFalse(files.isEmpty()); + boolean foundFile = false; + for (OpenAIFile file : files) { + if (file.getId().equals(uploadedFile.getId())) { + foundFile = true; + break; + } + } + assertTrue(foundFile, "Uploaded file should be in the file list"); + + // List files + files = agentsClient.listFiles(FilePurpose.AGENTS).getData(); + assertFalse(files.isEmpty()); + foundFile = false; + for (OpenAIFile file : files) { + if (file.getId().equals(uploadedFile.getId())) { + foundFile = true; + break; + } + } + assertTrue(foundFile, "Uploaded file should be in the file list"); + + // Download file content + OpenAIFile content = agentsClient.getFile(uploadedFile.getId()); + assertNotNull(content); + + // Clean up + agentsClient.deleteFile(uploadedFile.getId()); + } + + @Test + void testAgentWithFunctions() { + // Create an agent with function tools + FunctionToolDefinition getUserFavoriteCityTool = new FunctionToolDefinition( + new FunctionDefinition("getUserFavoriteCity", BinaryData.fromObject(new Object())) + .setDescription("Gets the user's favorite city.")); + + FunctionToolDefinition getCityNicknameTool = new FunctionToolDefinition(new FunctionDefinition( + "getCityNickname", + BinaryData.fromObject(mapOf("type", "object", "properties", + mapOf("location", mapOf("type", "string", "description", "The city and state, e.g. San Francisco, CA")), + "required", new String[] { "location" }))).setDescription("Gets the nickname of a city.")); + + String agentName = "functions_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a weather bot. Use the provided functions.") + .setTools(Arrays.asList(getUserFavoriteCityTool, getCityNicknameTool)); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + assertEquals(agentName, agent.getName()); + + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What's the nickname of my favorite city?"); + + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + // Process function calls + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + if (threadRun.getStatus() == RunStatus.REQUIRES_ACTION + && threadRun.getRequiredAction() instanceof SubmitToolOutputsAction) { + SubmitToolOutputsAction submitToolsOutputAction + = (SubmitToolOutputsAction) (threadRun.getRequiredAction()); + ArrayList toolOutputs = new ArrayList(); + + for (RequiredToolCall toolCall : submitToolsOutputAction.getSubmitToolOutputs().getToolCalls()) { + if (toolCall instanceof RequiredFunctionToolCall) { + RequiredFunctionToolCall functionToolCall = (RequiredFunctionToolCall) toolCall; + String functionName = functionToolCall.getFunction().getName(); + + if ("getUserFavoriteCity".equals(functionName)) { + toolOutputs.add( + new ToolOutput().setToolCallId(functionToolCall.getId()).setOutput("Seattle, WA")); + } else if ("getCityNickname".equals(functionName)) { + try { + String args = functionToolCall.getFunction().getArguments(); + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + toolOutputs.add(new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput("The Emerald City")); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + } + } + + threadRun = agentsClient.submitToolOutputsToRun(thread.getId(), threadRun.getId(), toolOutputs); + } + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + // Verify the run completed successfully + assertNotEquals(RunStatus.FAILED, threadRun.getStatus()); + + // Verify we got a response mentioning "Emerald City" + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + boolean foundEmeraldCity = false; + for (ThreadMessage message : messages.getData()) { + if (message.getRole() == MessageRole.AGENT) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue(); + if (content.contains("Emerald City")) { + foundEmeraldCity = true; + break; + } + } + } + } + } + assertTrue(foundEmeraldCity, "Agent response should mention 'Emerald City'"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + @Test + void testVectorStoreBatchFileSearch() throws InterruptedException { + // Upload a file + OpenAIFile uploadedFile = agentsClient.uploadFile(new UploadFileRequest( + new FileDetails(BinaryData.fromString("The Smart Eyewear offers AR display and voice control features.")) + .setFilename("product_info.md"), + FilePurpose.AGENTS)); + assertNotNull(uploadedFile); + + // Create vector store + VectorStore vectorStore + = agentsClient.createVectorStore(null, "test_vector_store_" + UUID.randomUUID(), null, null, null, null); + assertNotNull(vectorStore); + + // Create vector store file batch + VectorStoreFileBatch vectorStoreFileBatch = agentsClient.createVectorStoreFileBatch(vectorStore.getId(), + Arrays.asList(uploadedFile.getId()), null, null); + assertNotNull(vectorStoreFileBatch); + + // Wait for vector store to be ready + do { + Thread.sleep(500); + vectorStore = agentsClient.getVectorStore(vectorStore.getId()); + } while (vectorStore.getStatus() == VectorStoreStatus.IN_PROGRESS); + + // Create file search tool resource + FileSearchToolResource fileSearchToolResource + = new FileSearchToolResource().setVectorStoreIds(Arrays.asList(vectorStore.getId())); + + // Create agent with file search tool + String agentName = "file_search_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent that can search files for information.") + .setTools(Arrays.asList(new FileSearchToolDefinition())) + .setToolResources(new ToolResources().setFileSearch(fileSearchToolResource)); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Create thread and message + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What features does Smart Eyewear offer?"); + + // Run the agent + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(1000); // Longer sleep for file search + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + fail("Run failed: " + threadRun.getLastError().getMessage()); + } + + // Verify response contains information about the product + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + boolean foundFeatures = false; + for (ThreadMessage message : messages.getData()) { + if (message.getRole() == MessageRole.AGENT) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue(); + if (content.contains("AR display") || content.contains("voice control")) { + foundFeatures = true; + break; + } + } + } + } + } + + assertTrue(foundFeatures, "Agent response should mention Smart Eyewear features"); + + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + agentsClient.deleteVectorStore(vectorStore.getId()); + agentsClient.deleteFile(uploadedFile.getId()); + } + } + + @Test + void testAgentWithAdditionalMessages() { + // Create agent + String agentName = "additional_message_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent that provides consistent answers to questions.") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Create thread + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What is the value of Pi?"); + + // Run agent with additional messages + CreateRunOptions createRunOptions = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalMessages( + Arrays.asList(new ThreadMessageOptions(MessageRole.AGENT, BinaryData.fromString("Pi is exactly 3.")), + new ThreadMessageOptions(MessageRole.USER, BinaryData.fromString("Are you sure about Pi?")))); + + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + // Verify the run completed successfully + assertNotEquals(RunStatus.FAILED, threadRun.getStatus(), + threadRun.getStatus() == RunStatus.FAILED + ? threadRun.getLastError().getMessage() + : "Run should not fail"); + + // Verify that the response is influenced by additional messages + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + boolean foundPiResponse = false; + + for (ThreadMessage message : messages.getData()) { + if (message.getRole() == MessageRole.AGENT) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue().toLowerCase(); + // Response should mention Pi is approximately 3.14, not exactly 3 + if (content.contains("3.14") || content.contains("not 3")) { + foundPiResponse = true; + } + } + } + } + } + + assertTrue(foundPiResponse, "Agent should correct the value of Pi from the additional message"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + @Test + void testFileAttachmentWithCodeInterpreter() { + // Create agent with code interpreter + String agentName = "code_interpreter_file_test_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You help analyze data from files.") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Upload file + OpenAIFile uploadedFile = agentsClient.uploadFile(new UploadFileRequest(new FileDetails(BinaryData + .fromString("

Test Content

This is sample data for testing.

")) + .setFilename("sample_test.html"), + FilePurpose.AGENTS)); + assertNotNull(uploadedFile); + + // Create attachment with code interpreter tool + CodeInterpreterToolDefinition ciTool = new CodeInterpreterToolDefinition(); + MessageAttachment messageAttachment + = new MessageAttachment(Arrays.asList(BinaryData.fromObject(ciTool))).setFileId(uploadedFile.getId()); + assertNotNull(messageAttachment); + + // Create thread and message with attachment + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage(thread.getId(), MessageRole.USER, + "What does the attachment say?", Arrays.asList(messageAttachment), null); + assertNotNull(createdMessage); + + // Run agent + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + assertNotNull(threadRun); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + fail("Run failed: " + threadRun.getLastError().getMessage()); + } + + // Verify response includes file content + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertNotNull(messages); + assertFalse(messages.getData().isEmpty(), "Messages should not be empty"); + + boolean foundFileContent = false; + for (ThreadMessage message : messages.getData()) { + if (message.getRole() == MessageRole.AGENT) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue(); + if (content.contains("Test Content") || content.contains("sample data")) { + foundFileContent = true; + break; + } + } + } + } + } + + assertTrue(foundFileContent, "Agent response should include content from the attached file"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + agentsClient.deleteFile(uploadedFile.getId()); + } + } + + @Test + void testOpenApiTool() { + try { + + Path filePath = getFile("weather_openapi.json"); + JsonReader reader = JsonProviders.createReader(Files.readAllBytes(filePath)); + + OpenApiAnonymousAuthDetails oaiAuth = new OpenApiAnonymousAuthDetails(); + OpenApiToolDefinition openApiTool = new OpenApiToolDefinition(new OpenApiFunctionDefinition("openapitool", + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())), oaiAuth)); + // Create agent with OpenAPI tool + String agentName = "openapi_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent that can check the weather.") + .setTools(Arrays.asList(openApiTool)); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Create thread + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What's the weather in Seattle?"); + assertNotNull(createdMessage); + + // Run agent + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + assertNotNull(threadRun); + + try { + do { + Thread.sleep(500); + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + // Verify the run completed (may fail without actual endpoint) + assertNotNull(threadRun.getStatus()); + + // Even if we can't call an actual API, verify that we have an agent response + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertNotNull(messages); + + // There should be at least 2 messages (user question and agent response) + assertTrue(messages.getData().size() >= 2, "Should have at least a question and response"); + + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } catch (Exception e) { + // OpenAPI tests might fail due to lack of actual endpoint + System.out.println("OpenAPI test encountered exception: " + e.getMessage()); + } + } + + @Test + void testAgentStreaming() { + // Create an agent with code interpreter tool for visualization + String agentName = "streaming_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions( + "You politely help with math questions. Use the code interpreter tool when asked to visualize numbers.") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Create thread with a message asking for a visualization + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage(thread.getId(), MessageRole.USER, + "Draw a graph for a line with a slope of 4 and y-intercept of 9."); + + // Set up run with streaming + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + + try { + // Store results to verify afterward + AtomicBoolean receivedRunStartEvent = new AtomicBoolean(false); + AtomicBoolean receivedTextContent = new AtomicBoolean(false); + AtomicBoolean receivedImageContent = new AtomicBoolean(false); + + // Execute with streaming + Flux streamingUpdates = agentsClient.createRunStreaming(createRunOptions); + + // Process the streaming updates + streamingUpdates.doOnNext(streamUpdate -> { + if (streamUpdate.getKind() == AgentStreamEvent.THREAD_RUN_CREATED) { + receivedRunStartEvent.set(true); + } else if (streamUpdate instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) streamUpdate; + messageUpdate.getMessage().getDelta().getContent().forEach(delta -> { + if (delta instanceof MessageDeltaImageFileContent) { + MessageDeltaImageFileContent imgContent = (MessageDeltaImageFileContent) delta; + if (imgContent.getImageFile() != null && imgContent.getImageFile().getFileId() != null) { + receivedImageContent.set(true); + } + } else if (delta instanceof MessageDeltaTextContent) { + MessageDeltaTextContent textContent = (MessageDeltaTextContent) delta; + if (textContent.getText() != null && textContent.getText().getValue() != null) { + receivedTextContent.set(true); + } + } + }); + } + }).blockLast(); + + // Verify we received the expected streaming events + assertTrue(receivedRunStartEvent.get(), "Should receive run start event"); + assertTrue(receivedTextContent.get(), "Should receive text content in stream"); + + // Image content is not guaranteed depending on the model's response + // But we can check the final messages to see if any images were created + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + boolean foundGeneratedImage = false; + + for (ThreadMessage message : messages.getData()) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageImageFileContent) { + foundGeneratedImage = true; + break; + } + } + } + + // Check that messages were created correctly + assertFalse(messages.getData().isEmpty(), "Should have created messages"); + + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + @Test + void testAgentFunctionsStreaming() { + // Define function tools + FunctionToolDefinition getUserFavoriteCityTool = new FunctionToolDefinition( + new FunctionDefinition("getUserFavoriteCity", BinaryData.fromObject(new Object())) + .setDescription("Gets the user's favorite city.")); + + FunctionToolDefinition getCityNicknameTool = new FunctionToolDefinition(new FunctionDefinition( + "getCityNickname", + BinaryData.fromObject(mapOf("type", "object", "properties", + mapOf("location", mapOf("type", "string", "description", "The city and state, e.g. San Francisco, CA")), + "required", new String[] { "location" }))).setDescription("Gets the nickname of a city.")); + + FunctionToolDefinition getCurrentWeatherTool + = new FunctionToolDefinition( + new FunctionDefinition("getCurrentWeatherAtLocation", + BinaryData.fromObject(mapOf("type", "object", "properties", mapOf("location", + mapOf("type", "string", "description", "The city and state, e.g. San Francisco, CA"), "unit", + mapOf("type", "string", "description", "temperature unit as c or f", "enum", + new String[] { "c", "f" })), + "required", new String[] { "location", "unit" }))) + .setDescription("Gets the current weather at a provided location.")); + + // Function implementations + Supplier getUserFavoriteCity = () -> "Seattle, WA"; + + Function getCityNickname = (location) -> { + if ("Seattle, WA".equals(location)) { + return "The Emerald City"; + } + return "No nickname available"; + }; + + BiFunction getCurrentWeatherAtLocation = (location, unit) -> { + if ("Seattle, WA".equals(location)) { + return unit.equals("f") ? "70F" : "21C"; + } + return "Unknown"; + }; + + // Create the agent + String agentName = "function_streaming_test_agent_" + UUID.randomUUID(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a weather bot. Use the provided functions to help answer questions.") + .setTools(Arrays.asList(getUserFavoriteCityTool, getCityNicknameTool, getCurrentWeatherTool)); + + Agent agent = agentsClient.createAgent(createAgentOptions); + assertNotNull(agent); + + // Create thread + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage = agentsClient.createMessage(thread.getId(), MessageRole.USER, + "What's the weather like in my favorite city?"); + + // Function resolver + Function getResolvedToolOutput = toolCall -> { + if (toolCall instanceof RequiredFunctionToolCall) { + try { + RequiredFunctionToolCall functionToolCall = (RequiredFunctionToolCall) toolCall; + String functionName = functionToolCall.getFunction().getName(); + + if ("getUserFavoriteCity".equals(functionName)) { + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getUserFavoriteCity.get()); + } else if ("getCityNickname".equals(functionName)) { + String args = functionToolCall.getFunction().getArguments(); + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getCityNickname.apply(location)); + } else if ("getCurrentWeatherAtLocation".equals(functionName)) { + String args = functionToolCall.getFunction().getArguments(); + JsonNode root = new JsonMapper().readTree(args); + String location = String.valueOf(root.get("location").asText()); + String unit = String.valueOf(root.get("unit").asText()); + return new ToolOutput().setToolCallId(functionToolCall.getId()) + .setOutput(getCurrentWeatherAtLocation.apply(location, unit)); + } + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + return null; + }; + + // Setup and start streaming run + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + + try { + // Tracking variables + AtomicBoolean receivedRunStartEvent = new AtomicBoolean(false); + AtomicBoolean receivedTextContent = new AtomicBoolean(false); + AtomicBoolean receivedToolCall = new AtomicBoolean(false); + + // Execute streaming run + Flux streamingUpdates = agentsClient.createRunStreaming(createRunOptions); + + AtomicReference currentRun = new AtomicReference<>(); + + streamingUpdates.doOnNext(streamUpdate -> { + if (streamUpdate.getKind() == AgentStreamEvent.THREAD_RUN_CREATED) { + receivedRunStartEvent.set(true); + if (streamUpdate instanceof StreamThreadRunCreation) { + currentRun.set(((StreamThreadRunCreation) streamUpdate).getMessage()); + } + } else if (streamUpdate instanceof StreamRequiredAction) { + receivedToolCall.set(true); + StreamRequiredAction actionUpdate = (StreamRequiredAction) streamUpdate; + currentRun.set(actionUpdate.getMessage()); + + // Process function calls if required + if (currentRun.get().getStatus() == RunStatus.REQUIRES_ACTION + && currentRun.get().getRequiredAction() instanceof SubmitToolOutputsAction) { + + List toolOutputs = new ArrayList<>(); + SubmitToolOutputsAction action = (SubmitToolOutputsAction) currentRun.get().getRequiredAction(); + + for (RequiredToolCall toolCall : action.getSubmitToolOutputs().getToolCalls()) { + toolOutputs.add(getResolvedToolOutput.apply(toolCall)); + } + + // Submit tool outputs with streaming + agentsClient + .submitToolOutputsToRunStreaming(currentRun.get().getThreadId(), currentRun.get().getId(), + toolOutputs) + .doOnNext(update -> { + if (update instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) update; + messageUpdate.getMessage().getDelta().getContent().forEach(delta -> { + if (delta instanceof MessageDeltaTextContent) { + receivedTextContent.set(true); + } + }); + } + }) + .blockLast(); + } + } else if (streamUpdate instanceof StreamMessageUpdate) { + StreamMessageUpdate messageUpdate = (StreamMessageUpdate) streamUpdate; + messageUpdate.getMessage().getDelta().getContent().forEach(delta -> { + if (delta instanceof MessageDeltaTextContent) { + receivedTextContent.set(true); + } + }); + } + }).blockLast(); + + // Verify all the events we expect to happen + assertTrue(receivedRunStartEvent.get(), "Should receive run start event"); + assertTrue(receivedToolCall.get(), "Should receive tool call event"); + + // Verify final messages + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertFalse(messages.getData().isEmpty(), "Should have messages"); + + for (ThreadMessage message : messages.getData()) { + if (message.getRole() == MessageRole.AGENT) { + for (MessageContent contentItem : message.getContent()) { + if (contentItem instanceof MessageTextContent) { + String content = ((MessageTextContent) contentItem).getText().getValue().toLowerCase(); + } + } + } + } + + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + } + + @Test + void testAzureFunction() { + try { + // This test requires Azure Function integration, skipping if credentials aren't available + String storageQueueUri = Configuration.getGlobalConfiguration().get("STORAGE_QUEUE_URI", ""); + String azureFunctionName = Configuration.getGlobalConfiguration().get("AZURE_FUNCTION_NAME", ""); + + if (storageQueueUri.isEmpty() || azureFunctionName.isEmpty()) { + System.out.println("Skipping Azure Function test - missing configuration"); + return; + } + + // Create function definition + FunctionDefinition functionDefinition = new FunctionDefinition(azureFunctionName, + BinaryData.fromObject(mapOf("type", "object", "properties", + mapOf("location", mapOf("type", "string", "description", "The location to look up")), "required", + new String[] { "location" }))); + + AzureFunctionDefinition azureFunctionDefinition = new AzureFunctionDefinition(functionDefinition, + new AzureFunctionBinding(new AzureFunctionStorageQueue(storageQueueUri, "agent-input")), + new AzureFunctionBinding(new AzureFunctionStorageQueue(storageQueueUri, "agent-output"))); + + AzureFunctionToolDefinition azureFunctionTool = new AzureFunctionToolDefinition(azureFunctionDefinition); + + // Create agent with Azure Function tool + String agentName = "azure_function_test_agent_" + UUID.randomUUID(); + + // Azure Functions require preview flag + RequestOptions requestOptions + = new RequestOptions().setHeader(HttpHeaderName.fromString("x-ms-enable-preview"), "true"); + + CreateAgentRequest createAgentRequest = new CreateAgentRequest("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent. Use the provided function for weather queries.") + .setTools(Arrays.asList(azureFunctionTool)); + + BinaryData requestBody = BinaryData.fromObject(createAgentRequest); + Agent agent + = agentsClient.createAgentWithResponse(requestBody, requestOptions).getValue().toObject(Agent.class); + + assertNotNull(agent); + assertEquals(agentName, agent.getName()); + + // Create thread and message + AgentThread thread = agentsClient.createThread(); + ThreadMessage createdMessage + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What is the weather in Seattle, WA?"); + + // Run agent + CreateRunOptions createRunOptions + = new CreateRunOptions(thread.getId(), agent.getId()).setAdditionalInstructions(""); + + ThreadRun threadRun = agentsClient.createRun(createRunOptions); + assertNotNull(threadRun); + + // Wait for completion + try { + do { + Thread.sleep(1000); // Longer wait for Azure Function + threadRun = agentsClient.getRun(thread.getId(), threadRun.getId()); + } while (threadRun.getStatus() == RunStatus.QUEUED + || threadRun.getStatus() == RunStatus.IN_PROGRESS + || threadRun.getStatus() == RunStatus.REQUIRES_ACTION); + + if (threadRun.getStatus() == RunStatus.FAILED) { + System.out.println("Azure Function run failed: " + threadRun.getLastError().getMessage()); + // Don't fail the test as the actual function might not be available + } else { + // If the run completed, verify response + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertFalse(messages.getData().isEmpty(), "Should have received messages"); + + // There should be at least 2 messages (user query and agent response) + assertTrue(messages.getData().size() >= 2, "Should have at least user and agent messages"); + } + + } finally { + // Cleanup + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(agent.getId()); + } + + } catch (Exception e) { + System.out.println("Azure Function test encountered exception: " + e.getMessage()); + // Don't fail the test as Azure Function integration depends on external services + } + } + + @Test + void testCreateVector() { + // Create a vector store with configuration + String dataUri = Configuration.getGlobalConfiguration().get("DATA_URI", ""); + VectorStoreConfiguration config = new VectorStoreConfiguration( + Arrays.asList(new VectorStoreDataSource(dataUri, VectorStoreDataSourceAssetType.URI_ASSET))); + + String vectorStoreName = "config_vector_test_" + UUID.randomUUID(); + VectorStore vectorStore = agentsClient.createVectorStore(null, vectorStoreName, config, null, null, null); + + assertNotNull(vectorStore); + assertNotNull(vectorStore.getId()); + assertEquals(vectorStoreName, vectorStore.getName()); + + // Clean up + agentsClient.deleteVectorStore(vectorStore.getId()); + } + + @Test + void testCreateVectorStoreFileBatch() throws InterruptedException { + // Upload a file first + OpenAIFile uploadedFile = agentsClient.uploadFile( + new UploadFileRequest(new FileDetails(BinaryData.fromString("Content for vector store batch test")) + .setFilename("batch_test_file.txt"), FilePurpose.AGENTS)); + assertNotNull(uploadedFile); + + // Create empty vector store + VectorStore vectorStore + = agentsClient.createVectorStore(null, "file_batch_test_" + UUID.randomUUID(), null, null, null, null); + assertNotNull(vectorStore); + + // Create vector store file batch + VectorStoreFileBatch fileBatch = agentsClient.createVectorStoreFileBatch(vectorStore.getId(), + Arrays.asList(uploadedFile.getId()), null, null); + + assertNotNull(fileBatch); + assertNotNull(fileBatch.getId()); + assertEquals(vectorStore.getId(), fileBatch.getVectorStoreId()); + + // Wait for processing + do { + Thread.sleep(500); + vectorStore = agentsClient.getVectorStore(vectorStore.getId()); + } while (vectorStore.getStatus() == VectorStoreStatus.IN_PROGRESS); + + assertEquals(VectorStoreStatus.COMPLETED, vectorStore.getStatus()); + + // Clean up + agentsClient.deleteVectorStore(vectorStore.getId()); + agentsClient.deleteFile(uploadedFile.getId()); + } + + @Test + void testRunOperations() throws InterruptedException { + // Create thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + + // Create first message and run + ThreadMessage message1 + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "what is the value of y: x = 5; y = x + 1;"); + ThreadRun run1 = agentsClient.createRun(new CreateRunOptions(thread.getId(), ciAgent.getId())); + + while (run1.getStatus() != RunStatus.COMPLETED) { + Thread.sleep(500); + run1 = agentsClient.getRun(thread.getId(), run1.getId()); + } + + List runSteps = agentsClient.listRunSteps(run1.getThreadId(), run1.getId()).getData(); + assertTrue(runSteps.size() > 0); + RunStep runStep = runSteps.get(0); + assertNotNull(runStep); + runStep = agentsClient.getRunStep(run1.getThreadId(), run1.getId(), runStep.getId()); + assertNotNull(runStep); + + runSteps + = agentsClient.listRunSteps(run1.getThreadId(), run1.getId(), null, 1, ListSortOrder.ASCENDING, null, null) + .getData(); + assertTrue(runSteps.size() > 0); + agentsClient.updateRun(thread.getId(), run1.getId()); + + // List runs + List runs = agentsClient.listRuns(thread.getId()).getData(); + + assertEquals(1, runs.size(), "Should have 2 runs in the thread"); + + // Find both runs in the list + boolean foundRun1 = false; + + for (ThreadRun run : runs) { + if (run.getId().equals(run1.getId())) { + foundRun1 = true; + } + } + + assertTrue(foundRun1, "Run 1 should be in the list"); + + runs = agentsClient.listRuns(thread.getId(), 1, ListSortOrder.ASCENDING, null, null).getData(); + assertEquals(1, runs.size(), "Should have 2 runs in the thread"); + + // Clean up + agentsClient.deleteThread(thread.getId()); + + ThreadRun run2 = agentsClient.createThreadAndRun(new CreateThreadAndRunOptions(ciAgent.getId())); + assertNotNull(run2); + } + + @Test + void testCancelRun() { + // Create thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + + // Create message with a task that will take time to complete + ThreadMessage message = agentsClient.createMessage(thread.getId(), MessageRole.USER, + "Please analyze the Fibonacci sequence and its relationship to the golden ratio. " + + "Provide detailed mathematical analysis with formulas and proofs."); + + // Start a run + ThreadRun run = agentsClient.createRun(new CreateRunOptions(thread.getId(), ciAgent.getId())); + + assertNotNull(run); + + // Cancel the run immediately + ThreadRun cancelledRun = agentsClient.cancelRun(thread.getId(), run.getId()); + + // Verify cancellation + assertNotNull(cancelledRun); + assertTrue(cancelledRun.getStatus() == RunStatus.CANCELLING || cancelledRun.getStatus() == RunStatus.CANCELLED, + "Run should be cancelling or cancelled"); + + // Verify final state after waiting + try { + do { + Thread.sleep(500); + cancelledRun = agentsClient.getRun(thread.getId(), run.getId()); + } while (cancelledRun.getStatus() == RunStatus.CANCELLING); + + assertEquals(RunStatus.CANCELLED, cancelledRun.getStatus(), + "Run should have CANCELLED status after cancellation completes"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + // Clean up + agentsClient.deleteThread(thread.getId()); + } + } + + @Test + void testModifyThread() { + // Create thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + + // Create metadata + Map metadata = new HashMap<>(); + metadata.put("purpose", "testing"); + metadata.put("priority", "high"); + + // Modify thread + AgentThread modifiedThread = agentsClient.updateThread(thread.getId(), thread.getToolResources(), metadata); + + // Verify modification + assertNotNull(modifiedThread); + assertEquals(thread.getId(), modifiedThread.getId()); + assertNotNull(modifiedThread.getMetadata()); + assertEquals("testing", modifiedThread.getMetadata().get("purpose")); + assertEquals("high", modifiedThread.getMetadata().get("priority")); + + // Verify by getting the thread again + AgentThread retrievedThread = agentsClient.getThread(thread.getId()); + assertNotNull(retrievedThread.getMetadata()); + assertEquals("testing", retrievedThread.getMetadata().get("purpose")); + + // Clean up + agentsClient.deleteThread(thread.getId()); + } + + @Test + void testModifyMessage() { + // Create thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + + // Create message + ThreadMessage message = agentsClient.createMessage(thread.getId(), MessageRole.USER, "Original message"); + assertNotNull(message); + + // Create metadata + Map metadata = new HashMap<>(); + metadata.put("edited", "true"); + metadata.put("version", "2"); + + // Modify message + ThreadMessage modifiedMessage = agentsClient.updateMessage(thread.getId(), message.getId(), metadata); + + // Verify modification + assertNotNull(modifiedMessage); + assertEquals(message.getId(), modifiedMessage.getId()); + assertNotNull(modifiedMessage.getMetadata()); + assertEquals("true", modifiedMessage.getMetadata().get("edited")); + assertEquals("2", modifiedMessage.getMetadata().get("version")); + + // Verify by getting the message again + ThreadMessage retrievedMessage = agentsClient.getMessage(thread.getId(), message.getId()); + assertNotNull(retrievedMessage.getMetadata()); + assertEquals("true", retrievedMessage.getMetadata().get("edited")); + + // Clean up + agentsClient.deleteThread(thread.getId()); + } + + @Test + void testCreateRunStreaming() { + // Create thread + AgentThread thread = agentsClient.createThread(); + assertNotNull(thread); + + // Add message + ThreadMessage message + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "Please explain how rainbows form"); + assertNotNull(message); + + // Create run with streaming + CreateRunOptions runOptions = new CreateRunOptions(thread.getId(), ciAgent.getId()); + + AtomicBoolean receivedStreamUpdate = new AtomicBoolean(false); + + // Execute with streaming + Flux streamingUpdates = agentsClient.createRunStreaming(runOptions); + + streamingUpdates.doOnNext(update -> { + assertNotNull(update); + receivedStreamUpdate.set(true); + }).blockLast(); + + assertTrue(receivedStreamUpdate.get(), "Should have received streaming updates"); + + // Verify final messages + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertFalse(messages.getData().isEmpty(), "Should have created messages"); + + // Clean up + agentsClient.deleteThread(thread.getId()); + } + + @Test + void testSubmitToolOutputsToRunStreaming() { + // Create agent with function tool + FunctionToolDefinition getWeatherTool = new FunctionToolDefinition(new FunctionDefinition("getWeather", + BinaryData.fromObject(mapOf("type", "object", "properties", + mapOf("location", mapOf("type", "string", "description", "The city name")), "required", + new String[] { "location" }))).setDescription("Get weather for a location")); + + Agent functionAgent = agentsClient + .createAgent(new CreateAgentOptions("gpt-4o-mini").setName("streaming_tool_test_" + UUID.randomUUID()) + .setInstructions("You help with weather information") + .setTools(Arrays.asList(getWeatherTool))); + + // Create thread + AgentThread thread = agentsClient.createThread(); + ThreadMessage message + = agentsClient.createMessage(thread.getId(), MessageRole.USER, "What's the weather in Paris?"); + + // Create run + ThreadRun run = agentsClient.createRun(new CreateRunOptions(thread.getId(), functionAgent.getId())); + String runId = run.getId(); + + try { + // Wait until run requires action + do { + Thread.sleep(500); + run = agentsClient.getRun(thread.getId(), runId); + } while (run.getStatus() == RunStatus.QUEUED || run.getStatus() == RunStatus.IN_PROGRESS); + + // If run requires action, submit tool outputs with streaming + if (run.getStatus() == RunStatus.REQUIRES_ACTION + && run.getRequiredAction() instanceof SubmitToolOutputsAction) { + + SubmitToolOutputsAction action = (SubmitToolOutputsAction) run.getRequiredAction(); + List outputs = new ArrayList<>(); + + for (RequiredToolCall call : action.getSubmitToolOutputs().getToolCalls()) { + if (call instanceof RequiredFunctionToolCall) { + RequiredFunctionToolCall functionCall = (RequiredFunctionToolCall) call; + if ("getWeather".equals(functionCall.getFunction().getName())) { + outputs.add(new ToolOutput().setToolCallId(functionCall.getId()) + .setOutput("75°F and partly cloudy")); + } + } + } + + AtomicBoolean receivedStreamUpdate = new AtomicBoolean(false); + + // Submit tool outputs with streaming + Flux streamingUpdates + = agentsClient.submitToolOutputsToRunStreaming(thread.getId(), runId, outputs); + + streamingUpdates.doOnNext(update -> { + assertNotNull(update); + receivedStreamUpdate.set(true); + }).blockLast(); + + assertTrue(receivedStreamUpdate.get(), "Should have received streaming updates"); + } + + // Verify final messages + OpenAIPageableListOfThreadMessage messages = agentsClient.listMessages(thread.getId()); + assertFalse(messages.getData().isEmpty(), "Should have created messages"); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + // Clean up + agentsClient.deleteThread(thread.getId()); + agentsClient.deleteAgent(functionAgent.getId()); + } + } + + private Agent createCIAgent() { + String agentName = UUID.randomUUID().toString(); + CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini").setName(agentName) + .setInstructions("You are a helpful agent") + .setTools(Arrays.asList(new CodeInterpreterToolDefinition())); + ciAgent = agentsClient.createAgent(createAgentOptions); + return ciAgent; + } + + void printStreamUpdate(StreamMessageUpdate messageUpdate) { + messageUpdate.getMessage().getDelta().getContent().stream().forEach(delta -> { + if (delta instanceof MessageDeltaImageFileContent) { + MessageDeltaImageFileContent imgContent = (MessageDeltaImageFileContent) delta; + System.out.println("Image fileId: " + imgContent.getImageFile().getFileId()); + } else if (delta instanceof MessageDeltaTextContent) { + MessageDeltaTextContent textContent = (MessageDeltaTextContent) delta; + System.out.print(textContent.getText().getValue()); + } + }); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } + + // Get path of a fileName + private Path getFile(String fileName) throws FileNotFoundException, URISyntaxException { + URL resource = getClass().getClassLoader().getResource(fileName); + if (resource == null) { + throw new FileNotFoundException("File not found"); + } + File file = new File(resource.toURI()); + return file.toPath(); + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsClientTest.java new file mode 100644 index 000000000000..72d3ca2d0e6a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsClientTest.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.projects; + +import com.azure.ai.projects.generated.AIProjectClientTestBase; +import com.azure.ai.projects.implementation.models.GetConnectionResponse; +import com.azure.ai.projects.implementation.models.GetWorkspaceResponse; +import com.azure.ai.projects.implementation.models.ListConnectionsResponse; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ConnectionsClientTest extends AIProjectClientTestBase { + + @BeforeEach + void setUp() { + this.beforeTest(); + } + + @Test + @Disabled + void getWorkspace() { + GetWorkspaceResponse workspace = connectionsClient.getWorkspace(); + assertNotNull(workspace); + } + + @Test + @Disabled + void listConnections() { + ListConnectionsResponse connections = connectionsClient.listConnections(); + assertNotNull(connections); + } + + @Test + @Disabled + void getConnection() { + GetConnectionResponse connection = connectionsClient.getConnection("jayant-hub-2aqa-connection-AISearch"); + assertNotNull(connection); + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/TelemetryClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/TelemetryClientTest.java new file mode 100644 index 000000000000..0b0732b3e552 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/TelemetryClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.projects; + +import com.azure.ai.projects.generated.AIProjectClientTestBase; +import com.azure.ai.projects.implementation.models.GetAppInsightsResponse; +import com.azure.core.util.Configuration; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class TelemetryClientTest extends AIProjectClientTestBase { + + @BeforeEach + void setUp() { + this.beforeTest(); + } + + @Test + @Disabled + void testGetAppInsights() { + String appInsightsUrl = Configuration.getGlobalConfiguration().get("APP_INSIGHTS_URL", ""); + GetAppInsightsResponse appInsightsResponse = this.telemetryClient.getAppInsights(appInsightsUrl); + assertNotNull(appInsightsResponse); + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/generated/AIProjectClientTestBase.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/generated/AIProjectClientTestBase.java new file mode 100644 index 000000000000..7a37c6902d6f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/generated/AIProjectClientTestBase.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.projects.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.ai.projects.AIProjectClientBuilder; +import com.azure.ai.projects.AgentsClient; +import com.azure.ai.projects.ConnectionsClient; +import com.azure.ai.projects.EvaluationsClient; +import com.azure.ai.projects.TelemetryClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AIProjectClientTestBase extends TestProxyTestBase { + protected AgentsClient agentsClient; + + protected ConnectionsClient connectionsClient; + + protected TelemetryClient telemetryClient; + + protected EvaluationsClient evaluationsClient; + + @Override + protected void beforeTest() { + AIProjectClientBuilder agentsClientbuilder + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + agentsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + agentsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + agentsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + + agentsClient = agentsClientbuilder.buildAgentsClient(); + + AIProjectClientBuilder connectionsClientbuilder + = new AIProjectClientBuilder().endpoint("https://management.azure.com") + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + connectionsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + connectionsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + connectionsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + connectionsClient = connectionsClientbuilder.buildConnectionsClient(); + + AIProjectClientBuilder telemetryClientbuilder + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + telemetryClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + telemetryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + telemetryClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + telemetryClient = telemetryClientbuilder.buildTelemetryClient(); + + AIProjectClientBuilder evaluationsClientbuilder + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + evaluationsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + evaluationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + evaluationsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + evaluationsClient = evaluationsClientbuilder.buildEvaluationsClient(); + + } + + protected AIProjectClientBuilder getAIProjectClientBuilder() { + AIProjectClientBuilder agentsClientbuilder + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .subscriptionId(Configuration.getGlobalConfiguration().get("SUBSCRIPTIONID", "subscriptionid")) + .resourceGroupName(Configuration.getGlobalConfiguration().get("RESOURCEGROUPNAME", "resourcegroupname")) + .projectName(Configuration.getGlobalConfiguration().get("PROJECTNAME", "projectname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + agentsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + agentsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + agentsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + return agentsClientbuilder; + } +} diff --git a/sdk/ai/azure-ai-projects/src/test/resources/product_info_1.md b/sdk/ai/azure-ai-projects/src/test/resources/product_info_1.md new file mode 100644 index 000000000000..041155831d53 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/resources/product_info_1.md @@ -0,0 +1,51 @@ +# Information about product item_number: 1 + +## Brand +Contoso Galaxy Innovations + +## Category +Smart Eyewear + +## Features +- Augmented Reality interface +- Voice-controlled AI assistant +- HD video recording with 3D audio +- UV protection and blue light filtering +- Wireless charging with extended battery life + +## User Guide + +### 1. Introduction +Introduction to your new SmartView Glasses + +### 2. Product Overview +Overview of features and controls + +### 3. Sizing and Fit +Finding your perfect fit and style adjustments + +### 4. Proper Care and Maintenance +Cleaning and caring for your SmartView Glasses + +### 5. Break-in Period +Adjusting to the augmented reality experience + +### 6. Safety Tips +Safety guidelines for public and private spaces + +### 7. Troubleshooting +Quick fixes for common issues + +## Warranty Information +Two-year limited warranty on all electronic components + +## Contact Information +Customer Support at support@contoso-galaxy-innovations.com + +## Return Policy +30-day return policy with no questions asked + +## FAQ +- How to sync your SmartView Glasses with your devices +- Troubleshooting connection issues +- Customizing your augmented reality environment diff --git a/sdk/ai/azure-ai-projects/src/test/resources/sample_test.html b/sdk/ai/azure-ai-projects/src/test/resources/sample_test.html new file mode 100644 index 000000000000..a94253429cdb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/resources/sample_test.html @@ -0,0 +1,12 @@ + + + + + + Sample Document + + +

This is a sample document about Java

+

Java is an object oriented language

+ + diff --git a/sdk/ai/azure-ai-projects/src/test/resources/weather_openapi.json b/sdk/ai/azure-ai-projects/src/test/resources/weather_openapi.json new file mode 100644 index 000000000000..6cadfa516c19 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/test/resources/weather_openapi.json @@ -0,0 +1,62 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "get weather data", + "description": "Retrieves current weather data for a location based on wttr.in.", + "version": "v1.0.0" + }, + "servers": [ + { + "url": "https://wttr.in" + } + ], + "auth": [], + "paths": { + "/{location}": { + "get": { + "description": "Get weather information for a specific location", + "operationId": "GetCurrentWeather", + "parameters": [ + { + "name": "location", + "in": "path", + "description": "City or location to retrieve the weather for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "format", + "in": "query", + "description": "Always use j1 value for this parameter", + "required": true, + "schema": { + "type": "string", + "default": "j1" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Location not found" + } + }, + "deprecated": false + } + } + }, + "components": { + "schemes": {} + } +} diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml new file mode 100644 index 000000000000..d5f3db136a96 --- /dev/null +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -0,0 +1,5 @@ +repo: Azure/azure-rest-api-specs +additionalDirectories: [ ] +directory: specification/ai/Azure.AI.Projects +commit: b9c25f144f066778e516ba7b1a2e90067a5a2e3c +