diff --git a/.vscode/cspell.json b/.vscode/cspell.json index ade9ca3d6b7f..55f362e8a968 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -288,6 +288,7 @@ "Esto", "etag", "euap", + "evals", "eventhub", "eventhubs", "failondeprecatedstatus", diff --git a/sdk/ai/azure-ai-projects/README.md b/sdk/ai/azure-ai-projects/README.md index 6a8d3521adad..e590f79e60ff 100644 --- a/sdk/ai/azure-ai-projects/README.md +++ b/sdk/ai/azure-ai-projects/README.md @@ -1,8 +1,14 @@ # Azure Projects client library for Java -Azure Projects client library for Java. +The AI Projects client library is part of the Azure AI Foundry SDK and provides easy access to resources in your Azure AI Foundry Project. Use it to: -This package contains Microsoft Azure Projects client library. +* **Create and run Agents** using the separate package `com.azure.azure-ai-agents`. +* **Enumerate AI Models** deployed to your Foundry Project using the `Deployments` operations. +* **Enumerate connected Azure resources** in your Foundry project using the `Connections` operations. +* **Upload documents and create Datasets** to reference them using the `Datasets` operations. +* **Create and enumerate Search Indexes** using the `Indexes` operations. + +The client library uses version `v1` of the AI Foundry [data plane REST APIs](https://aka.ms/azsdk/azure-ai-projects/ga-rest-api-reference). ## Documentation @@ -36,9 +42,74 @@ Various documentation is available to help you get started ## Key concepts +The Azure AI Foundry provides a centralized spot to manage your AI Foundry resources. In order to access each feature you need to initialize your builder and access the corresponding sub-client like it's shown in the following code snippet: + +```java com.azure.ai.projects.clientInitialization +AIProjectClientBuilder builder = new AIProjectClientBuilder(); + +ConnectionsClient connectionsClient = builder.buildConnectionsClient(); +DatasetsClient datasetsClient = builder.buildDatasetsClient(); +DeploymentsClient deploymentsClient = builder.buildDeploymentsClient(); +EvaluationRulesClient evaluationRulesClient = builder.buildEvaluationRulesClient(); +EvaluationsClient evaluationsClient = builder.buildEvaluationsClient(); +EvaluationTaxonomiesClient evaluationTaxonomiesClient = builder.buildEvaluationTaxonomiesClient(); +EvaluatorsClient evaluatorsClient = builder.buildEvaluatorsClient(); +IndexesClient indexesClient = builder.buildIndexesClient(); +InsightsClient insightsClient = builder.buildInsightsClient(); +RedTeamsClient redTeamsClient = builder.buildRedTeamsClient(); +SchedulesClient schedulesClient = builder.buildSchedulesClient(); +``` + +In the particular case of the `EvaluationsClient`, this client library exposes [OpenAI's official SDK][openai_java_sdk] directly, so you can use the [official OpenAI docs][openai_api_docs] to access this feature. + +```java com.azure.ai.projects.evaluationsClientInit +EvalService evalService = evaluationsClient.getOpenAIClient(); +``` + ## Examples -```java com.azure.ai.projects.readme +### Connections operations + +The code below shows some Connection operations, which allow you to enumerate the Azure Resources connected to your AI Foundry Projects. These connections can be seen in the "Management Center", in the "Connected resources" tab in your AI Foundry Project. For more samples see the [package samples][package_samples]. + +```java com.azure.ai.projects.ConnectionsSample.listConnections +PagedIterable connections = connectionsClient.listConnections(); +for (Connection connection : connections) { + System.out.println("Connection name: " + connection.getName()); + System.out.println("Connection type: " + connection.getType()); + System.out.println("Connection credential type: " + connection.getCredentials().getType()); + System.out.println("-------------------------------------------------"); +} +``` + +### Indexes + +The code below shows some Indexes operations to list and create indexes. For more samples see the [package samples][package_samples]. + +```java com.azure.ai.projects.IndexesListSample.listIndexes +indexesClient.listLatest().forEach(index -> { + System.out.println("Index name: " + index.getName()); + System.out.println("Index version: " + index.getVersion()); + System.out.println("Index description: " + index.getDescription()); + System.out.println("-------------------------------------------------"); +}); +``` + +```java com.azure.ai.projects.IndexesGetSample.createOrUpdateIndex +String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); +String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "2.0"); +String aiSearchConnectionName = Configuration.getGlobalConfiguration().get("AI_SEARCH_CONNECTION_NAME", ""); +String aiSearchIndexName = Configuration.getGlobalConfiguration().get("AI_SEARCH_INDEX_NAME", ""); + +Index index = indexesClient.createOrUpdate( + indexName, + indexVersion, + new AzureAISearchIndex() + .setConnectionName(aiSearchConnectionName) + .setIndexName(aiSearchIndexName) +); + +System.out.println("Index created: " + index.getName()); ``` ### Service API versions @@ -71,8 +142,11 @@ For details on contributing to this repository, see the [contributing guide](htt 1. Create new Pull Request -[product_documentation]: https://azure.microsoft.com/services/ -[docs]: https://azure.github.io/azure-sdk-for-java/ +[product_documentation]: https://learn.microsoft.com/azure/ai-studio/ +[docs]: https://learn.microsoft.com/rest/api/aifoundry/aiprojects/ [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 +[package_samples]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects +[openai_java_sdk]: https://github.com/openai/openai-java +[openai_api_docs]: https://platform.openai.com/docs/overview diff --git a/sdk/ai/azure-ai-projects/_tsp-location.yaml b/sdk/ai/azure-ai-projects/_tsp-location.yaml index 97e466c545f6..64e6cc742e5d 100644 --- a/sdk/ai/azure-ai-projects/_tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/_tsp-location.yaml @@ -1,5 +1,5 @@ -directory: specification/ai/Azure.AI.Projects/ -commit: ff0bb49f83506566af01d38027029cd05469ab6a -repo: Azure/azure-rest-api-specs -additionalDirectories: [] - +directory: specification/ai/Azure.AI.Projects.java +commit: 78bfd335c31b8764578cfb9840f3b74349c10354 +repo: Azure/azure-rest-api-specs-pr +additionalDirectories: + - specification/ai/Azure.AI.Projects \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/checkstyle-suppressions.xml b/sdk/ai/azure-ai-projects/checkstyle-suppressions.xml index b7acfd3d4540..e926c1a9cd76 100644 --- a/sdk/ai/azure-ai-projects/checkstyle-suppressions.xml +++ b/sdk/ai/azure-ai-projects/checkstyle-suppressions.xml @@ -3,7 +3,6 @@ - - - - + + + diff --git a/sdk/ai/azure-ai-projects/customizations/pom.xml b/sdk/ai/azure-ai-projects/customizations/pom.xml new file mode 100644 index 000000000000..ca2397a9ff27 --- /dev/null +++ b/sdk/ai/azure-ai-projects/customizations/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + com.azure + azure-code-customization-parent + 1.0.0-beta.1 + ../../../parents/azure-code-customization-parent + + + com.azure.tools + azure-ai-projects-customizations + 1.2.0-beta.1 + jar + \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/customizations/src/main/java/ProjectsCustomizations.java b/sdk/ai/azure-ai-projects/customizations/src/main/java/ProjectsCustomizations.java new file mode 100644 index 000000000000..5ebd16e9cb2a --- /dev/null +++ b/sdk/ai/azure-ai-projects/customizations/src/main/java/ProjectsCustomizations.java @@ -0,0 +1,20 @@ +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.LibraryCustomization; +import org.slf4j.Logger; + + +/** + * This class contains the customization code to customize the AutoRest generated code for the Agents Client library + */ +public class ProjectsCustomizations extends Customization { + + @Override + public void customize(LibraryCustomization libraryCustomization, Logger logger) { +// removeConversationsClientBuilder(libraryCustomization, logger); + } + + private void removeConversationsClientBuilder(LibraryCustomization customization, Logger logger) { + logger.info("Removing ConversationsClientBuilder class"); + customization.getRawEditor().removeFile("src/main/java/com/azure/ai/agents/ConversationsClientBuilder.java"); + } +} \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/pom.xml b/sdk/ai/azure-ai-projects/pom.xml index 7e9dbac8705d..defd13f8368b 100644 --- a/sdk/ai/azure-ai-projects/pom.xml +++ b/sdk/ai/azure-ai-projects/pom.xml @@ -41,11 +41,13 @@ Code generated by Microsoft (R) TypeSpec Code Generator. Microsoft + + UTF-8 - 0.15 - 0.10 + 0.0 + 0.0 --add-exports com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED @@ -67,11 +69,11 @@ Code generated by Microsoft (R) TypeSpec Code Generator. azure-storage-blob 12.32.0 - - com.azure - azure-ai-agents-persistent - 1.0.0-beta.3 - + + + + + com.openai openai-java @@ -82,14 +84,14 @@ Code generated by Microsoft (R) TypeSpec Code Generator. com.azure - azure-core-test - 1.27.0-beta.13 + azure-identity + 1.18.1 test com.azure - azure-identity - 1.18.1 + azure-core-test + 1.27.0-beta.13 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 index c07d75bdbe1f..1759eeab6983 100644 --- 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 @@ -3,17 +3,8 @@ // Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.ai.projects; -import com.azure.ai.agents.persistent.PersistentAgentsAsyncClient; -import com.azure.ai.agents.persistent.PersistentAgentsClient; -import com.azure.ai.agents.persistent.PersistentAgentsClientBuilder; -import com.azure.ai.agents.persistent.PersistentAgentsServiceVersion; import com.azure.ai.projects.implementation.AIProjectClientImpl; -import com.azure.ai.projects.implementation.InferenceClientImpl; -import com.azure.ai.projects.models.ApiKeyCredentials; -import com.azure.ai.projects.models.BaseCredentials; -import com.azure.ai.projects.models.Connection; -import com.azure.ai.projects.models.ConnectionType; -import com.azure.ai.projects.models.CredentialType; +import com.azure.ai.projects.implementation.TokenUtils; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.client.traits.ConfigurationTrait; @@ -22,14 +13,10 @@ import com.azure.core.client.traits.TokenCredentialTrait; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.AddHeadersPolicy; @@ -44,21 +31,21 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; -import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; +import com.azure.core.util.UserAgentUtil; import com.azure.core.util.builder.ClientBuilderUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.serializer.JacksonAdapter; import com.openai.azure.AzureOpenAIServiceVersion; +import com.openai.azure.AzureUrlPathMode; import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.client.okhttp.OpenAIOkHttpClientAsync; import com.openai.credential.BearerTokenCredential; -import java.net.MalformedURLException; -import java.net.URL; +import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.function.Supplier; /** * A builder for creating a new instance of the AIProjectClient type. @@ -66,17 +53,25 @@ @ServiceClientBuilder( serviceClients = { ConnectionsClient.class, - EvaluationsClient.class, DatasetsClient.class, IndexesClient.class, DeploymentsClient.class, RedTeamsClient.class, + EvaluationRulesClient.class, + EvaluationTaxonomiesClient.class, + EvaluatorsClient.class, + InsightsClient.class, + SchedulesClient.class, ConnectionsAsyncClient.class, - EvaluationsAsyncClient.class, DatasetsAsyncClient.class, IndexesAsyncClient.class, DeploymentsAsyncClient.class, - RedTeamsAsyncClient.class }) + RedTeamsAsyncClient.class, + EvaluationRulesAsyncClient.class, + EvaluationTaxonomiesAsyncClient.class, + EvaluatorsAsyncClient.class, + InsightsAsyncClient.class, + SchedulesAsyncClient.class }) public final class AIProjectClientBuilder implements HttpTrait, ConfigurationTrait, TokenCredentialTrait, EndpointTrait { @@ -96,38 +91,46 @@ public final class AIProjectClientBuilder @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. + * The HTTP client used to send the request. */ @Generated - private HttpPipeline pipeline; + private HttpClient httpClient; /** * {@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; + public AIProjectClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; return this; } /* - * The HTTP client used to send the request. + * The HTTP pipeline to send requests through. */ @Generated - private HttpClient httpClient; + private HttpPipeline pipeline; /** * {@inheritDoc}. */ @Generated @Override - public AIProjectClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; + 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; } @@ -242,7 +245,7 @@ public AIProjectClientBuilder endpoint(String endpoint) { * Service version */ @Generated - private ProjectsServiceVersion serviceVersion; + private AIProjectsServiceVersion serviceVersion; /** * Sets Service version. @@ -251,7 +254,7 @@ public AIProjectClientBuilder endpoint(String endpoint) { * @return the AIProjectClientBuilder. */ @Generated - public AIProjectClientBuilder serviceVersion(ProjectsServiceVersion serviceVersion) { + public AIProjectClientBuilder serviceVersion(AIProjectsServiceVersion serviceVersion) { this.serviceVersion = serviceVersion; return this; } @@ -283,8 +286,8 @@ public AIProjectClientBuilder retryPolicy(RetryPolicy retryPolicy) { private AIProjectClientImpl buildInnerClient() { this.validateClient(); HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ProjectsServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ProjectsServiceVersion.getLatest(); + AIProjectsServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : AIProjectsServiceVersion.getLatest(); AIProjectClientImpl client = new AIProjectClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); return client; @@ -336,166 +339,103 @@ private HttpPipeline createHttpPipeline() { } /** - * Creates a configured instance of PersistentAgentsClientBuilder. + * Builds an instance of ConnectionsAsyncClient class. * - * @return a configured instance of PersistentAgentsClientBuilder. + * @return an instance of ConnectionsAsyncClient. */ - private PersistentAgentsClientBuilder createPersistentAgentsDelegateBuilder() { - PersistentAgentsClientBuilder builder = new PersistentAgentsClientBuilder(); - // Configure the builder with all the properties from this builder - if (pipeline != null) { - builder.pipeline(pipeline); - } - if (httpClient != null) { - builder.httpClient(httpClient); - } - if (httpLogOptions != null) { - builder.httpLogOptions(httpLogOptions); - } - if (clientOptions != null) { - builder.clientOptions(clientOptions); - } - if (retryOptions != null) { - builder.retryOptions(retryOptions); - } - if (configuration != null) { - builder.configuration(configuration); - } - if (tokenCredential != null) { - builder.credential(tokenCredential); - } - if (endpoint != null) { - builder.endpoint(endpoint); - } - if (serviceVersion != null) { - builder.serviceVersion(PersistentAgentsServiceVersion.valueOf(serviceVersion.getVersion())); - } - if (retryPolicy != null) { - builder.retryPolicy(retryPolicy); - } - // Add all pipeline policies - for (HttpPipelinePolicy policy : pipelinePolicies) { - builder.addPolicy(policy); - } - return builder; + @Generated + public ConnectionsAsyncClient buildConnectionsAsyncClient() { + return new ConnectionsAsyncClient(buildInnerClient().getConnections()); } /** - * The OpenAI connection name to be used for the OpenAIClient. + * Builds an instance of DatasetsAsyncClient class. + * + * @return an instance of DatasetsAsyncClient. */ - private String openAIConnectionName; + @Generated + public DatasetsAsyncClient buildDatasetsAsyncClient() { + return new DatasetsAsyncClient(buildInnerClient().getDatasets()); + } /** - * Sets the OpenAI connection name to be used for the OpenAIClient. + * Builds an instance of IndexesAsyncClient class. * - * @param openAIConnectionName the OpenAI connection name. - * @return the AIProjectClientBuilder. + * @return an instance of IndexesAsyncClient. */ - public AIProjectClientBuilder openAIConnectionName(String openAIConnectionName) { - this.openAIConnectionName = openAIConnectionName; - return this; + @Generated + public IndexesAsyncClient buildIndexesAsyncClient() { + return new IndexesAsyncClient(buildInnerClient().getIndexes()); } /** - * The Azure OpenAI service version to be used for the OpenAIClient. + * Builds an instance of DeploymentsAsyncClient class. + * + * @return an instance of DeploymentsAsyncClient. */ - private AzureOpenAIServiceVersion azureOpenAIServiceVersion; + @Generated + public DeploymentsAsyncClient buildDeploymentsAsyncClient() { + return new DeploymentsAsyncClient(buildInnerClient().getDeployments()); + } /** - * Sets the OpenAI service version to be used for the OpenAIClient. + * Builds an instance of RedTeamsAsyncClient class. * - * @param azureOpenAIServiceVersion the Azure OpenAI service version. - * @return the AIProjectClientBuilder. + * @return an instance of RedTeamsAsyncClient. */ - public AIProjectClientBuilder openAIServiceVersion(AzureOpenAIServiceVersion azureOpenAIServiceVersion) { - this.azureOpenAIServiceVersion = azureOpenAIServiceVersion; - return this; + @Generated + public RedTeamsAsyncClient buildRedTeamsAsyncClient() { + return new RedTeamsAsyncClient(buildInnerClient().getRedTeams()); } /** - * Creates a configured instance of OpenAIOkHttpClient.Builder. + * Builds an instance of EvaluationRulesAsyncClient class. * - * @return a configured instance of OpenAIOkHttpClient.Builder. - */ - private OpenAIOkHttpClient.Builder createOpenAIOkHttpClientDelegateBuilder() { - OpenAIOkHttpClient.Builder builder = OpenAIOkHttpClient.builder(); - ConnectionsClient connectionsClient = this.buildConnectionsClient(); - if (openAIConnectionName == null) { - // use the parent resource - String azureOpenAIEndpoint = getOpenAIInferenceUrl(this.endpoint); - builder.baseUrl(azureOpenAIEndpoint); - builder.credential(BearerTokenCredential - .create(getBearerTokenSupplier(this.tokenCredential, "https://cognitiveservices.azure.com/.default"))); - } else { - Connection connection = connectionsClient.getConnection(openAIConnectionName, true); - if (connection.getType() != ConnectionType.AZURE_OPEN_AI) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException("The connection is not of type OPENAI.")); - } - String azureOpenAIEndpoint = connection.getTarget(); - if (azureOpenAIEndpoint.endsWith("/")) { - azureOpenAIEndpoint = azureOpenAIEndpoint.substring(0, azureOpenAIEndpoint.length() - 1); - } - builder.baseUrl(azureOpenAIEndpoint); - BaseCredentials credentials = connection.getCredentials(); - if (credentials.getType() == CredentialType.API_KEY && credentials instanceof ApiKeyCredentials) { - String apiKey = ((ApiKeyCredentials) credentials).getApiKey(); - builder.apiKey(apiKey); - } else if (credentials.getType() == CredentialType.ENTRA_ID) { - if (tokenCredential == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Credential is required for OpenAI connection.")); - } - builder.credential(BearerTokenCredential - .create(getBearerTokenSupplier(tokenCredential, "https://cognitiveservices.azure.com/.default"))); - } else { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Unsupported credential type for OpenAI connection.")); - } - } - if (azureOpenAIServiceVersion != null) { - builder.azureServiceVersion(azureOpenAIServiceVersion); - } - return builder; + * @return an instance of EvaluationRulesAsyncClient. + */ + @Generated + public EvaluationRulesAsyncClient buildEvaluationRulesAsyncClient() { + return new EvaluationRulesAsyncClient(buildInnerClient().getEvaluationRules()); } /** - * Builds an instance of ConnectionsAsyncClient class. + * Builds an instance of EvaluationTaxonomiesAsyncClient class. * - * @return an instance of ConnectionsAsyncClient. + * @return an instance of EvaluationTaxonomiesAsyncClient. */ @Generated - public ConnectionsAsyncClient buildConnectionsAsyncClient() { - return new ConnectionsAsyncClient(buildInnerClient().getConnections()); + public EvaluationTaxonomiesAsyncClient buildEvaluationTaxonomiesAsyncClient() { + return new EvaluationTaxonomiesAsyncClient(buildInnerClient().getEvaluationTaxonomies()); } /** - * Builds an instance of DatasetsAsyncClient class. + * Builds an instance of EvaluatorsAsyncClient class. * - * @return an instance of DatasetsAsyncClient. + * @return an instance of EvaluatorsAsyncClient. */ @Generated - public DatasetsAsyncClient buildDatasetsAsyncClient() { - return new DatasetsAsyncClient(buildInnerClient().getDatasets()); + public EvaluatorsAsyncClient buildEvaluatorsAsyncClient() { + return new EvaluatorsAsyncClient(buildInnerClient().getEvaluators()); } /** - * Builds an instance of IndexesAsyncClient class. + * Builds an instance of InsightsAsyncClient class. * - * @return an instance of IndexesAsyncClient. + * @return an instance of InsightsAsyncClient. */ @Generated - public IndexesAsyncClient buildIndexesAsyncClient() { - return new IndexesAsyncClient(buildInnerClient().getIndexes()); + public InsightsAsyncClient buildInsightsAsyncClient() { + return new InsightsAsyncClient(buildInnerClient().getInsights()); } /** - * Builds an instance of DeploymentsAsyncClient class. + * Builds an instance of SchedulesAsyncClient class. * - * @return an instance of DeploymentsAsyncClient. + * @return an instance of SchedulesAsyncClient. */ @Generated - public DeploymentsAsyncClient buildDeploymentsAsyncClient() { - return new DeploymentsAsyncClient(buildInnerClient().getDeployments()); + public SchedulesAsyncClient buildSchedulesAsyncClient() { + return new SchedulesAsyncClient(buildInnerClient().getSchedules()); } /** @@ -539,146 +479,120 @@ public DeploymentsClient buildDeploymentsClient() { } /** - * Builds an instance of TelemetryClient + * Builds an instance of RedTeamsClient class. * - * @return an instance of TelemetryClient. + * @return an instance of RedTeamsClient. */ - public TelemetryClient buildTelemetryClient() { - ConnectionsClient connectionsClient = this.buildConnectionsClient(); - return new TelemetryClient(connectionsClient); + @Generated + public RedTeamsClient buildRedTeamsClient() { + return new RedTeamsClient(buildInnerClient().getRedTeams()); } /** - * Builds an instance of TelemetryAsyncClient + * Builds an instance of EvaluationRulesClient class. * - * @return an instance of TelemetryAsyncClient. + * @return an instance of EvaluationRulesClient. */ - public TelemetryAsyncClient buildTelemetryAsyncClient() { - ConnectionsAsyncClient connectionsAsyncClient = this.buildConnectionsAsyncClient(); - return new TelemetryAsyncClient(connectionsAsyncClient); + @Generated + public EvaluationRulesClient buildEvaluationRulesClient() { + return new EvaluationRulesClient(buildInnerClient().getEvaluationRules()); } /** - * Builds an instance of PersistentAgentsClient + * Builds an instance of EvaluationTaxonomiesClient class. * - * @return an instance of PersistentAgentsClient. + * @return an instance of EvaluationTaxonomiesClient. */ - public PersistentAgentsClient buildPersistentAgentsClient() { - return createPersistentAgentsDelegateBuilder().buildClient(); + @Generated + public EvaluationTaxonomiesClient buildEvaluationTaxonomiesClient() { + return new EvaluationTaxonomiesClient(buildInnerClient().getEvaluationTaxonomies()); } /** - * Builds an instance of PersistentAgentsAsyncClient + * Builds an instance of EvaluatorsClient class. * - * @return an instance of PersistentAgentsAsyncClient. + * @return an instance of EvaluatorsClient. */ - public PersistentAgentsAsyncClient buildPersistentAgentsAsyncClient() { - return createPersistentAgentsDelegateBuilder().buildAsyncClient(); + @Generated + public EvaluatorsClient buildEvaluatorsClient() { + return new EvaluatorsClient(buildInnerClient().getEvaluators()); } /** - * Builds an instance of InferenceClient. + * Builds an instance of InsightsClient class. * - * @return an instance of InferenceClient. + * @return an instance of InsightsClient. */ - public InferenceClient buildInferenceClient() { - return new InferenceClient(new InferenceClientImpl(createOpenAIOkHttpClientDelegateBuilder())); + @Generated + public InsightsClient buildInsightsClient() { + return new InsightsClient(buildInnerClient().getInsights()); } /** - * Builds an instance of InferenceAsyncClient. + * Builds an instance of SchedulesClient class. * - * @return an instance of InferenceAsyncClient. + * @return an instance of SchedulesClient. */ - public InferenceAsyncClient buildInferenceAsyncClient() { - return new InferenceAsyncClient(new InferenceClientImpl(createOpenAIOkHttpClientDelegateBuilder())); - } - - private static final ClientLogger LOGGER = new ClientLogger(AIProjectClientBuilder.class); - - private static Supplier getBearerTokenSupplier(TokenCredential credential, String... scopes) { - HttpPipeline pipeline - = new HttpPipelineBuilder().policies(new BearerTokenAuthenticationPolicy(credential, scopes)).build(); - return () -> { - // This request will never need to go anywhere; it is simply to cause the policy to interact with - // the user's credential - HttpRequest req = new HttpRequest(HttpMethod.GET, "https://www.example.com"); - try (HttpResponse res = pipeline.sendSync(req, Context.NONE)) { - return res.getRequest().getHeaders().get(HttpHeaderName.AUTHORIZATION).getValue().split(" ")[1]; - } - }; + @Generated + public SchedulesClient buildSchedulesClient() { + return new SchedulesClient(buildInnerClient().getSchedules()); } /** - * Converts an input URL in the format: - * https://[host-name]/[some-path] - * to: - * https://[host-name] + * Builds an instance of EvaluationsClient class with a default setup for OpenAI * - * @param inputUrl The input endpoint URL used to construct AIProjectClient. - * @return The endpoint URL required to construct an AzureOpenAI client. - */ - private static String getOpenAIInferenceUrl(String inputUrl) { - URL parsed = null; - try { - parsed = new URL(inputUrl); - } catch (MalformedURLException e) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Invalid endpoint URL format. Malformed.", e)); - } - if (!"https".equals(parsed.getProtocol()) || parsed.getHost().isEmpty()) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Invalid endpoint URL format. Must be an https URL with a host.")); - } - String newUrl = "https://" + parsed.getHost(); - return newUrl; - } - - /** - * Create an instance of the AIProjectClientBuilder. + * @return an instance of EvaluationsClient */ - @Generated - public AIProjectClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); + public EvaluationsClient buildEvaluationsClient() { + OpenAIOkHttpClient.Builder builder = getOpenAIClientBuilder(); + return new EvaluationsClient(builder.build()); } /** - * Builds an instance of EvaluationsAsyncClient class. + * Builds an instance of EvaluationsClientAsync class with a default setup for OpenAI * - * @return an instance of EvaluationsAsyncClient. + * @return an instance of EvaluationsClientAsync */ - @Generated public EvaluationsAsyncClient buildEvaluationsAsyncClient() { - return new EvaluationsAsyncClient(buildInnerClient().getEvaluations()); + return new EvaluationsAsyncClient(getOpenAIAsyncClientBuilder().build()); + } + + private OpenAIOkHttpClient.Builder getOpenAIClientBuilder() { + OpenAIOkHttpClient.Builder builder = OpenAIOkHttpClient.builder() + .credential( + BearerTokenCredential.create(TokenUtils.getBearerTokenSupplier(this.tokenCredential, DEFAULT_SCOPES))); + builder.baseUrl(this.endpoint + (this.endpoint.endsWith("/") ? "openai" : "/openai")); + builder.replaceHeaders("User-Agent", getUserAgent()); + if (this.serviceVersion != null) { + builder.azureServiceVersion(AzureOpenAIServiceVersion.fromString(this.serviceVersion.getVersion())); + builder.azureUrlPathMode(AzureUrlPathMode.UNIFIED); + } + builder.timeout(Duration.ofSeconds(30)); + return builder; } - /** - * Builds an instance of RedTeamsAsyncClient class. - * - * @return an instance of RedTeamsAsyncClient. - */ - @Generated - public RedTeamsAsyncClient buildRedTeamsAsyncClient() { - return new RedTeamsAsyncClient(buildInnerClient().getRedTeams()); + private OpenAIOkHttpClientAsync.Builder getOpenAIAsyncClientBuilder() { + OpenAIOkHttpClientAsync.Builder builder = OpenAIOkHttpClientAsync.builder() + .credential( + BearerTokenCredential.create(TokenUtils.getBearerTokenSupplier(this.tokenCredential, DEFAULT_SCOPES))); + builder.baseUrl(this.endpoint + (this.endpoint.endsWith("/") ? "openai" : "/openai")); + builder.replaceHeaders("User-Agent", getUserAgent()); + if (this.serviceVersion != null) { + builder.azureServiceVersion(AzureOpenAIServiceVersion.fromString(this.serviceVersion.getVersion())); + builder.azureUrlPath(AzureUrlPathMode.UNIFIED); + } + builder.timeout(Duration.ofSeconds(30)); + return builder; } - /** - * Builds an instance of EvaluationsClient class. - * - * @return an instance of EvaluationsClient. - */ - @Generated - public EvaluationsClient buildEvaluationsClient() { - return new EvaluationsClient(buildInnerClient().getEvaluations()); + private String getUserAgent() { + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + String sdkName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String sdkVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + return UserAgentUtil.toUserAgentString(applicationId, sdkName, sdkVersion, configuration); } - /** - * Builds an instance of RedTeamsClient class. - * - * @return an instance of RedTeamsClient. - */ - @Generated - public RedTeamsClient buildRedTeamsClient() { - return new RedTeamsClient(buildInnerClient().getRedTeams()); - } + private static final ClientLogger LOGGER = new ClientLogger(AIProjectClientBuilder.class); } 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/AIProjectsServiceVersion.java similarity index 59% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/ProjectsServiceVersion.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/AIProjectsServiceVersion.java index 2e2c7719dfec..e0395b87440a 100644 --- 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/AIProjectsServiceVersion.java @@ -7,9 +7,9 @@ import com.azure.core.util.ServiceVersion; /** - * Service version of ProjectsClient. + * Service version of AIProjectsClient. */ -public enum ProjectsServiceVersion implements ServiceVersion { +public enum AIProjectsServiceVersion implements ServiceVersion { /** * Enum value 2025-05-01. */ @@ -18,11 +18,16 @@ public enum ProjectsServiceVersion implements ServiceVersion { /** * Enum value 2025-05-15-preview. */ - V2025_05_15_PREVIEW("2025-05-15-preview"); + V2025_05_15_PREVIEW("2025-05-15-preview"), + + /** + * Enum value 2025-11-15-preview. + */ + V2025_11_15_PREVIEW("2025-11-15-preview"); private final String version; - ProjectsServiceVersion(String version) { + AIProjectsServiceVersion(String version) { this.version = version; } @@ -37,9 +42,9 @@ public String getVersion() { /** * Gets the latest service version supported by this client library. * - * @return The latest {@link ProjectsServiceVersion}. + * @return The latest {@link AIProjectsServiceVersion}. */ - public static ProjectsServiceVersion getLatest() { - return V2025_05_15_PREVIEW; + public static AIProjectsServiceVersion getLatest() { + return V2025_11_15_PREVIEW; } } 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 index 6ce88dc1a3f9..833d682fad74 100644 --- 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 @@ -44,90 +44,6 @@ public final class ConnectionsAsyncClient { this.serviceClient = serviceClient; } - /** - * Get a connection by name, with or without its connection credentials. - * - * @param name The friendly name of the connection, provided by the user. - * @param includeCredentials Whether to include connection credentials in the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 connection by name, with or without its connection credentials on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getConnection(String name, boolean includeCredentials) { - if (includeCredentials) { - return getConnectionWithCredentials(name); - } else { - return getConnection(name); - } - } - - /** - * Get a connection by name, without populating connection credentials. - * - * @param name The friendly name of the connection, provided by the user. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getConnection(String name) { - // Generated convenience method for getConnectionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getConnectionWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Connection.class)); - } - - /** - * Get the default connection for a given connection type. - * - * @param connectionType The type of the 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 Default connection of the type specified on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefaultConnection(ConnectionType connectionType) { - return getDefaultConnection(connectionType, false); - } - - /** - * Get the default connection for a given connection type. - * - * @param connectionType The type of the connection - * @param includeCredentials Whether to include connection credentials in the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return Default connection of the type specified on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefaultConnection(ConnectionType connectionType, boolean includeCredentials) { - return listConnections(connectionType, true).filter(Connection::isDefault).next().flatMap(connection -> { - if (includeCredentials && connection != null) { - return getConnectionWithCredentials(connection.getName()); - } else { - return Mono.just(connection); - } - }); - } - /** * Get a connection by name, without populating connection credentials. *

Response Body Schema

@@ -137,11 +53,11 @@ public Mono getDefaultConnection(ConnectionType connectionType, bool * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -174,11 +90,11 @@ Mono> getConnectionWithResponse(String name, RequestOptions * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -210,7 +126,7 @@ Mono> getConnectionWithCredentialsWithResponse(String name, * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -222,11 +138,11 @@ Mono> getConnectionWithCredentialsWithResponse(String name, * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -248,6 +164,27 @@ public PagedFlux listConnections(RequestOptions requestOptions) { return this.serviceClient.listConnectionsAsync(requestOptions); } + /** + * Get a connection by name, without populating connection credentials. + * + * @param name The friendly name of the connection, provided by the user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getConnection(String name) { + // Generated convenience method for getConnectionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getConnectionWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Connection.class)); + } + /** * Get a connection by name, with its connection credentials. * @@ -337,4 +274,26 @@ public PagedFlux listConnections() { pagedResponse.getContinuationToken(), null)); }); } + + /** + * Get a connection by name, without populating connection credentials. + * + * @param name The friendly name of the connection, provided by the user. + * @param includeCredentials Whether to include connection credentials in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getConnection(String name, boolean includeCredentials) { + if (includeCredentials) { + return getConnectionWithCredentials(name); + } else { + return getConnection(name); + } + } } 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 index b5799885452a..5ecb9ca0e6c0 100644 --- 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 @@ -38,87 +38,6 @@ public final class ConnectionsClient { this.serviceClient = serviceClient; } - /** - * Get the default connection for a given connection type. - * - * @param connectionType The type of the 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 Default connection of the type specified. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Connection getDefaultConnection(ConnectionType connectionType) { - return this.getDefaultConnection(connectionType, false); - } - - /** - * Get the default connection for a given connection type. - * - * @param connectionType The type of the connection - * @param includeCredentials Whether to include connection credentials in the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return Default connection of the type specified. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Connection getDefaultConnection(ConnectionType connectionType, boolean includeCredentials) { - PagedIterable connections = this.listConnections(connectionType, true); - for (Connection connection : connections) { - if (connection.isDefault()) { - return connection; - } - } - return null; - } - - /** - * Get a connection by name, without populating connection credentials. - * - * @param name The friendly name of the connection, provided by the user. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Connection getConnection(String name) { - RequestOptions requestOptions = new RequestOptions(); - return getConnectionWithResponse(name, requestOptions).getValue().toObject(Connection.class); - } - - /** - * Get a connection by name, without populating connection credentials. - * - * @param name The friendly name of the connection, provided by the user. - * @param includeCredentials Whether to include connection credentials in the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Connection getConnection(String name, boolean includeCredentials) { - if (includeCredentials) { - return getConnectionWithCredentials(name); - } else { - return getConnection(name); - } - } - /** * Get a connection by name, without populating connection credentials. *

Response Body Schema

@@ -128,11 +47,11 @@ public Connection getConnection(String name, boolean includeCredentials) { * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -164,11 +83,11 @@ Response getConnectionWithResponse(String name, RequestOptions reque * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -199,7 +118,7 @@ Response getConnectionWithCredentialsWithResponse(String name, Reque * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -211,11 +130,11 @@ Response getConnectionWithCredentialsWithResponse(String name, Reque * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -237,6 +156,26 @@ public PagedIterable listConnections(RequestOptions requestOptions) return this.serviceClient.listConnections(requestOptions); } + /** + * Get a connection by name, without populating connection credentials. + * + * @param name The friendly name of the connection, provided by the user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Connection getConnection(String name) { + // Generated convenience method for getConnectionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getConnectionWithResponse(name, requestOptions).getValue().toObject(Connection.class); + } + /** * Get a connection by name, with its connection credentials. * @@ -303,4 +242,26 @@ public PagedIterable listConnections() { return serviceClient.listConnections(requestOptions) .mapPage(bodyItemValue -> bodyItemValue.toObject(Connection.class)); } + + /** + * Get a connection by name, without populating connection credentials. + * + * @param name The friendly name of the connection, provided by the user. + * @param includeCredentials Whether to include connection credentials in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 connection by name, without populating connection credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Connection getConnection(String name, boolean includeCredentials) { + if (includeCredentials) { + return getConnectionWithCredentials(name); + } else { + return getConnection(name); + } + } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsAsyncClient.java index 5581dcdf9741..4c7c2f5fdb0f 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsAsyncClient.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsAsyncClient.java @@ -5,7 +5,7 @@ import com.azure.ai.projects.implementation.DatasetsImpl; import com.azure.ai.projects.implementation.JsonMergePatchHelper; -import com.azure.ai.projects.models.AssetCredentialResult; +import com.azure.ai.projects.models.DatasetCredential; import com.azure.ai.projects.models.DatasetVersion; import com.azure.ai.projects.models.FileDatasetVersion; import com.azure.ai.projects.models.FolderDatasetVersion; @@ -26,7 +26,6 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.BlobClientBuilder; import java.nio.file.Files; @@ -45,8 +44,6 @@ public final class DatasetsAsyncClient { @Generated private final DatasetsImpl serviceClient; - private final ClientLogger logger = new ClientLogger(DatasetsAsyncClient.class); - /** * Initializes an instance of DatasetsAsyncClient class. * @@ -58,55 +55,39 @@ public final class DatasetsAsyncClient { } /** - * Start a new or get an existing pending upload of a dataset for a specific version. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     pendingUploadId: String (Optional)
-     *     connectionName: String (Optional)
-     *     pendingUploadType: String(None/BlobReference) (Required)
-     * }
-     * }
-     * 
- * + * List all versions of the given DatasetVersion. *

Response Body Schema

* *
      * {@code
      * {
-     *     blobReference (Required): {
-     *         blobUri: String (Required)
-     *         storageAccountArmId: String (Required)
-     *         credential (Required): {
-     *             sasUri: String (Required)
-     *             type: String (Required)
-     *         }
+     *     type: String(uri_file/uri_folder) (Required)
+     *     dataUri: String (Optional, Required on create)
+     *     isReference: Boolean (Optional)
+     *     connectionName: String (Optional)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
      *     }
-     *     pendingUploadId: String (Required)
-     *     version: String (Optional)
-     *     pendingUploadType: String(None/BlobReference) (Required)
      * }
      * }
      * 
* * @param name The name of the resource. - * @param version The specific version id of the DatasetVersion to operate on. - * @param pendingUploadRequest The pending upload request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 the response for a pending upload request along with {@link Response} on successful completion - * of {@link Mono}. + * @return paged collection of DatasetVersion items as paginated response with {@link PagedFlux}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pendingUploadWithResponse(String name, String version, - BinaryData pendingUploadRequest, RequestOptions requestOptions) { - return this.serviceClient.pendingUploadWithResponseAsync(name, version, pendingUploadRequest, requestOptions); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersionsAsync(name, requestOptions); } /** @@ -146,28 +127,35 @@ public Mono> getCredentialsWithResponse(String name, String } /** - * Start a new or get an existing pending upload of a dataset for a specific version. + * List all versions of the given DatasetVersion. * * @param name The name of the resource. - * @param version The specific version id of the DatasetVersion to operate on. - * @param pendingUploadRequest The pending upload request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the 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 the response for a pending upload request on successful completion of {@link Mono}. + * @return paged collection of DatasetVersion items as paginated response with {@link PagedFlux}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono pendingUpload(String name, String version, - PendingUploadRequest pendingUploadRequest) { - // Generated convenience method for pendingUploadWithResponse + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name) { + // Generated convenience method for listVersions RequestOptions requestOptions = new RequestOptions(); - return pendingUploadWithResponse(name, version, BinaryData.fromObject(pendingUploadRequest), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PendingUploadResponse.class)); + PagedFlux pagedFluxResponse = listVersions(name, 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(DatasetVersion.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); } /** @@ -186,11 +174,11 @@ public Mono pendingUpload(String name, String version, */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCredentials(String name, String version) { + public Mono getCredentials(String name, String version) { // Generated convenience method for getCredentialsWithResponse RequestOptions requestOptions = new RequestOptions(); return getCredentialsWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AssetCredentialResult.class)); + .map(protocolMethodData -> protocolMethodData.toObject(DatasetCredential.class)); } /** @@ -217,8 +205,7 @@ public Mono createDatasetWithFile(String name, String versio RequestOptions requestOptions = new RequestOptions(); FileDatasetVersion fileDataset = new FileDatasetVersion().setDataUri(blobUrl); return this - .createOrUpdateDatasetVersionWithResponse(name, version, BinaryData.fromObject(fileDataset), - requestOptions) + .createOrUpdateVersionWithResponse(name, version, BinaryData.fromObject(fileDataset), requestOptions) .flatMap(FluxUtil::toMono) .map(data -> data.toObject(FileDatasetVersion.class)); }); @@ -265,47 +252,87 @@ public Mono createDatasetWithFolder(String name, String ve RequestOptions requestOptions = new RequestOptions(); FolderDatasetVersion folderDataset = new FolderDatasetVersion().setDataUri(containerUrl); return this - .createOrUpdateDatasetVersionWithResponse(name, version, BinaryData.fromObject(folderDataset), - requestOptions) + .createOrUpdateVersionWithResponse(name, version, BinaryData.fromObject(folderDataset), requestOptions) .flatMap(FluxUtil::toMono) .map(data -> data.toObject(FolderDatasetVersion.class)); }); } /** - * List all versions of the given DatasetVersion. - *

Response Body Schema

+ * Start a new or get an existing pending upload of a dataset for a specific version. + *

Request Body Schema

* *
      * {@code
      * {
-     *     type: String(uri_file/uri_folder) (Required)
-     *     dataUri: String (Optional, Required on create)
-     *     isReference: Boolean (Optional)
+     *     pendingUploadId: String (Optional)
      *     connectionName: String (Optional)
-     *     id: String (Optional)
-     *     name: String (Required)
-     *     version: String (Required)
-     *     description: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     pendingUploadType: String(None/BlobReference) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     blobReference (Required): {
+     *         blobUri: String (Required)
+     *         storageAccountArmId: String (Required)
+     *         credential (Required): {
+     *             sasUri: String (Required)
+     *             type: String (Required)
+     *         }
      *     }
+     *     pendingUploadId: String (Required)
+     *     version: String (Optional)
+     *     pendingUploadType: String(None/BlobReference) (Required)
      * }
      * }
      * 
* * @param name The name of the resource. + * @param version The specific version id of the DatasetVersion to operate on. + * @param pendingUploadRequest The pending upload request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 DatasetVersion items as paginated response with {@link PagedFlux}. + * @return represents the response for a pending upload request along with {@link Response} on successful completion + * of {@link Mono}. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listDatasetVersions(String name, RequestOptions requestOptions) { - return this.serviceClient.listDatasetVersionsAsync(name, requestOptions); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pendingUploadWithResponse(String name, String version, + BinaryData pendingUploadRequest, RequestOptions requestOptions) { + return this.serviceClient.pendingUploadWithResponseAsync(name, version, pendingUploadRequest, requestOptions); + } + + /** + * Start a new or get an existing pending upload of a dataset for a specific version. + * + * @param name The name of the resource. + * @param version The specific version id of the DatasetVersion to operate on. + * @param pendingUploadRequest The pending upload request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 the response for a pending upload request on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono pendingUpload(String name, String version, + PendingUploadRequest pendingUploadRequest) { + // Generated convenience method for pendingUploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pendingUploadWithResponse(name, version, BinaryData.fromObject(pendingUploadRequest), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PendingUploadResponse.class)); } /** @@ -339,12 +366,13 @@ public PagedFlux listDatasetVersions(String name, RequestOptions req */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listLatestDatasetVersions(RequestOptions requestOptions) { - return this.serviceClient.listLatestDatasetVersionsAsync(requestOptions); + public PagedFlux listLatest(RequestOptions requestOptions) { + return this.serviceClient.listLatestAsync(requestOptions); } /** - * Get the specific version of the DatasetVersion. + * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion + * does not exist. *

Response Body Schema

* *
@@ -383,7 +411,8 @@ public Mono> getDatasetVersionWithResponse(String name, Str
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      *
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -396,9 +425,8 @@ public Mono> getDatasetVersionWithResponse(String name, Str
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> deleteDatasetVersionWithResponse(String name, String version,
-        RequestOptions requestOptions) {
-        return this.serviceClient.deleteDatasetVersionWithResponseAsync(name, version, requestOptions);
+    public Mono> deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) {
+        return this.serviceClient.deleteVersionWithResponseAsync(name, version, requestOptions);
     }
 
     /**
@@ -455,42 +483,9 @@ public Mono> deleteDatasetVersionWithResponse(String name, String
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> createOrUpdateDatasetVersionWithResponse(String name, String version,
+    public Mono> createOrUpdateVersionWithResponse(String name, String version,
         BinaryData datasetVersion, RequestOptions requestOptions) {
-        return this.serviceClient.createOrUpdateDatasetVersionWithResponseAsync(name, version, datasetVersion,
-            requestOptions);
-    }
-
-    /**
-     * List all versions of the given DatasetVersion.
-     *
-     * @param name The name of the resource.
-     * @throws IllegalArgumentException thrown if parameters fail the validation.
-     * @throws HttpResponseException thrown if the request is rejected by server.
-     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
-     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
-     * @throws ResourceModifiedException thrown if the 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 DatasetVersion items as paginated response with {@link PagedFlux}.
-     */
-    @Generated
-    @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listDatasetVersions(String name) {
-        // Generated convenience method for listDatasetVersions
-        RequestOptions requestOptions = new RequestOptions();
-        PagedFlux pagedFluxResponse = listDatasetVersions(name, 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(DatasetVersion.class))
-                    .collect(Collectors.toList()),
-                pagedResponse.getContinuationToken(), null));
-        });
+        return this.serviceClient.createOrUpdateVersionWithResponseAsync(name, version, datasetVersion, requestOptions);
     }
 
     /**
@@ -505,10 +500,10 @@ public PagedFlux listDatasetVersions(String name) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listLatestDatasetVersions() {
-        // Generated convenience method for listLatestDatasetVersions
+    public PagedFlux listLatest() {
+        // Generated convenience method for listLatest
         RequestOptions requestOptions = new RequestOptions();
-        PagedFlux pagedFluxResponse = listLatestDatasetVersions(requestOptions);
+        PagedFlux pagedFluxResponse = listLatest(requestOptions);
         return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
             Flux> flux = (continuationTokenParam == null)
                 ? pagedFluxResponse.byPage().take(1)
@@ -524,7 +519,8 @@ public PagedFlux listLatestDatasetVersions() {
     }
 
     /**
-     * Get the specific version of the DatasetVersion.
+     * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion
+     * does not exist.
      *
      * @param name The name of the resource.
      * @param version The specific version id of the DatasetVersion to retrieve.
@@ -546,7 +542,8 @@ public Mono getDatasetVersion(String name, String version) {
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      *
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -560,10 +557,10 @@ public Mono getDatasetVersion(String name, String version) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono deleteDatasetVersion(String name, String version) {
-        // Generated convenience method for deleteDatasetVersionWithResponse
+    public Mono deleteVersion(String name, String version) {
+        // Generated convenience method for deleteVersionWithResponse
         RequestOptions requestOptions = new RequestOptions();
-        return deleteDatasetVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono);
+        return deleteVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono);
     }
 
     /**
@@ -582,16 +579,15 @@ public Mono deleteDatasetVersion(String name, String version) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono createOrUpdateDatasetVersion(String name, String version,
-        DatasetVersion datasetVersion) {
-        // Generated convenience method for createOrUpdateDatasetVersionWithResponse
+    public Mono createOrUpdateVersion(String name, String version, DatasetVersion datasetVersion) {
+        // Generated convenience method for createOrUpdateVersionWithResponse
         RequestOptions requestOptions = new RequestOptions();
         JsonMergePatchHelper.getDatasetVersionAccessor().prepareModelForJsonMergePatch(datasetVersion, true);
         BinaryData datasetVersionInBinaryData = BinaryData.fromObject(datasetVersion);
         // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
         datasetVersionInBinaryData.getLength();
         JsonMergePatchHelper.getDatasetVersionAccessor().prepareModelForJsonMergePatch(datasetVersion, false);
-        return createOrUpdateDatasetVersionWithResponse(name, version, datasetVersionInBinaryData, requestOptions)
+        return createOrUpdateVersionWithResponse(name, version, datasetVersionInBinaryData, requestOptions)
             .flatMap(FluxUtil::toMono)
             .map(protocolMethodData -> protocolMethodData.toObject(DatasetVersion.class));
     }
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsClient.java
index 43be66d99952..d5e80ac66d5d 100644
--- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsClient.java
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DatasetsClient.java
@@ -5,13 +5,13 @@
 
 import com.azure.ai.projects.implementation.DatasetsImpl;
 import com.azure.ai.projects.implementation.JsonMergePatchHelper;
-import com.azure.ai.projects.models.AssetCredentialResult;
+import com.azure.ai.projects.models.BlobReferenceSasCredential;
+import com.azure.ai.projects.models.DatasetCredential;
 import com.azure.ai.projects.models.DatasetVersion;
 import com.azure.ai.projects.models.FileDatasetVersion;
 import com.azure.ai.projects.models.FolderDatasetVersion;
 import com.azure.ai.projects.models.PendingUploadRequest;
 import com.azure.ai.projects.models.PendingUploadResponse;
-import com.azure.ai.projects.models.SasCredential;
 import com.azure.core.annotation.Generated;
 import com.azure.core.annotation.ReturnType;
 import com.azure.core.annotation.ServiceClient;
@@ -37,7 +37,7 @@
 @ServiceClient(builder = AIProjectClientBuilder.class)
 public final class DatasetsClient {
 
-    private final ClientLogger logger = new ClientLogger(DatasetsClient.class);
+    private static final ClientLogger LOGGER = new ClientLogger(DatasetsClient.class);
 
     @Generated
     private final DatasetsImpl serviceClient;
@@ -53,54 +53,39 @@ public final class DatasetsClient {
     }
 
     /**
-     * Start a new or get an existing pending upload of a dataset for a specific version.
-     * 

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     pendingUploadId: String (Optional)
-     *     connectionName: String (Optional)
-     *     pendingUploadType: String(None/BlobReference) (Required)
-     * }
-     * }
-     * 
- * + * List all versions of the given DatasetVersion. *

Response Body Schema

* *
      * {@code
      * {
-     *     blobReference (Required): {
-     *         blobUri: String (Required)
-     *         storageAccountArmId: String (Required)
-     *         credential (Required): {
-     *             sasUri: String (Required)
-     *             type: String (Required)
-     *         }
+     *     type: String(uri_file/uri_folder) (Required)
+     *     dataUri: String (Optional, Required on create)
+     *     isReference: Boolean (Optional)
+     *     connectionName: String (Optional)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
      *     }
-     *     pendingUploadId: String (Required)
-     *     version: String (Optional)
-     *     pendingUploadType: String(None/BlobReference) (Required)
      * }
      * }
      * 
* * @param name The name of the resource. - * @param version The specific version id of the DatasetVersion to operate on. - * @param pendingUploadRequest The pending upload request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 the response for a pending upload request along with {@link Response}. + * @return paged collection of DatasetVersion items as paginated response with {@link PagedIterable}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pendingUploadWithResponse(String name, String version, BinaryData pendingUploadRequest, - RequestOptions requestOptions) { - return this.serviceClient.pendingUploadWithResponse(name, version, pendingUploadRequest, requestOptions); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersions(name, requestOptions); } /** @@ -139,27 +124,24 @@ public Response getCredentialsWithResponse(String name, String versi } /** - * Start a new or get an existing pending upload of a dataset for a specific version. + * List all versions of the given DatasetVersion. * * @param name The name of the resource. - * @param version The specific version id of the DatasetVersion to operate on. - * @param pendingUploadRequest The pending upload request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the 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 the response for a pending upload request. + * @return paged collection of DatasetVersion items as paginated response with {@link PagedIterable}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PendingUploadResponse pendingUpload(String name, String version, PendingUploadRequest pendingUploadRequest) { - // Generated convenience method for pendingUploadWithResponse + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name) { + // Generated convenience method for listVersions RequestOptions requestOptions = new RequestOptions(); - return pendingUploadWithResponse(name, version, BinaryData.fromObject(pendingUploadRequest), requestOptions) - .getValue() - .toObject(PendingUploadResponse.class); + return serviceClient.listVersions(name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(DatasetVersion.class)); } /** @@ -177,11 +159,10 @@ public PendingUploadResponse pendingUpload(String name, String version, PendingU */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public AssetCredentialResult getCredentials(String name, String version) { + public DatasetCredential getCredentials(String name, String version) { // Generated convenience method for getCredentialsWithResponse RequestOptions requestOptions = new RequestOptions(); - return getCredentialsWithResponse(name, version, requestOptions).getValue() - .toObject(AssetCredentialResult.class); + return getCredentialsWithResponse(name, version, requestOptions).getValue().toObject(DatasetCredential.class); } /** @@ -196,18 +177,18 @@ public AssetCredentialResult getCredentials(String name, String version) { @ServiceMethod(returns = ReturnType.SINGLE) public FileDatasetVersion createDatasetWithFile(String name, String version, Path filePath) { if (!Files.isRegularFile(filePath)) { - throw logger - .logExceptionAsError(new IllegalArgumentException("The provided path is not a file: " + filePath)); + throw LOGGER + .logThrowableAsError(new IllegalArgumentException("The provided path is not a file: " + filePath)); } PendingUploadRequest body = new PendingUploadRequest(); PendingUploadResponse pendingUploadResponse = this.pendingUpload(name, version, body); - SasCredential credential = pendingUploadResponse.getBlobReference().getCredential(); + BlobReferenceSasCredential credential = pendingUploadResponse.getBlobReference().getCredential(); String blobUri = pendingUploadResponse.getBlobReference().getBlobUri(); BlobClient blobClient = new BlobClientBuilder().endpoint(credential.getSasUri()).blobName(name).buildClient(); blobClient.upload(BinaryData.fromFile(filePath)); RequestOptions requestOptions = new RequestOptions(); FileDatasetVersion datasetVersion = this - .createOrUpdateDatasetVersionWithResponse(name, version, + .createOrUpdateVersionWithResponse(name, version, BinaryData.fromObject(new FileDatasetVersion().setDataUri(blobClient.getBlobUrl())), requestOptions) .getValue() .toObject(FileDatasetVersion.class); @@ -228,14 +209,14 @@ public FileDatasetVersion createDatasetWithFile(String name, String version, Pat public FolderDatasetVersion createDatasetWithFolder(String name, String version, Path folderPath) throws IOException { if (!Files.isDirectory(folderPath)) { - throw logger + throw LOGGER .logExceptionAsError(new IllegalArgumentException("The provided path is not a folder: " + folderPath)); } // Request a pending upload for the folder PendingUploadRequest request = new PendingUploadRequest(); PendingUploadResponse pendingUploadResponse = this.pendingUpload(name, version, request); String blobContainerUri = pendingUploadResponse.getBlobReference().getBlobUri(); - SasCredential credential = pendingUploadResponse.getBlobReference().getCredential(); + BlobReferenceSasCredential credential = pendingUploadResponse.getBlobReference().getCredential(); String containerUrl = blobContainerUri.substring(0, blobContainerUri.lastIndexOf('/')); // Upload all files in the directory Files.walk(folderPath).filter(Files::isRegularFile).forEach(filePath -> { @@ -250,7 +231,7 @@ public FolderDatasetVersion createDatasetWithFolder(String name, String version, // Create a FolderDatasetVersion with the container URL RequestOptions requestOptions = new RequestOptions(); FolderDatasetVersion datasetVersion = this - .createOrUpdateDatasetVersionWithResponse(name, version, + .createOrUpdateVersionWithResponse(name, version, BinaryData.fromObject(new FolderDatasetVersion().setDataUri(containerUrl)), requestOptions) .getValue() .toObject(FolderDatasetVersion.class); @@ -258,39 +239,78 @@ public FolderDatasetVersion createDatasetWithFolder(String name, String version, } /** - * List all versions of the given DatasetVersion. - *

Response Body Schema

+ * Start a new or get an existing pending upload of a dataset for a specific version. + *

Request Body Schema

* *
      * {@code
      * {
-     *     type: String(uri_file/uri_folder) (Required)
-     *     dataUri: String (Optional, Required on create)
-     *     isReference: Boolean (Optional)
+     *     pendingUploadId: String (Optional)
      *     connectionName: String (Optional)
-     *     id: String (Optional)
-     *     name: String (Required)
-     *     version: String (Required)
-     *     description: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     pendingUploadType: String(None/BlobReference) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     blobReference (Required): {
+     *         blobUri: String (Required)
+     *         storageAccountArmId: String (Required)
+     *         credential (Required): {
+     *             sasUri: String (Required)
+     *             type: String (Required)
+     *         }
      *     }
+     *     pendingUploadId: String (Required)
+     *     version: String (Optional)
+     *     pendingUploadType: String(None/BlobReference) (Required)
      * }
      * }
      * 
* * @param name The name of the resource. + * @param version The specific version id of the DatasetVersion to operate on. + * @param pendingUploadRequest The pending upload request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 DatasetVersion items as paginated response with {@link PagedIterable}. + * @return represents the response for a pending upload request along with {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listDatasetVersions(String name, RequestOptions requestOptions) { - return this.serviceClient.listDatasetVersions(name, requestOptions); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pendingUploadWithResponse(String name, String version, BinaryData pendingUploadRequest, + RequestOptions requestOptions) { + return this.serviceClient.pendingUploadWithResponse(name, version, pendingUploadRequest, requestOptions); + } + + /** + * Start a new or get an existing pending upload of a dataset for a specific version. + * + * @param name The name of the resource. + * @param version The specific version id of the DatasetVersion to operate on. + * @param pendingUploadRequest The pending upload request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 the response for a pending upload request. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PendingUploadResponse pendingUpload(String name, String version, PendingUploadRequest pendingUploadRequest) { + // Generated convenience method for pendingUploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pendingUploadWithResponse(name, version, BinaryData.fromObject(pendingUploadRequest), requestOptions) + .getValue() + .toObject(PendingUploadResponse.class); } /** @@ -324,12 +344,13 @@ public PagedIterable listDatasetVersions(String name, RequestOptions */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLatestDatasetVersions(RequestOptions requestOptions) { - return this.serviceClient.listLatestDatasetVersions(requestOptions); + public PagedIterable listLatest(RequestOptions requestOptions) { + return this.serviceClient.listLatest(requestOptions); } /** - * Get the specific version of the DatasetVersion. + * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion + * does not exist. *

Response Body Schema

* *
@@ -367,7 +388,8 @@ public Response getDatasetVersionWithResponse(String name, String ve
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      *
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -380,8 +402,8 @@ public Response getDatasetVersionWithResponse(String name, String ve
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response deleteDatasetVersionWithResponse(String name, String version, RequestOptions requestOptions) {
-        return this.serviceClient.deleteDatasetVersionWithResponse(name, version, requestOptions);
+    public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) {
+        return this.serviceClient.deleteVersionWithResponse(name, version, requestOptions);
     }
 
     /**
@@ -438,31 +460,9 @@ public Response deleteDatasetVersionWithResponse(String name, String versi
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response createOrUpdateDatasetVersionWithResponse(String name, String version,
+    public Response createOrUpdateVersionWithResponse(String name, String version,
         BinaryData datasetVersion, RequestOptions requestOptions) {
-        return this.serviceClient.createOrUpdateDatasetVersionWithResponse(name, version, datasetVersion,
-            requestOptions);
-    }
-
-    /**
-     * List all versions of the given DatasetVersion.
-     *
-     * @param name The name of the resource.
-     * @throws IllegalArgumentException thrown if parameters fail the validation.
-     * @throws HttpResponseException thrown if the request is rejected by server.
-     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
-     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
-     * @throws ResourceModifiedException thrown if the 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 DatasetVersion items as paginated response with {@link PagedIterable}.
-     */
-    @Generated
-    @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listDatasetVersions(String name) {
-        // Generated convenience method for listDatasetVersions
-        RequestOptions requestOptions = new RequestOptions();
-        return serviceClient.listDatasetVersions(name, requestOptions)
-            .mapPage(bodyItemValue -> bodyItemValue.toObject(DatasetVersion.class));
+        return this.serviceClient.createOrUpdateVersionWithResponse(name, version, datasetVersion, requestOptions);
     }
 
     /**
@@ -477,15 +477,16 @@ public PagedIterable listDatasetVersions(String name) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listLatestDatasetVersions() {
-        // Generated convenience method for listLatestDatasetVersions
+    public PagedIterable listLatest() {
+        // Generated convenience method for listLatest
         RequestOptions requestOptions = new RequestOptions();
-        return serviceClient.listLatestDatasetVersions(requestOptions)
+        return serviceClient.listLatest(requestOptions)
             .mapPage(bodyItemValue -> bodyItemValue.toObject(DatasetVersion.class));
     }
 
     /**
-     * Get the specific version of the DatasetVersion.
+     * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion
+     * does not exist.
      *
      * @param name The name of the resource.
      * @param version The specific version id of the DatasetVersion to retrieve.
@@ -506,7 +507,8 @@ public DatasetVersion getDatasetVersion(String name, String version) {
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      *
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -519,10 +521,10 @@ public DatasetVersion getDatasetVersion(String name, String version) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public void deleteDatasetVersion(String name, String version) {
-        // Generated convenience method for deleteDatasetVersionWithResponse
+    public void deleteVersion(String name, String version) {
+        // Generated convenience method for deleteVersionWithResponse
         RequestOptions requestOptions = new RequestOptions();
-        deleteDatasetVersionWithResponse(name, version, requestOptions).getValue();
+        deleteVersionWithResponse(name, version, requestOptions).getValue();
     }
 
     /**
@@ -541,16 +543,15 @@ public void deleteDatasetVersion(String name, String version) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public DatasetVersion createOrUpdateDatasetVersion(String name, String version, DatasetVersion datasetVersion) {
-        // Generated convenience method for createOrUpdateDatasetVersionWithResponse
+    public DatasetVersion createOrUpdateVersion(String name, String version, DatasetVersion datasetVersion) {
+        // Generated convenience method for createOrUpdateVersionWithResponse
         RequestOptions requestOptions = new RequestOptions();
         JsonMergePatchHelper.getDatasetVersionAccessor().prepareModelForJsonMergePatch(datasetVersion, true);
         BinaryData datasetVersionInBinaryData = BinaryData.fromObject(datasetVersion);
         // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
         datasetVersionInBinaryData.getLength();
         JsonMergePatchHelper.getDatasetVersionAccessor().prepareModelForJsonMergePatch(datasetVersion, false);
-        return createOrUpdateDatasetVersionWithResponse(name, version, datasetVersionInBinaryData, requestOptions)
-            .getValue()
+        return createOrUpdateVersionWithResponse(name, version, datasetVersionInBinaryData, requestOptions).getValue()
             .toObject(DatasetVersion.class);
     }
 }
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsAsyncClient.java
index a7033ad284fe..1f6d58f72cdb 100644
--- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsAsyncClient.java
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsAsyncClient.java
@@ -67,8 +67,8 @@ public final class DeploymentsAsyncClient {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> getDeploymentWithResponse(String name, RequestOptions requestOptions) {
-        return this.serviceClient.getDeploymentWithResponseAsync(name, requestOptions);
+    public Mono> getWithResponse(String name, RequestOptions requestOptions) {
+        return this.serviceClient.getWithResponseAsync(name, requestOptions);
     }
 
     /**
@@ -104,8 +104,8 @@ public Mono> getDeploymentWithResponse(String name, Request
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listDeployments(RequestOptions requestOptions) {
-        return this.serviceClient.listDeploymentsAsync(requestOptions);
+    public PagedFlux list(RequestOptions requestOptions) {
+        return this.serviceClient.listAsync(requestOptions);
     }
 
     /**
@@ -122,10 +122,10 @@ public PagedFlux listDeployments(RequestOptions requestOptions) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono getDeployment(String name) {
-        // Generated convenience method for getDeploymentWithResponse
+    public Mono get(String name) {
+        // Generated convenience method for getWithResponse
         RequestOptions requestOptions = new RequestOptions();
-        return getDeploymentWithResponse(name, requestOptions).flatMap(FluxUtil::toMono)
+        return getWithResponse(name, requestOptions).flatMap(FluxUtil::toMono)
             .map(protocolMethodData -> protocolMethodData.toObject(Deployment.class));
     }
 
@@ -145,9 +145,8 @@ public Mono getDeployment(String name) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listDeployments(String modelPublisher, String modelName,
-        DeploymentType deploymentType) {
-        // Generated convenience method for listDeployments
+    public PagedFlux list(String modelPublisher, String modelName, DeploymentType deploymentType) {
+        // Generated convenience method for list
         RequestOptions requestOptions = new RequestOptions();
         if (modelPublisher != null) {
             requestOptions.addQueryParam("modelPublisher", modelPublisher, false);
@@ -158,7 +157,7 @@ public PagedFlux listDeployments(String modelPublisher, String model
         if (deploymentType != null) {
             requestOptions.addQueryParam("deploymentType", deploymentType.toString(), false);
         }
-        PagedFlux pagedFluxResponse = listDeployments(requestOptions);
+        PagedFlux pagedFluxResponse = list(requestOptions);
         return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
             Flux> flux = (continuationTokenParam == null)
                 ? pagedFluxResponse.byPage().take(1)
@@ -185,10 +184,10 @@ public PagedFlux listDeployments(String modelPublisher, String model
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listDeployments() {
-        // Generated convenience method for listDeployments
+    public PagedFlux list() {
+        // Generated convenience method for list
         RequestOptions requestOptions = new RequestOptions();
-        PagedFlux pagedFluxResponse = listDeployments(requestOptions);
+        PagedFlux pagedFluxResponse = list(requestOptions);
         return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
             Flux> flux = (continuationTokenParam == null)
                 ? pagedFluxResponse.byPage().take(1)
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsClient.java
index 7831dd5416b2..477ce8297dc9 100644
--- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsClient.java
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/DeploymentsClient.java
@@ -61,8 +61,8 @@ public final class DeploymentsClient {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response getDeploymentWithResponse(String name, RequestOptions requestOptions) {
-        return this.serviceClient.getDeploymentWithResponse(name, requestOptions);
+    public Response getWithResponse(String name, RequestOptions requestOptions) {
+        return this.serviceClient.getWithResponse(name, requestOptions);
     }
 
     /**
@@ -98,8 +98,8 @@ public Response getDeploymentWithResponse(String name, RequestOption
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listDeployments(RequestOptions requestOptions) {
-        return this.serviceClient.listDeployments(requestOptions);
+    public PagedIterable list(RequestOptions requestOptions) {
+        return this.serviceClient.list(requestOptions);
     }
 
     /**
@@ -116,10 +116,10 @@ public PagedIterable listDeployments(RequestOptions requestOptions)
      */
     @Generated
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Deployment getDeployment(String name) {
-        // Generated convenience method for getDeploymentWithResponse
+    public Deployment get(String name) {
+        // Generated convenience method for getWithResponse
         RequestOptions requestOptions = new RequestOptions();
-        return getDeploymentWithResponse(name, requestOptions).getValue().toObject(Deployment.class);
+        return getWithResponse(name, requestOptions).getValue().toObject(Deployment.class);
     }
 
     /**
@@ -138,9 +138,8 @@ public Deployment getDeployment(String name) {
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listDeployments(String modelPublisher, String modelName,
-        DeploymentType deploymentType) {
-        // Generated convenience method for listDeployments
+    public PagedIterable list(String modelPublisher, String modelName, DeploymentType deploymentType) {
+        // Generated convenience method for list
         RequestOptions requestOptions = new RequestOptions();
         if (modelPublisher != null) {
             requestOptions.addQueryParam("modelPublisher", modelPublisher, false);
@@ -151,8 +150,7 @@ public PagedIterable listDeployments(String modelPublisher, String m
         if (deploymentType != null) {
             requestOptions.addQueryParam("deploymentType", deploymentType.toString(), false);
         }
-        return serviceClient.listDeployments(requestOptions)
-            .mapPage(bodyItemValue -> bodyItemValue.toObject(Deployment.class));
+        return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Deployment.class));
     }
 
     /**
@@ -167,10 +165,9 @@ public PagedIterable listDeployments(String modelPublisher, String m
      */
     @Generated
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listDeployments() {
-        // Generated convenience method for listDeployments
+    public PagedIterable list() {
+        // Generated convenience method for list
         RequestOptions requestOptions = new RequestOptions();
-        return serviceClient.listDeployments(requestOptions)
-            .mapPage(bodyItemValue -> bodyItemValue.toObject(Deployment.class));
+        return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Deployment.class));
     }
 }
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesAsyncClient.java
new file mode 100644
index 000000000000..a68c221c0685
--- /dev/null
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesAsyncClient.java
@@ -0,0 +1,351 @@
+// Copyright (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.EvaluationRulesImpl;
+import com.azure.ai.projects.models.EvaluationRule;
+import com.azure.ai.projects.models.EvaluationRuleActionType;
+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 EvaluationRulesAsyncClient {
+
+    @Generated
+    private final EvaluationRulesImpl serviceClient;
+
+    /**
+     * Initializes an instance of EvaluationRulesAsyncClient class.
+     *
+     * @param serviceClient the service client implementation.
+     */
+    @Generated
+    EvaluationRulesAsyncClient(EvaluationRulesImpl serviceClient) {
+        this.serviceClient = serviceClient;
+    }
+
+    /**
+     * Get an evaluation rule.
+     * 

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Unique identifier for the evaluation rule. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation rule 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); + } + + /** + * Delete an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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> deleteWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(id, requestOptions); + } + + /** + * Create or update an evaluation rule. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 rule model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponse(String id, BinaryData evaluationRule, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponseAsync(id, evaluationRule, requestOptions); + } + + /** + * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         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 EvaluationRule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Get an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 evaluation rule 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(EvaluationRule.class)); + } + + /** + * Delete an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 delete(String id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Create or update an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 rule model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdate(String id, EvaluationRule evaluationRule) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateWithResponse(id, BinaryData.fromObject(evaluationRule), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationRule.class)); + } + + /** + * List all evaluation rules. + * + * @param actionType Filter by the type of evaluation rule. + * @param agentName Filter by the agent name. + * @param enabled Filter by the enabled status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationRule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(EvaluationRuleActionType actionType, String agentName, Boolean enabled) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (actionType != null) { + requestOptions.addQueryParam("actionType", actionType.toString(), false); + } + if (agentName != null) { + requestOptions.addQueryParam("agentName", agentName, false); + } + if (enabled != null) { + requestOptions.addQueryParam("enabled", String.valueOf(enabled), 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(EvaluationRule.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List all evaluation rules. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationRule 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(EvaluationRule.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesClient.java new file mode 100644 index 000000000000..9890aa34723b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationRulesClient.java @@ -0,0 +1,320 @@ +// Copyright (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.EvaluationRulesImpl; +import com.azure.ai.projects.models.EvaluationRule; +import com.azure.ai.projects.models.EvaluationRuleActionType; +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 EvaluationRulesClient { + + @Generated + private final EvaluationRulesImpl serviceClient; + + /** + * Initializes an instance of EvaluationRulesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluationRulesClient(EvaluationRulesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get an evaluation rule. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Unique identifier for the evaluation rule. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation rule along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(id, requestOptions); + } + + /** + * Delete an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 deleteWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(id, requestOptions); + } + + /** + * Create or update an evaluation rule. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 rule model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String id, BinaryData evaluationRule, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponse(id, evaluationRule, requestOptions); + } + + /** + * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         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 EvaluationRule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Get an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 evaluation rule. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationRule get(String id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).getValue().toObject(EvaluationRule.class); + } + + /** + * Delete an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if 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 delete(String id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(id, requestOptions).getValue(); + } + + /** + * Create or update an evaluation rule. + * + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 rule model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationRule createOrUpdate(String id, EvaluationRule evaluationRule) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateWithResponse(id, BinaryData.fromObject(evaluationRule), requestOptions).getValue() + .toObject(EvaluationRule.class); + } + + /** + * List all evaluation rules. + * + * @param actionType Filter by the type of evaluation rule. + * @param agentName Filter by the agent name. + * @param enabled Filter by the enabled status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationRule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(EvaluationRuleActionType actionType, String agentName, Boolean enabled) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (actionType != null) { + requestOptions.addQueryParam("actionType", actionType.toString(), false); + } + if (agentName != null) { + requestOptions.addQueryParam("agentName", agentName, false); + } + if (enabled != null) { + requestOptions.addQueryParam("enabled", String.valueOf(enabled), false); + } + return serviceClient.list(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluationRule.class)); + } + + /** + * List all evaluation rules. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationRule 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(EvaluationRule.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesAsyncClient.java new file mode 100644 index 000000000000..423487923629 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesAsyncClient.java @@ -0,0 +1,553 @@ +// Copyright (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.EvaluationTaxonomiesImpl; +import com.azure.ai.projects.models.EvaluationTaxonomy; +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 EvaluationTaxonomiesAsyncClient { + + @Generated + private final EvaluationTaxonomiesImpl serviceClient; + + /** + * Initializes an instance of EvaluationTaxonomiesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluationTaxonomiesAsyncClient(EvaluationTaxonomiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get an evaluation run by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(name, requestOptions); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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> deleteWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(name, requestOptions); + } + + /** + * Create an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(name, body, requestOptions); + } + + /** + * Update an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(name, body, requestOptions); + } + + /** + * Get an evaluation run by name. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 evaluation run by name on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String name) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationTaxonomy.class)); + } + + /** + * List evaluation taxonomies. + * + * @param inputName Filter by the evaluation input name. + * @param inputType Filter by taxonomy input type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationTaxonomy items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String inputName, String inputType) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (inputName != null) { + requestOptions.addQueryParam("inputName", inputName, false); + } + if (inputType != null) { + requestOptions.addQueryParam("inputType", inputType, 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(EvaluationTaxonomy.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List evaluation taxonomies. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationTaxonomy 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(EvaluationTaxonomy.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 delete(String name) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(name, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Create an evaluation taxonomy. + * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Taxonomy Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(String name, EvaluationTaxonomy body) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationTaxonomy.class)); + } + + /** + * Update an evaluation taxonomy. + * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Taxonomy Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono update(String name, EvaluationTaxonomy body) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluationTaxonomy.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesClient.java new file mode 100644 index 000000000000..d5f33718978b --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluationTaxonomiesClient.java @@ -0,0 +1,523 @@ +// Copyright (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.EvaluationTaxonomiesImpl; +import com.azure.ai.projects.models.EvaluationTaxonomy; +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 EvaluationTaxonomiesClient { + + @Generated + private final EvaluationTaxonomiesImpl serviceClient; + + /** + * Initializes an instance of EvaluationTaxonomiesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluationTaxonomiesClient(EvaluationTaxonomiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get an evaluation run by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(name, requestOptions); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 deleteWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(name, requestOptions); + } + + /** + * Create an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(name, body, requestOptions); + } + + /** + * Update an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponse(name, body, requestOptions); + } + + /** + * Get an evaluation run by name. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 evaluation run by name. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationTaxonomy get(String name) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(name, requestOptions).getValue().toObject(EvaluationTaxonomy.class); + } + + /** + * List evaluation taxonomies. + * + * @param inputName Filter by the evaluation input name. + * @param inputType Filter by taxonomy input type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationTaxonomy items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String inputName, String inputType) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (inputName != null) { + requestOptions.addQueryParam("inputName", inputName, false); + } + if (inputType != null) { + requestOptions.addQueryParam("inputType", inputType, false); + } + return serviceClient.list(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluationTaxonomy.class)); + } + + /** + * List evaluation taxonomies. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluationTaxonomy 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(EvaluationTaxonomy.class)); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if 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 delete(String name) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(name, requestOptions).getValue(); + } + + /** + * Create an evaluation taxonomy. + * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Taxonomy Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationTaxonomy create(String name, EvaluationTaxonomy body) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(EvaluationTaxonomy.class); + } + + /** + * Update an evaluation taxonomy. + * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Taxonomy Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluationTaxonomy update(String name, EvaluationTaxonomy body) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(EvaluationTaxonomy.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 index 77bea48dd861..93ebd52e1782 100644 --- 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 @@ -1,398 +1,34 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.ai.projects; -import com.azure.ai.projects.implementation.EvaluationsImpl; -import com.azure.ai.projects.models.AgentEvaluation; -import com.azure.ai.projects.models.AgentEvaluationRequest; -import com.azure.ai.projects.models.Evaluation; -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; +import com.openai.client.OpenAIClientAsync; +import com.openai.services.async.EvalServiceAsync; /** - * Initializes a new instance of the asynchronous AIProjectClient type. + * Initializes a new instance of the asynchronous EvaluationsClientAsync type. */ @ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) -public final class EvaluationsAsyncClient { +public class EvaluationsAsyncClient { - @Generated - private final EvaluationsImpl serviceClient; + private final EvalServiceAsync openaiEvalClientAsync; /** - * Initializes an instance of EvaluationsAsyncClient class. + * Initializes an instance of EvaluationsClientAsync class. * - * @param serviceClient the service client implementation. + * @param openAIClientAsync the service client implementation. */ - @Generated - EvaluationsAsyncClient(EvaluationsImpl serviceClient) { - this.serviceClient = serviceClient; + EvaluationsAsyncClient(OpenAIClientAsync openAIClientAsync) { + this.openaiEvalClientAsync = openAIClientAsync.evals(); } /** - * Creates an agent evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     runId: String (Required)
-     *     threadId: String (Optional)
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     *     samplingConfiguration (Optional): {
-     *         name: String (Required)
-     *         samplingPercent: double (Required)
-     *         maxRequestRate: double (Required)
-     *     }
-     *     redactionConfiguration (Optional): {
-     *         redactScoreProperties: Boolean (Optional)
-     *     }
-     *     appInsightsConnectionString: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String (Required)
-     *     error: String (Optional)
-     *     result (Optional): [
-     *          (Optional){
-     *             evaluator: String (Required)
-     *             evaluatorId: String (Required)
-     *             score: double (Required)
-     *             status: String (Required)
-     *             reason: String (Optional)
-     *             version: String (Optional)
-     *             threadId: String (Optional)
-     *             runId: String (Required)
-     *             error: String (Optional)
-     *             additionalDetails (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     ]
-     * }
-     * }
-     * 
+ * Get the OpenAI client for evaluations. * - * @param evaluation Agent evaluation to be 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 response for agent evaluation run along with {@link Response} on successful completion of - * {@link Mono}. + * @return the OpenAI evals service client. */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createAgentEvaluationWithResponse(BinaryData evaluation, - RequestOptions requestOptions) { - return this.serviceClient.createAgentEvaluationWithResponseAsync(evaluation, requestOptions); - } - - /** - * Creates an agent evaluation run. - * - * @param evaluation Agent evaluation to be 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 response for agent evaluation run on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createAgentEvaluation(AgentEvaluationRequest evaluation) { - // Generated convenience method for createAgentEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createAgentEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AgentEvaluation.class)); - } - - /** - * Get an evaluation run by name. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name 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 an evaluation run by name along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getEvaluationWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getEvaluationWithResponseAsync(name, requestOptions); - } - - /** - * List evaluation runs. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             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 listEvaluations(RequestOptions requestOptions) { - return this.serviceClient.listEvaluationsAsync(requestOptions); - } - - /** - * Creates an evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param evaluation Evaluation to be 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> createEvaluationWithResponse(BinaryData evaluation, - RequestOptions requestOptions) { - return this.serviceClient.createEvaluationWithResponseAsync(evaluation, requestOptions); - } - - /** - * Get an evaluation run by name. - * - * @param name 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 an evaluation run by name on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getEvaluation(String name) { - // Generated convenience method for getEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getEvaluationWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)); - } - - /** - * List evaluation runs. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 listEvaluations() { - // Generated convenience method for listEvaluations - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listEvaluations(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)); - }); - } - - /** - * Creates an evaluation run. - * - * @param evaluation Evaluation to be 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 createEvaluation(Evaluation evaluation) { - // Generated convenience method for createEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Evaluation.class)); + public EvalServiceAsync getOpenAIClient() { + return this.openaiEvalClientAsync; } } 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 index cda7767cb291..bb9df2396ef5 100644 --- 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 @@ -1,377 +1,34 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.ai.projects; -import com.azure.ai.projects.implementation.EvaluationsImpl; -import com.azure.ai.projects.models.AgentEvaluation; -import com.azure.ai.projects.models.AgentEvaluationRequest; -import com.azure.ai.projects.models.Evaluation; -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; +import com.openai.client.OpenAIClient; +import com.openai.services.blocking.EvalService; /** - * Initializes a new instance of the synchronous AIProjectClient type. + * Initializes a new instance of the asynchronous EvaluationsClient type. */ @ServiceClient(builder = AIProjectClientBuilder.class) -public final class EvaluationsClient { +public class EvaluationsClient { - @Generated - private final EvaluationsImpl serviceClient; + private final EvalService openaiEvalClient; /** - * Initializes an instance of EvaluationsClient class. + * Initializes an instance of EvaluationsClientAsync class. * - * @param serviceClient the service client implementation. + * @param openAIClient the service client implementation. */ - @Generated - EvaluationsClient(EvaluationsImpl serviceClient) { - this.serviceClient = serviceClient; + EvaluationsClient(OpenAIClient openAIClient) { + this.openaiEvalClient = openAIClient.evals(); } /** - * Creates an agent evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     runId: String (Required)
-     *     threadId: String (Optional)
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     *     samplingConfiguration (Optional): {
-     *         name: String (Required)
-     *         samplingPercent: double (Required)
-     *         maxRequestRate: double (Required)
-     *     }
-     *     redactionConfiguration (Optional): {
-     *         redactScoreProperties: Boolean (Optional)
-     *     }
-     *     appInsightsConnectionString: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String (Required)
-     *     error: String (Optional)
-     *     result (Optional): [
-     *          (Optional){
-     *             evaluator: String (Required)
-     *             evaluatorId: String (Required)
-     *             score: double (Required)
-     *             status: String (Required)
-     *             reason: String (Optional)
-     *             version: String (Optional)
-     *             threadId: String (Optional)
-     *             runId: String (Required)
-     *             error: String (Optional)
-     *             additionalDetails (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     ]
-     * }
-     * }
-     * 
+ * Get the OpenAI client for evaluations. * - * @param evaluation Agent evaluation to be 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 response for agent evaluation run along with {@link Response}. + * @return the OpenAI evals service client. */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createAgentEvaluationWithResponse(BinaryData evaluation, - RequestOptions requestOptions) { - return this.serviceClient.createAgentEvaluationWithResponse(evaluation, requestOptions); - } - - /** - * Creates an agent evaluation run. - * - * @param evaluation Agent evaluation to be 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 response for agent evaluation run. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public AgentEvaluation createAgentEvaluation(AgentEvaluationRequest evaluation) { - // Generated convenience method for createAgentEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createAgentEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions).getValue() - .toObject(AgentEvaluation.class); - } - - /** - * Get an evaluation run by name. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name 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 an evaluation run by name along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getEvaluationWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getEvaluationWithResponse(name, requestOptions); - } - - /** - * List evaluation runs. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             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 listEvaluations(RequestOptions requestOptions) { - return this.serviceClient.listEvaluations(requestOptions); - } - - /** - * Creates an evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param evaluation Evaluation to be 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 createEvaluationWithResponse(BinaryData evaluation, RequestOptions requestOptions) { - return this.serviceClient.createEvaluationWithResponse(evaluation, requestOptions); - } - - /** - * Get an evaluation run by name. - * - * @param name 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 an evaluation run by name. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Evaluation getEvaluation(String name) { - // Generated convenience method for getEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getEvaluationWithResponse(name, requestOptions).getValue().toObject(Evaluation.class); - } - - /** - * List evaluation runs. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the 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 listEvaluations() { - // Generated convenience method for listEvaluations - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listEvaluations(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(Evaluation.class)); - } - - /** - * Creates an evaluation run. - * - * @param evaluation Evaluation to be 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 createEvaluation(Evaluation evaluation) { - // Generated convenience method for createEvaluationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions).getValue() - .toObject(Evaluation.class); + public EvalService getOpenAIClient() { + return this.openaiEvalClient; } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsAsyncClient.java new file mode 100644 index 000000000000..927b4664bee5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsAsyncClient.java @@ -0,0 +1,695 @@ +// Copyright (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.EvaluatorsImpl; +import com.azure.ai.projects.models.EvaluatorVersion; +import com.azure.ai.projects.models.ListVersionsRequestType; +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 EvaluatorsAsyncClient { + + @Generated + private final EvaluatorsImpl serviceClient; + + /** + * Initializes an instance of EvaluatorsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluatorsAsyncClient(EvaluatorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersionsAsync(name, requestOptions); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLatestVersions(RequestOptions requestOptions) { + return this.serviceClient.listLatestVersionsAsync(requestOptions); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVersionWithResponse(String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.getVersionWithResponseAsync(name, version, requestOptions); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.deleteVersionWithResponseAsync(name, version, requestOptions); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVersionWithResponse(String name, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + return this.serviceClient.createVersionWithResponseAsync(name, evaluatorVersion, requestOptions); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateVersionWithResponse(String name, String version, + BinaryData evaluatorVersion, RequestOptions requestOptions) { + return this.serviceClient.updateVersionWithResponseAsync(name, version, evaluatorVersion, requestOptions); + } + + /** + * List all versions of the given evaluator. + * + * @param name The name of the resource. + * @param type Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. + * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default + * is 20. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name, ListVersionsRequestType type, Integer limit) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (limit != null) { + requestOptions.addQueryParam("limit", String.valueOf(limit), false); + } + PagedFlux pagedFluxResponse = listVersions(name, 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(EvaluatorVersion.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List all versions of the given evaluator. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listVersions(name, 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(EvaluatorVersion.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List the latest version of each evaluator. + * + * @param type Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. + * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default + * is 20. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLatestVersions(ListVersionsRequestType type, Integer limit) { + // Generated convenience method for listLatestVersions + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (limit != null) { + requestOptions.addQueryParam("limit", String.valueOf(limit), false); + } + PagedFlux pagedFluxResponse = listLatestVersions(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(EvaluatorVersion.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List the latest version of each evaluator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLatestVersions() { + // Generated convenience method for listLatestVersions + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listLatestVersions(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(EvaluatorVersion.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getVersion(String name, String version) { + // Generated convenience method for getVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluatorVersion.class)); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion 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 {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteVersion(String name, String version) { + // Generated convenience method for deleteVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return evaluator Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createVersion(String name, EvaluatorVersion evaluatorVersion) { + // Generated convenience method for createVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createVersionWithResponse(name, BinaryData.fromObject(evaluatorVersion), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluatorVersion.class)); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return evaluator Definition on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateVersion(String name, String version, EvaluatorVersion evaluatorVersion) { + // Generated convenience method for updateVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateVersionWithResponse(name, version, BinaryData.fromObject(evaluatorVersion), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EvaluatorVersion.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsClient.java new file mode 100644 index 000000000000..056750f89dff --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/EvaluatorsClient.java @@ -0,0 +1,640 @@ +// Copyright (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.EvaluatorsImpl; +import com.azure.ai.projects.models.EvaluatorVersion; +import com.azure.ai.projects.models.ListVersionsRequestType; +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 EvaluatorsClient { + + @Generated + private final EvaluatorsImpl serviceClient; + + /** + * Initializes an instance of EvaluatorsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EvaluatorsClient(EvaluatorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersions(name, requestOptions); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLatestVersions(RequestOptions requestOptions) { + return this.serviceClient.listLatestVersions(requestOptions); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.getVersionWithResponse(name, version, requestOptions); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.deleteVersionWithResponse(name, version, requestOptions); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVersionWithResponse(String name, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + return this.serviceClient.createVersionWithResponse(name, evaluatorVersion, requestOptions); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateVersionWithResponse(String name, String version, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + return this.serviceClient.updateVersionWithResponse(name, version, evaluatorVersion, requestOptions); + } + + /** + * List all versions of the given evaluator. + * + * @param name The name of the resource. + * @param type Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. + * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default + * is 20. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name, ListVersionsRequestType type, Integer limit) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (limit != null) { + requestOptions.addQueryParam("limit", String.valueOf(limit), false); + } + return serviceClient.listVersions(name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluatorVersion.class)); + } + + /** + * List all versions of the given evaluator. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listVersions(name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluatorVersion.class)); + } + + /** + * List the latest version of each evaluator. + * + * @param type Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. + * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default + * is 20. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLatestVersions(ListVersionsRequestType type, Integer limit) { + // Generated convenience method for listLatestVersions + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (limit != null) { + requestOptions.addQueryParam("limit", String.valueOf(limit), false); + } + return serviceClient.listLatestVersions(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluatorVersion.class)); + } + + /** + * List the latest version of each evaluator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLatestVersions() { + // Generated convenience method for listLatestVersions + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listLatestVersions(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(EvaluatorVersion.class)); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluatorVersion getVersion(String name, String version) { + // Generated convenience method for getVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getVersionWithResponse(name, version, requestOptions).getValue().toObject(EvaluatorVersion.class); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion 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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteVersion(String name, String version) { + // Generated convenience method for deleteVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteVersionWithResponse(name, version, requestOptions).getValue(); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return evaluator Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluatorVersion createVersion(String name, EvaluatorVersion evaluatorVersion) { + // Generated convenience method for createVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createVersionWithResponse(name, BinaryData.fromObject(evaluatorVersion), requestOptions).getValue() + .toObject(EvaluatorVersion.class); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return evaluator Definition. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluatorVersion updateVersion(String name, String version, EvaluatorVersion evaluatorVersion) { + // Generated convenience method for updateVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateVersionWithResponse(name, version, BinaryData.fromObject(evaluatorVersion), requestOptions) + .getValue() + .toObject(EvaluatorVersion.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesAsyncClient.java index dcd282ec8d0e..0026986c03ff 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesAsyncClient.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesAsyncClient.java @@ -73,13 +73,45 @@ public final class IndexesAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIndexVersions(String name, RequestOptions requestOptions) { - return this.serviceClient.listIndexVersionsAsync(name, requestOptions); + public PagedFlux listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersionsAsync(name, requestOptions); } /** - * List the latest version of each Index. - *

Response Body Schema

+ * List all versions of the given Index. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Index items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listVersions(name, 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(Index.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Create a new or update an existing Index with the given version id. + *

Request Body Schema

* *
      * {@code
@@ -95,22 +127,7 @@ public PagedFlux listIndexVersions(String name, RequestOptions reque
      * }
      * }
      * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the 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 Index items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listLatestIndexVersions(RequestOptions requestOptions) { - return this.serviceClient.listLatestIndexVersionsAsync(requestOptions); - } - - /** - * Get the specific version of the Index. + * *

Response Body Schema

* *
@@ -129,43 +146,53 @@ public PagedFlux listLatestIndexVersions(RequestOptions requestOptio
      * 
* * @param name The name of the resource. - * @param version The specific version id of the Index to retrieve. + * @param version The specific version id of the Index to create or update. + * @param index The Index to create or update. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 specific version of the Index along with {@link Response} on successful completion of {@link Mono}. + * @return index resource Definition along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getIndexVersionWithResponse(String name, String version, + public Mono> createOrUpdateWithResponse(String name, String version, BinaryData index, RequestOptions requestOptions) { - return this.serviceClient.getIndexVersionWithResponseAsync(name, version, requestOptions); + return this.serviceClient.createOrUpdateWithResponseAsync(name, version, index, requestOptions); } /** - * Delete the specific version of the Index. + * Create a new or update an existing Index with the given version id. * * @param name The name of the resource. - * @param version The version of the Index to delete. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param version The specific version id of the Index to create or update. + * @param index The Index to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return index resource Definition on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteIndexVersionWithResponse(String name, String version, - RequestOptions requestOptions) { - return this.serviceClient.deleteIndexVersionWithResponseAsync(name, version, requestOptions); + public Mono createOrUpdate(String name, String version, Index index) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, true); + BinaryData indexInBinaryData = BinaryData.fromObject(index); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + indexInBinaryData.getLength(); + JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, false); + return createOrUpdateWithResponse(name, version, indexInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Index.class)); } /** - * Create a new or update an existing Index with the given version id. - *

Request Body Schema

+ * List the latest version of each Index. + *

Response Body Schema

* *
      * {@code
@@ -181,7 +208,22 @@ public Mono> deleteIndexVersionWithResponse(String name, String v
      * }
      * }
      * 
- * + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Index items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLatest(RequestOptions requestOptions) { + return this.serviceClient.listLatestAsync(requestOptions); + } + + /** + * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist. *

Response Body Schema

* *
@@ -200,52 +242,38 @@ public Mono> deleteIndexVersionWithResponse(String name, String v
      * 
* * @param name The name of the resource. - * @param version The specific version id of the Index to create or update. - * @param index The Index to create or update. + * @param version The specific version id of the Index 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 index resource Definition along with {@link Response} on successful completion of {@link Mono}. + * @return the specific version of the Index along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateIndexVersionWithResponse(String name, String version, - BinaryData index, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateIndexVersionWithResponseAsync(name, version, index, requestOptions); + public Mono> getVersionWithResponse(String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.getVersionWithResponseAsync(name, version, requestOptions); } /** - * List all versions of the given Index. + * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted + * successfully or if the Index does not exist. * * @param name The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. + * @param version The version of the Index 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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Index items as paginated response with {@link PagedFlux}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIndexVersions(String name) { - // Generated convenience method for listIndexVersions - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listIndexVersions(name, 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(Index.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.deleteVersionWithResponseAsync(name, version, requestOptions); } /** @@ -260,10 +288,10 @@ public PagedFlux listIndexVersions(String name) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listLatestIndexVersions() { - // Generated convenience method for listLatestIndexVersions + public PagedFlux listLatest() { + // Generated convenience method for listLatest RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listLatestIndexVersions(requestOptions); + PagedFlux pagedFluxResponse = listLatest(requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) @@ -279,7 +307,7 @@ public PagedFlux listLatestIndexVersions() { } /** - * Get the specific version of the Index. + * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist. * * @param name The name of the resource. * @param version The specific version id of the Index to retrieve. @@ -293,15 +321,16 @@ public PagedFlux listLatestIndexVersions() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getIndexVersion(String name, String version) { - // Generated convenience method for getIndexVersionWithResponse + public Mono getVersion(String name, String version) { + // Generated convenience method for getVersionWithResponse RequestOptions requestOptions = new RequestOptions(); - return getIndexVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono) + return getVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Index.class)); } /** - * Delete the specific version of the Index. + * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted + * successfully or if the Index does not exist. * * @param name The name of the resource. * @param version The version of the Index to delete. @@ -315,38 +344,9 @@ public Mono getIndexVersion(String name, String version) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteIndexVersion(String name, String version) { - // Generated convenience method for deleteIndexVersionWithResponse + public Mono deleteVersion(String name, String version) { + // Generated convenience method for deleteVersionWithResponse RequestOptions requestOptions = new RequestOptions(); - return deleteIndexVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Create a new or update an existing Index with the given version id. - * - * @param name The name of the resource. - * @param version The specific version id of the Index to create or update. - * @param index The Index to create or update. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return index resource Definition on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateIndexVersion(String name, String version, Index index) { - // Generated convenience method for createOrUpdateIndexVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, true); - BinaryData indexInBinaryData = BinaryData.fromObject(index); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - indexInBinaryData.getLength(); - JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, false); - return createOrUpdateIndexVersionWithResponse(name, version, indexInBinaryData, requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Index.class)); + return deleteVersionWithResponse(name, version, requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesClient.java index 681554a60a05..eee2a7b38f10 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesClient.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/IndexesClient.java @@ -67,13 +67,34 @@ public final class IndexesClient { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIndexVersions(String name, RequestOptions requestOptions) { - return this.serviceClient.listIndexVersions(name, requestOptions); + public PagedIterable listVersions(String name, RequestOptions requestOptions) { + return this.serviceClient.listVersions(name, requestOptions); } /** - * List the latest version of each Index. - *

Response Body Schema

+ * List all versions of the given Index. + * + * @param name The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Index items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listVersions(name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(Index.class)); + } + + /** + * Create a new or update an existing Index with the given version id. + *

Request Body Schema

* *
      * {@code
@@ -89,22 +110,7 @@ public PagedIterable listIndexVersions(String name, RequestOptions r
      * }
      * }
      * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the 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 Index items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLatestIndexVersions(RequestOptions requestOptions) { - return this.serviceClient.listLatestIndexVersions(requestOptions); - } - - /** - * Get the specific version of the Index. + * *

Response Body Schema

* *
@@ -123,42 +129,53 @@ public PagedIterable listLatestIndexVersions(RequestOptions requestO
      * 
* * @param name The name of the resource. - * @param version The specific version id of the Index to retrieve. + * @param version The specific version id of the Index to create or update. + * @param index The Index to create or update. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 specific version of the Index along with {@link Response}. + * @return index resource Definition along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getIndexVersionWithResponse(String name, String version, + public Response createOrUpdateWithResponse(String name, String version, BinaryData index, RequestOptions requestOptions) { - return this.serviceClient.getIndexVersionWithResponse(name, version, requestOptions); + return this.serviceClient.createOrUpdateWithResponse(name, version, index, requestOptions); } /** - * Delete the specific version of the Index. + * Create a new or update an existing Index with the given version id. * * @param name The name of the resource. - * @param version The version of the Index to delete. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param version The specific version id of the Index to create or update. + * @param index The Index to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return index resource Definition. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteIndexVersionWithResponse(String name, String version, RequestOptions requestOptions) { - return this.serviceClient.deleteIndexVersionWithResponse(name, version, requestOptions); + public Index createOrUpdate(String name, String version, Index index) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, true); + BinaryData indexInBinaryData = BinaryData.fromObject(index); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + indexInBinaryData.getLength(); + JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, false); + return createOrUpdateWithResponse(name, version, indexInBinaryData, requestOptions).getValue() + .toObject(Index.class); } /** - * Create a new or update an existing Index with the given version id. - *

Request Body Schema

+ * List the latest version of each Index. + *

Response Body Schema

* *
      * {@code
@@ -174,7 +191,22 @@ public Response deleteIndexVersionWithResponse(String name, String version
      * }
      * }
      * 
- * + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Index items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLatest(RequestOptions requestOptions) { + return this.serviceClient.listLatest(requestOptions); + } + + /** + * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist. *

Response Body Schema

* *
@@ -193,41 +225,37 @@ public Response deleteIndexVersionWithResponse(String name, String version
      * 
* * @param name The name of the resource. - * @param version The specific version id of the Index to create or update. - * @param index The Index to create or update. + * @param version The specific version id of the Index 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 index resource Definition along with {@link Response}. + * @return the specific version of the Index along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateIndexVersionWithResponse(String name, String version, BinaryData index, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateIndexVersionWithResponse(name, version, index, requestOptions); + public Response getVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.getVersionWithResponse(name, version, requestOptions); } /** - * List all versions of the given Index. + * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted + * successfully or if the Index does not exist. * * @param name The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. + * @param version The version of the Index 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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Index items as paginated response with {@link PagedIterable}. + * @return the {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIndexVersions(String name) { - // Generated convenience method for listIndexVersions - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listIndexVersions(name, requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(Index.class)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return this.serviceClient.deleteVersionWithResponse(name, version, requestOptions); } /** @@ -242,15 +270,14 @@ public PagedIterable listIndexVersions(String name) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLatestIndexVersions() { - // Generated convenience method for listLatestIndexVersions + public PagedIterable listLatest() { + // Generated convenience method for listLatest RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listLatestIndexVersions(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(Index.class)); + return serviceClient.listLatest(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Index.class)); } /** - * Get the specific version of the Index. + * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist. * * @param name The name of the resource. * @param version The specific version id of the Index to retrieve. @@ -264,14 +291,15 @@ public PagedIterable listLatestIndexVersions() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Index getIndexVersion(String name, String version) { - // Generated convenience method for getIndexVersionWithResponse + public Index getVersion(String name, String version) { + // Generated convenience method for getVersionWithResponse RequestOptions requestOptions = new RequestOptions(); - return getIndexVersionWithResponse(name, version, requestOptions).getValue().toObject(Index.class); + return getVersionWithResponse(name, version, requestOptions).getValue().toObject(Index.class); } /** - * Delete the specific version of the Index. + * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted + * successfully or if the Index does not exist. * * @param name The name of the resource. * @param version The version of the Index to delete. @@ -284,37 +312,9 @@ public Index getIndexVersion(String name, String version) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteIndexVersion(String name, String version) { - // Generated convenience method for deleteIndexVersionWithResponse + public void deleteVersion(String name, String version) { + // Generated convenience method for deleteVersionWithResponse RequestOptions requestOptions = new RequestOptions(); - deleteIndexVersionWithResponse(name, version, requestOptions).getValue(); - } - - /** - * Create a new or update an existing Index with the given version id. - * - * @param name The name of the resource. - * @param version The specific version id of the Index to create or update. - * @param index The Index to create or update. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return index resource Definition. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Index createOrUpdateIndexVersion(String name, String version, Index index) { - // Generated convenience method for createOrUpdateIndexVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, true); - BinaryData indexInBinaryData = BinaryData.fromObject(index); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - indexInBinaryData.getLength(); - JsonMergePatchHelper.getIndexAccessor().prepareModelForJsonMergePatch(index, false); - return createOrUpdateIndexVersionWithResponse(name, version, indexInBinaryData, requestOptions).getValue() - .toObject(Index.class); + deleteVersionWithResponse(name, version, requestOptions).getValue(); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceAsyncClient.java deleted file mode 100644 index 57de4bc6d60a..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceAsyncClient.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.projects; - -import com.azure.ai.projects.implementation.InferenceClientImpl; -import com.openai.client.OpenAIClientAsync; - -/** - * Async client for interacting with the inference services. - */ -public final class InferenceAsyncClient { - private final InferenceClientImpl inferenceClientImpl; - - /** - * Initializes an instance of InferenceAsyncClient. - * - * @param inferenceClientImpl The implementation client. - */ - public InferenceAsyncClient(InferenceClientImpl inferenceClientImpl) { - this.inferenceClientImpl = inferenceClientImpl; - } - - /** - * Gets an instance of OpenAIAsyncClient for the specified deployment. - * - * @return An instance of OpenAIAsyncClient. - */ - public OpenAIClientAsync getOpenAIAsyncClient() { - return inferenceClientImpl.getOpenAIAsyncClient(); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceClient.java deleted file mode 100644 index c55d8a0425ac..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InferenceClient.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.projects; - -import com.azure.ai.projects.implementation.InferenceClientImpl; -import com.openai.client.OpenAIClient; - -/** - * Client for interacting with the inference services. - */ -public final class InferenceClient { - private final InferenceClientImpl inferenceClientImpl; - - /** - * Initializes an instance of InferenceClient. - * - * @param inferenceClientImpl The implementation client. - */ - public InferenceClient(InferenceClientImpl inferenceClientImpl) { - this.inferenceClientImpl = inferenceClientImpl; - } - - /** - * Gets an instance of OpenAIClient for the specified deployment. - * - * @return An instance of OpenAIClient. - */ - public OpenAIClient getOpenAIClient() { - return inferenceClientImpl.getOpenAIClient(); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsAsyncClient.java new file mode 100644 index 000000000000..6cb049bcd520 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsAsyncClient.java @@ -0,0 +1,361 @@ +// Copyright (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.InsightsImpl; +import com.azure.ai.projects.models.Insight; +import com.azure.ai.projects.models.InsightType; +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 InsightsAsyncClient { + + @Generated + private final InsightsImpl serviceClient; + + /** + * Initializes an instance of InsightsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InsightsAsyncClient(InsightsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate Insights. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 for cluster insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> generateWithResponse(BinaryData insight, RequestOptions requestOptions) { + return this.serviceClient.generateWithResponseAsync(insight, requestOptions); + } + + /** + * Get a specific insight by Id. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The unique identifier for the insights report. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 specific insight by Id 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); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Generate Insights. + * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 for cluster insights on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono generate(Insight insight) { + // Generated convenience method for generateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return generateWithResponse(BinaryData.fromObject(insight), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Insight.class)); + } + + /** + * Get a specific insight by Id. + * + * @param id The unique identifier for the insights report. + * @param includeCoordinates Whether to include coordinates for visualization in the response. Defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 specific insight by Id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String id, Boolean includeCoordinates) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (includeCoordinates != null) { + requestOptions.addQueryParam("includeCoordinates", String.valueOf(includeCoordinates), false); + } + return getWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Insight.class)); + } + + /** + * Get a specific insight by Id. + * + * @param id The unique identifier for the insights report. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 specific insight by Id 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(Insight.class)); + } + + /** + * List all insights in reverse chronological order (newest first). + * + * @param type Filter by the type of analysis. + * @param evalId Filter by the evaluation ID. + * @param runId Filter by the evaluation run ID. + * @param agentName Filter by the agent name. + * @param includeCoordinates Whether to include coordinates for visualization in the response. Defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Insight items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(InsightType type, String evalId, String runId, String agentName, + Boolean includeCoordinates) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (evalId != null) { + requestOptions.addQueryParam("evalId", evalId, false); + } + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + if (agentName != null) { + requestOptions.addQueryParam("agentName", agentName, false); + } + if (includeCoordinates != null) { + requestOptions.addQueryParam("includeCoordinates", String.valueOf(includeCoordinates), 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(Insight.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List all insights in reverse chronological order (newest first). + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Insight 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(Insight.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsClient.java new file mode 100644 index 000000000000..162195d5e08a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/InsightsClient.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; + +import com.azure.ai.projects.implementation.InsightsImpl; +import com.azure.ai.projects.models.Insight; +import com.azure.ai.projects.models.InsightType; +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 InsightsClient { + + @Generated + private final InsightsImpl serviceClient; + + /** + * Initializes an instance of InsightsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InsightsClient(InsightsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate Insights. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 for cluster insights along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateWithResponse(BinaryData insight, RequestOptions requestOptions) { + return this.serviceClient.generateWithResponse(insight, requestOptions); + } + + /** + * Get a specific insight by Id. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The unique identifier for the insights report. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 specific insight by Id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(id, requestOptions); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Generate Insights. + * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 for cluster insights. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Insight generate(Insight insight) { + // Generated convenience method for generateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return generateWithResponse(BinaryData.fromObject(insight), requestOptions).getValue().toObject(Insight.class); + } + + /** + * Get a specific insight by Id. + * + * @param id The unique identifier for the insights report. + * @param includeCoordinates Whether to include coordinates for visualization in the response. Defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 specific insight by Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Insight get(String id, Boolean includeCoordinates) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (includeCoordinates != null) { + requestOptions.addQueryParam("includeCoordinates", String.valueOf(includeCoordinates), false); + } + return getWithResponse(id, requestOptions).getValue().toObject(Insight.class); + } + + /** + * Get a specific insight by Id. + * + * @param id The unique identifier for the insights report. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 specific insight by Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Insight get(String id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).getValue().toObject(Insight.class); + } + + /** + * List all insights in reverse chronological order (newest first). + * + * @param type Filter by the type of analysis. + * @param evalId Filter by the evaluation ID. + * @param runId Filter by the evaluation run ID. + * @param agentName Filter by the agent name. + * @param includeCoordinates Whether to include coordinates for visualization in the response. Defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Insight items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(InsightType type, String evalId, String runId, String agentName, + Boolean includeCoordinates) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + if (evalId != null) { + requestOptions.addQueryParam("evalId", evalId, false); + } + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + if (agentName != null) { + requestOptions.addQueryParam("agentName", agentName, false); + } + if (includeCoordinates != null) { + requestOptions.addQueryParam("includeCoordinates", String.valueOf(includeCoordinates), false); + } + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Insight.class)); + } + + /** + * List all insights in reverse chronological order (newest first). + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Insight 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(Insight.class)); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsAsyncClient.java index fee0a5f7ac2d..6531e8c27d64 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsAsyncClient.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsAsyncClient.java @@ -54,11 +54,11 @@ public final class RedTeamsAsyncClient { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -85,8 +85,8 @@ public final class RedTeamsAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRedTeamWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getRedTeamWithResponseAsync(name, requestOptions); + public Mono> getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(name, requestOptions); } /** @@ -100,11 +100,11 @@ public Mono> getRedTeamWithResponse(String name, RequestOpt * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -130,8 +130,8 @@ public Mono> getRedTeamWithResponse(String name, RequestOpt */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listRedTeams(RequestOptions requestOptions) { - return this.serviceClient.listRedTeamsAsync(requestOptions); + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); } /** @@ -145,11 +145,11 @@ public PagedFlux listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -175,11 +175,11 @@ public PagedFlux listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -206,8 +206,8 @@ public PagedFlux listRedTeams(RequestOptions requestOptions) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createRedTeamWithResponse(BinaryData redTeam, RequestOptions requestOptions) { - return this.serviceClient.createRedTeamWithResponseAsync(redTeam, requestOptions); + public Mono> createWithResponse(BinaryData redTeam, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(redTeam, requestOptions); } /** @@ -224,10 +224,10 @@ public Mono> createRedTeamWithResponse(BinaryData redTeam, */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRedTeam(String name) { - // Generated convenience method for getRedTeamWithResponse + public Mono get(String name) { + // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getRedTeamWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + return getWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(RedTeam.class)); } @@ -243,10 +243,10 @@ public Mono getRedTeam(String name) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listRedTeams() { - // Generated convenience method for listRedTeams + public PagedFlux list() { + // Generated convenience method for list RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listRedTeams(requestOptions); + PagedFlux pagedFluxResponse = list(requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) @@ -275,10 +275,10 @@ public PagedFlux listRedTeams() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createRedTeam(RedTeam redTeam) { - // Generated convenience method for createRedTeamWithResponse + public Mono create(RedTeam redTeam) { + // Generated convenience method for createWithResponse RequestOptions requestOptions = new RequestOptions(); - return createRedTeamWithResponse(BinaryData.fromObject(redTeam), requestOptions).flatMap(FluxUtil::toMono) + return createWithResponse(BinaryData.fromObject(redTeam), requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(RedTeam.class)); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsClient.java index e82e814a873a..99f69e052a09 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsClient.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/RedTeamsClient.java @@ -48,11 +48,11 @@ public final class RedTeamsClient { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -79,8 +79,8 @@ public final class RedTeamsClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRedTeamWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getRedTeamWithResponse(name, requestOptions); + public Response getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(name, requestOptions); } /** @@ -94,11 +94,11 @@ public Response getRedTeamWithResponse(String name, RequestOptions r * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -124,8 +124,8 @@ public Response getRedTeamWithResponse(String name, RequestOptions r */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listRedTeams(RequestOptions requestOptions) { - return this.serviceClient.listRedTeams(requestOptions); + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); } /** @@ -139,11 +139,11 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -169,11 +169,11 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -200,8 +200,8 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response createRedTeamWithResponse(BinaryData redTeam, RequestOptions requestOptions) { - return this.serviceClient.createRedTeamWithResponse(redTeam, requestOptions); + public Response createWithResponse(BinaryData redTeam, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(redTeam, requestOptions); } /** @@ -218,10 +218,10 @@ public Response createRedTeamWithResponse(BinaryData redTeam, Reques */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public RedTeam getRedTeam(String name) { - // Generated convenience method for getRedTeamWithResponse + public RedTeam get(String name) { + // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getRedTeamWithResponse(name, requestOptions).getValue().toObject(RedTeam.class); + return getWithResponse(name, requestOptions).getValue().toObject(RedTeam.class); } /** @@ -236,11 +236,10 @@ public RedTeam getRedTeam(String name) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listRedTeams() { - // Generated convenience method for listRedTeams + public PagedIterable list() { + // Generated convenience method for list RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listRedTeams(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(RedTeam.class)); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(RedTeam.class)); } /** @@ -257,10 +256,9 @@ public PagedIterable listRedTeams() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public RedTeam createRedTeam(RedTeam redTeam) { - // Generated convenience method for createRedTeamWithResponse + public RedTeam create(RedTeam redTeam) { + // Generated convenience method for createWithResponse RequestOptions requestOptions = new RequestOptions(); - return createRedTeamWithResponse(BinaryData.fromObject(redTeam), requestOptions).getValue() - .toObject(RedTeam.class); + return createWithResponse(BinaryData.fromObject(redTeam), requestOptions).getValue().toObject(RedTeam.class); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesAsyncClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesAsyncClient.java new file mode 100644 index 000000000000..b3234e73b388 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesAsyncClient.java @@ -0,0 +1,455 @@ +// Copyright (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.SchedulesImpl; +import com.azure.ai.projects.models.Schedule; +import com.azure.ai.projects.models.ScheduleRun; +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 SchedulesAsyncClient { + + @Generated + private final SchedulesImpl serviceClient; + + /** + * Initializes an instance of SchedulesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SchedulesAsyncClient(SchedulesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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> deleteWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(id, requestOptions); + } + + /** + * Get a schedule by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 a schedule by id 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); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Create or update a schedule by id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return schedule model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponse(String id, BinaryData schedule, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponseAsync(id, schedule, requestOptions); + } + + /** + * Get a schedule run by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunWithResponse(String scheduleId, String runId, + RequestOptions requestOptions) { + return this.serviceClient.getRunWithResponseAsync(scheduleId, runId, requestOptions); + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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 delete(String id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get a schedule by id. + * + * @param id Identifier of the 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 schedule by id 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(Schedule.class)); + } + + /** + * List all schedules. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Schedule 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(Schedule.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Create or update a schedule by id. + * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdate(String id, Schedule schedule) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateWithResponse(id, BinaryData.fromObject(schedule), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Schedule.class)); + } + + /** + * Get a schedule run by id. + * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRun(String scheduleId, String runId) { + // Generated convenience method for getRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunWithResponse(scheduleId, runId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ScheduleRun.class)); + } + + /** + * List all schedule runs. + * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listRuns(String id) { + // Generated convenience method for listRuns + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listRuns(id, 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(ScheduleRun.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listRuns(String id, RequestOptions requestOptions) { + return this.serviceClient.listRunsAsync(id, requestOptions); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesClient.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesClient.java new file mode 100644 index 000000000000..875a41100f8f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/SchedulesClient.java @@ -0,0 +1,422 @@ +// Copyright (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.SchedulesImpl; +import com.azure.ai.projects.models.Schedule; +import com.azure.ai.projects.models.ScheduleRun; +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 SchedulesClient { + + @Generated + private final SchedulesImpl serviceClient; + + /** + * Initializes an instance of SchedulesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SchedulesClient(SchedulesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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 deleteWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(id, requestOptions); + } + + /** + * Get a schedule by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 a schedule by id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(id, requestOptions); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Create or update a schedule by id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return schedule model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String id, BinaryData schedule, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponse(id, schedule, requestOptions); + } + + /** + * Get a schedule run by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunWithResponse(String scheduleId, String runId, RequestOptions requestOptions) { + return this.serviceClient.getRunWithResponse(scheduleId, runId, requestOptions); + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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 delete(String id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(id, requestOptions).getValue(); + } + + /** + * Get a schedule by id. + * + * @param id Identifier of the 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 schedule by id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Schedule get(String id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).getValue().toObject(Schedule.class); + } + + /** + * List all schedules. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the 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 Schedule 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(Schedule.class)); + } + + /** + * Create or update a schedule by id. + * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Schedule createOrUpdate(String id, Schedule schedule) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateWithResponse(id, BinaryData.fromObject(schedule), requestOptions).getValue() + .toObject(Schedule.class); + } + + /** + * Get a schedule run by id. + * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleRun getRun(String scheduleId, String runId) { + // Generated convenience method for getRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunWithResponse(scheduleId, runId, requestOptions).getValue().toObject(ScheduleRun.class); + } + + /** + * List all schedule runs. + * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRuns(String id) { + // Generated convenience method for listRuns + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listRuns(id, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(ScheduleRun.class)); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRuns(String id, RequestOptions requestOptions) { + return this.serviceClient.listRuns(id, requestOptions); + } +} 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 deleted file mode 100644 index 35a68a9265b5..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryAsyncClient.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (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.models.ConnectionType; -import com.azure.ai.projects.models.CredentialType; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.AzureException; -import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AIProjectClient type. - */ -@ServiceClient(builder = AIProjectClientBuilder.class, isAsync = true) -public final class TelemetryAsyncClient { - - private final ConnectionsAsyncClient connectionsAsyncClient; - private final ClientLogger logger = new ClientLogger(TelemetryAsyncClient.class); - - /** - * Initializes an instance of TelemetryAsyncClient class. - * - * @param connectionsAsyncClient the connections async client implementation. - */ - TelemetryAsyncClient(ConnectionsAsyncClient connectionsAsyncClient) { - this.connectionsAsyncClient = connectionsAsyncClient; - } - - /** - * Get the Application Insights connection string associated with the Project's Application Insights resource. - * - * @return The Application Insights connection string if a the resource was enabled for the Project. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getConnectionString() { - return connectionsAsyncClient.listConnections(ConnectionType.APPLICATION_INSIGHTS, true) - .collectList() - .flatMap(connections -> { - if (connections.isEmpty()) { - return Mono.error( - logger.logExceptionAsError(new AzureException("No Application Insights connection found."))); - } - - String connectionName = connections.get(0).getName(); - return connectionsAsyncClient.getConnectionWithCredentials(connectionName).flatMap(connection -> { - if (connection.getCredentials().getType() != CredentialType.API_KEY) { - return Mono.error(logger.logExceptionAsError( - new AzureException("Application Insights connection does not use API Key credentials."))); - } - - if (connection.getId() == null || connection.getId().isEmpty()) { - return Mono.error(logger.logExceptionAsError( - new AzureException("Application Insights connection does not have a connection string."))); - } - - return Mono.just(connection.getId()); - }); - }); - } -} 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 deleted file mode 100644 index f0133c77b362..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/TelemetryClient.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (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.models.Connection; -import com.azure.ai.projects.models.ConnectionType; -import com.azure.ai.projects.models.CredentialType; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.AzureException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.logging.ClientLogger; -import java.util.Iterator; - -/** - * Initializes a new instance of the synchronous AIProjectClient type. - */ -@ServiceClient(builder = AIProjectClientBuilder.class) -public final class TelemetryClient { - - private final ConnectionsClient connectionsClient; - private final ClientLogger logger = new ClientLogger(TelemetryClient.class); - private static final String ENV_CONTENT_RECORDING_ENABLED = "AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED"; - - /** - * Initializes an instance of TelemetryClient class. - * - * @param connectionsClient the connections client implementation. - */ - TelemetryClient(ConnectionsClient connectionsClient) { - this.connectionsClient = connectionsClient; - } - - /** - * Get the Application Insights connection string associated with the Project's Application Insights resource. - * - * @return The Application Insights connection string if the resource was enabled for the Project. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public String getConnectionString() { - PagedIterable connections - = connectionsClient.listConnections(ConnectionType.APPLICATION_INSIGHTS, true); - Iterator iterator = connections.iterator(); - - if (iterator.hasNext()) { - Connection connection = connectionsClient.getConnection(iterator.next().getName(), true); - if (connection.getCredentials().getType() == CredentialType.API_KEY) { - if (connection.getId() != null) { - return connection.getId(); - } else { - throw logger.logExceptionAsError( - new AzureException("Application Insights connection does not have a connection string.")); - } - } else { - throw logger.logExceptionAsError( - new AzureException("Application Insights connection does not use API Key credentials.")); - } - } else { - throw logger.logExceptionAsError(new AzureException("No Application Insights connection found.")); - } - } -} 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 index 4628d2214cb6..1f6f463382f5 100644 --- 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 @@ -4,7 +4,7 @@ package com.azure.ai.projects.implementation; -import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.ai.projects.AIProjectsServiceVersion; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.RetryPolicy; @@ -17,22 +17,20 @@ */ public final class AIProjectClientImpl { /** - * Project endpoint. In the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project" - * if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>" if - * you want to explicitly - * specify the Foundry Project name. + * Foundry Project endpoint in the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". + * If you only have one Project in your Foundry Hub, or to target the default Project + * in your Hub, use the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". */ private final String endpoint; /** - * Gets Project endpoint. In the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project" - * if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>" if - * you want to explicitly - * specify the Foundry Project name. + * Gets Foundry Project endpoint in the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". + * If you only have one Project in your Foundry Hub, or to target the default Project + * in your Hub, use the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". * * @return the endpoint value. */ @@ -43,14 +41,14 @@ public String getEndpoint() { /** * Service version. */ - private final ProjectsServiceVersion serviceVersion; + private final AIProjectsServiceVersion serviceVersion; /** * Gets Service version. * * @return the serviceVersion value. */ - public ProjectsServiceVersion getServiceVersion() { + public AIProjectsServiceVersion getServiceVersion() { return this.serviceVersion; } @@ -96,20 +94,6 @@ public ConnectionsImpl getConnections() { return this.connections; } - /** - * 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; - } - /** * The DatasetsImpl object to access its operations. */ @@ -166,18 +150,87 @@ public RedTeamsImpl getRedTeams() { return this.redTeams; } + /** + * The EvaluationRulesImpl object to access its operations. + */ + private final EvaluationRulesImpl evaluationRules; + + /** + * Gets the EvaluationRulesImpl object to access its operations. + * + * @return the EvaluationRulesImpl object. + */ + public EvaluationRulesImpl getEvaluationRules() { + return this.evaluationRules; + } + + /** + * The EvaluationTaxonomiesImpl object to access its operations. + */ + private final EvaluationTaxonomiesImpl evaluationTaxonomies; + + /** + * Gets the EvaluationTaxonomiesImpl object to access its operations. + * + * @return the EvaluationTaxonomiesImpl object. + */ + public EvaluationTaxonomiesImpl getEvaluationTaxonomies() { + return this.evaluationTaxonomies; + } + + /** + * The EvaluatorsImpl object to access its operations. + */ + private final EvaluatorsImpl evaluators; + + /** + * Gets the EvaluatorsImpl object to access its operations. + * + * @return the EvaluatorsImpl object. + */ + public EvaluatorsImpl getEvaluators() { + return this.evaluators; + } + + /** + * The InsightsImpl object to access its operations. + */ + private final InsightsImpl insights; + + /** + * Gets the InsightsImpl object to access its operations. + * + * @return the InsightsImpl object. + */ + public InsightsImpl getInsights() { + return this.insights; + } + + /** + * The SchedulesImpl object to access its operations. + */ + private final SchedulesImpl schedules; + + /** + * Gets the SchedulesImpl object to access its operations. + * + * @return the SchedulesImpl object. + */ + public SchedulesImpl getSchedules() { + return this.schedules; + } + /** * Initializes an instance of AIProjectClient client. * - * @param endpoint Project endpoint. In the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project" - * if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>" if - * you want to explicitly - * specify the Foundry Project name. + * @param endpoint Foundry Project endpoint in the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". + * If you only have one Project in your Foundry Hub, or to target the default Project + * in your Hub, use the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". * @param serviceVersion Service version. */ - public AIProjectClientImpl(String endpoint, ProjectsServiceVersion serviceVersion) { + public AIProjectClientImpl(String endpoint, AIProjectsServiceVersion serviceVersion) { this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); } @@ -186,15 +239,14 @@ public AIProjectClientImpl(String endpoint, ProjectsServiceVersion serviceVersio * Initializes an instance of AIProjectClient client. * * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Project endpoint. In the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project" - * if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>" if - * you want to explicitly - * specify the Foundry Project name. + * @param endpoint Foundry Project endpoint in the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". + * If you only have one Project in your Foundry Hub, or to target the default Project + * in your Hub, use the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". * @param serviceVersion Service version. */ - public AIProjectClientImpl(HttpPipeline httpPipeline, String endpoint, ProjectsServiceVersion serviceVersion) { + public AIProjectClientImpl(HttpPipeline httpPipeline, String endpoint, AIProjectsServiceVersion serviceVersion) { this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); } @@ -203,25 +255,28 @@ public AIProjectClientImpl(HttpPipeline httpPipeline, String endpoint, ProjectsS * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Project endpoint. In the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project" - * if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the form - * "https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>" if - * you want to explicitly - * specify the Foundry Project name. + * @param endpoint Foundry Project endpoint in the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". + * If you only have one Project in your Foundry Hub, or to target the default Project + * in your Hub, use the form + * "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". * @param serviceVersion Service version. */ public AIProjectClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ProjectsServiceVersion serviceVersion) { + AIProjectsServiceVersion serviceVersion) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.endpoint = endpoint; this.serviceVersion = serviceVersion; this.connections = new ConnectionsImpl(this); - this.evaluations = new EvaluationsImpl(this); this.datasets = new DatasetsImpl(this); this.indexes = new IndexesImpl(this); this.deployments = new DeploymentsImpl(this); this.redTeams = new RedTeamsImpl(this); + this.evaluationRules = new EvaluationRulesImpl(this); + this.evaluationTaxonomies = new EvaluationTaxonomiesImpl(this); + this.evaluators = new EvaluatorsImpl(this); + this.insights = new InsightsImpl(this); + this.schedules = new SchedulesImpl(this); } } 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 index 866f1f8b5582..e545f7c50fc3 100644 --- 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 @@ -4,7 +4,7 @@ package com.azure.ai.projects.implementation; -import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.ai.projects.AIProjectsServiceVersion; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; @@ -66,7 +66,7 @@ public final class ConnectionsImpl { * * @return the serviceVersion value. */ - public ProjectsServiceVersion getServiceVersion() { + public AIProjectsServiceVersion getServiceVersion() { return client.getServiceVersion(); } @@ -167,11 +167,11 @@ Response listConnectionsNextSync(@PathParam(value = "nextLink", enco * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -205,11 +205,11 @@ public Mono> getConnectionWithResponseAsync(String name, Re * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -242,11 +242,11 @@ public Response getConnectionWithResponse(String name, RequestOption * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -281,11 +281,11 @@ public Mono> getConnectionWithCredentialsWithResponseAsync( * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -317,7 +317,7 @@ public Response getConnectionWithCredentialsWithResponse(String name * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -329,11 +329,11 @@ public Response getConnectionWithCredentialsWithResponse(String name * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -368,7 +368,7 @@ private Mono> listConnectionsSinglePageAsync(RequestOp * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -380,11 +380,11 @@ private Mono> listConnectionsSinglePageAsync(RequestOp * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -417,7 +417,7 @@ public PagedFlux listConnectionsAsync(RequestOptions requestOptions) * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -429,11 +429,11 @@ public PagedFlux listConnectionsAsync(RequestOptions requestOptions) * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -466,7 +466,7 @@ private PagedResponse listConnectionsSinglePage(RequestOptions reque * NameTypeRequiredDescription * connectionTypeStringNoList connections of this specific type. Allowed values: * "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", - * "AppInsights", "CustomKeys". + * "AppInsights", "CustomKeys", "RemoteTool". * defaultConnectionBooleanNoList connections that are default * connections * @@ -478,11 +478,11 @@ private PagedResponse listConnectionsSinglePage(RequestOptions reque * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -516,11 +516,11 @@ public PagedIterable listConnections(RequestOptions requestOptions) * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) @@ -558,11 +558,11 @@ private Mono> listConnectionsNextSinglePageAsync(Strin * { * name: String (Required) * id: String (Required) - * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys) (Required) + * type: String(AzureOpenAI/AzureBlob/AzureStorageAccount/CognitiveSearch/CosmosDB/ApiKey/AppConfig/AppInsights/CustomKeys/RemoteTool) (Required) * target: String (Required) * isDefault: boolean (Required) * credentials (Required): { - * type: String(ApiKey/AAD/SAS/CustomKeys/None) (Required) + * type: String(ApiKey/AAD/SAS/CustomKeys/None/AgenticIdentityToken) (Required) * } * metadata (Required): { * String: String (Required) diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DatasetsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DatasetsImpl.java index 55631f0a0351..4943c0ffa48d 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DatasetsImpl.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DatasetsImpl.java @@ -4,7 +4,7 @@ package com.azure.ai.projects.implementation; -import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.ai.projects.AIProjectsServiceVersion; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -68,7 +68,7 @@ public final class DatasetsImpl { * * @return the serviceVersion value. */ - public ProjectsServiceVersion getServiceVersion() { + public AIProjectsServiceVersion getServiceVersion() { return client.getServiceVersion(); } @@ -85,7 +85,7 @@ public interface DatasetsService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listDatasetVersions(@HostParam("endpoint") String endpoint, + Mono> listVersions(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -95,7 +95,7 @@ Mono> listDatasetVersions(@HostParam("endpoint") String end @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listDatasetVersionsSync(@HostParam("endpoint") String endpoint, + Response listVersionsSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -105,7 +105,7 @@ Response listDatasetVersionsSync(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listLatestDatasetVersions(@HostParam("endpoint") String endpoint, + Mono> listLatest(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -115,7 +115,7 @@ Mono> listLatestDatasetVersions(@HostParam("endpoint") Stri @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listLatestDatasetVersionsSync(@HostParam("endpoint") String endpoint, + Response listLatestSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -147,7 +147,7 @@ Response getDatasetVersionSync(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteDatasetVersion(@HostParam("endpoint") String endpoint, + Mono> deleteVersion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, Context context); @@ -157,7 +157,7 @@ Mono> deleteDatasetVersion(@HostParam("endpoint") String endpoint @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteDatasetVersionSync(@HostParam("endpoint") String endpoint, + Response deleteVersionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, Context context); @@ -167,7 +167,7 @@ Response deleteDatasetVersionSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateDatasetVersion(@HostParam("endpoint") String endpoint, + Mono> createOrUpdateVersion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Content-Type") String contentType, @PathParam("version") String version, @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData datasetVersion, @@ -179,7 +179,7 @@ Mono> createOrUpdateDatasetVersion(@HostParam("endpoint") S @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateDatasetVersionSync(@HostParam("endpoint") String endpoint, + Response createOrUpdateVersionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Content-Type") String contentType, @PathParam("version") String version, @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData datasetVersion, @@ -237,9 +237,9 @@ Response getCredentialsSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listDatasetVersionsNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> listVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -247,7 +247,7 @@ Mono> listDatasetVersionsNext( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listDatasetVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + Response listVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -257,9 +257,9 @@ Response listDatasetVersionsNextSync(@PathParam(value = "nextLink", @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listLatestDatasetVersionsNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> listLatestNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -267,9 +267,9 @@ Mono> listLatestDatasetVersionsNext( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listLatestDatasetVersionsNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Response listLatestNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); } /** @@ -304,11 +304,10 @@ Response listLatestDatasetVersionsNextSync( * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listDatasetVersionsSinglePageAsync(String name, - RequestOptions requestOptions) { + private Mono> listVersionsSinglePageAsync(String name, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listDatasetVersions(this.client.getEndpoint(), + .withContext(context -> service.listVersions(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); @@ -345,12 +344,12 @@ private Mono> listDatasetVersionsSinglePageAsync(Strin * @return paged collection of DatasetVersion items as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listDatasetVersionsAsync(String name, RequestOptions requestOptions) { + public PagedFlux listVersionsAsync(String name, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listDatasetVersionsSinglePageAsync(name, requestOptions), - nextLink -> listDatasetVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + return new PagedFlux<>(() -> listVersionsSinglePageAsync(name, requestOptions), + nextLink -> listVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -384,9 +383,9 @@ public PagedFlux listDatasetVersionsAsync(String name, RequestOption * @return paged collection of DatasetVersion items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listDatasetVersionsSinglePage(String name, RequestOptions requestOptions) { + private PagedResponse listVersionsSinglePage(String name, RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listDatasetVersionsSync(this.client.getEndpoint(), + Response res = service.listVersionsSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); @@ -423,12 +422,12 @@ private PagedResponse listDatasetVersionsSinglePage(String name, Req * @return paged collection of DatasetVersion items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listDatasetVersions(String name, RequestOptions requestOptions) { + public PagedIterable listVersions(String name, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listDatasetVersionsSinglePage(name, requestOptions), - nextLink -> listDatasetVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(() -> listVersionsSinglePage(name, requestOptions), + nextLink -> listVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); } /** @@ -462,10 +461,10 @@ public PagedIterable listDatasetVersions(String name, RequestOptions * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listLatestDatasetVersionsSinglePageAsync(RequestOptions requestOptions) { + private Mono> listLatestSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listLatestDatasetVersions(this.client.getEndpoint(), + .withContext(context -> service.listLatest(this.client.getEndpoint(), 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)); @@ -501,12 +500,12 @@ private Mono> listLatestDatasetVersionsSinglePageAsync * @return paged collection of DatasetVersion items as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listLatestDatasetVersionsAsync(RequestOptions requestOptions) { + public PagedFlux listLatestAsync(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listLatestDatasetVersionsSinglePageAsync(requestOptions), - nextLink -> listLatestDatasetVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + return new PagedFlux<>(() -> listLatestSinglePageAsync(requestOptions), + nextLink -> listLatestNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -539,9 +538,9 @@ public PagedFlux listLatestDatasetVersionsAsync(RequestOptions reque * @return paged collection of DatasetVersion items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listLatestDatasetVersionsSinglePage(RequestOptions requestOptions) { + private PagedResponse listLatestSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listLatestDatasetVersionsSync(this.client.getEndpoint(), + Response res = service.listLatestSync(this.client.getEndpoint(), 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); @@ -577,16 +576,17 @@ private PagedResponse listLatestDatasetVersionsSinglePage(RequestOpt * @return paged collection of DatasetVersion items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLatestDatasetVersions(RequestOptions requestOptions) { + public PagedIterable listLatest(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listLatestDatasetVersionsSinglePage(requestOptions), - nextLink -> listLatestDatasetVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(() -> listLatestSinglePage(requestOptions), + nextLink -> listLatestNextSinglePage(nextLink, requestOptionsForNextPage)); } /** - * Get the specific version of the DatasetVersion. + * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion + * does not exist. *

Response Body Schema

* *
@@ -626,7 +626,8 @@ public Mono> getDatasetVersionWithResponseAsync(String name
     }
 
     /**
-     * Get the specific version of the DatasetVersion.
+     * Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion
+     * does not exist.
      * 

Response Body Schema

* *
@@ -665,7 +666,8 @@ public Response getDatasetVersionWithResponse(String name, String ve
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      * 
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -677,14 +679,15 @@ public Response getDatasetVersionWithResponse(String name, String ve
      * @return the {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> deleteDatasetVersionWithResponseAsync(String name, String version,
+    public Mono> deleteVersionWithResponseAsync(String name, String version,
         RequestOptions requestOptions) {
-        return FluxUtil.withContext(context -> service.deleteDatasetVersion(this.client.getEndpoint(),
+        return FluxUtil.withContext(context -> service.deleteVersion(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, version, requestOptions, context));
     }
 
     /**
-     * Delete the specific version of the DatasetVersion.
+     * Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was
+     * deleted successfully or if the DatasetVersion does not exist.
      * 
      * @param name The name of the resource.
      * @param version The version of the DatasetVersion to delete.
@@ -696,9 +699,9 @@ public Mono> deleteDatasetVersionWithResponseAsync(String name, S
      * @return the {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response deleteDatasetVersionWithResponse(String name, String version, RequestOptions requestOptions) {
-        return service.deleteDatasetVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(),
-            name, version, requestOptions, Context.NONE);
+    public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) {
+        return service.deleteVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name,
+            version, requestOptions, Context.NONE);
     }
 
     /**
@@ -754,11 +757,11 @@ public Response deleteDatasetVersionWithResponse(String name, String versi
      * @return datasetVersion Definition along with {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> createOrUpdateDatasetVersionWithResponseAsync(String name, String version,
+    public Mono> createOrUpdateVersionWithResponseAsync(String name, String version,
         BinaryData datasetVersion, RequestOptions requestOptions) {
         final String contentType = "application/merge-patch+json";
         final String accept = "application/json";
-        return FluxUtil.withContext(context -> service.createOrUpdateDatasetVersion(this.client.getEndpoint(),
+        return FluxUtil.withContext(context -> service.createOrUpdateVersion(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, contentType, version, accept, datasetVersion,
             requestOptions, context));
     }
@@ -816,11 +819,11 @@ public Mono> createOrUpdateDatasetVersionWithResponseAsync(
      * @return datasetVersion Definition along with {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response createOrUpdateDatasetVersionWithResponse(String name, String version,
+    public Response createOrUpdateVersionWithResponse(String name, String version,
         BinaryData datasetVersion, RequestOptions requestOptions) {
         final String contentType = "application/merge-patch+json";
         final String accept = "application/json";
-        return service.createOrUpdateDatasetVersionSync(this.client.getEndpoint(),
+        return service.createOrUpdateVersionSync(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, contentType, version, accept, datasetVersion,
             requestOptions, Context.NONE);
     }
@@ -1038,12 +1041,11 @@ public Response getCredentialsWithResponse(String name, String versi
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listDatasetVersionsNextSinglePageAsync(String nextLink,
+    private Mono> listVersionsNextSinglePageAsync(String nextLink,
         RequestOptions requestOptions) {
         final String accept = "application/json";
-        return FluxUtil
-            .withContext(context -> service.listDatasetVersionsNext(nextLink, this.client.getEndpoint(), accept,
-                requestOptions, context))
+        return FluxUtil.withContext(
+            context -> service.listVersionsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context))
             .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                 getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
     }
@@ -1079,11 +1081,10 @@ private Mono> listDatasetVersionsNextSinglePageAsync(S
      * @return paged collection of DatasetVersion items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listDatasetVersionsNextSinglePage(String nextLink,
-        RequestOptions requestOptions) {
+    private PagedResponse listVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listDatasetVersionsNextSync(nextLink, this.client.getEndpoint(), accept,
-            requestOptions, Context.NONE);
+        Response res
+            = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE);
         return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
             getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
     }
@@ -1120,12 +1121,12 @@ private PagedResponse listDatasetVersionsNextSinglePage(String nextL
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listLatestDatasetVersionsNextSinglePageAsync(String nextLink,
+    private Mono> listLatestNextSinglePageAsync(String nextLink,
         RequestOptions requestOptions) {
         final String accept = "application/json";
         return FluxUtil
-            .withContext(context -> service.listLatestDatasetVersionsNext(nextLink, this.client.getEndpoint(), accept,
-                requestOptions, context))
+            .withContext(
+                context -> service.listLatestNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context))
             .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                 getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
     }
@@ -1161,11 +1162,10 @@ private Mono> listLatestDatasetVersionsNextSinglePageA
      * @return paged collection of DatasetVersion items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listLatestDatasetVersionsNextSinglePage(String nextLink,
-        RequestOptions requestOptions) {
+    private PagedResponse listLatestNextSinglePage(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listLatestDatasetVersionsNextSync(nextLink, this.client.getEndpoint(),
-            accept, requestOptions, Context.NONE);
+        Response res
+            = service.listLatestNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE);
         return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
             getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
     }
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DeploymentsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DeploymentsImpl.java
index 21795323e543..f5e22b028f0b 100644
--- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DeploymentsImpl.java
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/DeploymentsImpl.java
@@ -4,7 +4,7 @@
 
 package com.azure.ai.projects.implementation;
 
-import com.azure.ai.projects.ProjectsServiceVersion;
+import com.azure.ai.projects.AIProjectsServiceVersion;
 import com.azure.core.annotation.ExpectedResponses;
 import com.azure.core.annotation.Get;
 import com.azure.core.annotation.HeaderParam;
@@ -65,7 +65,7 @@ public final class DeploymentsImpl {
      * 
      * @return the serviceVersion value.
      */
-    public ProjectsServiceVersion getServiceVersion() {
+    public AIProjectsServiceVersion getServiceVersion() {
         return client.getServiceVersion();
     }
 
@@ -82,7 +82,7 @@ public interface DeploymentsService {
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> getDeployment(@HostParam("endpoint") String endpoint,
+        Mono> get(@HostParam("endpoint") String endpoint,
             @QueryParam("api-version") String apiVersion, @PathParam("name") String name,
             @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
 
@@ -92,7 +92,7 @@ Mono> getDeployment(@HostParam("endpoint") String endpoint,
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response getDeploymentSync(@HostParam("endpoint") String endpoint,
+        Response getSync(@HostParam("endpoint") String endpoint,
             @QueryParam("api-version") String apiVersion, @PathParam("name") String name,
             @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
 
@@ -102,7 +102,7 @@ Response getDeploymentSync(@HostParam("endpoint") String endpoint,
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> listDeployments(@HostParam("endpoint") String endpoint,
+        Mono> list(@HostParam("endpoint") String endpoint,
             @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
             RequestOptions requestOptions, Context context);
 
@@ -112,7 +112,7 @@ Mono> listDeployments(@HostParam("endpoint") String endpoin
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response listDeploymentsSync(@HostParam("endpoint") String endpoint,
+        Response listSync(@HostParam("endpoint") String endpoint,
             @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
             RequestOptions requestOptions, Context context);
 
@@ -122,7 +122,7 @@ Response listDeploymentsSync(@HostParam("endpoint") String endpoint,
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> listDeploymentsNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+        Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
             @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
             Context context);
 
@@ -132,7 +132,7 @@ Mono> listDeploymentsNext(@PathParam(value = "nextLink", en
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response listDeploymentsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+        Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
             @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
             Context context);
     }
@@ -159,9 +159,9 @@ Response listDeploymentsNextSync(@PathParam(value = "nextLink", enco
      * @return a deployed model along with {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> getDeploymentWithResponseAsync(String name, RequestOptions requestOptions) {
+    public Mono> getWithResponseAsync(String name, RequestOptions requestOptions) {
         final String accept = "application/json";
-        return FluxUtil.withContext(context -> service.getDeployment(this.client.getEndpoint(),
+        return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context));
     }
 
@@ -187,10 +187,10 @@ public Mono> getDeploymentWithResponseAsync(String name, Re
      * @return a deployed model along with {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response getDeploymentWithResponse(String name, RequestOptions requestOptions) {
+    public Response getWithResponse(String name, RequestOptions requestOptions) {
         final String accept = "application/json";
-        return service.getDeploymentSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name,
-            accept, requestOptions, Context.NONE);
+        return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept,
+            requestOptions, Context.NONE);
     }
 
     /**
@@ -226,10 +226,10 @@ public Response getDeploymentWithResponse(String name, RequestOption
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listDeploymentsSinglePageAsync(RequestOptions requestOptions) {
+    private Mono> listSinglePageAsync(RequestOptions requestOptions) {
         final String accept = "application/json";
         return FluxUtil
-            .withContext(context -> service.listDeployments(this.client.getEndpoint(),
+            .withContext(context -> service.list(this.client.getEndpoint(),
                 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));
@@ -267,12 +267,12 @@ private Mono> listDeploymentsSinglePageAsync(RequestOp
      * @return paged collection of Deployment items as paginated response with {@link PagedFlux}.
      */
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedFlux listDeploymentsAsync(RequestOptions requestOptions) {
+    public PagedFlux listAsync(RequestOptions requestOptions) {
         RequestOptions requestOptionsForNextPage = new RequestOptions();
         requestOptionsForNextPage.setContext(
             requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
-        return new PagedFlux<>(() -> listDeploymentsSinglePageAsync(requestOptions),
-            nextLink -> listDeploymentsNextSinglePageAsync(nextLink, requestOptionsForNextPage));
+        return new PagedFlux<>(() -> listSinglePageAsync(requestOptions),
+            nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage));
     }
 
     /**
@@ -307,9 +307,9 @@ public PagedFlux listDeploymentsAsync(RequestOptions requestOptions)
      * @return paged collection of Deployment items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listDeploymentsSinglePage(RequestOptions requestOptions) {
+    private PagedResponse listSinglePage(RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listDeploymentsSync(this.client.getEndpoint(),
+        Response res = service.listSync(this.client.getEndpoint(),
             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);
@@ -347,12 +347,12 @@ private PagedResponse listDeploymentsSinglePage(RequestOptions reque
      * @return paged collection of Deployment items as paginated response with {@link PagedIterable}.
      */
     @ServiceMethod(returns = ReturnType.COLLECTION)
-    public PagedIterable listDeployments(RequestOptions requestOptions) {
+    public PagedIterable list(RequestOptions requestOptions) {
         RequestOptions requestOptionsForNextPage = new RequestOptions();
         requestOptionsForNextPage.setContext(
             requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
-        return new PagedIterable<>(() -> listDeploymentsSinglePage(requestOptions),
-            nextLink -> listDeploymentsNextSinglePage(nextLink, requestOptionsForNextPage));
+        return new PagedIterable<>(() -> listSinglePage(requestOptions),
+            nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage));
     }
 
     /**
@@ -378,12 +378,11 @@ public PagedIterable listDeployments(RequestOptions requestOptions)
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listDeploymentsNextSinglePageAsync(String nextLink,
-        RequestOptions requestOptions) {
+    private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
         return FluxUtil
-            .withContext(context -> service.listDeploymentsNext(nextLink, this.client.getEndpoint(), accept,
-                requestOptions, context))
+            .withContext(
+                context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context))
             .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                 getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
     }
@@ -410,10 +409,10 @@ private Mono> listDeploymentsNextSinglePageAsync(Strin
      * @return paged collection of Deployment items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listDeploymentsNextSinglePage(String nextLink, RequestOptions requestOptions) {
+    private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listDeploymentsNextSync(nextLink, this.client.getEndpoint(), accept,
-            requestOptions, Context.NONE);
+        Response res
+            = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE);
         return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
             getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
     }
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/EvaluationRulesImpl.java
similarity index 52%
rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationsImpl.java
rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationRulesImpl.java
index 30cbd56b31de..50a2b751de77 100644
--- 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/EvaluationRulesImpl.java
@@ -4,15 +4,16 @@
 
 package com.azure.ai.projects.implementation;
 
-import com.azure.ai.projects.ProjectsServiceVersion;
+import com.azure.ai.projects.AIProjectsServiceVersion;
 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.Put;
 import com.azure.core.annotation.QueryParam;
 import com.azure.core.annotation.ReturnType;
 import com.azure.core.annotation.ServiceInterface;
@@ -38,13 +39,13 @@
 import reactor.core.publisher.Mono;
 
 /**
- * An instance of this class provides access to all the operations defined in Evaluations.
+ * An instance of this class provides access to all the operations defined in EvaluationRules.
  */
-public final class EvaluationsImpl {
+public final class EvaluationRulesImpl {
     /**
      * The proxy service used to perform REST calls.
      */
-    private final EvaluationsService service;
+    private final EvaluationRulesService service;
 
     /**
      * The service client containing this operation class.
@@ -52,13 +53,13 @@ public final class EvaluationsImpl {
     private final AIProjectClientImpl client;
 
     /**
-     * Initializes an instance of EvaluationsImpl.
+     * Initializes an instance of EvaluationRulesImpl.
      * 
      * @param client the instance of the service client containing this operation class.
      */
-    EvaluationsImpl(AIProjectClientImpl client) {
+    EvaluationRulesImpl(AIProjectClientImpl client) {
         this.service
-            = RestProxy.create(EvaluationsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+            = RestProxy.create(EvaluationRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
         this.client = client;
     }
 
@@ -67,99 +68,96 @@ public final class EvaluationsImpl {
      * 
      * @return the serviceVersion value.
      */
-    public ProjectsServiceVersion getServiceVersion() {
+    public AIProjectsServiceVersion getServiceVersion() {
         return client.getServiceVersion();
     }
 
     /**
-     * The interface defining all the services for AIProjectClientEvaluations to be used by the proxy service to perform
-     * REST calls.
+     * The interface defining all the services for AIProjectClientEvaluationRules to be used by the proxy service to
+     * perform REST calls.
      */
     @Host("{endpoint}")
-    @ServiceInterface(name = "AIProjectClientEvaluations")
-    public interface EvaluationsService {
-        @Get("/evaluations/runs/{name}")
+    @ServiceInterface(name = "AIProjectClientEvaluationRules")
+    public interface EvaluationRulesService {
+        @Get("/evaluationrules/{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> getEvaluation(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @PathParam("name") String name,
+        Mono> get(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
             @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
 
-        @Get("/evaluations/runs/{name}")
+        @Get("/evaluationrules/{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 getEvaluationSync(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @PathParam("name") String name,
+        Response getSync(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
             @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
 
-        @Get("/evaluations/runs")
-        @ExpectedResponses({ 200 })
+        @Delete("/evaluationrules/{id}")
+        @ExpectedResponses({ 204 })
         @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> listEvaluations(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
-            RequestOptions requestOptions, Context context);
+        Mono> delete(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id, RequestOptions requestOptions,
+            Context context);
 
-        @Get("/evaluations/runs")
-        @ExpectedResponses({ 200 })
+        @Delete("/evaluationrules/{id}")
+        @ExpectedResponses({ 204 })
         @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response listEvaluationsSync(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
-            RequestOptions requestOptions, Context context);
+        Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion,
+            @PathParam("id") String id, RequestOptions requestOptions, Context context);
 
-        @Post("/evaluations/runs:run")
-        @ExpectedResponses({ 201 })
+        @Put("/evaluationrules/{id}")
+        @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> createEvaluation(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
-            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation,
-            RequestOptions requestOptions, Context context);
+        Mono> createOrUpdate(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
+            @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+            @BodyParam("application/json") BinaryData evaluationRule, RequestOptions requestOptions, Context context);
 
-        @Post("/evaluations/runs:run")
-        @ExpectedResponses({ 201 })
+        @Put("/evaluationrules/{id}")
+        @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 createEvaluationSync(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
-            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation,
-            RequestOptions requestOptions, Context context);
+        Response createOrUpdateSync(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
+            @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+            @BodyParam("application/json") BinaryData evaluationRule, RequestOptions requestOptions, Context context);
 
-        @Post("/evaluations/runs:runAgent")
-        @ExpectedResponses({ 201 })
+        @Get("/evaluationrules")
+        @ExpectedResponses({ 200 })
         @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> createAgentEvaluation(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
-            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation,
+        Mono> list(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
             RequestOptions requestOptions, Context context);
 
-        @Post("/evaluations/runs:runAgent")
-        @ExpectedResponses({ 201 })
+        @Get("/evaluationrules")
+        @ExpectedResponses({ 200 })
         @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response createAgentEvaluationSync(@HostParam("endpoint") String endpoint,
-            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
-            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluation,
+        Response listSync(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
             RequestOptions requestOptions, Context context);
 
         @Get("{nextLink}")
@@ -168,7 +166,7 @@ Response createAgentEvaluationSync(@HostParam("endpoint") String end
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Mono> listEvaluationsNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+        Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
             @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
             Context context);
 
@@ -178,347 +176,212 @@ Mono> listEvaluationsNext(@PathParam(value = "nextLink", en
         @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
         @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
         @UnexpectedResponseExceptionType(HttpResponseException.class)
-        Response listEvaluationsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+        Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
             @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
             Context context);
     }
 
     /**
-     * Get an evaluation run by name.
+     * Get an evaluation rule.
      * 

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
      * 
* - * @param name Identifier of the evaluation. + * @param id Unique identifier for the evaluation rule. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response} on successful completion of {@link Mono}. + * @return an evaluation rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getEvaluationWithResponseAsync(String name, RequestOptions requestOptions) { + public Mono> getWithResponseAsync(String id, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getEvaluation(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, accept, requestOptions, context)); } /** - * Get an evaluation run by name. + * Get an evaluation rule. *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
      * 
* - * @param name Identifier of the evaluation. + * @param id Unique identifier for the evaluation rule. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response}. + * @return an evaluation rule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getEvaluationWithResponse(String name, RequestOptions requestOptions) { + public Response getWithResponse(String id, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getEvaluationSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, - accept, requestOptions, Context.NONE); + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), id, accept, + requestOptions, Context.NONE); } /** - * List evaluation runs. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
+ * Delete an evaluation rule. * + * @param id Unique identifier for the evaluation rule. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listEvaluationsSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listEvaluations(this.client.getEndpoint(), - 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)); + public Mono> deleteWithResponseAsync(String id, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, requestOptions, context)); } /** - * List evaluation runs. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
-     *     displayName: String (Optional)
-     *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
-     *     }
-     *     properties (Optional): {
-     *         String: String (Required)
-     *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     * }
-     * }
-     * 
+ * Delete an evaluation rule. * + * @param id Unique identifier for the evaluation rule. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listEvaluationsAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listEvaluationsSinglePageAsync(requestOptions), - nextLink -> listEvaluationsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String id, RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), id, + requestOptions, Context.NONE); } /** - * List evaluation runs. - *

Response Body Schema

+ * Create or update an evaluation rule. + *

Request Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         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 listEvaluationsSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listEvaluationsSync(this.client.getEndpoint(), - 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); - } - - /** - * List evaluation runs. *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
      * 
* + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @return evaluation rule model along with {@link Response} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listEvaluations(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listEvaluationsSinglePage(requestOptions), - nextLink -> listEvaluationsNextSinglePage(nextLink, requestOptionsForNextPage)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String id, BinaryData evaluationRule, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + id, contentType, accept, evaluationRule, requestOptions, context)); } /** - * Creates an evaluation run. + * Create or update an evaluation rule. *

Request Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
@@ -530,290 +393,245 @@ public PagedIterable listEvaluations(RequestOptions requestOptions)
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
      * 
* - * @param evaluation Evaluation to be run. + * @param id Unique identifier for the evaluation rule. + * @param evaluationRule Evaluation rule resource. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @return evaluation rule model along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createEvaluationWithResponseAsync(BinaryData evaluation, + public Response createOrUpdateWithResponse(String id, BinaryData evaluationRule, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createEvaluation(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), contentType, accept, evaluation, requestOptions, context)); + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), id, + contentType, accept, evaluationRule, requestOptions, Context.NONE); } /** - * Creates an evaluation run. - *

Request Body Schema

+ * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         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 EvaluationRule 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.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     data (Required): {
-     *         type: String (Required)
-     *     }
      *     displayName: String (Optional)
      *     description: String (Optional)
-     *     status: String (Optional)
-     *     tags (Optional): {
-     *         String: String (Required)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
      *     }
-     *     properties (Optional): {
-     *         String: String (Required)
+     *     filter (Optional): {
+     *         agentName: String (Required)
      *     }
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
      *     }
      * }
      * }
      * 
* - * @param evaluation Evaluation to be 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}. + * @return paged collection of EvaluationRule items as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createEvaluationWithResponse(BinaryData evaluation, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createEvaluationSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - contentType, accept, evaluation, requestOptions, Context.NONE); + @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<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** - * Creates an agent evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     runId: String (Required)
-     *     threadId: String (Optional)
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     *     samplingConfiguration (Optional): {
-     *         name: String (Required)
-     *         samplingPercent: double (Required)
-     *         maxRequestRate: double (Required)
-     *     }
-     *     redactionConfiguration (Optional): {
-     *         redactScoreProperties: Boolean (Optional)
-     *     }
-     *     appInsightsConnectionString: String (Required)
-     * }
-     * }
-     * 
- * + * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     status: String (Required)
-     *     error: String (Optional)
-     *     result (Optional): [
-     *          (Optional){
-     *             evaluator: String (Required)
-     *             evaluatorId: String (Required)
-     *             score: double (Required)
-     *             status: String (Required)
-     *             reason: String (Optional)
-     *             version: String (Optional)
-     *             threadId: String (Optional)
-     *             runId: String (Required)
-     *             error: String (Optional)
-     *             additionalDetails (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     ]
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
      * }
      * }
      * 
* - * @param evaluation Agent evaluation to be 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 response for agent evaluation run along with {@link Response} on successful completion of - * {@link Mono}. + * @return paged collection of EvaluationRule items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createAgentEvaluationWithResponseAsync(BinaryData evaluation, - RequestOptions requestOptions) { - final String contentType = "application/json"; + private PagedResponse listSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createAgentEvaluation(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), contentType, accept, evaluation, requestOptions, context)); + Response res = service.listSync(this.client.getEndpoint(), + 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); } /** - * Creates an agent evaluation run. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     runId: String (Required)
-     *     threadId: String (Optional)
-     *     evaluators (Required): {
-     *         String (Required): {
-     *             id: String (Required)
-     *             initParams (Optional): {
-     *                 String: BinaryData (Required)
-     *             }
-     *             dataMapping (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     }
-     *     samplingConfiguration (Optional): {
-     *         name: String (Required)
-     *         samplingPercent: double (Required)
-     *         maxRequestRate: double (Required)
-     *     }
-     *     redactionConfiguration (Optional): {
-     *         redactScoreProperties: Boolean (Optional)
-     *     }
-     *     appInsightsConnectionString: String (Required)
-     * }
-     * }
-     * 
- * + * List all evaluation rules. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
actionTypeStringNoFilter by the type of evaluation rule. Allowed values: + * "continuousEvaluation", "humanEvaluation".
agentNameStringNoFilter by the agent name.
enabledBooleanNoFilter by the enabled status.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} *

Response Body Schema

* *
      * {@code
      * {
      *     id: String (Required)
-     *     status: String (Required)
-     *     error: String (Optional)
-     *     result (Optional): [
-     *          (Optional){
-     *             evaluator: String (Required)
-     *             evaluatorId: String (Required)
-     *             score: double (Required)
-     *             status: String (Required)
-     *             reason: String (Optional)
-     *             version: String (Optional)
-     *             threadId: String (Optional)
-     *             runId: String (Required)
-     *             error: String (Optional)
-     *             additionalDetails (Optional): {
-     *                 String: String (Required)
-     *             }
-     *         }
-     *     ]
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     action (Required): {
+     *         type: String(continuousEvaluation/humanEvaluation) (Required)
+     *     }
+     *     filter (Optional): {
+     *         agentName: String (Required)
+     *     }
+     *     eventType: String(responseCompleted/manual) (Required)
+     *     enabled: boolean (Required)
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
      * }
      * }
      * 
* - * @param evaluation Agent evaluation to be 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 response for agent evaluation run along with {@link Response}. + * @return paged collection of EvaluationRule items as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createAgentEvaluationWithResponse(BinaryData evaluation, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createAgentEvaluationSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), contentType, accept, evaluation, requestOptions, - Context.NONE); + @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<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); } /** @@ -824,28 +642,18 @@ public Response createAgentEvaluationWithResponse(BinaryData evaluat * {@code * { * id: String (Required) - * data (Required): { - * type: String (Required) - * } * displayName: String (Optional) * description: String (Optional) - * status: String (Optional) - * tags (Optional): { - * String: String (Required) + * action (Required): { + * type: String(continuousEvaluation/humanEvaluation) (Required) * } - * properties (Optional): { - * String: String (Required) + * filter (Optional): { + * agentName: String (Required) * } - * evaluators (Required): { - * String (Required): { - * id: String (Required) - * initParams (Optional): { - * String: BinaryData (Required) - * } - * dataMapping (Optional): { - * String: String (Required) - * } - * } + * eventType: String(responseCompleted/manual) (Required) + * enabled: boolean (Required) + * systemData (Required): { + * String: String (Required) * } * } * } @@ -857,16 +665,15 @@ public Response createAgentEvaluationWithResponse(BinaryData evaluat * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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 + * @return paged collection of EvaluationRule items along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listEvaluationsNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listEvaluationsNext(nextLink, this.client.getEndpoint(), accept, - requestOptions, context)) + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } @@ -879,28 +686,18 @@ private Mono> listEvaluationsNextSinglePageAsync(Strin * {@code * { * id: String (Required) - * data (Required): { - * type: String (Required) - * } * displayName: String (Optional) * description: String (Optional) - * status: String (Optional) - * tags (Optional): { - * String: String (Required) + * action (Required): { + * type: String(continuousEvaluation/humanEvaluation) (Required) * } - * properties (Optional): { - * String: String (Required) + * filter (Optional): { + * agentName: String (Required) * } - * evaluators (Required): { - * String (Required): { - * id: String (Required) - * initParams (Optional): { - * String: BinaryData (Required) - * } - * dataMapping (Optional): { - * String: String (Required) - * } - * } + * eventType: String(responseCompleted/manual) (Required) + * enabled: boolean (Required) + * systemData (Required): { + * String: String (Required) * } * } * } @@ -912,13 +709,13 @@ private Mono> listEvaluationsNextSinglePageAsync(Strin * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the 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}. + * @return paged collection of EvaluationRule items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listEvaluationsNextSinglePage(String nextLink, RequestOptions requestOptions) { + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listEvaluationsNextSync(nextLink, this.client.getEndpoint(), accept, - requestOptions, Context.NONE); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationTaxonomiesImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationTaxonomiesImpl.java new file mode 100644 index 000000000000..1faa8db413e6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluationTaxonomiesImpl.java @@ -0,0 +1,1221 @@ +// Copyright (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.AIProjectsServiceVersion; +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.Patch; +import com.azure.core.annotation.PathParam; +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 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 EvaluationTaxonomies. + */ +public final class EvaluationTaxonomiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EvaluationTaxonomiesService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of EvaluationTaxonomiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EvaluationTaxonomiesImpl(AIProjectClientImpl client) { + this.service = RestProxy.create(EvaluationTaxonomiesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AIProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientEvaluationTaxonomies to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AIProjectClientEvaluationTaxonomies") + public interface EvaluationTaxonomiesService { + @Get("/evaluationtaxonomies/{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> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluationtaxonomies/{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 getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluationtaxonomies") + @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, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/evaluationtaxonomies") + @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, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/evaluationtaxonomies/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, RequestOptions requestOptions, + Context context); + + @Delete("/evaluationtaxonomies/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, RequestOptions requestOptions, Context context); + + @Put("/evaluationtaxonomies/{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> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/evaluationtaxonomies/{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 createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Patch("/evaluationtaxonomies/{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> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Patch("/evaluationtaxonomies/{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 updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, 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, @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, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Get an evaluation run by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + } + + /** + * Get an evaluation run by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 evaluation run by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, + requestOptions, Context.NONE); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List evaluation taxonomies. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
inputNameStringNoFilter by the evaluation input name.
inputTypeStringNoFilter by taxonomy input type.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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> deleteWithResponseAsync(String name, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, requestOptions, context)); + } + + /** + * Delete an evaluation taxonomy by name. + * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 deleteWithResponse(String name, RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + requestOptions, Context.NONE); + } + + /** + * Create an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(String name, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, body, requestOptions, context)); + } + + /** + * Create an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Update an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String name, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, body, requestOptions, context)); + } + + /** + * Update an evaluation taxonomy. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the evaluation taxonomy. + * @param body The evaluation taxonomy. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 Taxonomy Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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(), 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 (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     taxonomyInput (Required): {
+     *         type: String(agent/policy) (Required)
+     *     }
+     *     taxonomyCategories (Optional): [
+     *          (Optional){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             riskCategory: String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Required)
+     *             subCategories (Required): [
+     *                  (Required){
+     *                     id: String (Required)
+     *                     name: String (Required)
+     *                     description: String (Optional)
+     *                     enabled: boolean (Required)
+     *                     properties (Optional): {
+     *                         String: String (Required)
+     *                     }
+     *                 }
+     *             ]
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     properties (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 EvaluationTaxonomy 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(), 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/EvaluatorsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluatorsImpl.java new file mode 100644 index 000000000000..b0f307fde86a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/EvaluatorsImpl.java @@ -0,0 +1,1648 @@ +// Copyright (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.AIProjectsServiceVersion; +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.Patch; +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.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 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 Evaluators. + */ +public final class EvaluatorsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EvaluatorsService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of EvaluatorsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EvaluatorsImpl(AIProjectClientImpl client) { + this.service + = RestProxy.create(EvaluatorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AIProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientEvaluators to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AIProjectClientEvaluators") + public interface EvaluatorsService { + @Get("/evaluators/{name}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listVersions(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluators/{name}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listVersionsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/evaluators") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listLatestVersions(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/evaluators") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listLatestVersionsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, RequestOptions requestOptions, Context context); + + @Delete("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, RequestOptions requestOptions, Context context); + + @Post("/evaluators/{name}/versions") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData evaluatorVersion, RequestOptions requestOptions, Context context); + + @Post("/evaluators/{name}/versions") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData evaluatorVersion, RequestOptions requestOptions, Context context); + + @Patch("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluatorVersion, + RequestOptions requestOptions, Context context); + + @Patch("/evaluators/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @PathParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData evaluatorVersion, + 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> listVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @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 listVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @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> listLatestVersionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @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 listLatestVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsSinglePageAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVersions(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersionsAsync(String name, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listVersionsSinglePageAsync(name, requestOptions), + nextLink -> listVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsSinglePage(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listVersionsSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List all versions of the given evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String name, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listVersionsSinglePage(name, requestOptions), + nextLink -> listVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLatestVersionsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listLatestVersions(this.client.getEndpoint(), + 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)); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLatestVersionsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listLatestVersionsSinglePageAsync(requestOptions), + nextLink -> listLatestVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listLatestVersionsSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listLatestVersionsSync(this.client.getEndpoint(), + 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); + } + + /** + * List the latest version of each evaluator. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter evaluators by type. Possible values: 'all', 'custom', + * 'builtin'. Allowed values: "builtin", "custom", "all".
limitIntegerNoA limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLatestVersions(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listLatestVersionsSinglePage(requestOptions), + nextLink -> listLatestVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getVersionWithResponseAsync(String name, String version, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getVersion(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, version, accept, requestOptions, context)); + } + + /** + * Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if the EvaluatorVersion + * does not exist. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The specific version id of the EvaluatorVersion 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 specific version of the EvaluatorVersion along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVersionWithResponse(String name, String version, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + version, accept, requestOptions, Context.NONE); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteVersionWithResponseAsync(String name, String version, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.deleteVersion(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, version, requestOptions, context)); + } + + /** + * Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the EvaluatorVersion + * was deleted successfully or if the EvaluatorVersion does not exist. + * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) { + return service.deleteVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + version, requestOptions, Context.NONE); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createVersionWithResponseAsync(String name, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createVersion(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, contentType, accept, evaluatorVersion, requestOptions, context)); + } + + /** + * Create a new EvaluatorVersion with auto incremented version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createVersionWithResponse(String name, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, evaluatorVersion, requestOptions, Context.NONE); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateVersionWithResponseAsync(String name, String version, + BinaryData evaluatorVersion, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.updateVersion(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, version, contentType, accept, evaluatorVersion, requestOptions, context)); + } + + /** + * Update an existing EvaluatorVersion with the given version id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of the resource. + * @param version The version of the EvaluatorVersion to update. + * @param evaluatorVersion Evaluator resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return evaluator Definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateVersionWithResponse(String name, String version, BinaryData evaluatorVersion, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + version, contentType, accept, evaluatorVersion, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listVersionsNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLatestVersionsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listLatestVersionsNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     display_name: String (Optional)
+     *     metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     *     evaluator_type: String(builtin/custom) (Required)
+     *     categories (Required): [
+     *         String(quality/safety/agents) (Required)
+     *     ]
+     *     definition (Required): {
+     *         type: String(prompt/code/prompt_and_code/service/openai_graders) (Required)
+     *         init_parameters: BinaryData (Optional)
+     *         data_schema: BinaryData (Optional)
+     *         metrics (Optional): {
+     *             String (Required): {
+     *                 type: String(ordinal/continuous/boolean) (Optional)
+     *                 desirable_direction: String(increase/decrease/neutral) (Optional)
+     *                 min_value: Double (Optional)
+     *                 max_value: Double (Optional)
+     *                 is_primary: Boolean (Optional)
+     *             }
+     *         }
+     *     }
+     *     created_by: String (Required)
+     *     created_at: long (Required)
+     *     modified_at: long (Required)
+     *     id: String (Optional)
+     *     name: String (Required)
+     *     version: String (Required)
+     *     description: String (Optional)
+     *     tags (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 EvaluatorVersion items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listLatestVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listLatestVersionsNextSync(nextLink, this.client.getEndpoint(), 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/IndexesImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/IndexesImpl.java index 7a0666fffe1d..72cc5b0a96b2 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/IndexesImpl.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/IndexesImpl.java @@ -4,7 +4,7 @@ package com.azure.ai.projects.implementation; -import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.ai.projects.AIProjectsServiceVersion; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -67,7 +67,7 @@ public final class IndexesImpl { * * @return the serviceVersion value. */ - public ProjectsServiceVersion getServiceVersion() { + public AIProjectsServiceVersion getServiceVersion() { return client.getServiceVersion(); } @@ -84,7 +84,7 @@ public interface IndexesService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listIndexVersions(@HostParam("endpoint") String endpoint, + Mono> listVersions(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -94,7 +94,7 @@ Mono> listIndexVersions(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listIndexVersionsSync(@HostParam("endpoint") String endpoint, + Response listVersionsSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -104,7 +104,7 @@ Response listIndexVersionsSync(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listLatestIndexVersions(@HostParam("endpoint") String endpoint, + Mono> listLatest(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -114,7 +114,7 @@ Mono> listLatestIndexVersions(@HostParam("endpoint") String @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listLatestIndexVersionsSync(@HostParam("endpoint") String endpoint, + Response listLatestSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -124,7 +124,7 @@ Response listLatestIndexVersionsSync(@HostParam("endpoint") String e @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getIndexVersion(@HostParam("endpoint") String endpoint, + Mono> getVersion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -135,7 +135,7 @@ Mono> getIndexVersion(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getIndexVersionSync(@HostParam("endpoint") String endpoint, + Response getVersionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -146,7 +146,7 @@ Response getIndexVersionSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteIndexVersion(@HostParam("endpoint") String endpoint, + Mono> deleteVersion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, Context context); @@ -156,7 +156,7 @@ Mono> deleteIndexVersion(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteIndexVersionSync(@HostParam("endpoint") String endpoint, + Response deleteVersionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, Context context); @@ -166,7 +166,7 @@ Response deleteIndexVersionSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateIndexVersion(@HostParam("endpoint") String endpoint, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Content-Type") String contentType, @PathParam("version") String version, @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData index, @@ -178,7 +178,7 @@ Mono> createOrUpdateIndexVersion(@HostParam("endpoint") Str @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateIndexVersionSync(@HostParam("endpoint") String endpoint, + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Content-Type") String contentType, @PathParam("version") String version, @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData index, @@ -190,7 +190,7 @@ Response createOrUpdateIndexVersionSync(@HostParam("endpoint") Strin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listIndexVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + Mono> listVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -200,7 +200,7 @@ Mono> listIndexVersionsNext(@PathParam(value = "nextLink", @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listIndexVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + Response listVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -210,9 +210,9 @@ Response listIndexVersionsNextSync(@PathParam(value = "nextLink", en @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listLatestIndexVersionsNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> listLatestNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -220,9 +220,9 @@ Mono> listLatestIndexVersionsNext( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listLatestIndexVersionsNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Response listLatestNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); } /** @@ -254,11 +254,10 @@ Response listLatestIndexVersionsNextSync( * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listIndexVersionsSinglePageAsync(String name, - RequestOptions requestOptions) { + private Mono> listVersionsSinglePageAsync(String name, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listIndexVersions(this.client.getEndpoint(), + .withContext(context -> service.listVersions(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); @@ -292,12 +291,12 @@ private Mono> listIndexVersionsSinglePageAsync(String * @return paged collection of Index items as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIndexVersionsAsync(String name, RequestOptions requestOptions) { + public PagedFlux listVersionsAsync(String name, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listIndexVersionsSinglePageAsync(name, requestOptions), - nextLink -> listIndexVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + return new PagedFlux<>(() -> listVersionsSinglePageAsync(name, requestOptions), + nextLink -> listVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -328,9 +327,9 @@ public PagedFlux listIndexVersionsAsync(String name, RequestOptions * @return paged collection of Index items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listIndexVersionsSinglePage(String name, RequestOptions requestOptions) { + private PagedResponse listVersionsSinglePage(String name, RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listIndexVersionsSync(this.client.getEndpoint(), + Response res = service.listVersionsSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); @@ -364,12 +363,12 @@ private PagedResponse listIndexVersionsSinglePage(String name, Reque * @return paged collection of Index items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIndexVersions(String name, RequestOptions requestOptions) { + public PagedIterable listVersions(String name, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listIndexVersionsSinglePage(name, requestOptions), - nextLink -> listIndexVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(() -> listVersionsSinglePage(name, requestOptions), + nextLink -> listVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); } /** @@ -400,10 +399,10 @@ public PagedIterable listIndexVersions(String name, RequestOptions r * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listLatestIndexVersionsSinglePageAsync(RequestOptions requestOptions) { + private Mono> listLatestSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listLatestIndexVersions(this.client.getEndpoint(), + .withContext(context -> service.listLatest(this.client.getEndpoint(), 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)); @@ -436,12 +435,12 @@ private Mono> listLatestIndexVersionsSinglePageAsync(R * @return paged collection of Index items as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listLatestIndexVersionsAsync(RequestOptions requestOptions) { + public PagedFlux listLatestAsync(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listLatestIndexVersionsSinglePageAsync(requestOptions), - nextLink -> listLatestIndexVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + return new PagedFlux<>(() -> listLatestSinglePageAsync(requestOptions), + nextLink -> listLatestNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -471,9 +470,9 @@ public PagedFlux listLatestIndexVersionsAsync(RequestOptions request * @return paged collection of Index items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listLatestIndexVersionsSinglePage(RequestOptions requestOptions) { + private PagedResponse listLatestSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listLatestIndexVersionsSync(this.client.getEndpoint(), + Response res = service.listLatestSync(this.client.getEndpoint(), 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); @@ -506,16 +505,16 @@ private PagedResponse listLatestIndexVersionsSinglePage(RequestOptio * @return paged collection of Index items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLatestIndexVersions(RequestOptions requestOptions) { + public PagedIterable listLatest(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listLatestIndexVersionsSinglePage(requestOptions), - nextLink -> listLatestIndexVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(() -> listLatestSinglePage(requestOptions), + nextLink -> listLatestNextSinglePage(nextLink, requestOptionsForNextPage)); } /** - * Get the specific version of the Index. + * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist. *

Response Body Schema

* *
@@ -543,15 +542,15 @@ public PagedIterable listLatestIndexVersions(RequestOptions requestO
      * @return the specific version of the Index along with {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> getIndexVersionWithResponseAsync(String name, String version,
+    public Mono> getVersionWithResponseAsync(String name, String version,
         RequestOptions requestOptions) {
         final String accept = "application/json";
-        return FluxUtil.withContext(context -> service.getIndexVersion(this.client.getEndpoint(),
+        return FluxUtil.withContext(context -> service.getVersion(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, version, accept, requestOptions, context));
     }
 
     /**
-     * Get the specific version of the Index.
+     * Get the specific version of the Index. The service returns 404 Not Found error if the Index does not exist.
      * 

Response Body Schema

* *
@@ -579,15 +578,15 @@ public Mono> getIndexVersionWithResponseAsync(String name,
      * @return the specific version of the Index along with {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response getIndexVersionWithResponse(String name, String version,
-        RequestOptions requestOptions) {
+    public Response getVersionWithResponse(String name, String version, RequestOptions requestOptions) {
         final String accept = "application/json";
-        return service.getIndexVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(),
-            name, version, accept, requestOptions, Context.NONE);
+        return service.getVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name,
+            version, accept, requestOptions, Context.NONE);
     }
 
     /**
-     * Delete the specific version of the Index.
+     * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted
+     * successfully or if the Index does not exist.
      * 
      * @param name The name of the resource.
      * @param version The version of the Index to delete.
@@ -599,14 +598,15 @@ public Response getIndexVersionWithResponse(String name, String vers
      * @return the {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> deleteIndexVersionWithResponseAsync(String name, String version,
+    public Mono> deleteVersionWithResponseAsync(String name, String version,
         RequestOptions requestOptions) {
-        return FluxUtil.withContext(context -> service.deleteIndexVersion(this.client.getEndpoint(),
+        return FluxUtil.withContext(context -> service.deleteVersion(this.client.getEndpoint(),
             this.client.getServiceVersion().getVersion(), name, version, requestOptions, context));
     }
 
     /**
-     * Delete the specific version of the Index.
+     * Delete the specific version of the Index. The service returns 204 No Content if the Index was deleted
+     * successfully or if the Index does not exist.
      * 
      * @param name The name of the resource.
      * @param version The version of the Index to delete.
@@ -618,9 +618,9 @@ public Mono> deleteIndexVersionWithResponseAsync(String name, Str
      * @return the {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response deleteIndexVersionWithResponse(String name, String version, RequestOptions requestOptions) {
-        return service.deleteIndexVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(),
-            name, version, requestOptions, Context.NONE);
+    public Response deleteVersionWithResponse(String name, String version, RequestOptions requestOptions) {
+        return service.deleteVersionSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name,
+            version, requestOptions, Context.NONE);
     }
 
     /**
@@ -670,13 +670,13 @@ public Response deleteIndexVersionWithResponse(String name, String version
      * @return index resource Definition along with {@link Response} on successful completion of {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> createOrUpdateIndexVersionWithResponseAsync(String name, String version,
-        BinaryData index, RequestOptions requestOptions) {
+    public Mono> createOrUpdateWithResponseAsync(String name, String version, BinaryData index,
+        RequestOptions requestOptions) {
         final String contentType = "application/merge-patch+json";
         final String accept = "application/json";
-        return FluxUtil.withContext(context -> service.createOrUpdateIndexVersion(this.client.getEndpoint(),
-            this.client.getServiceVersion().getVersion(), name, contentType, version, accept, index, requestOptions,
-            context));
+        return FluxUtil.withContext(
+            context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(),
+                name, contentType, version, accept, index, requestOptions, context));
     }
 
     /**
@@ -726,13 +726,12 @@ public Mono> createOrUpdateIndexVersionWithResponseAsync(St
      * @return index resource Definition along with {@link Response}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Response createOrUpdateIndexVersionWithResponse(String name, String version, BinaryData index,
+    public Response createOrUpdateWithResponse(String name, String version, BinaryData index,
         RequestOptions requestOptions) {
         final String contentType = "application/merge-patch+json";
         final String accept = "application/json";
-        return service.createOrUpdateIndexVersionSync(this.client.getEndpoint(),
-            this.client.getServiceVersion().getVersion(), name, contentType, version, accept, index, requestOptions,
-            Context.NONE);
+        return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name,
+            contentType, version, accept, index, requestOptions, Context.NONE);
     }
 
     /**
@@ -764,12 +763,11 @@ public Response createOrUpdateIndexVersionWithResponse(String name,
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listIndexVersionsNextSinglePageAsync(String nextLink,
+    private Mono> listVersionsNextSinglePageAsync(String nextLink,
         RequestOptions requestOptions) {
         final String accept = "application/json";
-        return FluxUtil
-            .withContext(context -> service.listIndexVersionsNext(nextLink, this.client.getEndpoint(), accept,
-                requestOptions, context))
+        return FluxUtil.withContext(
+            context -> service.listVersionsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context))
             .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                 getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
     }
@@ -802,10 +800,10 @@ private Mono> listIndexVersionsNextSinglePageAsync(Str
      * @return paged collection of Index items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listIndexVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) {
+    private PagedResponse listVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listIndexVersionsNextSync(nextLink, this.client.getEndpoint(), accept,
-            requestOptions, Context.NONE);
+        Response res
+            = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE);
         return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
             getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
     }
@@ -839,12 +837,12 @@ private PagedResponse listIndexVersionsNextSinglePage(String nextLin
      * {@link Mono}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private Mono> listLatestIndexVersionsNextSinglePageAsync(String nextLink,
+    private Mono> listLatestNextSinglePageAsync(String nextLink,
         RequestOptions requestOptions) {
         final String accept = "application/json";
         return FluxUtil
-            .withContext(context -> service.listLatestIndexVersionsNext(nextLink, this.client.getEndpoint(), accept,
-                requestOptions, context))
+            .withContext(
+                context -> service.listLatestNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context))
             .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                 getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
     }
@@ -877,11 +875,10 @@ private Mono> listLatestIndexVersionsNextSinglePageAsy
      * @return paged collection of Index items along with {@link PagedResponse}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    private PagedResponse listLatestIndexVersionsNextSinglePage(String nextLink,
-        RequestOptions requestOptions) {
+    private PagedResponse listLatestNextSinglePage(String nextLink, RequestOptions requestOptions) {
         final String accept = "application/json";
-        Response res = service.listLatestIndexVersionsNextSync(nextLink, this.client.getEndpoint(), accept,
-            requestOptions, Context.NONE);
+        Response res
+            = service.listLatestNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE);
         return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
             getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
     }
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InferenceClientImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InferenceClientImpl.java
deleted file mode 100644
index dac165c87721..000000000000
--- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InferenceClientImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-package com.azure.ai.projects.implementation;
-
-import com.openai.client.OpenAIClient;
-import com.openai.client.OpenAIClientAsync;
-import com.openai.client.okhttp.OpenAIOkHttpClient;
-
-/**
- * Initializes a new instance of the InferenceClient interface for inference operations.
- */
-public class InferenceClientImpl {
-
-    private final OpenAIOkHttpClient.Builder openAIOkHttpClientBuilder;
-
-    /**
-     * Initializes an instance of InferenceClientImpl.
-     *
-     * @param openAIOkHttpClientBuilder the OpenAI OkHttp client builder.
-     */
-    public InferenceClientImpl(OpenAIOkHttpClient.Builder openAIOkHttpClientBuilder) {
-        this.openAIOkHttpClientBuilder = openAIOkHttpClientBuilder;
-    }
-
-    /**
-     * Gets an instance of OpenAIClient.
-     *
-     * @return an instance of OpenAIClient.
-     */
-    public OpenAIClient getOpenAIClient() {
-        return openAIOkHttpClientBuilder.build();
-    }
-
-    /**
-     * Gets an instance of OpenAIAsyncClient.
-     *
-     * @return an instance of OpenAIAsyncClient.
-     */
-    public OpenAIClientAsync getOpenAIAsyncClient() {
-        return openAIOkHttpClientBuilder.build().async();
-    }
-}
diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InsightsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InsightsImpl.java
new file mode 100644
index 000000000000..8422b7b3e831
--- /dev/null
+++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/InsightsImpl.java
@@ -0,0 +1,748 @@
+// Copyright (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.AIProjectsServiceVersion;
+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.HttpHeaderName;
+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.CoreUtils;
+import com.azure.core.util.DateTimeRfc1123;
+import com.azure.core.util.FluxUtil;
+import java.time.OffsetDateTime;
+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 Insights.
+ */
+public final class InsightsImpl {
+    /**
+     * The proxy service used to perform REST calls.
+     */
+    private final InsightsService service;
+
+    /**
+     * The service client containing this operation class.
+     */
+    private final AIProjectClientImpl client;
+
+    /**
+     * Initializes an instance of InsightsImpl.
+     * 
+     * @param client the instance of the service client containing this operation class.
+     */
+    InsightsImpl(AIProjectClientImpl client) {
+        this.service = RestProxy.create(InsightsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+        this.client = client;
+    }
+
+    /**
+     * Gets Service version.
+     * 
+     * @return the serviceVersion value.
+     */
+    public AIProjectsServiceVersion getServiceVersion() {
+        return client.getServiceVersion();
+    }
+
+    /**
+     * The interface defining all the services for AIProjectClientInsights to be used by the proxy service to perform
+     * REST calls.
+     */
+    @Host("{endpoint}")
+    @ServiceInterface(name = "AIProjectClientInsights")
+    public interface InsightsService {
+        @Post("/insights")
+        @ExpectedResponses({ 201 })
+        @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+        @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+        @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+        @UnexpectedResponseExceptionType(HttpResponseException.class)
+        Mono> generate(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
+            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData insight,
+            RequestOptions requestOptions, Context context);
+
+        @Post("/insights")
+        @ExpectedResponses({ 201 })
+        @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+        @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+        @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+        @UnexpectedResponseExceptionType(HttpResponseException.class)
+        Response generateSync(@HostParam("endpoint") String endpoint,
+            @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
+            @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData insight,
+            RequestOptions requestOptions, Context context);
+
+        @Get("/insights/{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,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
+            @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+        @Get("/insights/{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,
+            @QueryParam("api-version") String apiVersion, @PathParam("id") String id,
+            @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+        @Get("/insights")
+        @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,
+            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+            RequestOptions requestOptions, Context context);
+
+        @Get("/insights")
+        @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,
+            @QueryParam("api-version") String apiVersion, @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, @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, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
+            Context context);
+    }
+
+    /**
+     * Generate Insights.
+     * 

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 for cluster insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> generateWithResponseAsync(BinaryData insight, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext(context -> service.generate(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), contentType, accept, insight, requestOptionsLocal, context)); + } + + /** + * Generate Insights. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param insight Complete evaluation configuration including data source, evaluators, and result settings. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 for cluster insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateWithResponse(BinaryData insight, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.generateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + contentType, accept, insight, requestOptionsLocal, Context.NONE); + } + + /** + * Get a specific insight by Id. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The unique identifier for the insights report. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 specific insight by Id 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.getServiceVersion().getVersion(), id, accept, requestOptions, context)); + } + + /** + * Get a specific insight by Id. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The unique identifier for the insights report. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the 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 specific insight by Id 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.getServiceVersion().getVersion(), id, accept, + requestOptions, Context.NONE); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List all insights in reverse chronological order (newest first). + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoFilter by the type of analysis. Allowed values: + * "EvaluationRunClusterInsight", "AgentClusterInsight", "EvaluationComparison".
evalIdStringNoFilter by the evaluation ID.
runIdStringNoFilter by the evaluation run ID.
agentNameStringNoFilter by the agent name.
includeCoordinatesBooleanNoWhether to include coordinates for visualization in + * the response. Defaults to false.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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(), 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)
+     *     metadata (Required): {
+     *         createdAt: OffsetDateTime (Required)
+     *         completedAt: OffsetDateTime (Optional)
+     *     }
+     *     state: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     displayName: String (Required)
+     *     request (Required): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (Required)
+     *     }
+     *     result (Optional): {
+     *         type: String(EvaluationRunClusterInsight/AgentClusterInsight/EvaluationComparison) (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 Insight 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(), 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/RedTeamsImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/RedTeamsImpl.java index 74894b0d19d1..cadf657232f2 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/RedTeamsImpl.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/RedTeamsImpl.java @@ -4,7 +4,7 @@ package com.azure.ai.projects.implementation; -import com.azure.ai.projects.ProjectsServiceVersion; +import com.azure.ai.projects.AIProjectsServiceVersion; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; @@ -66,7 +66,7 @@ public final class RedTeamsImpl { * * @return the serviceVersion value. */ - public ProjectsServiceVersion getServiceVersion() { + public AIProjectsServiceVersion getServiceVersion() { return client.getServiceVersion(); } @@ -83,7 +83,7 @@ public interface RedTeamsService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRedTeam(@HostParam("endpoint") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -93,7 +93,7 @@ Mono> getRedTeam(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRedTeamSync(@HostParam("endpoint") String endpoint, + Response getSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -103,7 +103,7 @@ Response getRedTeamSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listRedTeams(@HostParam("endpoint") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -113,7 +113,7 @@ Mono> listRedTeams(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listRedTeamsSync(@HostParam("endpoint") String endpoint, + Response listSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -123,7 +123,7 @@ Response listRedTeamsSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createRedTeam(@HostParam("endpoint") String endpoint, + Mono> create(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData redTeam, RequestOptions requestOptions, Context context); @@ -134,7 +134,7 @@ Mono> createRedTeam(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createRedTeamSync(@HostParam("endpoint") String endpoint, + Response createSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData redTeam, RequestOptions requestOptions, Context context); @@ -145,7 +145,7 @@ Response createRedTeamSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listRedTeamsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -155,7 +155,7 @@ Mono> listRedTeamsNext(@PathParam(value = "nextLink", encod @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listRedTeamsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); } @@ -171,11 +171,11 @@ Response listRedTeamsNextSync(@PathParam(value = "nextLink", encoded * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -201,9 +201,9 @@ Response listRedTeamsNextSync(@PathParam(value = "nextLink", encoded * @return a redteam by name along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRedTeamWithResponseAsync(String name, RequestOptions requestOptions) { + public Mono> getWithResponseAsync(String name, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getRedTeam(this.client.getEndpoint(), + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); } @@ -218,11 +218,11 @@ public Mono> getRedTeamWithResponseAsync(String name, Reque * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -248,10 +248,10 @@ public Mono> getRedTeamWithResponseAsync(String name, Reque * @return a redteam by name along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRedTeamWithResponse(String name, RequestOptions requestOptions) { + public Response getWithResponse(String name, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getRedTeamSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, - accept, requestOptions, Context.NONE); + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, + requestOptions, Context.NONE); } /** @@ -265,11 +265,11 @@ public Response getRedTeamWithResponse(String name, RequestOptions r * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -295,10 +295,10 @@ public Response getRedTeamWithResponse(String name, RequestOptions r * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listRedTeamsSinglePageAsync(RequestOptions requestOptions) { + private Mono> listSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listRedTeams(this.client.getEndpoint(), + .withContext(context -> service.list(this.client.getEndpoint(), 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)); @@ -315,11 +315,11 @@ private Mono> listRedTeamsSinglePageAsync(RequestOptio * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -344,12 +344,12 @@ private Mono> listRedTeamsSinglePageAsync(RequestOptio * @return paged collection of RedTeam items as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listRedTeamsAsync(RequestOptions requestOptions) { + public PagedFlux listAsync(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listRedTeamsSinglePageAsync(requestOptions), - nextLink -> listRedTeamsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -363,11 +363,11 @@ public PagedFlux listRedTeamsAsync(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -392,9 +392,9 @@ public PagedFlux listRedTeamsAsync(RequestOptions requestOptions) { * @return paged collection of RedTeam items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listRedTeamsSinglePage(RequestOptions requestOptions) { + private PagedResponse listSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listRedTeamsSync(this.client.getEndpoint(), + Response res = service.listSync(this.client.getEndpoint(), 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); @@ -411,11 +411,11 @@ private PagedResponse listRedTeamsSinglePage(RequestOptions requestO * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -440,12 +440,12 @@ private PagedResponse listRedTeamsSinglePage(RequestOptions requestO * @return paged collection of RedTeam items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listRedTeams(RequestOptions requestOptions) { + public PagedIterable list(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listRedTeamsSinglePage(requestOptions), - nextLink -> listRedTeamsNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); } /** @@ -459,11 +459,11 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -489,11 +489,11 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -519,11 +519,10 @@ public PagedIterable listRedTeams(RequestOptions requestOptions) { * @return red team details along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createRedTeamWithResponseAsync(BinaryData redTeam, - RequestOptions requestOptions) { + public Mono> createWithResponseAsync(BinaryData redTeam, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createRedTeam(this.client.getEndpoint(), + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), contentType, accept, redTeam, requestOptions, context)); } @@ -538,11 +537,11 @@ public Mono> createRedTeamWithResponseAsync(BinaryData redT * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -568,11 +567,11 @@ public Mono> createRedTeamWithResponseAsync(BinaryData redT * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -598,11 +597,11 @@ public Mono> createRedTeamWithResponseAsync(BinaryData redT * @return red team details along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createRedTeamWithResponse(BinaryData redTeam, RequestOptions requestOptions) { + public Response createWithResponse(BinaryData redTeam, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; - return service.createRedTeamSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - contentType, accept, redTeam, requestOptions, Context.NONE); + return service.createSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), contentType, + accept, redTeam, requestOptions, Context.NONE); } /** @@ -616,11 +615,11 @@ public Response createRedTeamWithResponse(BinaryData redTeam, Reques * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -647,11 +646,11 @@ public Response createRedTeamWithResponse(BinaryData redTeam, Reques * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listRedTeamsNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listRedTeamsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } @@ -667,11 +666,11 @@ private Mono> listRedTeamsNextSinglePageAsync(String n * displayName: String (Optional) * numTurns: Integer (Optional) * attackStrategies (Optional): [ - * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline) (Optional) + * String(easy/moderate/difficult/ascii_art/ascii_smuggler/atbash/base64/binary/caesar/character_space/jailbreak/ansii_attack/character_swap/suffix_append/string_join/unicode_confusable/unicode_substitution/diacritic/flip/leetspeak/rot13/morse/url/baseline/indirect_jailbreak/tense/multi_turn/crescendo) (Optional) * ] * simulationOnly: Boolean (Optional) * riskCategories (Optional): [ - * String(HateUnfairness/Violence/Sexual/SelfHarm) (Optional) + * String(HateUnfairness/Violence/Sexual/SelfHarm/ProtectedMaterial/CodeVulnerability/UngroundedAttributes/ProhibitedActions/SensitiveDataLeakage/TaskAdherence) (Optional) * ] * applicationScenario: String (Optional) * tags (Optional): { @@ -697,10 +696,10 @@ private Mono> listRedTeamsNextSinglePageAsync(String n * @return paged collection of RedTeam items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listRedTeamsNextSinglePage(String nextLink, RequestOptions requestOptions) { + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; Response res - = service.listRedTeamsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/SchedulesImpl.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/SchedulesImpl.java new file mode 100644 index 000000000000..78f3c3e77e4f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/SchedulesImpl.java @@ -0,0 +1,1162 @@ +// Copyright (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.AIProjectsServiceVersion; +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.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 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 Schedules. + */ +public final class SchedulesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SchedulesService service; + + /** + * The service client containing this operation class. + */ + private final AIProjectClientImpl client; + + /** + * Initializes an instance of SchedulesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchedulesImpl(AIProjectClientImpl client) { + this.service + = RestProxy.create(SchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AIProjectsServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AIProjectClientSchedules to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AIProjectClientSchedules") + public interface SchedulesService { + @Delete("/schedules/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, RequestOptions requestOptions, + Context context); + + @Delete("/schedules/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("id") String id, RequestOptions requestOptions, Context context); + + @Get("/schedules/{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, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/schedules/{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, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/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> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/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 listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/schedules/{id}") + @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> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData schedule, RequestOptions requestOptions, Context context); + + @Put("/schedules/{id}") + @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 createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData schedule, RequestOptions requestOptions, Context context); + + @Get("/schedules/{scheduleId}/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, + @QueryParam("api-version") String apiVersion, @PathParam("scheduleId") String scheduleId, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/schedules/{scheduleId}/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, + @QueryParam("api-version") String apiVersion, @PathParam("scheduleId") String scheduleId, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/schedules/{id}/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, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/schedules/{id}/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, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @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, @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, @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> listRunsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @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 listRunsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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> deleteWithResponseAsync(String id, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, requestOptions, context)); + } + + /** + * Delete a schedule. + * + * @param id Identifier of the 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 deleteWithResponse(String id, RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), id, + requestOptions, Context.NONE); + } + + /** + * Get a schedule by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 a schedule by id 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.getServiceVersion().getVersion(), id, accept, requestOptions, context)); + } + + /** + * Get a schedule by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 a schedule by id 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.getServiceVersion().getVersion(), id, accept, + requestOptions, Context.NONE); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List all schedules. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Create or update a schedule by id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return schedule model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String id, BinaryData schedule, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, contentType, accept, schedule, requestOptions, context)); + } + + /** + * Create or update a schedule by id. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the schedule. + * @param schedule Schedule resource. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return schedule model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String id, BinaryData schedule, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), id, + contentType, accept, schedule, requestOptions, Context.NONE); + } + + /** + * Get a schedule run by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunWithResponseAsync(String scheduleId, String runId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getRun(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), scheduleId, runId, accept, requestOptions, context)); + } + + /** + * Get a schedule run by id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param scheduleId Identifier of the schedule. + * @param runId Identifier of the schedule 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 schedule run by id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunWithResponse(String scheduleId, String runId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRunSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), scheduleId, + runId, accept, requestOptions, Context.NONE); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunsSinglePageAsync(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRuns(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listRunsAsync(String id, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listRunsSinglePageAsync(id, requestOptions), + nextLink -> listRunsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listRunsSinglePage(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listRunsSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), id, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List all schedule runs. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id Identifier of the 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 paged collection of ScheduleRun items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRuns(String id, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listRunsSinglePage(id, requestOptions), + nextLink -> listRunsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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(), 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)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     enabled: boolean (Required)
+     *     provisioningStatus: String(Creating/Updating/Deleting/Succeeded/Failed) (Optional)
+     *     trigger (Required): {
+     *         type: String(Cron/Recurrence/OneTime) (Required)
+     *     }
+     *     task (Required): {
+     *         type: String(Evaluation/Insight) (Required)
+     *         configuration (Optional): {
+     *             String: String (Required)
+     *         }
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     systemData (Required): {
+     *         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 Schedule 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(), 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
+     * {
+     *     id: String (Required)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         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 ScheduleRun items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listRunsNext(nextLink, this.client.getEndpoint(), 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)
+     *     scheduleId: String (Required)
+     *     success: boolean (Required)
+     *     triggerTime: String (Optional)
+     *     error: String (Optional)
+     *     properties (Required): {
+     *         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 ScheduleRun items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listRunsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listRunsNextSync(nextLink, this.client.getEndpoint(), 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/TokenUtils.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/TokenUtils.java new file mode 100644 index 000000000000..d7c0e208b930 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/implementation/TokenUtils.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.projects.implementation; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.util.Context; + +import java.util.function.Supplier; + +/** + * Utility class used to forward token authentication to Stainless clients + */ +public final class TokenUtils { + + /** + * Utility authentication function. + * + * @param tokenCredential Token credential to be used + * @param scopes for which the token credential authentication will be obtained + * @return token supplier callback + */ + public static Supplier getBearerTokenSupplier(TokenCredential tokenCredential, String... scopes) { + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new BearerTokenAuthenticationPolicy(tokenCredential, scopes)).build(); + return () -> { + // This request will never need to go anywhere; it is simply to cause the policy to interact with + // the user's credential + HttpRequest req = new HttpRequest(HttpMethod.GET, "https://www.example.com"); + try (HttpResponse res = pipeline.sendSync(req, Context.NONE)) { + return res.getRequest().getHeaders().get(HttpHeaderName.AUTHORIZATION).getValue().split(" ")[1]; + } + }; + } +} 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 index 09f9fb8c7506..b0dd9c48cbd5 100644 --- 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 @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) TypeSpec Code Generator. /** * - * Package containing the implementations for Projects. + * Package containing the implementations for AIProjects. * */ package com.azure.ai.projects.implementation; diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightResult.java new file mode 100644 index 000000000000..5e8991a9dafe --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightResult.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; + +/** + * Insights from the agent cluster analysis. + */ +@Immutable +public final class AgentClusterInsightResult extends InsightResult { + + /* + * The type of insights result. + */ + @Generated + private InsightType type = InsightType.AGENT_CLUSTER_INSIGHT; + + /* + * The clusterInsight property. + */ + @Generated + private final ClusterInsightResult clusterInsight; + + /** + * Creates an instance of AgentClusterInsightResult class. + * + * @param clusterInsight the clusterInsight value to set. + */ + @Generated + private AgentClusterInsightResult(ClusterInsightResult clusterInsight) { + this.clusterInsight = clusterInsight; + } + + /** + * Get the type property: The type of insights result. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the clusterInsight property: The clusterInsight property. + * + * @return the clusterInsight value. + */ + @Generated + public ClusterInsightResult getClusterInsight() { + return this.clusterInsight; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("clusterInsight", this.clusterInsight); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentClusterInsightResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentClusterInsightResult 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 AgentClusterInsightResult. + */ + @Generated + public static AgentClusterInsightResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClusterInsightResult clusterInsight = null; + InsightType type = InsightType.AGENT_CLUSTER_INSIGHT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("clusterInsight".equals(fieldName)) { + clusterInsight = ClusterInsightResult.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + AgentClusterInsightResult deserializedAgentClusterInsightResult + = new AgentClusterInsightResult(clusterInsight); + deserializedAgentClusterInsightResult.type = type; + return deserializedAgentClusterInsightResult; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightsRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightsRequest.java new file mode 100644 index 000000000000..f041bd29a744 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentClusterInsightsRequest.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.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; + +/** + * Insights on set of Agent Evaluation Results. + */ +@Fluent +public final class AgentClusterInsightsRequest extends InsightRequest { + + /* + * The type of request. + */ + @Generated + private InsightType type = InsightType.AGENT_CLUSTER_INSIGHT; + + /* + * Identifier for the agent. + */ + @Generated + private final String agentName; + + /* + * Configuration of the model used in the insight generation. + */ + @Generated + private InsightModelConfiguration modelConfiguration; + + /** + * Creates an instance of AgentClusterInsightsRequest class. + * + * @param agentName the agentName value to set. + */ + @Generated + public AgentClusterInsightsRequest(String agentName) { + this.agentName = agentName; + } + + /** + * Get the type property: The type of request. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the agentName property: Identifier for the agent. + * + * @return the agentName value. + */ + @Generated + public String getAgentName() { + return this.agentName; + } + + /** + * Get the modelConfiguration property: Configuration of the model used in the insight generation. + * + * @return the modelConfiguration value. + */ + @Generated + public InsightModelConfiguration getModelConfiguration() { + return this.modelConfiguration; + } + + /** + * Set the modelConfiguration property: Configuration of the model used in the insight generation. + * + * @param modelConfiguration the modelConfiguration value to set. + * @return the AgentClusterInsightsRequest object itself. + */ + @Generated + public AgentClusterInsightsRequest setModelConfiguration(InsightModelConfiguration modelConfiguration) { + this.modelConfiguration = modelConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("agentName", this.agentName); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("modelConfiguration", this.modelConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentClusterInsightsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentClusterInsightsRequest 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 AgentClusterInsightsRequest. + */ + @Generated + public static AgentClusterInsightsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String agentName = null; + InsightType type = InsightType.AGENT_CLUSTER_INSIGHT; + InsightModelConfiguration modelConfiguration = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("agentName".equals(fieldName)) { + agentName = reader.getString(); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else if ("modelConfiguration".equals(fieldName)) { + modelConfiguration = InsightModelConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + AgentClusterInsightsRequest deserializedAgentClusterInsightsRequest + = new AgentClusterInsightsRequest(agentName); + deserializedAgentClusterInsightsRequest.type = type; + deserializedAgentClusterInsightsRequest.modelConfiguration = modelConfiguration; + return deserializedAgentClusterInsightsRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluation.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluation.java deleted file mode 100644 index 858c74a7ef90..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluation.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (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; - -/** - * Evaluation response for agent evaluation run. - */ -@Immutable -public final class AgentEvaluation implements JsonSerializable { - - /* - * Identifier of the agent evaluation run. - */ - @Generated - private final String id; - - /* - * Status of the agent evaluation. Options: Running, Completed, Failed. - */ - @Generated - private final String status; - - /* - * The reason of the request failure for the long running process, if applicable. - */ - @Generated - private String error; - - /* - * The agent evaluation result. - */ - @Generated - private List result; - - /** - * Creates an instance of AgentEvaluation class. - * - * @param id the id value to set. - * @param status the status value to set. - */ - @Generated - private AgentEvaluation(String id, String status) { - this.id = id; - this.status = status; - } - - /** - * Get the id property: Identifier of the agent evaluation run. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the status property: Status of the agent evaluation. Options: Running, Completed, Failed. - * - * @return the status value. - */ - @Generated - public String getStatus() { - return this.status; - } - - /** - * Get the error property: The reason of the request failure for the long running process, if applicable. - * - * @return the error value. - */ - @Generated - public String getError() { - return this.error; - } - - /** - * Get the result property: The agent evaluation result. - * - * @return the result value. - */ - @Generated - public List getResult() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("status", this.status); - jsonWriter.writeStringField("error", this.error); - jsonWriter.writeArrayField("result", this.result, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AgentEvaluation from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AgentEvaluation 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 AgentEvaluation. - */ - @Generated - public static AgentEvaluation fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String status = null; - String error = null; - List result = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("status".equals(fieldName)) { - status = reader.getString(); - } else if ("error".equals(fieldName)) { - error = reader.getString(); - } else if ("result".equals(fieldName)) { - result = reader.readArray(reader1 -> AgentEvaluationResult.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - AgentEvaluation deserializedAgentEvaluation = new AgentEvaluation(id, status); - deserializedAgentEvaluation.error = error; - deserializedAgentEvaluation.result = result; - return deserializedAgentEvaluation; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRedactionConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRedactionConfiguration.java deleted file mode 100644 index ee4d8f017649..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRedactionConfiguration.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (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 redaction configuration will allow the user to control what is redacted. - */ -@Fluent -public final class AgentEvaluationRedactionConfiguration - implements JsonSerializable { - - /* - * Redact score properties. If not specified, the default is to redact in production. - */ - @Generated - private Boolean redactScoreProperties; - - /** - * Creates an instance of AgentEvaluationRedactionConfiguration class. - */ - @Generated - public AgentEvaluationRedactionConfiguration() { - } - - /** - * Get the redactScoreProperties property: Redact score properties. If not specified, the default is to redact in - * production. - * - * @return the redactScoreProperties value. - */ - @Generated - public Boolean isRedactScoreProperties() { - return this.redactScoreProperties; - } - - /** - * Set the redactScoreProperties property: Redact score properties. If not specified, the default is to redact in - * production. - * - * @param redactScoreProperties the redactScoreProperties value to set. - * @return the AgentEvaluationRedactionConfiguration object itself. - */ - @Generated - public AgentEvaluationRedactionConfiguration setRedactScoreProperties(Boolean redactScoreProperties) { - this.redactScoreProperties = redactScoreProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("redactScoreProperties", this.redactScoreProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AgentEvaluationRedactionConfiguration from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AgentEvaluationRedactionConfiguration 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 AgentEvaluationRedactionConfiguration. - */ - @Generated - public static AgentEvaluationRedactionConfiguration fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AgentEvaluationRedactionConfiguration deserializedAgentEvaluationRedactionConfiguration - = new AgentEvaluationRedactionConfiguration(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("redactScoreProperties".equals(fieldName)) { - deserializedAgentEvaluationRedactionConfiguration.redactScoreProperties - = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - } - return deserializedAgentEvaluationRedactionConfiguration; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRequest.java deleted file mode 100644 index d65897002844..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationRequest.java +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (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 request for agent run. - */ -@Fluent -public final class AgentEvaluationRequest implements JsonSerializable { - - /* - * Identifier of the agent run. - */ - @Generated - private final String runId; - - /* - * Identifier of the agent thread. This field is mandatory currently, but it will be optional in the future. - */ - @Generated - private String threadId; - - /* - * Evaluators to be used for the evaluation. - */ - @Generated - private final Map evaluators; - - /* - * Sampling configuration for the evaluation. - */ - @Generated - private AgentEvaluationSamplingConfiguration samplingConfiguration; - - /* - * Redaction configuration for the evaluation. - */ - @Generated - private AgentEvaluationRedactionConfiguration redactionConfiguration; - - /* - * Pass the AppInsights connection string to the agent evaluation for the evaluation results and the errors logs. - */ - @Generated - private final String appInsightsConnectionString; - - /** - * Creates an instance of AgentEvaluationRequest class. - * - * @param runId the runId value to set. - * @param evaluators the evaluators value to set. - * @param appInsightsConnectionString the appInsightsConnectionString value to set. - */ - @Generated - public AgentEvaluationRequest(String runId, Map evaluators, - String appInsightsConnectionString) { - this.runId = runId; - this.evaluators = evaluators; - this.appInsightsConnectionString = appInsightsConnectionString; - } - - /** - * Get the runId property: Identifier of the agent run. - * - * @return the runId value. - */ - @Generated - public String getRunId() { - return this.runId; - } - - /** - * Get the threadId property: Identifier of the agent thread. This field is mandatory currently, but it will be - * optional in the future. - * - * @return the threadId value. - */ - @Generated - public String getThreadId() { - return this.threadId; - } - - /** - * Set the threadId property: Identifier of the agent thread. This field is mandatory currently, but it will be - * optional in the future. - * - * @param threadId the threadId value to set. - * @return the AgentEvaluationRequest object itself. - */ - @Generated - public AgentEvaluationRequest setThreadId(String threadId) { - this.threadId = threadId; - return this; - } - - /** - * Get the evaluators property: Evaluators to be used for the evaluation. - * - * @return the evaluators value. - */ - @Generated - public Map getEvaluators() { - return this.evaluators; - } - - /** - * Get the samplingConfiguration property: Sampling configuration for the evaluation. - * - * @return the samplingConfiguration value. - */ - @Generated - public AgentEvaluationSamplingConfiguration getSamplingConfiguration() { - return this.samplingConfiguration; - } - - /** - * Set the samplingConfiguration property: Sampling configuration for the evaluation. - * - * @param samplingConfiguration the samplingConfiguration value to set. - * @return the AgentEvaluationRequest object itself. - */ - @Generated - public AgentEvaluationRequest setSamplingConfiguration(AgentEvaluationSamplingConfiguration samplingConfiguration) { - this.samplingConfiguration = samplingConfiguration; - return this; - } - - /** - * Get the redactionConfiguration property: Redaction configuration for the evaluation. - * - * @return the redactionConfiguration value. - */ - @Generated - public AgentEvaluationRedactionConfiguration getRedactionConfiguration() { - return this.redactionConfiguration; - } - - /** - * Set the redactionConfiguration property: Redaction configuration for the evaluation. - * - * @param redactionConfiguration the redactionConfiguration value to set. - * @return the AgentEvaluationRequest object itself. - */ - @Generated - public AgentEvaluationRequest - setRedactionConfiguration(AgentEvaluationRedactionConfiguration redactionConfiguration) { - this.redactionConfiguration = redactionConfiguration; - return this; - } - - /** - * Get the appInsightsConnectionString property: Pass the AppInsights connection string to the agent evaluation for - * the evaluation results and the errors logs. - * - * @return the appInsightsConnectionString value. - */ - @Generated - public String getAppInsightsConnectionString() { - return this.appInsightsConnectionString; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("runId", this.runId); - jsonWriter.writeMapField("evaluators", this.evaluators, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("appInsightsConnectionString", this.appInsightsConnectionString); - jsonWriter.writeStringField("threadId", this.threadId); - jsonWriter.writeJsonField("samplingConfiguration", this.samplingConfiguration); - jsonWriter.writeJsonField("redactionConfiguration", this.redactionConfiguration); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AgentEvaluationRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AgentEvaluationRequest 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 AgentEvaluationRequest. - */ - @Generated - public static AgentEvaluationRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String runId = null; - Map evaluators = null; - String appInsightsConnectionString = null; - String threadId = null; - AgentEvaluationSamplingConfiguration samplingConfiguration = null; - AgentEvaluationRedactionConfiguration redactionConfiguration = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("runId".equals(fieldName)) { - runId = reader.getString(); - } else if ("evaluators".equals(fieldName)) { - evaluators = reader.readMap(reader1 -> EvaluatorConfiguration.fromJson(reader1)); - } else if ("appInsightsConnectionString".equals(fieldName)) { - appInsightsConnectionString = reader.getString(); - } else if ("threadId".equals(fieldName)) { - threadId = reader.getString(); - } else if ("samplingConfiguration".equals(fieldName)) { - samplingConfiguration = AgentEvaluationSamplingConfiguration.fromJson(reader); - } else if ("redactionConfiguration".equals(fieldName)) { - redactionConfiguration = AgentEvaluationRedactionConfiguration.fromJson(reader); - } else { - reader.skipChildren(); - } - } - AgentEvaluationRequest deserializedAgentEvaluationRequest - = new AgentEvaluationRequest(runId, evaluators, appInsightsConnectionString); - deserializedAgentEvaluationRequest.threadId = threadId; - deserializedAgentEvaluationRequest.samplingConfiguration = samplingConfiguration; - deserializedAgentEvaluationRequest.redactionConfiguration = redactionConfiguration; - return deserializedAgentEvaluationRequest; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationResult.java deleted file mode 100644 index 87ef31bd5e54..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationResult.java +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (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.Map; - -/** - * Result for the agent evaluation evaluator run. - */ -@Immutable -public final class AgentEvaluationResult implements JsonSerializable { - - /* - * Evaluator's name. This is the name of the evaluator that was used to evaluate the agent's completion. - */ - @Generated - private final String evaluator; - - /* - * Identifier of the evaluator. - */ - @Generated - private final String evaluatorId; - - /* - * Score of the given evaluator. No restriction on range. - */ - @Generated - private final double score; - - /* - * Status of the evaluator result. Options: Running, Completed, Failed, NotApplicable. - */ - @Generated - private final String status; - - /* - * Reasoning for the evaluation result. - */ - @Generated - private String reason; - - /* - * Version of the evaluator that was used to evaluate the agent's completion. - */ - @Generated - private String version; - - /* - * The unique identifier of the thread. - */ - @Generated - private String threadId; - - /* - * The unique identifier of the run. - */ - @Generated - private final String runId; - - /* - * A string explaining why there was an error, if applicable. - */ - @Generated - private String error; - - /* - * Additional properties relevant to the evaluator. These will differ between evaluators. - */ - @Generated - private Map additionalDetails; - - /** - * Creates an instance of AgentEvaluationResult class. - * - * @param evaluator the evaluator value to set. - * @param evaluatorId the evaluatorId value to set. - * @param score the score value to set. - * @param status the status value to set. - * @param runId the runId value to set. - */ - @Generated - private AgentEvaluationResult(String evaluator, String evaluatorId, double score, String status, String runId) { - this.evaluator = evaluator; - this.evaluatorId = evaluatorId; - this.score = score; - this.status = status; - this.runId = runId; - } - - /** - * Get the evaluator property: Evaluator's name. This is the name of the evaluator that was used to evaluate the - * agent's completion. - * - * @return the evaluator value. - */ - @Generated - public String getEvaluator() { - return this.evaluator; - } - - /** - * Get the evaluatorId property: Identifier of the evaluator. - * - * @return the evaluatorId value. - */ - @Generated - public String getEvaluatorId() { - return this.evaluatorId; - } - - /** - * Get the score property: Score of the given evaluator. No restriction on range. - * - * @return the score value. - */ - @Generated - public double getScore() { - return this.score; - } - - /** - * Get the status property: Status of the evaluator result. Options: Running, Completed, Failed, NotApplicable. - * - * @return the status value. - */ - @Generated - public String getStatus() { - return this.status; - } - - /** - * Get the reason property: Reasoning for the evaluation result. - * - * @return the reason value. - */ - @Generated - public String getReason() { - return this.reason; - } - - /** - * Get the version property: Version of the evaluator that was used to evaluate the agent's completion. - * - * @return the version value. - */ - @Generated - public String getVersion() { - return this.version; - } - - /** - * Get the threadId property: The unique identifier of the thread. - * - * @return the threadId value. - */ - @Generated - public String getThreadId() { - return this.threadId; - } - - /** - * Get the runId property: The unique identifier of the run. - * - * @return the runId value. - */ - @Generated - public String getRunId() { - return this.runId; - } - - /** - * Get the error property: A string explaining why there was an error, if applicable. - * - * @return the error value. - */ - @Generated - public String getError() { - return this.error; - } - - /** - * Get the additionalDetails property: Additional properties relevant to the evaluator. These will differ between - * evaluators. - * - * @return the additionalDetails value. - */ - @Generated - public Map getAdditionalDetails() { - return this.additionalDetails; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("evaluator", this.evaluator); - jsonWriter.writeStringField("evaluatorId", this.evaluatorId); - jsonWriter.writeDoubleField("score", this.score); - jsonWriter.writeStringField("status", this.status); - jsonWriter.writeStringField("runId", this.runId); - jsonWriter.writeStringField("reason", this.reason); - jsonWriter.writeStringField("version", this.version); - jsonWriter.writeStringField("threadId", this.threadId); - jsonWriter.writeStringField("error", this.error); - jsonWriter.writeMapField("additionalDetails", this.additionalDetails, - (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AgentEvaluationResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AgentEvaluationResult 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 AgentEvaluationResult. - */ - @Generated - public static AgentEvaluationResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String evaluator = null; - String evaluatorId = null; - double score = 0.0; - String status = null; - String runId = null; - String reason = null; - String version = null; - String threadId = null; - String error = null; - Map additionalDetails = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("evaluator".equals(fieldName)) { - evaluator = reader.getString(); - } else if ("evaluatorId".equals(fieldName)) { - evaluatorId = reader.getString(); - } else if ("score".equals(fieldName)) { - score = reader.getDouble(); - } else if ("status".equals(fieldName)) { - status = reader.getString(); - } else if ("runId".equals(fieldName)) { - runId = reader.getString(); - } else if ("reason".equals(fieldName)) { - reason = reader.getString(); - } else if ("version".equals(fieldName)) { - version = reader.getString(); - } else if ("threadId".equals(fieldName)) { - threadId = reader.getString(); - } else if ("error".equals(fieldName)) { - error = reader.getString(); - } else if ("additionalDetails".equals(fieldName)) { - additionalDetails = reader.readMap(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - AgentEvaluationResult deserializedAgentEvaluationResult - = new AgentEvaluationResult(evaluator, evaluatorId, score, status, runId); - deserializedAgentEvaluationResult.reason = reason; - deserializedAgentEvaluationResult.version = version; - deserializedAgentEvaluationResult.threadId = threadId; - deserializedAgentEvaluationResult.error = error; - deserializedAgentEvaluationResult.additionalDetails = additionalDetails; - return deserializedAgentEvaluationResult; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationSamplingConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationSamplingConfiguration.java deleted file mode 100644 index a364e640fa3b..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentEvaluationSamplingConfiguration.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (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; - -/** - * Definition for sampling strategy. - */ -@Immutable -public final class AgentEvaluationSamplingConfiguration - implements JsonSerializable { - - /* - * Name of the sampling strategy. - */ - @Generated - private final String name; - - /* - * Percentage of sampling per hour (0-100). - */ - @Generated - private final double samplingPercent; - - /* - * Maximum request rate per hour (0 to 1000). - */ - @Generated - private final double maxRequestRate; - - /** - * Creates an instance of AgentEvaluationSamplingConfiguration class. - * - * @param name the name value to set. - * @param samplingPercent the samplingPercent value to set. - * @param maxRequestRate the maxRequestRate value to set. - */ - @Generated - public AgentEvaluationSamplingConfiguration(String name, double samplingPercent, double maxRequestRate) { - this.name = name; - this.samplingPercent = samplingPercent; - this.maxRequestRate = maxRequestRate; - } - - /** - * Get the name property: Name of the sampling strategy. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the samplingPercent property: Percentage of sampling per hour (0-100). - * - * @return the samplingPercent value. - */ - @Generated - public double getSamplingPercent() { - return this.samplingPercent; - } - - /** - * Get the maxRequestRate property: Maximum request rate per hour (0 to 1000). - * - * @return the maxRequestRate value. - */ - @Generated - public double getMaxRequestRate() { - return this.maxRequestRate; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeDoubleField("samplingPercent", this.samplingPercent); - jsonWriter.writeDoubleField("maxRequestRate", this.maxRequestRate); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AgentEvaluationSamplingConfiguration from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AgentEvaluationSamplingConfiguration 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 AgentEvaluationSamplingConfiguration. - */ - @Generated - public static AgentEvaluationSamplingConfiguration fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - double samplingPercent = 0.0; - double maxRequestRate = 0.0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("samplingPercent".equals(fieldName)) { - samplingPercent = reader.getDouble(); - } else if ("maxRequestRate".equals(fieldName)) { - maxRequestRate = reader.getDouble(); - } else { - reader.skipChildren(); - } - } - return new AgentEvaluationSamplingConfiguration(name, samplingPercent, maxRequestRate); - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentTaxonomyInput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentTaxonomyInput.java new file mode 100644 index 000000000000..f66484d2f0af --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgentTaxonomyInput.java @@ -0,0 +1,128 @@ +// Copyright (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; + +/** + * Input configuration for the evaluation taxonomy when the input type is agent. + */ +@Immutable +public final class AgentTaxonomyInput extends EvaluationTaxonomyInput { + + /* + * Input type of the evaluation taxonomy. + */ + @Generated + private EvaluationTaxonomyInputType type = EvaluationTaxonomyInputType.AGENT; + + /* + * Target configuration for the agent. + */ + @Generated + private final AzureAIAgentTarget target; + + /* + * List of risk categories to evaluate against. + */ + @Generated + private final List riskCategories; + + /** + * Creates an instance of AgentTaxonomyInput class. + * + * @param target the target value to set. + * @param riskCategories the riskCategories value to set. + */ + @Generated + public AgentTaxonomyInput(AzureAIAgentTarget target, List riskCategories) { + this.target = target; + this.riskCategories = riskCategories; + } + + /** + * Get the type property: Input type of the evaluation taxonomy. + * + * @return the type value. + */ + @Generated + @Override + public EvaluationTaxonomyInputType getType() { + return this.type; + } + + /** + * Get the target property: Target configuration for the agent. + * + * @return the target value. + */ + @Generated + public AzureAIAgentTarget getTarget() { + return this.target; + } + + /** + * Get the riskCategories property: List of risk categories to evaluate against. + * + * @return the riskCategories value. + */ + @Generated + public List getRiskCategories() { + return this.riskCategories; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("target", this.target); + jsonWriter.writeArrayField("riskCategories", this.riskCategories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentTaxonomyInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentTaxonomyInput 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 AgentTaxonomyInput. + */ + @Generated + public static AgentTaxonomyInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureAIAgentTarget target = null; + List riskCategories = null; + EvaluationTaxonomyInputType type = EvaluationTaxonomyInputType.AGENT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("target".equals(fieldName)) { + target = AzureAIAgentTarget.fromJson(reader); + } else if ("riskCategories".equals(fieldName)) { + riskCategories = reader.readArray(reader1 -> RiskCategory.fromString(reader1.getString())); + } else if ("type".equals(fieldName)) { + type = EvaluationTaxonomyInputType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + AgentTaxonomyInput deserializedAgentTaxonomyInput = new AgentTaxonomyInput(target, riskCategories); + deserializedAgentTaxonomyInput.type = type; + return deserializedAgentTaxonomyInput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgenticIdentityCredentials.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgenticIdentityCredentials.java new file mode 100644 index 000000000000..b44e5d0fa1ad --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AgenticIdentityCredentials.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; + +/** + * Agentic identity credential definition. + */ +@Immutable +public final class AgenticIdentityCredentials extends BaseCredentials { + + /* + * The type of credential used by the connection + */ + @Generated + private CredentialType type = CredentialType.AGENTIC_IDENTITY; + + /** + * Creates an instance of AgenticIdentityCredentials class. + */ + @Generated + private AgenticIdentityCredentials() { + } + + /** + * Get the type property: The type of credential used by the connection. + * + * @return the type value. + */ + @Generated + @Override + public CredentialType 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 AgenticIdentityCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgenticIdentityCredentials 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 AgenticIdentityCredentials. + */ + @Generated + public static AgenticIdentityCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgenticIdentityCredentials deserializedAgenticIdentityCredentials = new AgenticIdentityCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedAgenticIdentityCredentials.type = CredentialType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedAgenticIdentityCredentials; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AttackStrategy.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AttackStrategy.java index bae69fb46a97..7480cff5ad2f 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AttackStrategy.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AttackStrategy.java @@ -161,6 +161,30 @@ public final class AttackStrategy extends ExpandableStringEnum { @Generated public static final AttackStrategy BASELINE = fromString("baseline"); + /** + * Represents indirect jailbreak attacks that use complex methods to bypass AI safeguards. + */ + @Generated + public static final AttackStrategy INDIRECT_JAILBREAK = fromString("indirect_jailbreak"); + + /** + * Alters the tense of the text, changing its temporal context. + */ + @Generated + public static final AttackStrategy TENSE = fromString("tense"); + + /** + * Creates multi-turn conversations to simulate extended interactions. + */ + @Generated + public static final AttackStrategy MULTI_TURN = fromString("multi_turn"); + + /** + * Gradually increases the intensity or complexity of the attack over time. + */ + @Generated + public static final AttackStrategy CRESCENDO = fromString("crescendo"); + /** * Creates a new instance of AttackStrategy value. * diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAgentTarget.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAgentTarget.java new file mode 100644 index 000000000000..0f8995db22b4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAgentTarget.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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a target specifying an Azure AI agent. + */ +@Fluent +public final class AzureAIAgentTarget extends Target { + + /* + * The type of target. + */ + @Generated + private String type = "azure_ai_agent"; + + /* + * The unique identifier of the Azure AI agent. + */ + @Generated + private final String name; + + /* + * The version of the Azure AI agent. + */ + @Generated + private String version; + + /* + * The parameters used to control the sampling behavior of the agent during text generation. + */ + @Generated + private List toolDescriptions; + + /** + * Creates an instance of AzureAIAgentTarget class. + * + * @param name the name value to set. + */ + @Generated + public AzureAIAgentTarget(String name) { + this.name = name; + } + + /** + * Get the type property: The type of target. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the name property: The unique identifier of the Azure AI agent. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the version property: The version of the Azure AI agent. + * + * @return the version value. + */ + @Generated + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the Azure AI agent. + * + * @param version the version value to set. + * @return the AzureAIAgentTarget object itself. + */ + @Generated + public AzureAIAgentTarget setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the toolDescriptions property: The parameters used to control the sampling behavior of the agent during text + * generation. + * + * @return the toolDescriptions value. + */ + @Generated + public List getToolDescriptions() { + return this.toolDescriptions; + } + + /** + * Set the toolDescriptions property: The parameters used to control the sampling behavior of the agent during text + * generation. + * + * @param toolDescriptions the toolDescriptions value to set. + * @return the AzureAIAgentTarget object itself. + */ + @Generated + public AzureAIAgentTarget setToolDescriptions(List toolDescriptions) { + this.toolDescriptions = toolDescriptions; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeArrayField("tool_descriptions", this.toolDescriptions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureAIAgentTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureAIAgentTarget 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 AzureAIAgentTarget. + */ + @Generated + public static AzureAIAgentTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String type = "azure_ai_agent"; + String version = null; + List toolDescriptions = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("version".equals(fieldName)) { + version = reader.getString(); + } else if ("tool_descriptions".equals(fieldName)) { + toolDescriptions = reader.readArray(reader1 -> ToolDescription.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + AzureAIAgentTarget deserializedAzureAIAgentTarget = new AzureAIAgentTarget(name); + deserializedAzureAIAgentTarget.type = type; + deserializedAzureAIAgentTarget.version = version; + deserializedAzureAIAgentTarget.toolDescriptions = toolDescriptions; + return deserializedAzureAIAgentTarget; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAssistantTarget.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAssistantTarget.java new file mode 100644 index 000000000000..d8e3b57f3aba --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIAssistantTarget.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.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; +import java.util.List; + +/** + * Represents a target specifying an Azure AI Assistant (Agent V1) endpoint, including its id. + */ +@Fluent +public final class AzureAIAssistantTarget extends Target { + + /* + * The type of target. + */ + @Generated + private String type = "azure_ai_assistant"; + + /* + * The unique identifier of the Azure AI Assistant. + */ + @Generated + private String id; + + /* + * The descriptions of tools available to the assistant. + */ + @Generated + private final List toolDescriptions; + + /** + * Creates an instance of AzureAIAssistantTarget class. + * + * @param toolDescriptions the toolDescriptions value to set. + */ + @Generated + public AzureAIAssistantTarget(List toolDescriptions) { + this.toolDescriptions = toolDescriptions; + } + + /** + * Get the type property: The type of target. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the id property: The unique identifier of the Azure AI Assistant. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: The unique identifier of the Azure AI Assistant. + * + * @param id the id value to set. + * @return the AzureAIAssistantTarget object itself. + */ + @Generated + public AzureAIAssistantTarget setId(String id) { + this.id = id; + return this; + } + + /** + * Get the toolDescriptions property: The descriptions of tools available to the assistant. + * + * @return the toolDescriptions value. + */ + @Generated + public List getToolDescriptions() { + return this.toolDescriptions; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tool_descriptions", this.toolDescriptions, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureAIAssistantTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureAIAssistantTarget 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 AzureAIAssistantTarget. + */ + @Generated + public static AzureAIAssistantTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List toolDescriptions = null; + String type = "azure_ai_assistant"; + String id = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("tool_descriptions".equals(fieldName)) { + toolDescriptions = reader.readArray(reader1 -> ToolDescription.fromJson(reader1)); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else { + reader.skipChildren(); + } + } + AzureAIAssistantTarget deserializedAzureAIAssistantTarget = new AzureAIAssistantTarget(toolDescriptions); + deserializedAzureAIAssistantTarget.type = type; + deserializedAzureAIAssistantTarget.id = id; + return deserializedAzureAIAssistantTarget; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIModelTarget.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIModelTarget.java new file mode 100644 index 000000000000..bf79835bdc49 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureAIModelTarget.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a target specifying an Azure AI model for operations requiring model selection. + */ +@Fluent +public final class AzureAIModelTarget extends Target { + + /* + * The type of target. + */ + @Generated + private String type = "azure_ai_model"; + + /* + * The unique identifier of the Azure AI model. + */ + @Generated + private String model; + + /* + * The parameters used to control the sampling behavior of the model during text generation. + */ + @Generated + private ModelSamplingParams samplingParams; + + /** + * Creates an instance of AzureAIModelTarget class. + */ + @Generated + public AzureAIModelTarget() { + } + + /** + * Get the type property: The type of target. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the model property: The unique identifier of the Azure AI model. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The unique identifier of the Azure AI model. + * + * @param model the model value to set. + * @return the AzureAIModelTarget object itself. + */ + @Generated + public AzureAIModelTarget setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the samplingParams property: The parameters used to control the sampling behavior of the model during text + * generation. + * + * @return the samplingParams value. + */ + @Generated + public ModelSamplingParams getSamplingParams() { + return this.samplingParams; + } + + /** + * Set the samplingParams property: The parameters used to control the sampling behavior of the model during text + * generation. + * + * @param samplingParams the samplingParams value to set. + * @return the AzureAIModelTarget object itself. + */ + @Generated + public AzureAIModelTarget setSamplingParams(ModelSamplingParams samplingParams) { + this.samplingParams = samplingParams; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeJsonField("sampling_params", this.samplingParams); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureAIModelTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureAIModelTarget 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 AzureAIModelTarget. + */ + @Generated + public static AzureAIModelTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureAIModelTarget deserializedAzureAIModelTarget = new AzureAIModelTarget(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedAzureAIModelTarget.type = reader.getString(); + } else if ("model".equals(fieldName)) { + deserializedAzureAIModelTarget.model = reader.getString(); + } else if ("sampling_params".equals(fieldName)) { + deserializedAzureAIModelTarget.samplingParams = ModelSamplingParams.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedAzureAIModelTarget; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureOpenAIModelConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureOpenAIModelConfiguration.java index f46f3f8f2de1..f89a2326b106 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureOpenAIModelConfiguration.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AzureOpenAIModelConfiguration.java @@ -24,7 +24,7 @@ public final class AzureOpenAIModelConfiguration extends TargetConfig { /* * Deployment name for AOAI model. Example: gpt-4o if in AIServices or connection based - * `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`. + * `connection_name/deployment_name` (e.g. `my-aoai-connection/gpt-4o`). */ @Generated private final String modelDeploymentName; @@ -52,7 +52,7 @@ public String getType() { /** * Get the modelDeploymentName property: Deployment name for AOAI model. Example: gpt-4o if in AIServices or - * connection based `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`. + * connection based `connection_name/deployment_name` (e.g. `my-aoai-connection/gpt-4o`). * * @return the modelDeploymentName value. */ diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BaseCredentials.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BaseCredentials.java index c627bdc91ba7..65e2ee9424d5 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BaseCredentials.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BaseCredentials.java @@ -80,13 +80,15 @@ public static BaseCredentials fromJson(JsonReader jsonReader) throws IOException if ("ApiKey".equals(discriminatorValue)) { return ApiKeyCredentials.fromJson(readerToUse.reset()); } else if ("AAD".equals(discriminatorValue)) { - return EntraIDCredentials.fromJson(readerToUse.reset()); + return EntraIdCredentials.fromJson(readerToUse.reset()); } else if ("CustomKeys".equals(discriminatorValue)) { return CustomCredential.fromJson(readerToUse.reset()); } else if ("SAS".equals(discriminatorValue)) { return SasCredentials.fromJson(readerToUse.reset()); } else if ("None".equals(discriminatorValue)) { return NoAuthenticationCredentials.fromJson(readerToUse.reset()); + } else if ("AgenticIdentityToken".equals(discriminatorValue)) { + return AgenticIdentityCredentials.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReference.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReference.java index 0dd2dee54c7b..5db26d64c692 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReference.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReference.java @@ -18,7 +18,7 @@ public final class BlobReference implements JsonSerializable { /* - * Blob URI path for client to upload data. Example: https://blob.windows.core.net/Container/Path + * Blob URI path for client to upload data. Example: `https://blob.windows.core.net/Container/Path` */ @Generated private final String blobUri; @@ -33,7 +33,7 @@ public final class BlobReference implements JsonSerializable { * Credential info to access the storage account. */ @Generated - private final SasCredential credential; + private final BlobReferenceSasCredential credential; /** * Creates an instance of BlobReference class. @@ -43,7 +43,7 @@ public final class BlobReference implements JsonSerializable { * @param credential the credential value to set. */ @Generated - private BlobReference(String blobUri, String storageAccountArmId, SasCredential credential) { + private BlobReference(String blobUri, String storageAccountArmId, BlobReferenceSasCredential credential) { this.blobUri = blobUri; this.storageAccountArmId = storageAccountArmId; this.credential = credential; @@ -51,7 +51,7 @@ private BlobReference(String blobUri, String storageAccountArmId, SasCredential /** * Get the blobUri property: Blob URI path for client to upload data. Example: - * https://blob.windows.core.net/Container/Path. + * `https://blob.windows.core.net/Container/Path`. * * @return the blobUri value. */ @@ -76,7 +76,7 @@ public String getStorageAccountArmId() { * @return the credential value. */ @Generated - public SasCredential getCredential() { + public BlobReferenceSasCredential getCredential() { return this.credential; } @@ -107,7 +107,7 @@ public static BlobReference fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String blobUri = null; String storageAccountArmId = null; - SasCredential credential = null; + BlobReferenceSasCredential credential = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -116,7 +116,7 @@ public static BlobReference fromJson(JsonReader jsonReader) throws IOException { } else if ("storageAccountArmId".equals(fieldName)) { storageAccountArmId = reader.getString(); } else if ("credential".equals(fieldName)) { - credential = SasCredential.fromJson(reader); + credential = BlobReferenceSasCredential.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredential.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReferenceSasCredential.java similarity index 69% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredential.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReferenceSasCredential.java index 91b4fbb35956..983d9e75383c 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredential.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/BlobReferenceSasCredential.java @@ -15,7 +15,7 @@ * SAS Credential definition. */ @Immutable -public final class SasCredential implements JsonSerializable { +public final class BlobReferenceSasCredential implements JsonSerializable { /* * SAS uri @@ -30,10 +30,10 @@ public final class SasCredential implements JsonSerializable { private final String type = "SAS"; /** - * Creates an instance of SasCredential class. + * Creates an instance of BlobReferenceSasCredential class. */ @Generated - private SasCredential() { + private BlobReferenceSasCredential() { } /** @@ -67,28 +67,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of SasCredential from the JsonReader. + * Reads an instance of BlobReferenceSasCredential from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of SasCredential if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. + * @return An instance of BlobReferenceSasCredential 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 SasCredential. + * @throws IOException If an error occurs while reading the BlobReferenceSasCredential. */ @Generated - public static SasCredential fromJson(JsonReader jsonReader) throws IOException { + public static BlobReferenceSasCredential fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - SasCredential deserializedSasCredential = new SasCredential(); + BlobReferenceSasCredential deserializedBlobReferenceSasCredential = new BlobReferenceSasCredential(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("sasUri".equals(fieldName)) { - deserializedSasCredential.sasUri = reader.getString(); + deserializedBlobReferenceSasCredential.sasUri = reader.getString(); } else { reader.skipChildren(); } } - return deserializedSasCredential; + return deserializedBlobReferenceSasCredential; }); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ChartCoordinate.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ChartCoordinate.java new file mode 100644 index 000000000000..3c56ed8db711 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ChartCoordinate.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; + +/** + * Coordinates for the analysis chart. + */ +@Immutable +public final class ChartCoordinate implements JsonSerializable { + + /* + * X-axis coordinate. + */ + @Generated + private final int x; + + /* + * Y-axis coordinate. + */ + @Generated + private final int y; + + /* + * Size of the chart element. + */ + @Generated + private final int size; + + /** + * Creates an instance of ChartCoordinate class. + * + * @param x the x value to set. + * @param y the y value to set. + * @param size the size value to set. + */ + @Generated + private ChartCoordinate(int x, int y, int size) { + this.x = x; + this.y = y; + this.size = size; + } + + /** + * Get the x property: X-axis coordinate. + * + * @return the x value. + */ + @Generated + public int getX() { + return this.x; + } + + /** + * Get the y property: Y-axis coordinate. + * + * @return the y value. + */ + @Generated + public int getY() { + return this.y; + } + + /** + * Get the size property: Size of the chart element. + * + * @return the size value. + */ + @Generated + public int getSize() { + return this.size; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("x", this.x); + jsonWriter.writeIntField("y", this.y); + jsonWriter.writeIntField("size", this.size); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChartCoordinate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChartCoordinate 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 ChartCoordinate. + */ + @Generated + public static ChartCoordinate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int x = 0; + int y = 0; + int size = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("x".equals(fieldName)) { + x = reader.getInt(); + } else if ("y".equals(fieldName)) { + y = reader.getInt(); + } else if ("size".equals(fieldName)) { + size = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new ChartCoordinate(x, y, size); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterInsightResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterInsightResult.java new file mode 100644 index 000000000000..83af074ce601 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterInsightResult.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.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; +import java.util.Map; + +/** + * Insights from the cluster analysis. + */ +@Immutable +public final class ClusterInsightResult implements JsonSerializable { + + /* + * Summary of the insights report. + */ + @Generated + private final InsightSummary summary; + + /* + * List of clusters identified in the insights. + */ + @Generated + private final List clusters; + + /* + * Optional mapping of IDs to 2D coordinates used by the UX for visualization. + * + * The map keys are string identifiers (for example, a cluster id or a sample id) + * and the values are the coordinates and visual size for rendering on a 2D chart. + * + * This property is omitted unless the client requests coordinates (for example, + * by passing `includeCoordinates=true` as a query parameter). + * + * Example: + * ``` + * { + * "cluster-1": { "x": 12, "y": 34, "size": 8 }, + * "sample-123": { "x": 18, "y": 22, "size": 4 } + * } + * ``` + * + * Coordinates are intended only for client-side visualization and do not + * modify the canonical insights results. + */ + @Generated + private Map coordinates; + + /** + * Creates an instance of ClusterInsightResult class. + * + * @param summary the summary value to set. + * @param clusters the clusters value to set. + */ + @Generated + private ClusterInsightResult(InsightSummary summary, List clusters) { + this.summary = summary; + this.clusters = clusters; + } + + /** + * Get the summary property: Summary of the insights report. + * + * @return the summary value. + */ + @Generated + public InsightSummary getSummary() { + return this.summary; + } + + /** + * Get the clusters property: List of clusters identified in the insights. + * + * @return the clusters value. + */ + @Generated + public List getClusters() { + return this.clusters; + } + + /** + * Get the coordinates property: Optional mapping of IDs to 2D coordinates used by the UX for visualization. + * + * The map keys are string identifiers (for example, a cluster id or a sample id) + * and the values are the coordinates and visual size for rendering on a 2D chart. + * + * This property is omitted unless the client requests coordinates (for example, + * by passing `includeCoordinates=true` as a query parameter). + * + * Example: + * ``` + * { + * "cluster-1": { "x": 12, "y": 34, "size": 8 }, + * "sample-123": { "x": 18, "y": 22, "size": 4 } + * } + * ``` + * + * Coordinates are intended only for client-side visualization and do not + * modify the canonical insights results. + * + * @return the coordinates value. + */ + @Generated + public Map getCoordinates() { + return this.coordinates; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("summary", this.summary); + jsonWriter.writeArrayField("clusters", this.clusters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("coordinates", this.coordinates, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClusterInsightResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClusterInsightResult 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 ClusterInsightResult. + */ + @Generated + public static ClusterInsightResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightSummary summary = null; + List clusters = null; + Map coordinates = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("summary".equals(fieldName)) { + summary = InsightSummary.fromJson(reader); + } else if ("clusters".equals(fieldName)) { + clusters = reader.readArray(reader1 -> InsightCluster.fromJson(reader1)); + } else if ("coordinates".equals(fieldName)) { + coordinates = reader.readMap(reader1 -> ChartCoordinate.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + ClusterInsightResult deserializedClusterInsightResult = new ClusterInsightResult(summary, clusters); + deserializedClusterInsightResult.coordinates = coordinates; + return deserializedClusterInsightResult; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterTokenUsage.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterTokenUsage.java new file mode 100644 index 000000000000..70c392a9020c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ClusterTokenUsage.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; + +/** + * Token usage for cluster analysis. + */ +@Immutable +public final class ClusterTokenUsage implements JsonSerializable { + + /* + * input token usage + */ + @Generated + private final int inputTokenUsage; + + /* + * output token usage + */ + @Generated + private final int outputTokenUsage; + + /* + * total token usage + */ + @Generated + private final int totalTokenUsage; + + /** + * Creates an instance of ClusterTokenUsage class. + * + * @param inputTokenUsage the inputTokenUsage value to set. + * @param outputTokenUsage the outputTokenUsage value to set. + * @param totalTokenUsage the totalTokenUsage value to set. + */ + @Generated + private ClusterTokenUsage(int inputTokenUsage, int outputTokenUsage, int totalTokenUsage) { + this.inputTokenUsage = inputTokenUsage; + this.outputTokenUsage = outputTokenUsage; + this.totalTokenUsage = totalTokenUsage; + } + + /** + * Get the inputTokenUsage property: input token usage. + * + * @return the inputTokenUsage value. + */ + @Generated + public int getInputTokenUsage() { + return this.inputTokenUsage; + } + + /** + * Get the outputTokenUsage property: output token usage. + * + * @return the outputTokenUsage value. + */ + @Generated + public int getOutputTokenUsage() { + return this.outputTokenUsage; + } + + /** + * Get the totalTokenUsage property: total token usage. + * + * @return the totalTokenUsage value. + */ + @Generated + public int getTotalTokenUsage() { + return this.totalTokenUsage; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("inputTokenUsage", this.inputTokenUsage); + jsonWriter.writeIntField("outputTokenUsage", this.outputTokenUsage); + jsonWriter.writeIntField("totalTokenUsage", this.totalTokenUsage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClusterTokenUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClusterTokenUsage 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 ClusterTokenUsage. + */ + @Generated + public static ClusterTokenUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int inputTokenUsage = 0; + int outputTokenUsage = 0; + int totalTokenUsage = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("inputTokenUsage".equals(fieldName)) { + inputTokenUsage = reader.getInt(); + } else if ("outputTokenUsage".equals(fieldName)) { + outputTokenUsage = reader.getInt(); + } else if ("totalTokenUsage".equals(fieldName)) { + totalTokenUsage = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new ClusterTokenUsage(inputTokenUsage, outputTokenUsage, totalTokenUsage); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeBasedEvaluatorDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeBasedEvaluatorDefinition.java new file mode 100644 index 000000000000..f825c4925beb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeBasedEvaluatorDefinition.java @@ -0,0 +1,160 @@ +// Copyright (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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Code-based evaluator definition using python code. + */ +@Fluent +public final class CodeBasedEvaluatorDefinition extends EvaluatorDefinition { + + /* + * The type of evaluator definition + */ + @Generated + private EvaluatorDefinitionType type = EvaluatorDefinitionType.CODE; + + /* + * Inline code text for the evaluator + */ + @Generated + private final String codeText; + + /** + * Creates an instance of CodeBasedEvaluatorDefinition class. + * + * @param codeText the codeText value to set. + */ + @Generated + public CodeBasedEvaluatorDefinition(String codeText) { + this.codeText = codeText; + } + + /** + * Get the type property: The type of evaluator definition. + * + * @return the type value. + */ + @Generated + @Override + public EvaluatorDefinitionType getType() { + return this.type; + } + + /** + * Get the codeText property: Inline code text for the evaluator. + * + * @return the codeText value. + */ + @Generated + public String getCodeText() { + return this.codeText; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CodeBasedEvaluatorDefinition setInitParameters(BinaryData initParameters) { + super.setInitParameters(initParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CodeBasedEvaluatorDefinition setDataSchema(BinaryData dataSchema) { + super.setDataSchema(dataSchema); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CodeBasedEvaluatorDefinition setMetrics(Map metrics) { + super.setMetrics(metrics); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (getInitParameters() != null) { + jsonWriter.writeFieldName("init_parameters"); + getInitParameters().writeTo(jsonWriter); + } + if (getDataSchema() != null) { + jsonWriter.writeFieldName("data_schema"); + getDataSchema().writeTo(jsonWriter); + } + jsonWriter.writeMapField("metrics", getMetrics(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("code_text", this.codeText); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeBasedEvaluatorDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeBasedEvaluatorDefinition 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 CodeBasedEvaluatorDefinition. + */ + @Generated + public static CodeBasedEvaluatorDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData initParameters = null; + BinaryData dataSchema = null; + Map metrics = null; + String codeText = null; + EvaluatorDefinitionType type = EvaluatorDefinitionType.CODE; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("init_parameters".equals(fieldName)) { + initParameters + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("data_schema".equals(fieldName)) { + dataSchema + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metrics".equals(fieldName)) { + metrics = reader.readMap(reader1 -> EvaluatorMetric.fromJson(reader1)); + } else if ("code_text".equals(fieldName)) { + codeText = reader.getString(); + } else if ("type".equals(fieldName)) { + type = EvaluatorDefinitionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + CodeBasedEvaluatorDefinition deserializedCodeBasedEvaluatorDefinition + = new CodeBasedEvaluatorDefinition(codeText); + deserializedCodeBasedEvaluatorDefinition.setInitParameters(initParameters); + deserializedCodeBasedEvaluatorDefinition.setDataSchema(dataSchema); + deserializedCodeBasedEvaluatorDefinition.setMetrics(metrics); + deserializedCodeBasedEvaluatorDefinition.type = type; + return deserializedCodeBasedEvaluatorDefinition; + }); + } +} 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 index a843cafb151b..a34239363296 100644 --- 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 @@ -30,6 +30,12 @@ public final class ConnectionType extends ExpandableStringEnum { @Generated public static final ConnectionType AZURE_STORAGE_ACCOUNT = fromString("AzureStorageAccount"); + /** + * Azure AI Search. + */ + @Generated + public static final ConnectionType AZURE_AISEARCH = fromString("CognitiveSearch"); + /** * CosmosDB. */ @@ -60,6 +66,12 @@ public final class ConnectionType extends ExpandableStringEnum { @Generated public static final ConnectionType CUSTOM = fromString("CustomKeys"); + /** + * Remote tool. + */ + @Generated + public static final ConnectionType REMOTE_TOOL = fromString("RemoteTool"); + /** * Creates a new instance of ConnectionType value. * @@ -90,10 +102,4 @@ public static ConnectionType fromString(String name) { public static Collection values() { return values(ConnectionType.class); } - - /** - * Azure AI Search. - */ - @Generated - public static final ConnectionType AZURE_AI_SEARCH = fromString("CognitiveSearch"); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ContinuousEvaluationRuleAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ContinuousEvaluationRuleAction.java new file mode 100644 index 000000000000..186771c96040 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ContinuousEvaluationRuleAction.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.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; + +/** + * Evaluation rule action for continuous evaluation. + */ +@Fluent +public final class ContinuousEvaluationRuleAction extends EvaluationRuleAction { + + /* + * Type of the evaluation action. + */ + @Generated + private EvaluationRuleActionType type = EvaluationRuleActionType.CONTINUOUS_EVALUATION; + + /* + * Eval Id to add continuous evaluation runs to. + */ + @Generated + private final String evalId; + + /* + * Maximum number of evaluation runs allowed per hour. + */ + @Generated + private Integer maxHourlyRuns; + + /** + * Creates an instance of ContinuousEvaluationRuleAction class. + * + * @param evalId the evalId value to set. + */ + @Generated + public ContinuousEvaluationRuleAction(String evalId) { + this.evalId = evalId; + } + + /** + * Get the type property: Type of the evaluation action. + * + * @return the type value. + */ + @Generated + @Override + public EvaluationRuleActionType getType() { + return this.type; + } + + /** + * Get the evalId property: Eval Id to add continuous evaluation runs to. + * + * @return the evalId value. + */ + @Generated + public String getEvalId() { + return this.evalId; + } + + /** + * Get the maxHourlyRuns property: Maximum number of evaluation runs allowed per hour. + * + * @return the maxHourlyRuns value. + */ + @Generated + public Integer getMaxHourlyRuns() { + return this.maxHourlyRuns; + } + + /** + * Set the maxHourlyRuns property: Maximum number of evaluation runs allowed per hour. + * + * @param maxHourlyRuns the maxHourlyRuns value to set. + * @return the ContinuousEvaluationRuleAction object itself. + */ + @Generated + public ContinuousEvaluationRuleAction setMaxHourlyRuns(Integer maxHourlyRuns) { + this.maxHourlyRuns = maxHourlyRuns; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("evalId", this.evalId); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeNumberField("maxHourlyRuns", this.maxHourlyRuns); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousEvaluationRuleAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousEvaluationRuleAction 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 ContinuousEvaluationRuleAction. + */ + @Generated + public static ContinuousEvaluationRuleAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String evalId = null; + EvaluationRuleActionType type = EvaluationRuleActionType.CONTINUOUS_EVALUATION; + Integer maxHourlyRuns = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("evalId".equals(fieldName)) { + evalId = reader.getString(); + } else if ("type".equals(fieldName)) { + type = EvaluationRuleActionType.fromString(reader.getString()); + } else if ("maxHourlyRuns".equals(fieldName)) { + maxHourlyRuns = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + ContinuousEvaluationRuleAction deserializedContinuousEvaluationRuleAction + = new ContinuousEvaluationRuleAction(evalId); + deserializedContinuousEvaluationRuleAction.type = type; + deserializedContinuousEvaluationRuleAction.maxHourlyRuns = maxHourlyRuns; + return deserializedContinuousEvaluationRuleAction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CredentialType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CredentialType.java index 47752861bcd9..f503aed23d0a 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CredentialType.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CredentialType.java @@ -42,6 +42,12 @@ public final class CredentialType extends ExpandableStringEnum { @Generated public static final CredentialType NONE = fromString("None"); + /** + * Agentic identity credential. + */ + @Generated + public static final CredentialType AGENTIC_IDENTITY = fromString("AgenticIdentityToken"); + /** * Creates a new instance of CredentialType value. * 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..21c2bb485120 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CronTrigger.java @@ -0,0 +1,203 @@ +// Copyright (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; + +/** + * Cron based trigger. + */ +@Fluent +public final class CronTrigger extends Trigger { + + /* + * Type of the trigger. + */ + @Generated + private TriggerType type = TriggerType.CRON; + + /* + * Cron expression that defines the schedule frequency. + */ + @Generated + private final String expression; + + /* + * Time zone for the cron schedule. + */ + @Generated + private String timeZone; + + /* + * Start time for the cron schedule in ISO 8601 format. + */ + @Generated + private String startTime; + + /* + * End time for the cron schedule in ISO 8601 format. + */ + @Generated + private String endTime; + + /** + * 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 TriggerType getType() { + return this.type; + } + + /** + * Get the expression property: Cron expression that defines the schedule frequency. + * + * @return the expression value. + */ + @Generated + public String getExpression() { + return this.expression; + } + + /** + * Get the timeZone property: Time zone for the cron schedule. + * + * @return the timeZone value. + */ + @Generated + public String getTimeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Time zone for the cron schedule. + * + * @param timeZone the timeZone value to set. + * @return the CronTrigger object itself. + */ + @Generated + public CronTrigger setTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the startTime property: Start time for the cron schedule in ISO 8601 format. + * + * @return the startTime value. + */ + @Generated + public String getStartTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time for the cron schedule in ISO 8601 format. + * + * @param startTime the startTime value to set. + * @return the CronTrigger object itself. + */ + @Generated + public CronTrigger setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time for the cron schedule in ISO 8601 format. + * + * @return the endTime value. + */ + @Generated + public String getEndTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time for the cron schedule in ISO 8601 format. + * + * @param endTime the endTime value to set. + * @return the CronTrigger object itself. + */ + @Generated + public CronTrigger setEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("expression", this.expression); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeStringField("startTime", this.startTime); + jsonWriter.writeStringField("endTime", this.endTime); + 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; + TriggerType type = TriggerType.CRON; + String timeZone = null; + String startTime = null; + String endTime = null; + 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 = TriggerType.fromString(reader.getString()); + } else if ("timeZone".equals(fieldName)) { + timeZone = reader.getString(); + } else if ("startTime".equals(fieldName)) { + startTime = reader.getString(); + } else if ("endTime".equals(fieldName)) { + endTime = reader.getString(); + } else { + reader.skipChildren(); + } + } + CronTrigger deserializedCronTrigger = new CronTrigger(expression); + deserializedCronTrigger.type = type; + deserializedCronTrigger.timeZone = timeZone; + deserializedCronTrigger.startTime = startTime; + deserializedCronTrigger.endTime = endTime; + return deserializedCronTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CustomCredential.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CustomCredential.java index 01dfba5bcaed..8a89cde1cc5b 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CustomCredential.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CustomCredential.java @@ -9,6 +9,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -24,10 +25,10 @@ public final class CustomCredential extends BaseCredentials { private CredentialType type = CredentialType.CUSTOM; /* - * The credential type + * Custom credential definition */ @Generated - private Map keys; + private Map additionalProperties; /** * Creates an instance of CustomCredential class. @@ -48,13 +49,13 @@ public CredentialType getType() { } /** - * Get the keys property: The credential type. + * Get the additionalProperties property: Custom credential definition. * - * @return the keys value. + * @return the additionalProperties value. */ @Generated - public Map getKeys() { - return this.keys; + public Map getAdditionalProperties() { + return this.additionalProperties; } /** @@ -65,6 +66,11 @@ public Map getKeys() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } return jsonWriter.writeEndObject(); } @@ -74,25 +80,26 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of CustomCredential 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 CustomCredential. */ @Generated public static CustomCredential fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CustomCredential deserializedCustomCredential = new CustomCredential(); + Map additionalProperties = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("keys".equals(fieldName)) { - Map keys = reader.readMap(reader1 -> reader1.getString()); - deserializedCustomCredential.keys = keys; - } else if ("type".equals(fieldName)) { + if ("type".equals(fieldName)) { deserializedCustomCredential.type = CredentialType.fromString(reader.getString()); } else { - reader.skipChildren(); + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + additionalProperties.put(fieldName, reader.getString()); } } + deserializedCustomCredential.additionalProperties = additionalProperties; return deserializedCustomCredential; }); } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DailyRecurrenceSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DailyRecurrenceSchedule.java new file mode 100644 index 000000000000..3ec7ef0d87d0 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DailyRecurrenceSchedule.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; + +/** + * Daily recurrence schedule. + */ +@Immutable +public final class DailyRecurrenceSchedule extends RecurrenceSchedule { + + /* + * Recurrence type for the recurrence schedule. + */ + @Generated + private RecurrenceType type = RecurrenceType.DAILY; + + /* + * Hours for the recurrence schedule. + */ + @Generated + private final List hours; + + /** + * Creates an instance of DailyRecurrenceSchedule class. + * + * @param hours the hours value to set. + */ + @Generated + public DailyRecurrenceSchedule(List hours) { + this.hours = hours; + } + + /** + * Get the type property: Recurrence type for the recurrence schedule. + * + * @return the type value. + */ + @Generated + @Override + public RecurrenceType getType() { + return this.type; + } + + /** + * Get the hours property: Hours for the recurrence schedule. + * + * @return the hours value. + */ + @Generated + public List getHours() { + return this.hours; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("hours", this.hours, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DailyRecurrenceSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DailyRecurrenceSchedule 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 DailyRecurrenceSchedule. + */ + @Generated + public static DailyRecurrenceSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List hours = null; + RecurrenceType type = RecurrenceType.DAILY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("hours".equals(fieldName)) { + hours = reader.readArray(reader1 -> reader1.getInt()); + } else if ("type".equals(fieldName)) { + type = RecurrenceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + DailyRecurrenceSchedule deserializedDailyRecurrenceSchedule = new DailyRecurrenceSchedule(hours); + deserializedDailyRecurrenceSchedule.type = type; + return deserializedDailyRecurrenceSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AssetCredentialResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetCredential.java similarity index 77% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AssetCredentialResult.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetCredential.java index 8e817ec61699..43121d3a3fa8 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/AssetCredentialResult.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetCredential.java @@ -15,7 +15,7 @@ * Represents a reference to a blob for consumption. */ @Immutable -public final class AssetCredentialResult implements JsonSerializable { +public final class DatasetCredential implements JsonSerializable { /* * Credential info to access the storage account. @@ -24,12 +24,12 @@ public final class AssetCredentialResult implements JsonSerializable { BlobReference blobReference = null; while (reader.nextToken() != JsonToken.END_OBJECT) { @@ -76,7 +76,7 @@ public static AssetCredentialResult fromJson(JsonReader jsonReader) throws IOExc reader.skipChildren(); } } - return new AssetCredentialResult(blobReference); + return new DatasetCredential(blobReference); }); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetVersion.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetVersion.java index 423d3f8a68eb..51593ed97f6e 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetVersion.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DatasetVersion.java @@ -28,7 +28,7 @@ public class DatasetVersion implements JsonSerializable { private DatasetType type = DatasetType.fromString("DatasetVersion"); /* - * URI of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330 + * URI of the data ([example](https://go.microsoft.com/fwlink/?linkid=2202330)) */ @Generated private String dataUri; @@ -40,6 +40,13 @@ public class DatasetVersion implements JsonSerializable { @Generated private Boolean isReference; + /* + * The Azure Storage Account connection name. Required if startPendingUploadVersion was not called before creating + * the Dataset + */ + @Generated + private String connectionName; + /* * Asset ID, a unique identifier for the asset */ @@ -158,7 +165,7 @@ public DatasetType getType() { } /** - * Get the dataUri property: URI of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. + * Get the dataUri property: URI of the data ([example](https://go.microsoft.com/fwlink/?linkid=2202330)). * * @return the dataUri value. */ @@ -168,7 +175,7 @@ public String getDataUri() { } /** - * Set the dataUri property: URI of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. + * Set the dataUri property: URI of the data ([example](https://go.microsoft.com/fwlink/?linkid=2202330)). *

Required when create the resource.

* * @param dataUri the dataUri value to set. @@ -192,6 +199,31 @@ public Boolean isReference() { return this.isReference; } + /** + * Get the connectionName property: The Azure Storage Account connection name. Required if startPendingUploadVersion + * was not called before creating the Dataset. + * + * @return the connectionName value. + */ + @Generated + public String getConnectionName() { + return this.connectionName; + } + + /** + * Set the connectionName property: The Azure Storage Account connection name. Required if startPendingUploadVersion + * was not called before creating the Dataset. + * + * @param connectionName the connectionName value to set. + * @return the DatasetVersion object itself. + */ + @Generated + public DatasetVersion setConnectionName(String connectionName) { + this.connectionName = connectionName; + this.updatedProperties.add("connectionName"); + return this; + } + /** * Get the id property: Asset ID, a unique identifier for the asset. * @@ -399,36 +431,4 @@ static DatasetVersion fromJsonKnownDiscriminator(JsonReader jsonReader) throws I return deserializedDatasetVersion; }); } - - /* - * The Azure Storage Account connection name. Required if startPendingUploadVersion was not called before creating - * the Dataset - */ - @Generated - private String connectionName; - - /** - * Get the connectionName property: The Azure Storage Account connection name. Required if startPendingUploadVersion - * was not called before creating the Dataset. - * - * @return the connectionName value. - */ - @Generated - public String getConnectionName() { - return this.connectionName; - } - - /** - * Set the connectionName property: The Azure Storage Account connection name. Required if startPendingUploadVersion - * was not called before creating the Dataset. - * - * @param connectionName the connectionName value to set. - * @return the DatasetVersion object itself. - */ - @Generated - public DatasetVersion setConnectionName(String connectionName) { - this.connectionName = connectionName; - this.updatedProperties.add("connectionName"); - return this; - } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DayOfWeek.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DayOfWeek.java new file mode 100644 index 000000000000..a4c760ae3966 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/DayOfWeek.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; + +/** + * Days of the week for recurrence schedule. + */ +public final class DayOfWeek extends ExpandableStringEnum { + + /** + * Sunday. + */ + @Generated + public static final DayOfWeek SUNDAY = fromString("Sunday"); + + /** + * Monday. + */ + @Generated + public static final DayOfWeek MONDAY = fromString("Monday"); + + /** + * Tuesday. + */ + @Generated + public static final DayOfWeek TUESDAY = fromString("Tuesday"); + + /** + * Wednesday. + */ + @Generated + public static final DayOfWeek WEDNESDAY = fromString("Wednesday"); + + /** + * Thursday. + */ + @Generated + public static final DayOfWeek THURSDAY = fromString("Thursday"); + + /** + * Friday. + */ + @Generated + public static final DayOfWeek FRIDAY = fromString("Friday"); + + /** + * Saturday. + */ + @Generated + public static final DayOfWeek SATURDAY = fromString("Saturday"); + + /** + * Creates a new instance of DayOfWeek value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DayOfWeek() { + } + + /** + * Creates or finds a DayOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DayOfWeek. + */ + @Generated + public static DayOfWeek fromString(String name) { + return fromString(name, DayOfWeek.class); + } + + /** + * Gets known DayOfWeek values. + * + * @return known DayOfWeek values. + */ + @Generated + public static Collection values() { + return values(DayOfWeek.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIDCredentials.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIdCredentials.java similarity index 76% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIDCredentials.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIdCredentials.java index af7b607d26bc..26a92c9af957 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIDCredentials.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EntraIdCredentials.java @@ -14,7 +14,7 @@ * Entra ID credential definition. */ @Immutable -public final class EntraIDCredentials extends BaseCredentials { +public final class EntraIdCredentials extends BaseCredentials { /* * The type of credential used by the connection @@ -23,10 +23,10 @@ public final class EntraIDCredentials extends BaseCredentials { private CredentialType type = CredentialType.ENTRA_ID; /** - * Creates an instance of EntraIDCredentials class. + * Creates an instance of EntraIdCredentials class. */ @Generated - private EntraIDCredentials() { + private EntraIdCredentials() { } /** @@ -52,27 +52,27 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of EntraIDCredentials from the JsonReader. + * Reads an instance of EntraIdCredentials from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of EntraIDCredentials if the JsonReader was pointing to an instance of it, or null if it was + * @return An instance of EntraIdCredentials 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 EntraIDCredentials. + * @throws IOException If an error occurs while reading the EntraIdCredentials. */ @Generated - public static EntraIDCredentials fromJson(JsonReader jsonReader) throws IOException { + public static EntraIdCredentials fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - EntraIDCredentials deserializedEntraIDCredentials = new EntraIDCredentials(); + EntraIdCredentials deserializedEntraIdCredentials = new EntraIdCredentials(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("type".equals(fieldName)) { - deserializedEntraIDCredentials.type = CredentialType.fromString(reader.getString()); + deserializedEntraIdCredentials.type = CredentialType.fromString(reader.getString()); } else { reader.skipChildren(); } } - return deserializedEntraIDCredentials; + return deserializedEntraIdCredentials; }); } } 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 deleted file mode 100644 index 1032f4c2d403..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Evaluation.java +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (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 Definition. - */ -@Fluent -public final class Evaluation implements JsonSerializable { - - /* - * Identifier of the evaluation. - */ - @Generated - private String name; - - /* - * Data for evaluation. - */ - @Generated - private final InputData data; - - /* - * 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; - - /* - * 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 final Map evaluators; - - /** - * Creates an instance of Evaluation class. - * - * @param data the data value to set. - * @param evaluators the evaluators value to set. - */ - @Generated - public Evaluation(InputData data, Map evaluators) { - this.data = data; - this.evaluators = evaluators; - } - - /** - * Get the name property: Identifier of 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 InputData getData() { - return this.data; - } - - /** - * 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; - 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; - return this; - } - - /** - * 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; - 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; - return this; - } - - /** - * Get the evaluators property: Evaluators to be used for the evaluation. - * - * @return the evaluators value. - */ - @Generated - public Map getEvaluators() { - return this.evaluators; - } - - /** - * {@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.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)); - 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 -> { - String name = null; - InputData data = null; - Map evaluators = null; - String displayName = null; - String description = null; - String status = null; - Map tags = null; - Map properties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("id".equals(fieldName)) { - name = reader.getString(); - } else if ("data".equals(fieldName)) { - data = InputData.fromJson(reader); - } else if ("evaluators".equals(fieldName)) { - evaluators = reader.readMap(reader1 -> EvaluatorConfiguration.fromJson(reader1)); - } else if ("displayName".equals(fieldName)) { - displayName = reader.getString(); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else if ("status".equals(fieldName)) { - status = 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 { - reader.skipChildren(); - } - } - Evaluation deserializedEvaluation = new Evaluation(data, evaluators); - deserializedEvaluation.name = name; - deserializedEvaluation.displayName = displayName; - deserializedEvaluation.description = description; - deserializedEvaluation.status = status; - deserializedEvaluation.tags = tags; - deserializedEvaluation.properties = properties; - return deserializedEvaluation; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationCompareReport.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationCompareReport.java new file mode 100644 index 000000000000..45b5b350f616 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationCompareReport.java @@ -0,0 +1,128 @@ +// Copyright (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; + +/** + * Insights from the evaluation comparison. + */ +@Immutable +public final class EvaluationCompareReport extends InsightResult { + + /* + * The type of insights result. + */ + @Generated + private InsightType type = InsightType.EVALUATION_COMPARISON; + + /* + * Comparison results for each treatment run against the baseline. + */ + @Generated + private final List comparisons; + + /* + * The statistical method used for comparison. + */ + @Generated + private final String method; + + /** + * Creates an instance of EvaluationCompareReport class. + * + * @param comparisons the comparisons value to set. + * @param method the method value to set. + */ + @Generated + private EvaluationCompareReport(List comparisons, String method) { + this.comparisons = comparisons; + this.method = method; + } + + /** + * Get the type property: The type of insights result. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the comparisons property: Comparison results for each treatment run against the baseline. + * + * @return the comparisons value. + */ + @Generated + public List getComparisons() { + return this.comparisons; + } + + /** + * Get the method property: The statistical method used for comparison. + * + * @return the method value. + */ + @Generated + public String getMethod() { + return this.method; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("comparisons", this.comparisons, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("method", this.method); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationCompareReport from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationCompareReport 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 EvaluationCompareReport. + */ + @Generated + public static EvaluationCompareReport fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List comparisons = null; + String method = null; + InsightType type = InsightType.EVALUATION_COMPARISON; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("comparisons".equals(fieldName)) { + comparisons = reader.readArray(reader1 -> EvaluationRunResultComparison.fromJson(reader1)); + } else if ("method".equals(fieldName)) { + method = reader.getString(); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationCompareReport deserializedEvaluationCompareReport + = new EvaluationCompareReport(comparisons, method); + deserializedEvaluationCompareReport.type = type; + return deserializedEvaluationCompareReport; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationComparisonRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationComparisonRequest.java new file mode 100644 index 000000000000..0e2d6fb6d8b7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationComparisonRequest.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.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; + +/** + * Evaluation Comparison Request. + */ +@Immutable +public final class EvaluationComparisonRequest extends InsightRequest { + + /* + * The type of request. + */ + @Generated + private InsightType type = InsightType.EVALUATION_COMPARISON; + + /* + * Identifier for the evaluation. + */ + @Generated + private final String evalId; + + /* + * The baseline run ID for comparison. + */ + @Generated + private final String baselineRunId; + + /* + * List of treatment run IDs for comparison. + */ + @Generated + private final List treatmentRunIds; + + /** + * Creates an instance of EvaluationComparisonRequest class. + * + * @param evalId the evalId value to set. + * @param baselineRunId the baselineRunId value to set. + * @param treatmentRunIds the treatmentRunIds value to set. + */ + @Generated + public EvaluationComparisonRequest(String evalId, String baselineRunId, List treatmentRunIds) { + this.evalId = evalId; + this.baselineRunId = baselineRunId; + this.treatmentRunIds = treatmentRunIds; + } + + /** + * Get the type property: The type of request. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the evalId property: Identifier for the evaluation. + * + * @return the evalId value. + */ + @Generated + public String getEvalId() { + return this.evalId; + } + + /** + * Get the baselineRunId property: The baseline run ID for comparison. + * + * @return the baselineRunId value. + */ + @Generated + public String getBaselineRunId() { + return this.baselineRunId; + } + + /** + * Get the treatmentRunIds property: List of treatment run IDs for comparison. + * + * @return the treatmentRunIds value. + */ + @Generated + public List getTreatmentRunIds() { + return this.treatmentRunIds; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("evalId", this.evalId); + jsonWriter.writeStringField("baselineRunId", this.baselineRunId); + jsonWriter.writeArrayField("treatmentRunIds", this.treatmentRunIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationComparisonRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationComparisonRequest 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 EvaluationComparisonRequest. + */ + @Generated + public static EvaluationComparisonRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String evalId = null; + String baselineRunId = null; + List treatmentRunIds = null; + InsightType type = InsightType.EVALUATION_COMPARISON; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("evalId".equals(fieldName)) { + evalId = reader.getString(); + } else if ("baselineRunId".equals(fieldName)) { + baselineRunId = reader.getString(); + } else if ("treatmentRunIds".equals(fieldName)) { + treatmentRunIds = reader.readArray(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationComparisonRequest deserializedEvaluationComparisonRequest + = new EvaluationComparisonRequest(evalId, baselineRunId, treatmentRunIds); + deserializedEvaluationComparisonRequest.type = type; + return deserializedEvaluationComparisonRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResult.java new file mode 100644 index 000000000000..7a9ed40859a6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResult.java @@ -0,0 +1,148 @@ +// Copyright (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; + +/** + * Result of the evaluation. + */ +@Immutable +public final class EvaluationResult implements JsonSerializable { + + /* + * name of the check + */ + @Generated + private final String name; + + /* + * type of the check + */ + @Generated + private final String type; + + /* + * score + */ + @Generated + private final double score; + + /* + * indicates if the check passed or failed + */ + @Generated + private final boolean passed; + + /** + * Creates an instance of EvaluationResult class. + * + * @param name the name value to set. + * @param type the type value to set. + * @param score the score value to set. + * @param passed the passed value to set. + */ + @Generated + private EvaluationResult(String name, String type, double score, boolean passed) { + this.name = name; + this.type = type; + this.score = score; + this.passed = passed; + } + + /** + * Get the name property: name of the check. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the type property: type of the check. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the score property: score. + * + * @return the score value. + */ + @Generated + public double getScore() { + return this.score; + } + + /** + * Get the passed property: indicates if the check passed or failed. + * + * @return the passed value. + */ + @Generated + public boolean isPassed() { + return this.passed; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeDoubleField("score", this.score); + jsonWriter.writeBooleanField("passed", this.passed); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationResult 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 EvaluationResult. + */ + @Generated + public static EvaluationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String type = null; + double score = 0.0; + boolean passed = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("score".equals(fieldName)) { + score = reader.getDouble(); + } else if ("passed".equals(fieldName)) { + passed = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new EvaluationResult(name, type, score, passed); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResultSample.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResultSample.java new file mode 100644 index 000000000000..5a7d637f2395 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationResultSample.java @@ -0,0 +1,128 @@ +// Copyright (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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * A sample from the evaluation result. + */ +@Immutable +public final class EvaluationResultSample extends InsightSample { + + /* + * Sample type + */ + @Generated + private SampleType type = SampleType.EVALUATION_RESULT_SAMPLE; + + /* + * Evaluation result for the analysis sample. + */ + @Generated + private final EvaluationResult evaluationResult; + + /** + * Get the type property: Sample type. + * + * @return the type value. + */ + @Generated + @Override + public SampleType getType() { + return this.type; + } + + /** + * Get the evaluationResult property: Evaluation result for the analysis sample. + * + * @return the evaluationResult value. + */ + @Generated + public EvaluationResult getEvaluationResult() { + return this.evaluationResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeMapField("features", getFeatures(), + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeMapField("correlationInfo", getCorrelationInfo(), + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeJsonField("evaluationResult", this.evaluationResult); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationResultSample from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationResultSample 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 EvaluationResultSample. + */ + @Generated + public static EvaluationResultSample fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map features = null; + Map correlationInfo = null; + EvaluationResult evaluationResult = null; + SampleType type = SampleType.EVALUATION_RESULT_SAMPLE; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("features".equals(fieldName)) { + features = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("correlationInfo".equals(fieldName)) { + correlationInfo = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("evaluationResult".equals(fieldName)) { + evaluationResult = EvaluationResult.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = SampleType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationResultSample deserializedEvaluationResultSample + = new EvaluationResultSample(id, features, correlationInfo, evaluationResult); + deserializedEvaluationResultSample.type = type; + return deserializedEvaluationResultSample; + }); + } + + /** + * Creates an instance of EvaluationResultSample class. + * + * @param id the id value to set. + * @param features the features value to set. + * @param correlationInfo the correlationInfo value to set. + * @param evaluationResult the evaluationResult value to set. + */ + @Generated + private EvaluationResultSample(String id, Map features, Map correlationInfo, + EvaluationResult evaluationResult) { + super(id, features, correlationInfo); + this.evaluationResult = evaluationResult; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRule.java new file mode 100644 index 000000000000..0d80e2747187 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRule.java @@ -0,0 +1,267 @@ +// Copyright (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 rule model. + */ +@Fluent +public final class EvaluationRule implements JsonSerializable { + + /* + * Unique identifier for the evaluation rule. + */ + @Generated + private String id; + + /* + * Display Name for the evaluation rule. + */ + @Generated + private String displayName; + + /* + * Description for the evaluation rule. + */ + @Generated + private String description; + + /* + * Definition of the evaluation rule action. + */ + @Generated + private final EvaluationRuleAction action; + + /* + * Filter condition of the evaluation rule. + */ + @Generated + private EvaluationRuleFilter filter; + + /* + * Event type that the evaluation rule applies to. + */ + @Generated + private final EvaluationRuleEventType eventType; + + /* + * Indicates whether the evaluation rule is enabled. Default is true. + */ + @Generated + private final boolean enabled; + + /* + * System metadata for the evaluation rule. + */ + @Generated + private Map systemData; + + /** + * Creates an instance of EvaluationRule class. + * + * @param action the action value to set. + * @param eventType the eventType value to set. + * @param enabled the enabled value to set. + */ + @Generated + public EvaluationRule(EvaluationRuleAction action, EvaluationRuleEventType eventType, boolean enabled) { + this.action = action; + this.eventType = eventType; + this.enabled = enabled; + } + + /** + * Get the id property: Unique identifier for the evaluation rule. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the displayName property: Display Name for the evaluation rule. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display Name for the evaluation rule. + * + * @param displayName the displayName value to set. + * @return the EvaluationRule object itself. + */ + @Generated + public EvaluationRule setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Description for the evaluation rule. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description for the evaluation rule. + * + * @param description the description value to set. + * @return the EvaluationRule object itself. + */ + @Generated + public EvaluationRule setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action property: Definition of the evaluation rule action. + * + * @return the action value. + */ + @Generated + public EvaluationRuleAction getAction() { + return this.action; + } + + /** + * Get the filter property: Filter condition of the evaluation rule. + * + * @return the filter value. + */ + @Generated + public EvaluationRuleFilter getFilter() { + return this.filter; + } + + /** + * Set the filter property: Filter condition of the evaluation rule. + * + * @param filter the filter value to set. + * @return the EvaluationRule object itself. + */ + @Generated + public EvaluationRule setFilter(EvaluationRuleFilter filter) { + this.filter = filter; + return this; + } + + /** + * Get the eventType property: Event type that the evaluation rule applies to. + * + * @return the eventType value. + */ + @Generated + public EvaluationRuleEventType getEventType() { + return this.eventType; + } + + /** + * Get the enabled property: Indicates whether the evaluation rule is enabled. Default is true. + * + * @return the enabled value. + */ + @Generated + public boolean isEnabled() { + return this.enabled; + } + + /** + * Get the systemData property: System metadata for the evaluation rule. + * + * @return the systemData value. + */ + @Generated + public Map getSystemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("action", this.action); + jsonWriter.writeStringField("eventType", this.eventType == null ? null : this.eventType.toString()); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("filter", this.filter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRule 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 EvaluationRule. + */ + @Generated + public static EvaluationRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + EvaluationRuleAction action = null; + EvaluationRuleEventType eventType = null; + boolean enabled = false; + Map systemData = null; + String displayName = null; + String description = null; + EvaluationRuleFilter filter = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("action".equals(fieldName)) { + action = EvaluationRuleAction.fromJson(reader); + } else if ("eventType".equals(fieldName)) { + eventType = EvaluationRuleEventType.fromString(reader.getString()); + } else if ("enabled".equals(fieldName)) { + enabled = reader.getBoolean(); + } else if ("systemData".equals(fieldName)) { + systemData = reader.readMap(reader1 -> reader1.getString()); + } else if ("displayName".equals(fieldName)) { + displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("filter".equals(fieldName)) { + filter = EvaluationRuleFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + EvaluationRule deserializedEvaluationRule = new EvaluationRule(action, eventType, enabled); + deserializedEvaluationRule.id = id; + deserializedEvaluationRule.systemData = systemData; + deserializedEvaluationRule.displayName = displayName; + deserializedEvaluationRule.description = description; + deserializedEvaluationRule.filter = filter; + return deserializedEvaluationRule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleAction.java new file mode 100644 index 000000000000..7cdb2a32e2f9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleAction.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; + +/** + * Evaluation action model. + */ +@Immutable +public class EvaluationRuleAction implements JsonSerializable { + + /* + * Type of the evaluation action. + */ + @Generated + private EvaluationRuleActionType type = EvaluationRuleActionType.fromString("EvaluationRuleAction"); + + /** + * Creates an instance of EvaluationRuleAction class. + */ + @Generated + public EvaluationRuleAction() { + } + + /** + * Get the type property: Type of the evaluation action. + * + * @return the type value. + */ + @Generated + public EvaluationRuleActionType 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 EvaluationRuleAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRuleAction 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 EvaluationRuleAction. + */ + @Generated + public static EvaluationRuleAction 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 ("continuousEvaluation".equals(discriminatorValue)) { + return ContinuousEvaluationRuleAction.fromJson(readerToUse.reset()); + } else if ("humanEvaluation".equals(discriminatorValue)) { + return HumanEvaluationRuleAction.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static EvaluationRuleAction fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluationRuleAction deserializedEvaluationRuleAction = new EvaluationRuleAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedEvaluationRuleAction.type = EvaluationRuleActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedEvaluationRuleAction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleActionType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleActionType.java new file mode 100644 index 000000000000..8fd3f470b932 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleActionType.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; + +/** + * Type of the evaluation action. + */ +public final class EvaluationRuleActionType extends ExpandableStringEnum { + + /** + * Continuous evaluation. + */ + @Generated + public static final EvaluationRuleActionType CONTINUOUS_EVALUATION = fromString("continuousEvaluation"); + + /** + * Human evaluation. + */ + @Generated + public static final EvaluationRuleActionType HUMAN_EVALUATION = fromString("humanEvaluation"); + + /** + * Creates a new instance of EvaluationRuleActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluationRuleActionType() { + } + + /** + * Creates or finds a EvaluationRuleActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluationRuleActionType. + */ + @Generated + public static EvaluationRuleActionType fromString(String name) { + return fromString(name, EvaluationRuleActionType.class); + } + + /** + * Gets known EvaluationRuleActionType values. + * + * @return known EvaluationRuleActionType values. + */ + @Generated + public static Collection values() { + return values(EvaluationRuleActionType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleEventType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleEventType.java new file mode 100644 index 000000000000..4ef80a6467f6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleEventType.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; + +/** + * Type of the evaluation rule event. + */ +public final class EvaluationRuleEventType extends ExpandableStringEnum { + + /** + * Response completed. + */ + @Generated + public static final EvaluationRuleEventType RESPONSE_COMPLETED = fromString("responseCompleted"); + + /** + * Manual trigger. + */ + @Generated + public static final EvaluationRuleEventType MANUAL = fromString("manual"); + + /** + * Creates a new instance of EvaluationRuleEventType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluationRuleEventType() { + } + + /** + * Creates or finds a EvaluationRuleEventType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluationRuleEventType. + */ + @Generated + public static EvaluationRuleEventType fromString(String name) { + return fromString(name, EvaluationRuleEventType.class); + } + + /** + * Gets known EvaluationRuleEventType values. + * + * @return known EvaluationRuleEventType values. + */ + @Generated + public static Collection values() { + return values(EvaluationRuleEventType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleFilter.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleFilter.java new file mode 100644 index 000000000000..c3faaa8d1737 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRuleFilter.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; + +/** + * Evaluation filter model. + */ +@Immutable +public final class EvaluationRuleFilter implements JsonSerializable { + + /* + * Filter by agent name. + */ + @Generated + private final String agentName; + + /** + * Creates an instance of EvaluationRuleFilter class. + * + * @param agentName the agentName value to set. + */ + @Generated + public EvaluationRuleFilter(String agentName) { + this.agentName = agentName; + } + + /** + * Get the agentName property: Filter by agent name. + * + * @return the agentName value. + */ + @Generated + public String getAgentName() { + return this.agentName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("agentName", this.agentName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRuleFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRuleFilter 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 EvaluationRuleFilter. + */ + @Generated + public static EvaluationRuleFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String agentName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("agentName".equals(fieldName)) { + agentName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new EvaluationRuleFilter(agentName); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightResult.java new file mode 100644 index 000000000000..6cba63247989 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightResult.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; + +/** + * Insights from the evaluation run cluster analysis. + */ +@Immutable +public final class EvaluationRunClusterInsightResult extends InsightResult { + + /* + * The type of insights result. + */ + @Generated + private InsightType type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT; + + /* + * The clusterInsight property. + */ + @Generated + private final ClusterInsightResult clusterInsight; + + /** + * Creates an instance of EvaluationRunClusterInsightResult class. + * + * @param clusterInsight the clusterInsight value to set. + */ + @Generated + private EvaluationRunClusterInsightResult(ClusterInsightResult clusterInsight) { + this.clusterInsight = clusterInsight; + } + + /** + * Get the type property: The type of insights result. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the clusterInsight property: The clusterInsight property. + * + * @return the clusterInsight value. + */ + @Generated + public ClusterInsightResult getClusterInsight() { + return this.clusterInsight; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("clusterInsight", this.clusterInsight); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRunClusterInsightResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRunClusterInsightResult 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 EvaluationRunClusterInsightResult. + */ + @Generated + public static EvaluationRunClusterInsightResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClusterInsightResult clusterInsight = null; + InsightType type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("clusterInsight".equals(fieldName)) { + clusterInsight = ClusterInsightResult.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationRunClusterInsightResult deserializedEvaluationRunClusterInsightResult + = new EvaluationRunClusterInsightResult(clusterInsight); + deserializedEvaluationRunClusterInsightResult.type = type; + return deserializedEvaluationRunClusterInsightResult; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightsRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightsRequest.java new file mode 100644 index 000000000000..5d5bff977b20 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightsRequest.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.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; +import java.util.List; + +/** + * Insights on set of Evaluation Results. + */ +@Fluent +public final class EvaluationRunClusterInsightsRequest extends InsightRequest { + + /* + * The type of request. + */ + @Generated + private InsightType type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT; + + /* + * Evaluation Id for the insights. + */ + @Generated + private final String evalId; + + /* + * List of evaluation run IDs for the insights. + */ + @Generated + private final List runIds; + + /* + * Configuration of the model used in the insight generation. + */ + @Generated + private InsightModelConfiguration modelConfiguration; + + /** + * Creates an instance of EvaluationRunClusterInsightsRequest class. + * + * @param evalId the evalId value to set. + * @param runIds the runIds value to set. + */ + @Generated + public EvaluationRunClusterInsightsRequest(String evalId, List runIds) { + this.evalId = evalId; + this.runIds = runIds; + } + + /** + * Get the type property: The type of request. + * + * @return the type value. + */ + @Generated + @Override + public InsightType getType() { + return this.type; + } + + /** + * Get the evalId property: Evaluation Id for the insights. + * + * @return the evalId value. + */ + @Generated + public String getEvalId() { + return this.evalId; + } + + /** + * Get the runIds property: List of evaluation run IDs for the insights. + * + * @return the runIds value. + */ + @Generated + public List getRunIds() { + return this.runIds; + } + + /** + * Get the modelConfiguration property: Configuration of the model used in the insight generation. + * + * @return the modelConfiguration value. + */ + @Generated + public InsightModelConfiguration getModelConfiguration() { + return this.modelConfiguration; + } + + /** + * Set the modelConfiguration property: Configuration of the model used in the insight generation. + * + * @param modelConfiguration the modelConfiguration value to set. + * @return the EvaluationRunClusterInsightsRequest object itself. + */ + @Generated + public EvaluationRunClusterInsightsRequest setModelConfiguration(InsightModelConfiguration modelConfiguration) { + this.modelConfiguration = modelConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("evalId", this.evalId); + jsonWriter.writeArrayField("runIds", this.runIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("modelConfiguration", this.modelConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRunClusterInsightsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRunClusterInsightsRequest 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 EvaluationRunClusterInsightsRequest. + */ + @Generated + public static EvaluationRunClusterInsightsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String evalId = null; + List runIds = null; + InsightType type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT; + InsightModelConfiguration modelConfiguration = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("evalId".equals(fieldName)) { + evalId = reader.getString(); + } else if ("runIds".equals(fieldName)) { + runIds = reader.readArray(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = InsightType.fromString(reader.getString()); + } else if ("modelConfiguration".equals(fieldName)) { + modelConfiguration = InsightModelConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + EvaluationRunClusterInsightsRequest deserializedEvaluationRunClusterInsightsRequest + = new EvaluationRunClusterInsightsRequest(evalId, runIds); + deserializedEvaluationRunClusterInsightsRequest.type = type; + deserializedEvaluationRunClusterInsightsRequest.modelConfiguration = modelConfiguration; + return deserializedEvaluationRunClusterInsightsRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultCompareItem.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultCompareItem.java new file mode 100644 index 000000000000..73f6f508dfea --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultCompareItem.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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Metric comparison for a treatment against the baseline. + */ +@Immutable +public final class EvaluationRunResultCompareItem implements JsonSerializable { + + /* + * The treatment run ID. + */ + @Generated + private final String treatmentRunId; + + /* + * Summary statistics of the treatment run. + */ + @Generated + private final EvaluationRunResultSummary treatmentRunSummary; + + /* + * Estimated difference between treatment and baseline. + */ + @Generated + private final double deltaEstimate; + + /* + * P-value for the treatment effect. + */ + @Generated + private final double pValue; + + /* + * Type of treatment effect. + */ + @Generated + private final TreatmentEffectType treatmentEffect; + + /** + * Creates an instance of EvaluationRunResultCompareItem class. + * + * @param treatmentRunId the treatmentRunId value to set. + * @param treatmentRunSummary the treatmentRunSummary value to set. + * @param deltaEstimate the deltaEstimate value to set. + * @param pValue the pValue value to set. + * @param treatmentEffect the treatmentEffect value to set. + */ + @Generated + private EvaluationRunResultCompareItem(String treatmentRunId, EvaluationRunResultSummary treatmentRunSummary, + double deltaEstimate, double pValue, TreatmentEffectType treatmentEffect) { + this.treatmentRunId = treatmentRunId; + this.treatmentRunSummary = treatmentRunSummary; + this.deltaEstimate = deltaEstimate; + this.pValue = pValue; + this.treatmentEffect = treatmentEffect; + } + + /** + * Get the treatmentRunId property: The treatment run ID. + * + * @return the treatmentRunId value. + */ + @Generated + public String getTreatmentRunId() { + return this.treatmentRunId; + } + + /** + * Get the treatmentRunSummary property: Summary statistics of the treatment run. + * + * @return the treatmentRunSummary value. + */ + @Generated + public EvaluationRunResultSummary getTreatmentRunSummary() { + return this.treatmentRunSummary; + } + + /** + * Get the deltaEstimate property: Estimated difference between treatment and baseline. + * + * @return the deltaEstimate value. + */ + @Generated + public double getDeltaEstimate() { + return this.deltaEstimate; + } + + /** + * Get the pValue property: P-value for the treatment effect. + * + * @return the pValue value. + */ + @Generated + public double getPValue() { + return this.pValue; + } + + /** + * Get the treatmentEffect property: Type of treatment effect. + * + * @return the treatmentEffect value. + */ + @Generated + public TreatmentEffectType getTreatmentEffect() { + return this.treatmentEffect; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("treatmentRunId", this.treatmentRunId); + jsonWriter.writeJsonField("treatmentRunSummary", this.treatmentRunSummary); + jsonWriter.writeDoubleField("deltaEstimate", this.deltaEstimate); + jsonWriter.writeDoubleField("pValue", this.pValue); + jsonWriter.writeStringField("treatmentEffect", + this.treatmentEffect == null ? null : this.treatmentEffect.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRunResultCompareItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRunResultCompareItem 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 EvaluationRunResultCompareItem. + */ + @Generated + public static EvaluationRunResultCompareItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String treatmentRunId = null; + EvaluationRunResultSummary treatmentRunSummary = null; + double deltaEstimate = 0.0; + double pValue = 0.0; + TreatmentEffectType treatmentEffect = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("treatmentRunId".equals(fieldName)) { + treatmentRunId = reader.getString(); + } else if ("treatmentRunSummary".equals(fieldName)) { + treatmentRunSummary = EvaluationRunResultSummary.fromJson(reader); + } else if ("deltaEstimate".equals(fieldName)) { + deltaEstimate = reader.getDouble(); + } else if ("pValue".equals(fieldName)) { + pValue = reader.getDouble(); + } else if ("treatmentEffect".equals(fieldName)) { + treatmentEffect = TreatmentEffectType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new EvaluationRunResultCompareItem(treatmentRunId, treatmentRunSummary, deltaEstimate, pValue, + treatmentEffect); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultComparison.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultComparison.java new file mode 100644 index 000000000000..4a4dddfdba92 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultComparison.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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Comparison results for treatment runs against the baseline. + */ +@Immutable +public final class EvaluationRunResultComparison implements JsonSerializable { + + /* + * Name of the testing criteria. + */ + @Generated + private final String testingCriteria; + + /* + * Metric being evaluated. + */ + @Generated + private final String metric; + + /* + * Name of the evaluator for this testing criteria. + */ + @Generated + private final String evaluator; + + /* + * Summary statistics of the baseline run. + */ + @Generated + private final EvaluationRunResultSummary baselineRunSummary; + + /* + * List of comparison results for each treatment run. + */ + @Generated + private final List compareItems; + + /** + * Creates an instance of EvaluationRunResultComparison class. + * + * @param testingCriteria the testingCriteria value to set. + * @param metric the metric value to set. + * @param evaluator the evaluator value to set. + * @param baselineRunSummary the baselineRunSummary value to set. + * @param compareItems the compareItems value to set. + */ + @Generated + private EvaluationRunResultComparison(String testingCriteria, String metric, String evaluator, + EvaluationRunResultSummary baselineRunSummary, List compareItems) { + this.testingCriteria = testingCriteria; + this.metric = metric; + this.evaluator = evaluator; + this.baselineRunSummary = baselineRunSummary; + this.compareItems = compareItems; + } + + /** + * Get the testingCriteria property: Name of the testing criteria. + * + * @return the testingCriteria value. + */ + @Generated + public String getTestingCriteria() { + return this.testingCriteria; + } + + /** + * Get the metric property: Metric being evaluated. + * + * @return the metric value. + */ + @Generated + public String getMetric() { + return this.metric; + } + + /** + * Get the evaluator property: Name of the evaluator for this testing criteria. + * + * @return the evaluator value. + */ + @Generated + public String getEvaluator() { + return this.evaluator; + } + + /** + * Get the baselineRunSummary property: Summary statistics of the baseline run. + * + * @return the baselineRunSummary value. + */ + @Generated + public EvaluationRunResultSummary getBaselineRunSummary() { + return this.baselineRunSummary; + } + + /** + * Get the compareItems property: List of comparison results for each treatment run. + * + * @return the compareItems value. + */ + @Generated + public List getCompareItems() { + return this.compareItems; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("testingCriteria", this.testingCriteria); + jsonWriter.writeStringField("metric", this.metric); + jsonWriter.writeStringField("evaluator", this.evaluator); + jsonWriter.writeJsonField("baselineRunSummary", this.baselineRunSummary); + jsonWriter.writeArrayField("compareItems", this.compareItems, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRunResultComparison from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRunResultComparison 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 EvaluationRunResultComparison. + */ + @Generated + public static EvaluationRunResultComparison fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String testingCriteria = null; + String metric = null; + String evaluator = null; + EvaluationRunResultSummary baselineRunSummary = null; + List compareItems = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("testingCriteria".equals(fieldName)) { + testingCriteria = reader.getString(); + } else if ("metric".equals(fieldName)) { + metric = reader.getString(); + } else if ("evaluator".equals(fieldName)) { + evaluator = reader.getString(); + } else if ("baselineRunSummary".equals(fieldName)) { + baselineRunSummary = EvaluationRunResultSummary.fromJson(reader); + } else if ("compareItems".equals(fieldName)) { + compareItems = reader.readArray(reader1 -> EvaluationRunResultCompareItem.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new EvaluationRunResultComparison(testingCriteria, metric, evaluator, baselineRunSummary, + compareItems); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultSummary.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultSummary.java new file mode 100644 index 000000000000..81b1a9a4629f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationRunResultSummary.java @@ -0,0 +1,148 @@ +// Copyright (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; + +/** + * Summary statistics of a metric in an evaluation run. + */ +@Immutable +public final class EvaluationRunResultSummary implements JsonSerializable { + + /* + * The evaluation run ID. + */ + @Generated + private final String runId; + + /* + * Number of samples in the evaluation run. + */ + @Generated + private final int sampleCount; + + /* + * Average value of the metric in the evaluation run. + */ + @Generated + private final double average; + + /* + * Standard deviation of the metric in the evaluation run. + */ + @Generated + private final double standardDeviation; + + /** + * Creates an instance of EvaluationRunResultSummary class. + * + * @param runId the runId value to set. + * @param sampleCount the sampleCount value to set. + * @param average the average value to set. + * @param standardDeviation the standardDeviation value to set. + */ + @Generated + private EvaluationRunResultSummary(String runId, int sampleCount, double average, double standardDeviation) { + this.runId = runId; + this.sampleCount = sampleCount; + this.average = average; + this.standardDeviation = standardDeviation; + } + + /** + * Get the runId property: The evaluation run ID. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } + + /** + * Get the sampleCount property: Number of samples in the evaluation run. + * + * @return the sampleCount value. + */ + @Generated + public int getSampleCount() { + return this.sampleCount; + } + + /** + * Get the average property: Average value of the metric in the evaluation run. + * + * @return the average value. + */ + @Generated + public double getAverage() { + return this.average; + } + + /** + * Get the standardDeviation property: Standard deviation of the metric in the evaluation run. + * + * @return the standardDeviation value. + */ + @Generated + public double getStandardDeviation() { + return this.standardDeviation; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("runId", this.runId); + jsonWriter.writeIntField("sampleCount", this.sampleCount); + jsonWriter.writeDoubleField("average", this.average); + jsonWriter.writeDoubleField("standardDeviation", this.standardDeviation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationRunResultSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationRunResultSummary 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 EvaluationRunResultSummary. + */ + @Generated + public static EvaluationRunResultSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String runId = null; + int sampleCount = 0; + double average = 0.0; + double standardDeviation = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("runId".equals(fieldName)) { + runId = reader.getString(); + } else if ("sampleCount".equals(fieldName)) { + sampleCount = reader.getInt(); + } else if ("average".equals(fieldName)) { + average = reader.getDouble(); + } else if ("standardDeviation".equals(fieldName)) { + standardDeviation = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new EvaluationRunResultSummary(runId, sampleCount, average, standardDeviation); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTask.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTask.java new file mode 100644 index 000000000000..42e060998a3d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTask.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Evaluation task for the schedule. + */ +@Fluent +public final class EvaluationScheduleTask extends ScheduleTask { + + /* + * Type of the task. + */ + @Generated + private ScheduleTaskType type = ScheduleTaskType.EVALUATION; + + /* + * Identifier of the evaluation group. + */ + @Generated + private final String evalId; + + /* + * The evaluation run payload. + */ + @Generated + private final EvaluationScheduleTaskEvalRun evalRun; + + /** + * Creates an instance of EvaluationScheduleTask class. + * + * @param evalId the evalId value to set. + * @param evalRun the evalRun value to set. + */ + @Generated + public EvaluationScheduleTask(String evalId, EvaluationScheduleTaskEvalRun evalRun) { + this.evalId = evalId; + this.evalRun = evalRun; + } + + /** + * Get the type property: Type of the task. + * + * @return the type value. + */ + @Generated + @Override + public ScheduleTaskType getType() { + return this.type; + } + + /** + * Get the evalId property: Identifier of the evaluation group. + * + * @return the evalId value. + */ + @Generated + public String getEvalId() { + return this.evalId; + } + + /** + * Get the evalRun property: The evaluation run payload. + * + * @return the evalRun value. + */ + @Generated + public EvaluationScheduleTaskEvalRun getEvalRun() { + return this.evalRun; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EvaluationScheduleTask setConfiguration(Map configuration) { + super.setConfiguration(configuration); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("configuration", getConfiguration(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("evalId", this.evalId); + jsonWriter.writeJsonField("evalRun", this.evalRun); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationScheduleTask from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationScheduleTask 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 EvaluationScheduleTask. + */ + @Generated + public static EvaluationScheduleTask fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map configuration = null; + String evalId = null; + EvaluationScheduleTaskEvalRun evalRun = null; + ScheduleTaskType type = ScheduleTaskType.EVALUATION; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("configuration".equals(fieldName)) { + configuration = reader.readMap(reader1 -> reader1.getString()); + } else if ("evalId".equals(fieldName)) { + evalId = reader.getString(); + } else if ("evalRun".equals(fieldName)) { + evalRun = EvaluationScheduleTaskEvalRun.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = ScheduleTaskType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationScheduleTask deserializedEvaluationScheduleTask = new EvaluationScheduleTask(evalId, evalRun); + deserializedEvaluationScheduleTask.setConfiguration(configuration); + deserializedEvaluationScheduleTask.type = type; + return deserializedEvaluationScheduleTask; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTaskEvalRun.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTaskEvalRun.java new file mode 100644 index 000000000000..13f12e468e87 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationScheduleTaskEvalRun.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.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 EvaluationScheduleTaskEvalRun model. + */ +@Immutable +public final class EvaluationScheduleTaskEvalRun implements JsonSerializable { + + /** + * Creates an instance of EvaluationScheduleTaskEvalRun class. + */ + @Generated + public EvaluationScheduleTaskEvalRun() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationScheduleTaskEvalRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationScheduleTaskEvalRun 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 EvaluationScheduleTaskEvalRun. + */ + @Generated + public static EvaluationScheduleTaskEvalRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluationScheduleTaskEvalRun deserializedEvaluationScheduleTaskEvalRun + = new EvaluationScheduleTaskEvalRun(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + reader.skipChildren(); + } + return deserializedEvaluationScheduleTaskEvalRun; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomy.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomy.java new file mode 100644 index 000000000000..2a9b09448cde --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomy.java @@ -0,0 +1,278 @@ +// Copyright (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; + +/** + * Evaluation Taxonomy Definition. + */ +@Fluent +public final class EvaluationTaxonomy implements JsonSerializable { + + /* + * Asset ID, a unique identifier for the asset + */ + @Generated + private String id; + + /* + * The name of the resource + */ + @Generated + private String name; + + /* + * The version of the resource + */ + @Generated + private String version; + + /* + * The asset description text. + */ + @Generated + private String description; + + /* + * Tag dictionary. Tags can be added, removed, and updated. + */ + @Generated + private Map tags; + + /* + * Input configuration for the evaluation taxonomy. + */ + @Generated + private final EvaluationTaxonomyInput taxonomyInput; + + /* + * List of taxonomy categories. + */ + @Generated + private List taxonomyCategories; + + /* + * Additional properties for the evaluation taxonomy. + */ + @Generated + private Map properties; + + /** + * Creates an instance of EvaluationTaxonomy class. + * + * @param taxonomyInput the taxonomyInput value to set. + */ + @Generated + public EvaluationTaxonomy(EvaluationTaxonomyInput taxonomyInput) { + this.taxonomyInput = taxonomyInput; + } + + /** + * Get the id property: Asset ID, a unique identifier for the asset. + * + * @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 version property: The version of the resource. + * + * @return the version value. + */ + @Generated + public String getVersion() { + return this.version; + } + + /** + * Get the description property: The asset description text. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The asset description text. + * + * @param description the description value to set. + * @return the EvaluationTaxonomy object itself. + */ + @Generated + public EvaluationTaxonomy setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the tags property: Tag dictionary. Tags can be added, removed, and updated. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: Tag dictionary. Tags can be added, removed, and updated. + * + * @param tags the tags value to set. + * @return the EvaluationTaxonomy object itself. + */ + @Generated + public EvaluationTaxonomy setTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the taxonomyInput property: Input configuration for the evaluation taxonomy. + * + * @return the taxonomyInput value. + */ + @Generated + public EvaluationTaxonomyInput getTaxonomyInput() { + return this.taxonomyInput; + } + + /** + * Get the taxonomyCategories property: List of taxonomy categories. + * + * @return the taxonomyCategories value. + */ + @Generated + public List getTaxonomyCategories() { + return this.taxonomyCategories; + } + + /** + * Set the taxonomyCategories property: List of taxonomy categories. + * + * @param taxonomyCategories the taxonomyCategories value to set. + * @return the EvaluationTaxonomy object itself. + */ + @Generated + public EvaluationTaxonomy setTaxonomyCategories(List taxonomyCategories) { + this.taxonomyCategories = taxonomyCategories; + return this; + } + + /** + * Get the properties property: Additional properties for the evaluation taxonomy. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties for the evaluation taxonomy. + * + * @param properties the properties value to set. + * @return the EvaluationTaxonomy object itself. + */ + @Generated + public EvaluationTaxonomy setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("taxonomyInput", this.taxonomyInput); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("taxonomyCategories", this.taxonomyCategories, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluationTaxonomy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationTaxonomy 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 EvaluationTaxonomy. + */ + @Generated + public static EvaluationTaxonomy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String version = null; + EvaluationTaxonomyInput taxonomyInput = null; + String id = null; + String description = null; + Map tags = null; + List taxonomyCategories = null; + Map properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("version".equals(fieldName)) { + version = reader.getString(); + } else if ("taxonomyInput".equals(fieldName)) { + taxonomyInput = EvaluationTaxonomyInput.fromJson(reader); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("tags".equals(fieldName)) { + tags = reader.readMap(reader1 -> reader1.getString()); + } else if ("taxonomyCategories".equals(fieldName)) { + taxonomyCategories = reader.readArray(reader1 -> TaxonomyCategory.fromJson(reader1)); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + EvaluationTaxonomy deserializedEvaluationTaxonomy = new EvaluationTaxonomy(taxonomyInput); + deserializedEvaluationTaxonomy.name = name; + deserializedEvaluationTaxonomy.version = version; + deserializedEvaluationTaxonomy.id = id; + deserializedEvaluationTaxonomy.description = description; + deserializedEvaluationTaxonomy.tags = tags; + deserializedEvaluationTaxonomy.taxonomyCategories = taxonomyCategories; + deserializedEvaluationTaxonomy.properties = properties; + return deserializedEvaluationTaxonomy; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInput.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInput.java new file mode 100644 index 000000000000..90b5513e68cc --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInput.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; + +/** + * Input configuration for the evaluation taxonomy. + */ +@Immutable +public class EvaluationTaxonomyInput implements JsonSerializable { + + /* + * Input type of the evaluation taxonomy. + */ + @Generated + private EvaluationTaxonomyInputType type = EvaluationTaxonomyInputType.fromString("EvaluationTaxonomyInput"); + + /** + * Creates an instance of EvaluationTaxonomyInput class. + */ + @Generated + public EvaluationTaxonomyInput() { + } + + /** + * Get the type property: Input type of the evaluation taxonomy. + * + * @return the type value. + */ + @Generated + public EvaluationTaxonomyInputType 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 EvaluationTaxonomyInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluationTaxonomyInput 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 EvaluationTaxonomyInput. + */ + @Generated + public static EvaluationTaxonomyInput 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 ("agent".equals(discriminatorValue)) { + return AgentTaxonomyInput.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static EvaluationTaxonomyInput fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluationTaxonomyInput deserializedEvaluationTaxonomyInput = new EvaluationTaxonomyInput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedEvaluationTaxonomyInput.type + = EvaluationTaxonomyInputType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedEvaluationTaxonomyInput; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInputType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInputType.java new file mode 100644 index 000000000000..556c82104c2d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInputType.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; + +/** + * Type of the evaluation taxonomy input. + */ +public final class EvaluationTaxonomyInputType extends ExpandableStringEnum { + + /** + * Agent. + */ + @Generated + public static final EvaluationTaxonomyInputType AGENT = fromString("agent"); + + /** + * Policy. + */ + @Generated + public static final EvaluationTaxonomyInputType POLICY = fromString("policy"); + + /** + * Creates a new instance of EvaluationTaxonomyInputType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluationTaxonomyInputType() { + } + + /** + * Creates or finds a EvaluationTaxonomyInputType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluationTaxonomyInputType. + */ + @Generated + public static EvaluationTaxonomyInputType fromString(String name) { + return fromString(name, EvaluationTaxonomyInputType.class); + } + + /** + * Gets known EvaluationTaxonomyInputType values. + * + * @return known EvaluationTaxonomyInputType values. + */ + @Generated + public static Collection values() { + return values(EvaluationTaxonomyInputType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorCategory.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorCategory.java new file mode 100644 index 000000000000..5b401d7acbf1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorCategory.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 category of the evaluator. + */ +public final class EvaluatorCategory extends ExpandableStringEnum { + + /** + * Quality. + */ + @Generated + public static final EvaluatorCategory QUALITY = fromString("quality"); + + /** + * Risk & Safety. + */ + @Generated + public static final EvaluatorCategory SAFETY = fromString("safety"); + + /** + * Agents. + */ + @Generated + public static final EvaluatorCategory AGENTS = fromString("agents"); + + /** + * Creates a new instance of EvaluatorCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluatorCategory() { + } + + /** + * Creates or finds a EvaluatorCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluatorCategory. + */ + @Generated + public static EvaluatorCategory fromString(String name) { + return fromString(name, EvaluatorCategory.class); + } + + /** + * Gets known EvaluatorCategory values. + * + * @return known EvaluatorCategory values. + */ + @Generated + public static Collection values() { + return values(EvaluatorCategory.class); + } +} 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 deleted file mode 100644 index ec1df7f936d7..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorConfiguration.java +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (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.Map; - -/** - * Evaluator Configuration. - */ -@Fluent -public final class EvaluatorConfiguration implements JsonSerializable { - - /* - * Identifier of the evaluator. - */ - @Generated - private final String id; - - /* - * Initialization parameters of the evaluator. - */ - @Generated - private Map initParams; - - /* - * Data parameters of the evaluator. - */ - @Generated - private Map dataMapping; - - /** - * Creates an instance of EvaluatorConfiguration class. - * - * @param id the id value to set. - */ - @Generated - public EvaluatorConfiguration(String id) { - this.id = id; - } - - /** - * Get the id property: Identifier of the evaluator. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * 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; - 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; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - 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(); - } - - /** - * 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 IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the EvaluatorConfiguration. - */ - @Generated - public static EvaluatorConfiguration fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - Map initParams = null; - Map dataMapping = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("initParams".equals(fieldName)) { - initParams = reader.readMap(reader1 -> reader1 - .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } else if ("dataMapping".equals(fieldName)) { - dataMapping = reader.readMap(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - EvaluatorConfiguration deserializedEvaluatorConfiguration = new EvaluatorConfiguration(id); - deserializedEvaluatorConfiguration.initParams = initParams; - deserializedEvaluatorConfiguration.dataMapping = dataMapping; - return deserializedEvaluatorConfiguration; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinition.java new file mode 100644 index 000000000000..fb2ea88f3003 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinition.java @@ -0,0 +1,217 @@ +// Copyright (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.Map; + +/** + * Base evaluator configuration with discriminator. + */ +@Fluent +public class EvaluatorDefinition implements JsonSerializable { + + /* + * The type of evaluator definition + */ + @Generated + private EvaluatorDefinitionType type = EvaluatorDefinitionType.fromString("EvaluatorDefinition"); + + /* + * The JSON schema (Draft 2020-12) for the evaluator's input parameters. This includes parameters like type, + * properties, required. + */ + @Generated + private BinaryData initParameters; + + /* + * The JSON schema (Draft 2020-12) for the evaluator's input data. This includes parameters like type, properties, + * required. + */ + @Generated + private BinaryData dataSchema; + + /* + * List of output metrics produced by this evaluator + */ + @Generated + private Map metrics; + + /** + * Creates an instance of EvaluatorDefinition class. + */ + @Generated + public EvaluatorDefinition() { + } + + /** + * Get the type property: The type of evaluator definition. + * + * @return the type value. + */ + @Generated + public EvaluatorDefinitionType getType() { + return this.type; + } + + /** + * Get the initParameters property: The JSON schema (Draft 2020-12) for the evaluator's input parameters. This + * includes parameters like type, properties, required. + * + * @return the initParameters value. + */ + @Generated + public BinaryData getInitParameters() { + return this.initParameters; + } + + /** + * Set the initParameters property: The JSON schema (Draft 2020-12) for the evaluator's input parameters. This + * includes parameters like type, properties, required. + * + * @param initParameters the initParameters value to set. + * @return the EvaluatorDefinition object itself. + */ + @Generated + public EvaluatorDefinition setInitParameters(BinaryData initParameters) { + this.initParameters = initParameters; + return this; + } + + /** + * Get the dataSchema property: The JSON schema (Draft 2020-12) for the evaluator's input data. This includes + * parameters like type, properties, required. + * + * @return the dataSchema value. + */ + @Generated + public BinaryData getDataSchema() { + return this.dataSchema; + } + + /** + * Set the dataSchema property: The JSON schema (Draft 2020-12) for the evaluator's input data. This includes + * parameters like type, properties, required. + * + * @param dataSchema the dataSchema value to set. + * @return the EvaluatorDefinition object itself. + */ + @Generated + public EvaluatorDefinition setDataSchema(BinaryData dataSchema) { + this.dataSchema = dataSchema; + return this; + } + + /** + * Get the metrics property: List of output metrics produced by this evaluator. + * + * @return the metrics value. + */ + @Generated + public Map getMetrics() { + return this.metrics; + } + + /** + * Set the metrics property: List of output metrics produced by this evaluator. + * + * @param metrics the metrics value to set. + * @return the EvaluatorDefinition object itself. + */ + @Generated + public EvaluatorDefinition setMetrics(Map metrics) { + this.metrics = metrics; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + if (this.initParameters != null) { + jsonWriter.writeFieldName("init_parameters"); + this.initParameters.writeTo(jsonWriter); + } + if (this.dataSchema != null) { + jsonWriter.writeFieldName("data_schema"); + this.dataSchema.writeTo(jsonWriter); + } + jsonWriter.writeMapField("metrics", this.metrics, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluatorDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluatorDefinition 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 EvaluatorDefinition. + */ + @Generated + public static EvaluatorDefinition 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".equals(discriminatorValue)) { + return CodeBasedEvaluatorDefinition.fromJson(readerToUse.reset()); + } else if ("prompt".equals(discriminatorValue)) { + return PromptBasedEvaluatorDefinition.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static EvaluatorDefinition fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluatorDefinition deserializedEvaluatorDefinition = new EvaluatorDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedEvaluatorDefinition.type = EvaluatorDefinitionType.fromString(reader.getString()); + } else if ("init_parameters".equals(fieldName)) { + deserializedEvaluatorDefinition.initParameters + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("data_schema".equals(fieldName)) { + deserializedEvaluatorDefinition.dataSchema + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metrics".equals(fieldName)) { + Map metrics = reader.readMap(reader1 -> EvaluatorMetric.fromJson(reader1)); + deserializedEvaluatorDefinition.metrics = metrics; + } else { + reader.skipChildren(); + } + } + return deserializedEvaluatorDefinition; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinitionType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinitionType.java new file mode 100644 index 000000000000..9e2d5501690d --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorDefinitionType.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; + +/** + * The type of evaluator definition. + */ +public final class EvaluatorDefinitionType extends ExpandableStringEnum { + + /** + * Prompt-based definition. + */ + @Generated + public static final EvaluatorDefinitionType PROMPT = fromString("prompt"); + + /** + * Code-based definition. + */ + @Generated + public static final EvaluatorDefinitionType CODE = fromString("code"); + + /** + * Prompt & Code Based definition. + */ + @Generated + public static final EvaluatorDefinitionType PROMPT_AND_CODE = fromString("prompt_and_code"); + + /** + * Service-based evaluator. + */ + @Generated + public static final EvaluatorDefinitionType SERVICE = fromString("service"); + + /** + * OpenAI graders. + */ + @Generated + public static final EvaluatorDefinitionType OPENAI_GRADERS = fromString("openai_graders"); + + /** + * Creates a new instance of EvaluatorDefinitionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluatorDefinitionType() { + } + + /** + * Creates or finds a EvaluatorDefinitionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluatorDefinitionType. + */ + @Generated + public static EvaluatorDefinitionType fromString(String name) { + return fromString(name, EvaluatorDefinitionType.class); + } + + /** + * Gets known EvaluatorDefinitionType values. + * + * @return known EvaluatorDefinitionType values. + */ + @Generated + public static Collection values() { + return values(EvaluatorDefinitionType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorId.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorId.java deleted file mode 100644 index 2a7562830ac0..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorId.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.ai.projects.models; - -import com.azure.core.util.ExpandableStringEnum; - -/** - * EvaluatorId enumeration. - */ -public class EvaluatorId extends ExpandableStringEnum { - - /** - * Creates a new instance of EvaluatorId value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public EvaluatorId() { - } - - /** - * Creates or finds a EvaluatorId from its string representation. - * - * @param name a name to look for. - * @return the corresponding EvaluatorId. - */ - public static EvaluatorId fromString(String name) { - return fromString(name, EvaluatorId.class); - } - - /** - * EvaluatorId for relevance. - */ - public static final EvaluatorId RELEVANCE = fromString("azureai://built-in/evaluators/relevance"); - - /** - * EvaluatorId for hate_unfairness. - */ - public static final EvaluatorId HATE_UNFAIRNESS = fromString("azureai://built-in/evaluators/hate_unfairness"); - - /** - * EvaluatorId for violence. - */ - public static final EvaluatorId VIOLENCE = fromString("azureai://built-in/evaluators/violence"); - - /** - * EvaluatorId for groundedness. - */ - public static final EvaluatorId GROUNDEDNESS = fromString("azureai://built-in/evaluators/groundedness"); - - /** - * EvaluatorId for groundedness_pro. - */ - public static final EvaluatorId GROUNDEDNESS_PRO = fromString("azureai://built-in/evaluators/groundedness_pro"); - - /** - * EvaluatorId for blue_score. - */ - public static final EvaluatorId BLUE_SCORE = fromString("azureai://built-in/evaluators/blue_score"); - - /** - * EvaluatorId for code_vulnerability. - */ - public static final EvaluatorId CODE_VULNERABILITY = fromString("azureai://built-in/evaluators/code_vulnerability"); - - /** - * EvaluatorId for coherence. - */ - public static final EvaluatorId COHERENCE = fromString("azureai://built-in/evaluators/coherence"); - - /** - * EvaluatorId for content_safety. - */ - public static final EvaluatorId CONTENT_SAFETY = fromString("azureai://built-in/evaluators/content_safety"); - - /** - * EvaluatorId for f1_score. - */ - public static final EvaluatorId F1_SCORE = fromString("azureai://built-in/evaluators/f1_score"); - - /** - * EvaluatorId for fluency. - */ - public static final EvaluatorId FLUENCY = fromString("azureai://built-in/evaluators/fluency"); - - /** - * EvaluatorId for gleu_score. - */ - public static final EvaluatorId GLEU_SCORE = fromString("azureai://built-in/evaluators/gleu_score"); - - /** - * EvaluatorId for indirect_attack. - */ - public static final EvaluatorId INDIRECT_ATTACK = fromString("azureai://built-in/evaluators/indirect_attack"); - - /** - * EvaluatorId for intent_resolution. - */ - // public static final EvaluatorId INTENT_RESOLUTION = fromString("azureai://built-in/evaluators/intent_resolution"); - - /** - * EvaluatorId for meteor_score. - */ - public static final EvaluatorId METEOR_SCORE = fromString("azureai://built-in/evaluators/meteor_score"); - - /** - * EvaluatorId for protected_material. - */ - public static final EvaluatorId PROTECTED_MATERIAL = fromString("azureai://built-in/evaluators/protected_material"); - - /** - * EvaluatorId for retrieval. - */ - public static final EvaluatorId RETRIEVAL = fromString("azureai://built-in/evaluators/retrieval"); - - /** - * EvaluatorId for rouge_score. - */ - public static final EvaluatorId ROUGE_SCORE = fromString("azureai://built-in/evaluators/rouge_score"); - - /** - * EvaluatorId for self_harm. - */ - public static final EvaluatorId SELF_HARM = fromString("azureai://built-in/evaluators/self_harm"); - - /** - * EvaluatorId for sexual. - */ - public static final EvaluatorId SEXUAL = fromString("azureai://built-in/evaluators/sexual"); - - /** - * EvaluatorId for similarity_score. - */ - public static final EvaluatorId SIMILARITY_SCORE = fromString("azureai://built-in/evaluators/similarity_score"); - - /** - * EvaluatorId for task_adherence. - */ - // public static final EvaluatorId TASK_ADHERENCE = fromString("azureai://built-in/evaluators/task_adherence"); - - /** - * EvaluatorId for tool_call_accuracy. - */ - // public static final EvaluatorId TOOL_CALL_ACCURACY = fromString("azureai://built-in/evaluators/tool_call_accuracy"); - - /** - * EvaluatorId for ungrounded_attributes. - */ - public static final EvaluatorId UNGROUNDED_ATTRIBUTES - = fromString("azureai://built-in/evaluators/ungrounded_attributes"); - - /** - * EvaluatorId for response_completeness. - */ - public static final EvaluatorId RESPONSE_COMPLETENESS - = fromString("azureai://built-in/evaluators/response_completeness"); -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetric.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetric.java new file mode 100644 index 000000000000..7c0cb6dec700 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetric.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.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; + +/** + * Evaluator Metric. + */ +@Fluent +public final class EvaluatorMetric implements JsonSerializable { + + /* + * Type of the metric. + */ + @Generated + private EvaluatorMetricType type; + + /* + * It indicates whether a higher value is better or a lower value is better for this metric. + */ + @Generated + private EvaluatorMetricDirection desirableDirection; + + /* + * Minimum value for the metric + */ + @Generated + private Double minValue; + + /* + * Maximum value for the metric. If not specified, it is assumed to be unbounded. + */ + @Generated + private Double maxValue; + + /* + * Indicates if this metric is primary when there are multiple metrics. + */ + @Generated + private Boolean isPrimary; + + /** + * Creates an instance of EvaluatorMetric class. + */ + @Generated + public EvaluatorMetric() { + } + + /** + * Get the type property: Type of the metric. + * + * @return the type value. + */ + @Generated + public EvaluatorMetricType getType() { + return this.type; + } + + /** + * Set the type property: Type of the metric. + * + * @param type the type value to set. + * @return the EvaluatorMetric object itself. + */ + @Generated + public EvaluatorMetric setType(EvaluatorMetricType type) { + this.type = type; + return this; + } + + /** + * Get the desirableDirection property: It indicates whether a higher value is better or a lower value is better for + * this metric. + * + * @return the desirableDirection value. + */ + @Generated + public EvaluatorMetricDirection getDesirableDirection() { + return this.desirableDirection; + } + + /** + * Set the desirableDirection property: It indicates whether a higher value is better or a lower value is better for + * this metric. + * + * @param desirableDirection the desirableDirection value to set. + * @return the EvaluatorMetric object itself. + */ + @Generated + public EvaluatorMetric setDesirableDirection(EvaluatorMetricDirection desirableDirection) { + this.desirableDirection = desirableDirection; + return this; + } + + /** + * Get the minValue property: Minimum value for the metric. + * + * @return the minValue value. + */ + @Generated + public Double getMinValue() { + return this.minValue; + } + + /** + * Set the minValue property: Minimum value for the metric. + * + * @param minValue the minValue value to set. + * @return the EvaluatorMetric object itself. + */ + @Generated + public EvaluatorMetric setMinValue(Double minValue) { + this.minValue = minValue; + return this; + } + + /** + * Get the maxValue property: Maximum value for the metric. If not specified, it is assumed to be unbounded. + * + * @return the maxValue value. + */ + @Generated + public Double getMaxValue() { + return this.maxValue; + } + + /** + * Set the maxValue property: Maximum value for the metric. If not specified, it is assumed to be unbounded. + * + * @param maxValue the maxValue value to set. + * @return the EvaluatorMetric object itself. + */ + @Generated + public EvaluatorMetric setMaxValue(Double maxValue) { + this.maxValue = maxValue; + return this; + } + + /** + * Get the isPrimary property: Indicates if this metric is primary when there are multiple metrics. + * + * @return the isPrimary value. + */ + @Generated + public Boolean isPrimary() { + return this.isPrimary; + } + + /** + * Set the isPrimary property: Indicates if this metric is primary when there are multiple metrics. + * + * @param isPrimary the isPrimary value to set. + * @return the EvaluatorMetric object itself. + */ + @Generated + public EvaluatorMetric setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + 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.writeStringField("desirable_direction", + this.desirableDirection == null ? null : this.desirableDirection.toString()); + jsonWriter.writeNumberField("min_value", this.minValue); + jsonWriter.writeNumberField("max_value", this.maxValue); + jsonWriter.writeBooleanField("is_primary", this.isPrimary); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluatorMetric from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluatorMetric 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 EvaluatorMetric. + */ + @Generated + public static EvaluatorMetric fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluatorMetric deserializedEvaluatorMetric = new EvaluatorMetric(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedEvaluatorMetric.type = EvaluatorMetricType.fromString(reader.getString()); + } else if ("desirable_direction".equals(fieldName)) { + deserializedEvaluatorMetric.desirableDirection + = EvaluatorMetricDirection.fromString(reader.getString()); + } else if ("min_value".equals(fieldName)) { + deserializedEvaluatorMetric.minValue = reader.getNullable(JsonReader::getDouble); + } else if ("max_value".equals(fieldName)) { + deserializedEvaluatorMetric.maxValue = reader.getNullable(JsonReader::getDouble); + } else if ("is_primary".equals(fieldName)) { + deserializedEvaluatorMetric.isPrimary = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + return deserializedEvaluatorMetric; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricDirection.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricDirection.java new file mode 100644 index 000000000000..e314e0c367e5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricDirection.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 direction of the metric indicating whether a higher value is better, a lower value is better, or neutral. + */ +public final class EvaluatorMetricDirection extends ExpandableStringEnum { + + /** + * It indicates a higher value is better for this metric. + */ + @Generated + public static final EvaluatorMetricDirection INCREASE = fromString("increase"); + + /** + * It indicates a lower value is better for this metric. + */ + @Generated + public static final EvaluatorMetricDirection DECREASE = fromString("decrease"); + + /** + * It indicates no preference for this metric direction. + */ + @Generated + public static final EvaluatorMetricDirection NEUTRAL = fromString("neutral"); + + /** + * Creates a new instance of EvaluatorMetricDirection value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluatorMetricDirection() { + } + + /** + * Creates or finds a EvaluatorMetricDirection from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluatorMetricDirection. + */ + @Generated + public static EvaluatorMetricDirection fromString(String name) { + return fromString(name, EvaluatorMetricDirection.class); + } + + /** + * Gets known EvaluatorMetricDirection values. + * + * @return known EvaluatorMetricDirection values. + */ + @Generated + public static Collection values() { + return values(EvaluatorMetricDirection.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricType.java new file mode 100644 index 000000000000..d3d54cdf1c97 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorMetricType.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 type of the evaluator. + */ +public final class EvaluatorMetricType extends ExpandableStringEnum { + + /** + * Ordinal metric representing categories that can be ordered or ranked. + */ + @Generated + public static final EvaluatorMetricType ORDINAL = fromString("ordinal"); + + /** + * Continuous metric representing values in a continuous range. + */ + @Generated + public static final EvaluatorMetricType CONTINUOUS = fromString("continuous"); + + /** + * Boolean metric representing true/false values. + */ + @Generated + public static final EvaluatorMetricType BOOLEAN = fromString("boolean"); + + /** + * Creates a new instance of EvaluatorMetricType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluatorMetricType() { + } + + /** + * Creates or finds a EvaluatorMetricType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluatorMetricType. + */ + @Generated + public static EvaluatorMetricType fromString(String name) { + return fromString(name, EvaluatorMetricType.class); + } + + /** + * Gets known EvaluatorMetricType values. + * + * @return known EvaluatorMetricType values. + */ + @Generated + public static Collection values() { + return values(EvaluatorMetricType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorType.java new file mode 100644 index 000000000000..f4620f6f48d1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorType.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 type of the evaluator. + */ +public final class EvaluatorType extends ExpandableStringEnum { + + /** + * Built-in evaluator (Microsoft provided). + */ + @Generated + public static final EvaluatorType BUILT_IN = fromString("builtin"); + + /** + * Custom evaluator. + */ + @Generated + public static final EvaluatorType CUSTOM = fromString("custom"); + + /** + * Creates a new instance of EvaluatorType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EvaluatorType() { + } + + /** + * Creates or finds a EvaluatorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvaluatorType. + */ + @Generated + public static EvaluatorType fromString(String name) { + return fromString(name, EvaluatorType.class); + } + + /** + * Gets known EvaluatorType values. + * + * @return known EvaluatorType values. + */ + @Generated + public static Collection values() { + return values(EvaluatorType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorVersion.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorVersion.java new file mode 100644 index 000000000000..511944902d00 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/EvaluatorVersion.java @@ -0,0 +1,386 @@ +// Copyright (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; + +/** + * Evaluator Definition. + */ +@Fluent +public final class EvaluatorVersion implements JsonSerializable { + + /* + * Display Name for evaluator. It helps to find the evaluator easily in AI Foundry. It does not need to be unique. + */ + @Generated + private String displayName; + + /* + * Metadata about the evaluator + */ + @Generated + private Map metadata; + + /* + * The type of the evaluator + */ + @Generated + private final EvaluatorType evaluatorType; + + /* + * The categories of the evaluator + */ + @Generated + private final List categories; + + /* + * Definition of the evaluator + */ + @Generated + private final EvaluatorDefinition definition; + + /* + * Creator of the evaluator + */ + @Generated + private String createdBy; + + /* + * Creation date/time of the evaluator + */ + @Generated + private long createdAt; + + /* + * Last modified date/time of the evaluator + */ + @Generated + private long modifiedAt; + + /* + * Asset ID, a unique identifier for the asset + */ + @Generated + private String id; + + /* + * The name of the resource + */ + @Generated + private String name; + + /* + * The version of the resource + */ + @Generated + private String version; + + /* + * The asset description text. + */ + @Generated + private String description; + + /* + * Tag dictionary. Tags can be added, removed, and updated. + */ + @Generated + private Map tags; + + /** + * Creates an instance of EvaluatorVersion class. + * + * @param evaluatorType the evaluatorType value to set. + * @param categories the categories value to set. + * @param definition the definition value to set. + */ + @Generated + public EvaluatorVersion(EvaluatorType evaluatorType, List categories, + EvaluatorDefinition definition) { + this.evaluatorType = evaluatorType; + this.categories = categories; + this.definition = definition; + } + + /** + * Get the displayName property: Display Name for evaluator. It helps to find the evaluator 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 evaluator. It helps to find the evaluator easily in AI Foundry. It + * does not need to be unique. + * + * @param displayName the displayName value to set. + * @return the EvaluatorVersion object itself. + */ + @Generated + public EvaluatorVersion setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the metadata property: Metadata about the evaluator. + * + * @return the metadata value. + */ + @Generated + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: Metadata about the evaluator. + * + * @param metadata the metadata value to set. + * @return the EvaluatorVersion object itself. + */ + @Generated + public EvaluatorVersion setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the evaluatorType property: The type of the evaluator. + * + * @return the evaluatorType value. + */ + @Generated + public EvaluatorType getEvaluatorType() { + return this.evaluatorType; + } + + /** + * Get the categories property: The categories of the evaluator. + * + * @return the categories value. + */ + @Generated + public List getCategories() { + return this.categories; + } + + /** + * Get the definition property: Definition of the evaluator. + * + * @return the definition value. + */ + @Generated + public EvaluatorDefinition getDefinition() { + return this.definition; + } + + /** + * Get the createdBy property: Creator of the evaluator. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdAt property: Creation date/time of the evaluator. + * + * @return the createdAt value. + */ + @Generated + public long getCreatedAt() { + return this.createdAt; + } + + /** + * Get the modifiedAt property: Last modified date/time of the evaluator. + * + * @return the modifiedAt value. + */ + @Generated + public long getModifiedAt() { + return this.modifiedAt; + } + + /** + * Get the id property: Asset ID, a unique identifier for the asset. + * + * @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 version property: The version of the resource. + * + * @return the version value. + */ + @Generated + public String getVersion() { + return this.version; + } + + /** + * Get the description property: The asset description text. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The asset description text. + * + * @param description the description value to set. + * @return the EvaluatorVersion object itself. + */ + @Generated + public EvaluatorVersion setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the tags property: Tag dictionary. Tags can be added, removed, and updated. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: Tag dictionary. Tags can be added, removed, and updated. + * + * @param tags the tags value to set. + * @return the EvaluatorVersion object itself. + */ + @Generated + public EvaluatorVersion setTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("evaluator_type", + this.evaluatorType == null ? null : this.evaluatorType.toString()); + jsonWriter.writeArrayField("categories", this.categories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("definition", this.definition); + jsonWriter.writeStringField("display_name", this.displayName); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EvaluatorVersion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EvaluatorVersion 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 EvaluatorVersion. + */ + @Generated + public static EvaluatorVersion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EvaluatorType evaluatorType = null; + List categories = null; + EvaluatorDefinition definition = null; + String createdBy = null; + long createdAt = 0L; + long modifiedAt = 0L; + String name = null; + String version = null; + String displayName = null; + Map metadata = null; + String id = null; + String description = null; + Map tags = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("evaluator_type".equals(fieldName)) { + evaluatorType = EvaluatorType.fromString(reader.getString()); + } else if ("categories".equals(fieldName)) { + categories = reader.readArray(reader1 -> EvaluatorCategory.fromString(reader1.getString())); + } else if ("definition".equals(fieldName)) { + definition = EvaluatorDefinition.fromJson(reader); + } else if ("created_by".equals(fieldName)) { + createdBy = reader.getString(); + } else if ("created_at".equals(fieldName)) { + createdAt = reader.getLong(); + } else if ("modified_at".equals(fieldName)) { + modifiedAt = reader.getLong(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("version".equals(fieldName)) { + version = reader.getString(); + } else if ("display_name".equals(fieldName)) { + displayName = reader.getString(); + } else if ("metadata".equals(fieldName)) { + metadata = reader.readMap(reader1 -> reader1.getString()); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("tags".equals(fieldName)) { + tags = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + EvaluatorVersion deserializedEvaluatorVersion = new EvaluatorVersion(evaluatorType, categories, definition); + deserializedEvaluatorVersion.createdBy = createdBy; + deserializedEvaluatorVersion.createdAt = createdAt; + deserializedEvaluatorVersion.modifiedAt = modifiedAt; + deserializedEvaluatorVersion.name = name; + deserializedEvaluatorVersion.version = version; + deserializedEvaluatorVersion.displayName = displayName; + deserializedEvaluatorVersion.metadata = metadata; + deserializedEvaluatorVersion.id = id; + deserializedEvaluatorVersion.description = description; + deserializedEvaluatorVersion.tags = tags; + return deserializedEvaluatorVersion; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDatasetVersion.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDatasetVersion.java index b22aa1ae6fa6..65042fb6bbea 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDatasetVersion.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FileDatasetVersion.java @@ -61,6 +61,17 @@ public FileDatasetVersion setDataUri(String dataUri) { return this; } + /** + * {@inheritDoc} + */ + @Generated + @Override + public FileDatasetVersion setConnectionName(String connectionName) { + super.setConnectionName(connectionName); + this.updatedProperties.add("connectionName"); + return this; + } + /** * {@inheritDoc} */ @@ -192,15 +203,4 @@ public static FileDatasetVersion fromJson(JsonReader jsonReader) throws IOExcept return deserializedFileDatasetVersion; }); } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public FileDatasetVersion setConnectionName(String connectionName) { - super.setConnectionName(connectionName); - this.updatedProperties.add("connectionName"); - return this; - } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FolderDatasetVersion.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FolderDatasetVersion.java index d0222600b40a..e480d966ed5e 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FolderDatasetVersion.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FolderDatasetVersion.java @@ -61,6 +61,17 @@ public FolderDatasetVersion setDataUri(String dataUri) { return this; } + /** + * {@inheritDoc} + */ + @Generated + @Override + public FolderDatasetVersion setConnectionName(String connectionName) { + super.setConnectionName(connectionName); + this.updatedProperties.add("connectionName"); + return this; + } + /** * {@inheritDoc} */ @@ -192,15 +203,4 @@ public static FolderDatasetVersion fromJson(JsonReader jsonReader) throws IOExce return deserializedFolderDatasetVersion; }); } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public FolderDatasetVersion setConnectionName(String connectionName) { - super.setConnectionName(connectionName); - this.updatedProperties.add("connectionName"); - return this; - } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HourlyRecurrenceSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HourlyRecurrenceSchedule.java new file mode 100644 index 000000000000..73875762df51 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HourlyRecurrenceSchedule.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; + +/** + * Hourly recurrence schedule. + */ +@Immutable +public final class HourlyRecurrenceSchedule extends RecurrenceSchedule { + + /* + * Recurrence type for the recurrence schedule. + */ + @Generated + private RecurrenceType type = RecurrenceType.HOURLY; + + /** + * Creates an instance of HourlyRecurrenceSchedule class. + */ + @Generated + public HourlyRecurrenceSchedule() { + } + + /** + * Get the type property: Recurrence type for the recurrence schedule. + * + * @return the type value. + */ + @Generated + @Override + public RecurrenceType 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 HourlyRecurrenceSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HourlyRecurrenceSchedule 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 HourlyRecurrenceSchedule. + */ + @Generated + public static HourlyRecurrenceSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HourlyRecurrenceSchedule deserializedHourlyRecurrenceSchedule = new HourlyRecurrenceSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedHourlyRecurrenceSchedule.type = RecurrenceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedHourlyRecurrenceSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HumanEvaluationRuleAction.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HumanEvaluationRuleAction.java new file mode 100644 index 000000000000..0b0aa17b77de --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/HumanEvaluationRuleAction.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; + +/** + * Evaluation rule action for human evaluation. + */ +@Immutable +public final class HumanEvaluationRuleAction extends EvaluationRuleAction { + + /* + * Type of the evaluation action. + */ + @Generated + private EvaluationRuleActionType type = EvaluationRuleActionType.HUMAN_EVALUATION; + + /* + * Human evaluation template Id. + */ + @Generated + private final String templateId; + + /** + * Creates an instance of HumanEvaluationRuleAction class. + * + * @param templateId the templateId value to set. + */ + @Generated + public HumanEvaluationRuleAction(String templateId) { + this.templateId = templateId; + } + + /** + * Get the type property: Type of the evaluation action. + * + * @return the type value. + */ + @Generated + @Override + public EvaluationRuleActionType getType() { + return this.type; + } + + /** + * Get the templateId property: Human evaluation template Id. + * + * @return the templateId value. + */ + @Generated + public String getTemplateId() { + return this.templateId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("templateId", this.templateId); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HumanEvaluationRuleAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HumanEvaluationRuleAction 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 HumanEvaluationRuleAction. + */ + @Generated + public static HumanEvaluationRuleAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String templateId = null; + EvaluationRuleActionType type = EvaluationRuleActionType.HUMAN_EVALUATION; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("templateId".equals(fieldName)) { + templateId = reader.getString(); + } else if ("type".equals(fieldName)) { + type = EvaluationRuleActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + HumanEvaluationRuleAction deserializedHumanEvaluationRuleAction = new HumanEvaluationRuleAction(templateId); + deserializedHumanEvaluationRuleAction.type = type; + return deserializedHumanEvaluationRuleAction; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputDataset.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputDataset.java deleted file mode 100644 index 289730e74ab2..000000000000 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputDataset.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (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; - -/** - * Dataset as source for evaluation. - */ -@Immutable -public final class InputDataset extends InputData { - - /* - * Type of the data - */ - @Generated - private String type = "dataset"; - - /* - * Evaluation input data - */ - @Generated - private final String id; - - /** - * Creates an instance of InputDataset class. - * - * @param id the id value to set. - */ - @Generated - public InputDataset(String id) { - this.id = id; - } - - /** - * 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; - } - - /** - * {@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 InputDataset from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InputDataset 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 InputDataset. - */ - @Generated - public static InputDataset fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String type = "dataset"; - 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(); - } - } - InputDataset deserializedInputDataset = new InputDataset(id); - deserializedInputDataset.type = type; - return deserializedInputDataset; - }); - } -} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Insight.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Insight.java new file mode 100644 index 000000000000..db7d2da024a7 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Insight.java @@ -0,0 +1,185 @@ +// Copyright (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 response body for cluster insights. + */ +@Immutable +public final class Insight implements JsonSerializable { + + /* + * The unique identifier for the insights report. + */ + @Generated + private String id; + + /* + * Metadata about the insights report. + */ + @Generated + private InsightsMetadata metadata; + + /* + * The current state of the insights. + */ + @Generated + private OperationStatus state; + + /* + * User friendly display name for the insight. + */ + @Generated + private final String displayName; + + /* + * Request for the insights analysis. + */ + @Generated + private final InsightRequest request; + + /* + * The result of the insights report. + */ + @Generated + private InsightResult result; + + /** + * Creates an instance of Insight class. + * + * @param displayName the displayName value to set. + * @param request the request value to set. + */ + @Generated + public Insight(String displayName, InsightRequest request) { + this.displayName = displayName; + this.request = request; + } + + /** + * Get the id property: The unique identifier for the insights report. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the metadata property: Metadata about the insights report. + * + * @return the metadata value. + */ + @Generated + public InsightsMetadata getMetadata() { + return this.metadata; + } + + /** + * Get the state property: The current state of the insights. + * + * @return the state value. + */ + @Generated + public OperationStatus getState() { + return this.state; + } + + /** + * Get the displayName property: User friendly display name for the insight. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Get the request property: Request for the insights analysis. + * + * @return the request value. + */ + @Generated + public InsightRequest getRequest() { + return this.request; + } + + /** + * Get the result property: The result of the insights report. + * + * @return the result value. + */ + @Generated + public InsightResult getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeJsonField("request", this.request); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Insight from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Insight 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 Insight. + */ + @Generated + public static Insight fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + InsightsMetadata metadata = null; + OperationStatus state = null; + String displayName = null; + InsightRequest request = null; + InsightResult result = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("metadata".equals(fieldName)) { + metadata = InsightsMetadata.fromJson(reader); + } else if ("state".equals(fieldName)) { + state = OperationStatus.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + displayName = reader.getString(); + } else if ("request".equals(fieldName)) { + request = InsightRequest.fromJson(reader); + } else if ("result".equals(fieldName)) { + result = InsightResult.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Insight deserializedInsight = new Insight(displayName, request); + deserializedInsight.id = id; + deserializedInsight.metadata = metadata; + deserializedInsight.state = state; + deserializedInsight.result = result; + return deserializedInsight; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightCluster.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightCluster.java new file mode 100644 index 000000000000..1e85e27821b4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightCluster.java @@ -0,0 +1,238 @@ +// Copyright (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 cluster of analysis samples. + */ +@Immutable +public final class InsightCluster implements JsonSerializable { + + /* + * The id of the analysis cluster. + */ + @Generated + private final String id; + + /* + * Label for the cluster + */ + @Generated + private final String label; + + /* + * Suggestion for the cluster + */ + @Generated + private final String suggestion; + + /* + * The title of the suggestion for the cluster + */ + @Generated + private final String suggestionTitle; + + /* + * Description of the analysis cluster. + */ + @Generated + private final String description; + + /* + * The weight of the analysis cluster. This indicate number of samples in the cluster. + */ + @Generated + private final int weight; + + /* + * List of subclusters within this cluster. Empty if no subclusters exist. + */ + @Generated + private List subClusters; + + /* + * List of samples that belong to this cluster. Empty if samples are part of subclusters. + */ + @Generated + private List samples; + + /** + * Creates an instance of InsightCluster class. + * + * @param id the id value to set. + * @param label the label value to set. + * @param suggestion the suggestion value to set. + * @param suggestionTitle the suggestionTitle value to set. + * @param description the description value to set. + * @param weight the weight value to set. + */ + @Generated + private InsightCluster(String id, String label, String suggestion, String suggestionTitle, String description, + int weight) { + this.id = id; + this.label = label; + this.suggestion = suggestion; + this.suggestionTitle = suggestionTitle; + this.description = description; + this.weight = weight; + } + + /** + * Get the id property: The id of the analysis cluster. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the label property: Label for the cluster. + * + * @return the label value. + */ + @Generated + public String getLabel() { + return this.label; + } + + /** + * Get the suggestion property: Suggestion for the cluster. + * + * @return the suggestion value. + */ + @Generated + public String getSuggestion() { + return this.suggestion; + } + + /** + * Get the suggestionTitle property: The title of the suggestion for the cluster. + * + * @return the suggestionTitle value. + */ + @Generated + public String getSuggestionTitle() { + return this.suggestionTitle; + } + + /** + * Get the description property: Description of the analysis cluster. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the weight property: The weight of the analysis cluster. This indicate number of samples in the cluster. + * + * @return the weight value. + */ + @Generated + public int getWeight() { + return this.weight; + } + + /** + * Get the subClusters property: List of subclusters within this cluster. Empty if no subclusters exist. + * + * @return the subClusters value. + */ + @Generated + public List getSubClusters() { + return this.subClusters; + } + + /** + * Get the samples property: List of samples that belong to this cluster. Empty if samples are part of subclusters. + * + * @return the samples value. + */ + @Generated + public List getSamples() { + return this.samples; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("label", this.label); + jsonWriter.writeStringField("suggestion", this.suggestion); + jsonWriter.writeStringField("suggestionTitle", this.suggestionTitle); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeIntField("weight", this.weight); + jsonWriter.writeArrayField("subClusters", this.subClusters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("samples", this.samples, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightCluster from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightCluster 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 InsightCluster. + */ + @Generated + public static InsightCluster fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String label = null; + String suggestion = null; + String suggestionTitle = null; + String description = null; + int weight = 0; + List subClusters = null; + List samples = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("label".equals(fieldName)) { + label = reader.getString(); + } else if ("suggestion".equals(fieldName)) { + suggestion = reader.getString(); + } else if ("suggestionTitle".equals(fieldName)) { + suggestionTitle = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("weight".equals(fieldName)) { + weight = reader.getInt(); + } else if ("subClusters".equals(fieldName)) { + subClusters = reader.readArray(reader1 -> InsightCluster.fromJson(reader1)); + } else if ("samples".equals(fieldName)) { + samples = reader.readArray(reader1 -> InsightSample.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + InsightCluster deserializedInsightCluster + = new InsightCluster(id, label, suggestion, suggestionTitle, description, weight); + deserializedInsightCluster.subClusters = subClusters; + deserializedInsightCluster.samples = samples; + return deserializedInsightCluster; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightModelConfiguration.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightModelConfiguration.java new file mode 100644 index 000000000000..925451c68bb9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightModelConfiguration.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; + +/** + * Configuration of the model used in the insight generation. + */ +@Immutable +public final class InsightModelConfiguration implements JsonSerializable { + + /* + * The model deployment to be evaluated. Accepts either the deployment name alone or with the connection name as + * '{connectionName}/'. + */ + @Generated + private final String modelDeploymentName; + + /** + * Creates an instance of InsightModelConfiguration class. + * + * @param modelDeploymentName the modelDeploymentName value to set. + */ + @Generated + public InsightModelConfiguration(String modelDeploymentName) { + this.modelDeploymentName = modelDeploymentName; + } + + /** + * Get the modelDeploymentName property: The model deployment to be evaluated. Accepts either the deployment name + * alone or with the connection name as '{connectionName}/<modelDeploymentName>'. + * + * @return the modelDeploymentName value. + */ + @Generated + public String getModelDeploymentName() { + return this.modelDeploymentName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("modelDeploymentName", this.modelDeploymentName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightModelConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightModelConfiguration 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 InsightModelConfiguration. + */ + @Generated + public static InsightModelConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String modelDeploymentName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("modelDeploymentName".equals(fieldName)) { + modelDeploymentName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InsightModelConfiguration(modelDeploymentName); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightRequest.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightRequest.java new file mode 100644 index 000000000000..a507a1a214a9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightRequest.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; + +/** + * The request of the insights report. + */ +@Immutable +public class InsightRequest implements JsonSerializable { + + /* + * The type of request. + */ + @Generated + private InsightType type = InsightType.fromString("InsightRequest"); + + /** + * Creates an instance of InsightRequest class. + */ + @Generated + public InsightRequest() { + } + + /** + * Get the type property: The type of request. + * + * @return the type value. + */ + @Generated + public InsightType 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 InsightRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightRequest 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 InsightRequest. + */ + @Generated + public static InsightRequest 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 ("EvaluationRunClusterInsight".equals(discriminatorValue)) { + return EvaluationRunClusterInsightsRequest.fromJson(readerToUse.reset()); + } else if ("AgentClusterInsight".equals(discriminatorValue)) { + return AgentClusterInsightsRequest.fromJson(readerToUse.reset()); + } else if ("EvaluationComparison".equals(discriminatorValue)) { + return EvaluationComparisonRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static InsightRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightRequest deserializedInsightRequest = new InsightRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedInsightRequest.type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedInsightRequest; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightResult.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightResult.java new file mode 100644 index 000000000000..318ce7eb0412 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightResult.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; + +/** + * The result of the insights. + */ +@Immutable +public class InsightResult implements JsonSerializable { + + /* + * The type of insights result. + */ + @Generated + private InsightType type = InsightType.fromString("InsightResult"); + + /** + * Creates an instance of InsightResult class. + */ + @Generated + protected InsightResult() { + } + + /** + * Get the type property: The type of insights result. + * + * @return the type value. + */ + @Generated + public InsightType 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 InsightResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightResult 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 InsightResult. + */ + @Generated + public static InsightResult 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 ("EvaluationComparison".equals(discriminatorValue)) { + return EvaluationCompareReport.fromJson(readerToUse.reset()); + } else if ("EvaluationRunClusterInsight".equals(discriminatorValue)) { + return EvaluationRunClusterInsightResult.fromJson(readerToUse.reset()); + } else if ("AgentClusterInsight".equals(discriminatorValue)) { + return AgentClusterInsightResult.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static InsightResult fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightResult deserializedInsightResult = new InsightResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedInsightResult.type = InsightType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedInsightResult; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSample.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSample.java new file mode 100644 index 000000000000..1f2095f84ad1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSample.java @@ -0,0 +1,181 @@ +// Copyright (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.util.Map; + +/** + * A sample from the analysis. + */ +@Immutable +public class InsightSample implements JsonSerializable { + + /* + * Sample type + */ + @Generated + private SampleType type = SampleType.fromString("InsightSample"); + + /* + * The unique identifier for the analysis sample. + */ + @Generated + private final String id; + + /* + * Features to help with additional filtering of data in UX. + */ + @Generated + private final Map features; + + /* + * Info about the correlation for the analysis sample. + */ + @Generated + private final Map correlationInfo; + + /** + * Creates an instance of InsightSample class. + * + * @param id the id value to set. + * @param features the features value to set. + * @param correlationInfo the correlationInfo value to set. + */ + @Generated + protected InsightSample(String id, Map features, Map correlationInfo) { + this.id = id; + this.features = features; + this.correlationInfo = correlationInfo; + } + + /** + * Get the type property: Sample type. + * + * @return the type value. + */ + @Generated + public SampleType getType() { + return this.type; + } + + /** + * Get the id property: The unique identifier for the analysis sample. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the features property: Features to help with additional filtering of data in UX. + * + * @return the features value. + */ + @Generated + public Map getFeatures() { + return this.features; + } + + /** + * Get the correlationInfo property: Info about the correlation for the analysis sample. + * + * @return the correlationInfo value. + */ + @Generated + public Map getCorrelationInfo() { + return this.correlationInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeMapField("features", this.features, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeMapField("correlationInfo", this.correlationInfo, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightSample from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightSample 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 InsightSample. + */ + @Generated + public static InsightSample 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 ("EvaluationResultSample".equals(discriminatorValue)) { + return EvaluationResultSample.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static InsightSample fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + Map features = null; + Map correlationInfo = null; + SampleType type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("features".equals(fieldName)) { + features = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("correlationInfo".equals(fieldName)) { + correlationInfo = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("type".equals(fieldName)) { + type = SampleType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InsightSample deserializedInsightSample = new InsightSample(id, features, correlationInfo); + deserializedInsightSample.type = type; + return deserializedInsightSample; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightScheduleTask.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightScheduleTask.java new file mode 100644 index 000000000000..c6928c236e57 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightScheduleTask.java @@ -0,0 +1,120 @@ +// Copyright (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; +import java.util.Map; + +/** + * Insight task for the schedule. + */ +@Fluent +public final class InsightScheduleTask extends ScheduleTask { + + /* + * Type of the task. + */ + @Generated + private ScheduleTaskType type = ScheduleTaskType.INSIGHT; + + /* + * The insight payload. + */ + @Generated + private final Insight insight; + + /** + * Creates an instance of InsightScheduleTask class. + * + * @param insight the insight value to set. + */ + @Generated + public InsightScheduleTask(Insight insight) { + this.insight = insight; + } + + /** + * Get the type property: Type of the task. + * + * @return the type value. + */ + @Generated + @Override + public ScheduleTaskType getType() { + return this.type; + } + + /** + * Get the insight property: The insight payload. + * + * @return the insight value. + */ + @Generated + public Insight getInsight() { + return this.insight; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public InsightScheduleTask setConfiguration(Map configuration) { + super.setConfiguration(configuration); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("configuration", getConfiguration(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("insight", this.insight); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightScheduleTask from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightScheduleTask 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 InsightScheduleTask. + */ + @Generated + public static InsightScheduleTask fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map configuration = null; + Insight insight = null; + ScheduleTaskType type = ScheduleTaskType.INSIGHT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("configuration".equals(fieldName)) { + configuration = reader.readMap(reader1 -> reader1.getString()); + } else if ("insight".equals(fieldName)) { + insight = Insight.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = ScheduleTaskType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InsightScheduleTask deserializedInsightScheduleTask = new InsightScheduleTask(insight); + deserializedInsightScheduleTask.setConfiguration(configuration); + deserializedInsightScheduleTask.type = type; + return deserializedInsightScheduleTask; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSummary.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSummary.java new file mode 100644 index 000000000000..9c5b6c952a2c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightSummary.java @@ -0,0 +1,171 @@ +// Copyright (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; + +/** + * Summary of the error cluster analysis. + */ +@Immutable +public final class InsightSummary implements JsonSerializable { + + /* + * Total number of samples analyzed. + */ + @Generated + private final int sampleCount; + + /* + * Total number of unique subcluster labels. + */ + @Generated + private final int uniqueSubclusterCount; + + /* + * Total number of unique clusters. + */ + @Generated + private final int uniqueClusterCount; + + /* + * Method used for clustering. + */ + @Generated + private final String method; + + /* + * Token usage while performing clustering analysis + */ + @Generated + private final ClusterTokenUsage usage; + + /** + * Creates an instance of InsightSummary class. + * + * @param sampleCount the sampleCount value to set. + * @param uniqueSubclusterCount the uniqueSubclusterCount value to set. + * @param uniqueClusterCount the uniqueClusterCount value to set. + * @param method the method value to set. + * @param usage the usage value to set. + */ + @Generated + private InsightSummary(int sampleCount, int uniqueSubclusterCount, int uniqueClusterCount, String method, + ClusterTokenUsage usage) { + this.sampleCount = sampleCount; + this.uniqueSubclusterCount = uniqueSubclusterCount; + this.uniqueClusterCount = uniqueClusterCount; + this.method = method; + this.usage = usage; + } + + /** + * Get the sampleCount property: Total number of samples analyzed. + * + * @return the sampleCount value. + */ + @Generated + public int getSampleCount() { + return this.sampleCount; + } + + /** + * Get the uniqueSubclusterCount property: Total number of unique subcluster labels. + * + * @return the uniqueSubclusterCount value. + */ + @Generated + public int getUniqueSubclusterCount() { + return this.uniqueSubclusterCount; + } + + /** + * Get the uniqueClusterCount property: Total number of unique clusters. + * + * @return the uniqueClusterCount value. + */ + @Generated + public int getUniqueClusterCount() { + return this.uniqueClusterCount; + } + + /** + * Get the method property: Method used for clustering. + * + * @return the method value. + */ + @Generated + public String getMethod() { + return this.method; + } + + /** + * Get the usage property: Token usage while performing clustering analysis. + * + * @return the usage value. + */ + @Generated + public ClusterTokenUsage getUsage() { + return this.usage; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("sampleCount", this.sampleCount); + jsonWriter.writeIntField("uniqueSubclusterCount", this.uniqueSubclusterCount); + jsonWriter.writeIntField("uniqueClusterCount", this.uniqueClusterCount); + jsonWriter.writeStringField("method", this.method); + jsonWriter.writeJsonField("usage", this.usage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightSummary 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 InsightSummary. + */ + @Generated + public static InsightSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int sampleCount = 0; + int uniqueSubclusterCount = 0; + int uniqueClusterCount = 0; + String method = null; + ClusterTokenUsage usage = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("sampleCount".equals(fieldName)) { + sampleCount = reader.getInt(); + } else if ("uniqueSubclusterCount".equals(fieldName)) { + uniqueSubclusterCount = reader.getInt(); + } else if ("uniqueClusterCount".equals(fieldName)) { + uniqueClusterCount = reader.getInt(); + } else if ("method".equals(fieldName)) { + method = reader.getString(); + } else if ("usage".equals(fieldName)) { + usage = ClusterTokenUsage.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new InsightSummary(sampleCount, uniqueSubclusterCount, uniqueClusterCount, method, usage); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightType.java new file mode 100644 index 000000000000..da97616060b9 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightType.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 request of the insights. + */ +public final class InsightType extends ExpandableStringEnum { + + /** + * Insights on an Evaluation run result. + */ + @Generated + public static final InsightType EVALUATION_RUN_CLUSTER_INSIGHT = fromString("EvaluationRunClusterInsight"); + + /** + * Cluster Insight on an Agent. + */ + @Generated + public static final InsightType AGENT_CLUSTER_INSIGHT = fromString("AgentClusterInsight"); + + /** + * Evaluation Comparison. + */ + @Generated + public static final InsightType EVALUATION_COMPARISON = fromString("EvaluationComparison"); + + /** + * Creates a new instance of InsightType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public InsightType() { + } + + /** + * Creates or finds a InsightType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InsightType. + */ + @Generated + public static InsightType fromString(String name) { + return fromString(name, InsightType.class); + } + + /** + * Gets known InsightType values. + * + * @return known InsightType values. + */ + @Generated + public static Collection values() { + return values(InsightType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightsMetadata.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightsMetadata.java new file mode 100644 index 000000000000..90bc7909bf95 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InsightsMetadata.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.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; +import java.time.format.DateTimeFormatter; + +/** + * Metadata about the insights. + */ +@Immutable +public final class InsightsMetadata implements JsonSerializable { + + /* + * The timestamp when the insights were created. + */ + @Generated + private final OffsetDateTime createdAt; + + /* + * The timestamp when the insights were completed. + */ + @Generated + private OffsetDateTime completedAt; + + /** + * Creates an instance of InsightsMetadata class. + * + * @param createdAt the createdAt value to set. + */ + @Generated + private InsightsMetadata(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Get the createdAt property: The timestamp when the insights were created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the completedAt property: The timestamp when the insights were completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("completedAt", + this.completedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.completedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightsMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightsMetadata 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 InsightsMetadata. + */ + @Generated + public static InsightsMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime createdAt = null; + OffsetDateTime completedAt = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("completedAt".equals(fieldName)) { + completedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + InsightsMetadata deserializedInsightsMetadata = new InsightsMetadata(createdAt); + deserializedInsightsMetadata.completedAt = completedAt; + return deserializedInsightsMetadata; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListVersionsRequestType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListVersionsRequestType.java new file mode 100644 index 000000000000..c07b833c6980 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ListVersionsRequestType.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; + +/** + * Defines values for ListVersionsRequestType. + */ +public final class ListVersionsRequestType extends ExpandableStringEnum { + + /** + * Built-in evaluator (Microsoft provided). + */ + @Generated + public static final ListVersionsRequestType BUILT_IN = fromString("builtin"); + + /** + * Custom evaluator. + */ + @Generated + public static final ListVersionsRequestType CUSTOM = fromString("custom"); + + /** + * Static value all for ListVersionsRequestType. + */ + @Generated + public static final ListVersionsRequestType ALL = fromString("all"); + + /** + * Creates a new instance of ListVersionsRequestType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ListVersionsRequestType() { + } + + /** + * Creates or finds a ListVersionsRequestType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ListVersionsRequestType. + */ + @Generated + public static ListVersionsRequestType fromString(String name) { + return fromString(name, ListVersionsRequestType.class); + } + + /** + * Gets known ListVersionsRequestType values. + * + * @return known ListVersionsRequestType values. + */ + @Generated + public static Collection values() { + return values(ListVersionsRequestType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeployment.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeployment.java index 18b971f10c64..0c949b507dd6 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeployment.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeployment.java @@ -51,7 +51,7 @@ public final class ModelDeployment extends Deployment { * Sku of the model deployment */ @Generated - private Sku sku; + private ModelDeploymentSku sku; /* * Name of the connection the deployment comes from @@ -123,7 +123,7 @@ public Map getCapabilities() { * @return the sku value. */ @Generated - public Sku getSku() { + public ModelDeploymentSku getSku() { return this.sku; } @@ -176,7 +176,7 @@ public static ModelDeployment fromJson(JsonReader jsonReader) throws IOException Map capabilities = reader.readMap(reader1 -> reader1.getString()); deserializedModelDeployment.capabilities = capabilities; } else if ("sku".equals(fieldName)) { - deserializedModelDeployment.sku = Sku.fromJson(reader); + deserializedModelDeployment.sku = ModelDeploymentSku.fromJson(reader); } else if ("type".equals(fieldName)) { deserializedModelDeployment.type = DeploymentType.fromString(reader.getString()); } else if ("connectionName".equals(fieldName)) { diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Sku.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeploymentSku.java similarity index 85% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Sku.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeploymentSku.java index 323ea06a6fd1..ba16f14f5012 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Sku.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelDeploymentSku.java @@ -15,7 +15,7 @@ * Sku information. */ @Immutable -public final class Sku implements JsonSerializable { +public final class ModelDeploymentSku implements JsonSerializable { /* * Sku capacity @@ -48,7 +48,7 @@ public final class Sku implements JsonSerializable { private final String tier; /** - * Creates an instance of Sku class. + * Creates an instance of ModelDeploymentSku class. * * @param capacity the capacity value to set. * @param family the family value to set. @@ -57,7 +57,7 @@ public final class Sku implements JsonSerializable { * @param tier the tier value to set. */ @Generated - private Sku(long capacity, String family, String name, String size, String tier) { + private ModelDeploymentSku(long capacity, String family, String name, String size, String tier) { this.capacity = capacity; this.family = family; this.name = name; @@ -131,16 +131,16 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of Sku from the JsonReader. + * Reads an instance of ModelDeploymentSku from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of Sku if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. + * @return An instance of ModelDeploymentSku 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 Sku. + * @throws IOException If an error occurs while reading the ModelDeploymentSku. */ @Generated - public static Sku fromJson(JsonReader jsonReader) throws IOException { + public static ModelDeploymentSku fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { long capacity = 0L; String family = null; @@ -164,7 +164,7 @@ public static Sku fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - return new Sku(capacity, family, name, size, tier); + return new ModelDeploymentSku(capacity, family, name, size, tier); }); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelSamplingParams.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelSamplingParams.java new file mode 100644 index 000000000000..4127ae67535e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ModelSamplingParams.java @@ -0,0 +1,148 @@ +// Copyright (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 set of parameters used to control the sampling behavior of a language model during text generation. + */ +@Immutable +public final class ModelSamplingParams implements JsonSerializable { + + /* + * The temperature parameter for sampling. + */ + @Generated + private final double temperature; + + /* + * The top-p parameter for nucleus sampling. + */ + @Generated + private final double topP; + + /* + * The random seed for reproducibility. + */ + @Generated + private final int seed; + + /* + * The maximum number of tokens allowed in the completion. + */ + @Generated + private final int maxCompletionTokens; + + /** + * Creates an instance of ModelSamplingParams class. + * + * @param temperature the temperature value to set. + * @param topP the topP value to set. + * @param seed the seed value to set. + * @param maxCompletionTokens the maxCompletionTokens value to set. + */ + @Generated + public ModelSamplingParams(double temperature, double topP, int seed, int maxCompletionTokens) { + this.temperature = temperature; + this.topP = topP; + this.seed = seed; + this.maxCompletionTokens = maxCompletionTokens; + } + + /** + * Get the temperature property: The temperature parameter for sampling. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } + + /** + * Get the topP property: The top-p parameter for nucleus sampling. + * + * @return the topP value. + */ + @Generated + public double getTopP() { + return this.topP; + } + + /** + * Get the seed property: The random seed for reproducibility. + * + * @return the seed value. + */ + @Generated + public int getSeed() { + return this.seed; + } + + /** + * Get the maxCompletionTokens property: The maximum number of tokens allowed in the completion. + * + * @return the maxCompletionTokens value. + */ + @Generated + public int getMaxCompletionTokens() { + return this.maxCompletionTokens; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("temperature", this.temperature); + jsonWriter.writeDoubleField("top_p", this.topP); + jsonWriter.writeIntField("seed", this.seed); + jsonWriter.writeIntField("max_completion_tokens", this.maxCompletionTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelSamplingParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelSamplingParams 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 ModelSamplingParams. + */ + @Generated + public static ModelSamplingParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double temperature = 0.0; + double topP = 0.0; + int seed = 0; + int maxCompletionTokens = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("temperature".equals(fieldName)) { + temperature = reader.getDouble(); + } else if ("top_p".equals(fieldName)) { + topP = reader.getDouble(); + } else if ("seed".equals(fieldName)) { + seed = reader.getInt(); + } else if ("max_completion_tokens".equals(fieldName)) { + maxCompletionTokens = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new ModelSamplingParams(temperature, topP, seed, maxCompletionTokens); + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MonthlyRecurrenceSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MonthlyRecurrenceSchedule.java new file mode 100644 index 000000000000..883b6d6d475a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/MonthlyRecurrenceSchedule.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; +import java.util.List; + +/** + * Monthly recurrence schedule. + */ +@Immutable +public final class MonthlyRecurrenceSchedule extends RecurrenceSchedule { + + /* + * Recurrence type for the recurrence schedule. + */ + @Generated + private RecurrenceType type = RecurrenceType.MONTHLY; + + /* + * Days of the month for the recurrence schedule. + */ + @Generated + private final List daysOfMonth; + + /** + * Creates an instance of MonthlyRecurrenceSchedule class. + * + * @param daysOfMonth the daysOfMonth value to set. + */ + @Generated + public MonthlyRecurrenceSchedule(List daysOfMonth) { + this.daysOfMonth = daysOfMonth; + } + + /** + * Get the type property: Recurrence type for the recurrence schedule. + * + * @return the type value. + */ + @Generated + @Override + public RecurrenceType getType() { + return this.type; + } + + /** + * Get the daysOfMonth property: Days of the month for the recurrence schedule. + * + * @return the daysOfMonth value. + */ + @Generated + public List getDaysOfMonth() { + return this.daysOfMonth; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("daysOfMonth", this.daysOfMonth, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MonthlyRecurrenceSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MonthlyRecurrenceSchedule 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 MonthlyRecurrenceSchedule. + */ + @Generated + public static MonthlyRecurrenceSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List daysOfMonth = null; + RecurrenceType type = RecurrenceType.MONTHLY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("daysOfMonth".equals(fieldName)) { + daysOfMonth = reader.readArray(reader1 -> reader1.getInt()); + } else if ("type".equals(fieldName)) { + type = RecurrenceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + MonthlyRecurrenceSchedule deserializedMonthlyRecurrenceSchedule + = new MonthlyRecurrenceSchedule(daysOfMonth); + deserializedMonthlyRecurrenceSchedule.type = type; + return deserializedMonthlyRecurrenceSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OneTimeTrigger.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OneTimeTrigger.java new file mode 100644 index 000000000000..eb7f2660d00e --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OneTimeTrigger.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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * One-time trigger. + */ +@Fluent +public final class OneTimeTrigger extends Trigger { + + /* + * Type of the trigger. + */ + @Generated + private TriggerType type = TriggerType.ONE_TIME; + + /* + * Date and time for the one-time trigger in ISO 8601 format. + */ + @Generated + private final String triggerAt; + + /* + * Time zone for the one-time trigger. + */ + @Generated + private String timeZone; + + /** + * Creates an instance of OneTimeTrigger class. + * + * @param triggerAt the triggerAt value to set. + */ + @Generated + public OneTimeTrigger(String triggerAt) { + this.triggerAt = triggerAt; + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + @Override + public TriggerType getType() { + return this.type; + } + + /** + * Get the triggerAt property: Date and time for the one-time trigger in ISO 8601 format. + * + * @return the triggerAt value. + */ + @Generated + public String getTriggerAt() { + return this.triggerAt; + } + + /** + * Get the timeZone property: Time zone for the one-time trigger. + * + * @return the timeZone value. + */ + @Generated + public String getTimeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Time zone for the one-time trigger. + * + * @param timeZone the timeZone value to set. + * @return the OneTimeTrigger object itself. + */ + @Generated + public OneTimeTrigger setTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("triggerAt", this.triggerAt); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("timeZone", this.timeZone); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OneTimeTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OneTimeTrigger 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 OneTimeTrigger. + */ + @Generated + public static OneTimeTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String triggerAt = null; + TriggerType type = TriggerType.ONE_TIME; + String timeZone = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("triggerAt".equals(fieldName)) { + triggerAt = reader.getString(); + } else if ("type".equals(fieldName)) { + type = TriggerType.fromString(reader.getString()); + } else if ("timeZone".equals(fieldName)) { + timeZone = reader.getString(); + } else { + reader.skipChildren(); + } + } + OneTimeTrigger deserializedOneTimeTrigger = new OneTimeTrigger(triggerAt); + deserializedOneTimeTrigger.type = type; + deserializedOneTimeTrigger.timeZone = timeZone; + return deserializedOneTimeTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OperationStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OperationStatus.java new file mode 100644 index 000000000000..a3787302a6a6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/OperationStatus.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; + +/** + * Enum describing allowed operation states. + */ +public final class OperationStatus extends ExpandableStringEnum { + + /** + * The operation has not started. + */ + @Generated + public static final OperationStatus NOT_STARTED = fromString("NotStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final OperationStatus RUNNING = fromString("Running"); + + /** + * The operation has completed successfully. + */ + @Generated + public static final OperationStatus SUCCEEDED = fromString("Succeeded"); + + /** + * The operation has failed. + */ + @Generated + public static final OperationStatus FAILED = fromString("Failed"); + + /** + * The operation has been canceled by the user. + */ + @Generated + public static final OperationStatus CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of OperationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationStatus() { + } + + /** + * Creates or finds a OperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationStatus. + */ + @Generated + public static OperationStatus fromString(String name) { + return fromString(name, OperationStatus.class); + } + + /** + * Gets known OperationStatus values. + * + * @return known OperationStatus values. + */ + @Generated + public static Collection values() { + return values(OperationStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/PromptBasedEvaluatorDefinition.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/PromptBasedEvaluatorDefinition.java new file mode 100644 index 000000000000..50595fd36573 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/PromptBasedEvaluatorDefinition.java @@ -0,0 +1,160 @@ +// Copyright (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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Prompt-based evaluator. + */ +@Fluent +public final class PromptBasedEvaluatorDefinition extends EvaluatorDefinition { + + /* + * The type of evaluator definition + */ + @Generated + private EvaluatorDefinitionType type = EvaluatorDefinitionType.PROMPT; + + /* + * The prompt text used for evaluation + */ + @Generated + private final String promptText; + + /** + * Creates an instance of PromptBasedEvaluatorDefinition class. + * + * @param promptText the promptText value to set. + */ + @Generated + public PromptBasedEvaluatorDefinition(String promptText) { + this.promptText = promptText; + } + + /** + * Get the type property: The type of evaluator definition. + * + * @return the type value. + */ + @Generated + @Override + public EvaluatorDefinitionType getType() { + return this.type; + } + + /** + * Get the promptText property: The prompt text used for evaluation. + * + * @return the promptText value. + */ + @Generated + public String getPromptText() { + return this.promptText; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PromptBasedEvaluatorDefinition setInitParameters(BinaryData initParameters) { + super.setInitParameters(initParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PromptBasedEvaluatorDefinition setDataSchema(BinaryData dataSchema) { + super.setDataSchema(dataSchema); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PromptBasedEvaluatorDefinition setMetrics(Map metrics) { + super.setMetrics(metrics); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (getInitParameters() != null) { + jsonWriter.writeFieldName("init_parameters"); + getInitParameters().writeTo(jsonWriter); + } + if (getDataSchema() != null) { + jsonWriter.writeFieldName("data_schema"); + getDataSchema().writeTo(jsonWriter); + } + jsonWriter.writeMapField("metrics", getMetrics(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("prompt_text", this.promptText); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PromptBasedEvaluatorDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PromptBasedEvaluatorDefinition 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 PromptBasedEvaluatorDefinition. + */ + @Generated + public static PromptBasedEvaluatorDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData initParameters = null; + BinaryData dataSchema = null; + Map metrics = null; + String promptText = null; + EvaluatorDefinitionType type = EvaluatorDefinitionType.PROMPT; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("init_parameters".equals(fieldName)) { + initParameters + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("data_schema".equals(fieldName)) { + dataSchema + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("metrics".equals(fieldName)) { + metrics = reader.readMap(reader1 -> EvaluatorMetric.fromJson(reader1)); + } else if ("prompt_text".equals(fieldName)) { + promptText = reader.getString(); + } else if ("type".equals(fieldName)) { + type = EvaluatorDefinitionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + PromptBasedEvaluatorDefinition deserializedPromptBasedEvaluatorDefinition + = new PromptBasedEvaluatorDefinition(promptText); + deserializedPromptBasedEvaluatorDefinition.setInitParameters(initParameters); + deserializedPromptBasedEvaluatorDefinition.setDataSchema(dataSchema); + deserializedPromptBasedEvaluatorDefinition.setMetrics(metrics); + deserializedPromptBasedEvaluatorDefinition.type = type; + return deserializedPromptBasedEvaluatorDefinition; + }); + } +} 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..ecbf508dabef --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceSchedule.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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Recurrence schedule model. + */ +@Immutable +public class RecurrenceSchedule implements JsonSerializable { + + /* + * Recurrence type for the recurrence schedule. + */ + @Generated + private RecurrenceType type = RecurrenceType.fromString("RecurrenceSchedule"); + + /** + * Creates an instance of RecurrenceSchedule class. + */ + @Generated + public RecurrenceSchedule() { + } + + /** + * Get the type property: Recurrence type for the recurrence schedule. + * + * @return the type value. + */ + @Generated + public RecurrenceType 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 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 IOException If an error occurs while reading the RecurrenceSchedule. + */ + @Generated + public static RecurrenceSchedule 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 ("Hourly".equals(discriminatorValue)) { + return HourlyRecurrenceSchedule.fromJson(readerToUse.reset()); + } else if ("Daily".equals(discriminatorValue)) { + return DailyRecurrenceSchedule.fromJson(readerToUse.reset()); + } else if ("Weekly".equals(discriminatorValue)) { + return WeeklyRecurrenceSchedule.fromJson(readerToUse.reset()); + } else if ("Monthly".equals(discriminatorValue)) { + return MonthlyRecurrenceSchedule.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static RecurrenceSchedule fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecurrenceSchedule deserializedRecurrenceSchedule = new RecurrenceSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedRecurrenceSchedule.type = RecurrenceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + 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..b55222bf60fb --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java @@ -0,0 +1,225 @@ +// Copyright (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 based trigger. + */ +@Fluent +public final class RecurrenceTrigger extends Trigger { + + /* + * Type of the trigger. + */ + @Generated + private TriggerType type = TriggerType.RECURRENCE; + + /* + * Start time for the recurrence schedule in ISO 8601 format. + */ + @Generated + private String startTime; + + /* + * End time for the recurrence schedule in ISO 8601 format. + */ + @Generated + private String endTime; + + /* + * Time zone for the recurrence schedule. + */ + @Generated + private String timeZone; + + /* + * Interval for the recurrence schedule. + */ + @Generated + private final int interval; + + /* + * Recurrence schedule for the recurrence trigger. + */ + @Generated + private final RecurrenceSchedule schedule; + + /** + * Creates an instance of RecurrenceTrigger class. + * + * @param interval the interval value to set. + * @param schedule the schedule value to set. + */ + @Generated + public RecurrenceTrigger(int interval, RecurrenceSchedule schedule) { + this.interval = interval; + this.schedule = schedule; + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + @Override + public TriggerType getType() { + return this.type; + } + + /** + * Get the startTime property: Start time for the recurrence schedule in ISO 8601 format. + * + * @return the startTime value. + */ + @Generated + public String getStartTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time for the recurrence schedule in ISO 8601 format. + * + * @param startTime the startTime value to set. + * @return the RecurrenceTrigger object itself. + */ + @Generated + public RecurrenceTrigger setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time for the recurrence schedule in ISO 8601 format. + * + * @return the endTime value. + */ + @Generated + public String getEndTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time for the recurrence schedule in ISO 8601 format. + * + * @param endTime the endTime value to set. + * @return the RecurrenceTrigger object itself. + */ + @Generated + public RecurrenceTrigger setEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the timeZone property: Time zone for the recurrence schedule. + * + * @return the timeZone value. + */ + @Generated + public String getTimeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Time zone for the recurrence schedule. + * + * @param timeZone the timeZone value to set. + * @return the RecurrenceTrigger object itself. + */ + @Generated + public RecurrenceTrigger setTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the interval property: Interval for the recurrence schedule. + * + * @return the interval value. + */ + @Generated + public int getInterval() { + return this.interval; + } + + /** + * Get the schedule property: Recurrence schedule for the recurrence trigger. + * + * @return the schedule value. + */ + @Generated + public RecurrenceSchedule getSchedule() { + return this.schedule; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("interval", this.interval); + jsonWriter.writeJsonField("schedule", this.schedule); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("startTime", this.startTime); + jsonWriter.writeStringField("endTime", this.endTime); + jsonWriter.writeStringField("timeZone", this.timeZone); + 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 -> { + int interval = 0; + RecurrenceSchedule schedule = null; + TriggerType type = TriggerType.RECURRENCE; + String startTime = null; + String endTime = null; + String timeZone = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("interval".equals(fieldName)) { + interval = reader.getInt(); + } else if ("schedule".equals(fieldName)) { + schedule = RecurrenceSchedule.fromJson(reader); + } else if ("type".equals(fieldName)) { + type = TriggerType.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + startTime = reader.getString(); + } else if ("endTime".equals(fieldName)) { + endTime = reader.getString(); + } else if ("timeZone".equals(fieldName)) { + timeZone = reader.getString(); + } else { + reader.skipChildren(); + } + } + RecurrenceTrigger deserializedRecurrenceTrigger = new RecurrenceTrigger(interval, schedule); + deserializedRecurrenceTrigger.type = type; + deserializedRecurrenceTrigger.startTime = startTime; + deserializedRecurrenceTrigger.endTime = endTime; + deserializedRecurrenceTrigger.timeZone = timeZone; + return deserializedRecurrenceTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceType.java new file mode 100644 index 000000000000..c467d8db70b2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceType.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; + +/** + * Recurrence type. + */ +public final class RecurrenceType extends ExpandableStringEnum { + + /** + * Hourly recurrence pattern. + */ + @Generated + public static final RecurrenceType HOURLY = fromString("Hourly"); + + /** + * Daily recurrence pattern. + */ + @Generated + public static final RecurrenceType DAILY = fromString("Daily"); + + /** + * Weekly recurrence pattern. + */ + @Generated + public static final RecurrenceType WEEKLY = fromString("Weekly"); + + /** + * Monthly recurrence pattern. + */ + @Generated + public static final RecurrenceType MONTHLY = fromString("Monthly"); + + /** + * Creates a new instance of RecurrenceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RecurrenceType() { + } + + /** + * Creates or finds a RecurrenceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecurrenceType. + */ + @Generated + public static RecurrenceType fromString(String name) { + return fromString(name, RecurrenceType.class); + } + + /** + * Gets known RecurrenceType values. + * + * @return known RecurrenceType values. + */ + @Generated + public static Collection values() { + return values(RecurrenceType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RiskCategory.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RiskCategory.java index 6fc56ca8b46f..d308abf90c65 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RiskCategory.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RiskCategory.java @@ -36,6 +36,42 @@ public final class RiskCategory extends ExpandableStringEnum { @Generated public static final RiskCategory SELF_HARM = fromString("SelfHarm"); + /** + * Represents content that involves illegal activities. + */ + @Generated + public static final RiskCategory PROTECTED_MATERIAL = fromString("ProtectedMaterial"); + + /** + * Represents content that contains vulnerabilities in code. + */ + @Generated + public static final RiskCategory CODE_VULNERABILITY = fromString("CodeVulnerability"); + + /** + * Represents content that lacks a solid grounding in fact. + */ + @Generated + public static final RiskCategory UNGROUNDED_ATTRIBUTES = fromString("UngroundedAttributes"); + + /** + * Represents content that involves prohibited actions. + */ + @Generated + public static final RiskCategory PROHIBITED_ACTIONS = fromString("ProhibitedActions"); + + /** + * Represents content that involves sensitive data leakage. + */ + @Generated + public static final RiskCategory SENSITIVE_DATA_LEAKAGE = fromString("SensitiveDataLeakage"); + + /** + * Represents content that involves task adherence. + */ + @Generated + public static final RiskCategory TASK_ADHERENCE = fromString("TaskAdherence"); + /** * Creates a new instance of RiskCategory value. * diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SampleType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SampleType.java new file mode 100644 index 000000000000..13fdc10b4755 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SampleType.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; + +/** + * The type of sample used in the analysis. + */ +public final class SampleType extends ExpandableStringEnum { + + /** + * A sample from the evaluation result. + */ + @Generated + public static final SampleType EVALUATION_RESULT_SAMPLE = fromString("EvaluationResultSample"); + + /** + * Creates a new instance of SampleType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SampleType() { + } + + /** + * Creates or finds a SampleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SampleType. + */ + @Generated + public static SampleType fromString(String name) { + return fromString(name, SampleType.class); + } + + /** + * Gets known SampleType values. + * + * @return known SampleType values. + */ + @Generated + public static Collection values() { + return values(SampleType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredentials.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredentials.java index 1640f31e582e..a915c5df1a26 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredentials.java +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/SasCredentials.java @@ -28,6 +28,13 @@ public final class SasCredentials extends BaseCredentials { @Generated private String sasToken; + /** + * Creates an instance of SasCredentials class. + */ + @Generated + private SasCredentials() { + } + /** * Get the type property: The type of credential used by the connection. * @@ -86,11 +93,4 @@ public static SasCredentials fromJson(JsonReader jsonReader) throws IOException return deserializedSasCredentials; }); } - - /** - * Creates an instance of SasCredentials class. - */ - @Generated - private SasCredentials() { - } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Schedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Schedule.java new file mode 100644 index 000000000000..3a0fec40b5d5 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Schedule.java @@ -0,0 +1,322 @@ +// Copyright (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; + +/** + * Schedule model. + */ +@Fluent +public final class Schedule implements JsonSerializable { + + /* + * Identifier of the schedule. + */ + @Generated + private String id; + + /* + * Name of the schedule. + */ + @Generated + private String displayName; + + /* + * Description of the schedule. + */ + @Generated + private String description; + + /* + * Enabled status of the schedule. + */ + @Generated + private final boolean enabled; + + /* + * Provisioning status of the schedule. + */ + @Generated + private ScheduleProvisioningStatus provisioningStatus; + + /* + * Trigger for the schedule. + */ + @Generated + private final Trigger trigger; + + /* + * Task for the schedule. + */ + @Generated + private final ScheduleTask task; + + /* + * Schedule's tags. Unlike properties, tags are fully mutable. + */ + @Generated + private Map tags; + + /* + * Schedule's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. + */ + @Generated + private Map properties; + + /* + * System metadata for the resource. + */ + @Generated + private Map systemData; + + /** + * Creates an instance of Schedule class. + * + * @param enabled the enabled value to set. + * @param trigger the trigger value to set. + * @param task the task value to set. + */ + @Generated + public Schedule(boolean enabled, Trigger trigger, ScheduleTask task) { + this.enabled = enabled; + this.trigger = trigger; + this.task = task; + } + + /** + * Get the id property: Identifier of the schedule. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the displayName property: Name of the schedule. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Name of the schedule. + * + * @param displayName the displayName value to set. + * @return the Schedule object itself. + */ + @Generated + public Schedule setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Description of the schedule. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the schedule. + * + * @param description the description value to set. + * @return the Schedule object itself. + */ + @Generated + public Schedule setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the enabled property: Enabled status of the schedule. + * + * @return the enabled value. + */ + @Generated + public boolean isEnabled() { + return this.enabled; + } + + /** + * Get the provisioningStatus property: Provisioning status of the schedule. + * + * @return the provisioningStatus value. + */ + @Generated + public ScheduleProvisioningStatus getProvisioningStatus() { + return this.provisioningStatus; + } + + /** + * Get the trigger property: Trigger for the schedule. + * + * @return the trigger value. + */ + @Generated + public Trigger getTrigger() { + return this.trigger; + } + + /** + * Get the task property: Task for the schedule. + * + * @return the task value. + */ + @Generated + public ScheduleTask getTask() { + return this.task; + } + + /** + * Get the tags property: Schedule's tags. Unlike properties, tags are fully mutable. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: Schedule's tags. Unlike properties, tags are fully mutable. + * + * @param tags the tags value to set. + * @return the Schedule object itself. + */ + @Generated + public Schedule setTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Schedule'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: Schedule's properties. Unlike tags, properties are add-only. Once added, a property + * cannot be removed. + * + * @param properties the properties value to set. + * @return the Schedule object itself. + */ + @Generated + public Schedule setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: System metadata for the resource. + * + * @return the systemData value. + */ + @Generated + public Map getSystemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("trigger", this.trigger); + jsonWriter.writeJsonField("task", this.task); + 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)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Schedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Schedule 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 Schedule. + */ + @Generated + public static Schedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + boolean enabled = false; + Trigger trigger = null; + ScheduleTask task = null; + Map systemData = null; + String displayName = null; + String description = null; + ScheduleProvisioningStatus provisioningStatus = null; + Map tags = null; + Map properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("enabled".equals(fieldName)) { + enabled = reader.getBoolean(); + } else if ("trigger".equals(fieldName)) { + trigger = Trigger.fromJson(reader); + } else if ("task".equals(fieldName)) { + task = ScheduleTask.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + systemData = reader.readMap(reader1 -> reader1.getString()); + } else if ("displayName".equals(fieldName)) { + displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + provisioningStatus = ScheduleProvisioningStatus.fromString(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 { + reader.skipChildren(); + } + } + Schedule deserializedSchedule = new Schedule(enabled, trigger, task); + deserializedSchedule.id = id; + deserializedSchedule.systemData = systemData; + deserializedSchedule.displayName = displayName; + deserializedSchedule.description = description; + deserializedSchedule.provisioningStatus = provisioningStatus; + deserializedSchedule.tags = tags; + deserializedSchedule.properties = properties; + return deserializedSchedule; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleProvisioningStatus.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleProvisioningStatus.java new file mode 100644 index 000000000000..875b2621b7f6 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleProvisioningStatus.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; + +/** + * Schedule provisioning status. + */ +public final class ScheduleProvisioningStatus extends ExpandableStringEnum { + + /** + * Represents the creation status of the schedule. + */ + @Generated + public static final ScheduleProvisioningStatus CREATING = fromString("Creating"); + + /** + * Represents the updating status of the schedule. + */ + @Generated + public static final ScheduleProvisioningStatus UPDATING = fromString("Updating"); + + /** + * Represents the deleting status of the schedule. + */ + @Generated + public static final ScheduleProvisioningStatus DELETING = fromString("Deleting"); + + /** + * Represents the succeeded status of the schedule. + */ + @Generated + public static final ScheduleProvisioningStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Represents the failed status of the schedule. + */ + @Generated + public static final ScheduleProvisioningStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of ScheduleProvisioningStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ScheduleProvisioningStatus() { + } + + /** + * Creates or finds a ScheduleProvisioningStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScheduleProvisioningStatus. + */ + @Generated + public static ScheduleProvisioningStatus fromString(String name) { + return fromString(name, ScheduleProvisioningStatus.class); + } + + /** + * Gets known ScheduleProvisioningStatus values. + * + * @return known ScheduleProvisioningStatus values. + */ + @Generated + public static Collection values() { + return values(ScheduleProvisioningStatus.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleRun.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleRun.java new file mode 100644 index 000000000000..db22261239e0 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleRun.java @@ -0,0 +1,185 @@ +// Copyright (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.Map; + +/** + * Schedule run model. + */ +@Immutable +public final class ScheduleRun implements JsonSerializable { + + /* + * Identifier of the schedule. + */ + @Generated + private final String scheduleId; + + /* + * Trigger success status of the schedule run. + */ + @Generated + private boolean success; + + /* + * Trigger time of the schedule run. + */ + @Generated + private String triggerTime; + + /* + * Error information for the schedule run. + */ + @Generated + private String error; + + /* + * Properties of the schedule run. + */ + @Generated + private Map properties; + + /** + * Creates an instance of ScheduleRun class. + * + * @param scheduleId the scheduleId value to set. + */ + @Generated + private ScheduleRun(String scheduleId) { + this.scheduleId = scheduleId; + } + + /** + * Get the scheduleId property: Identifier of the schedule. + * + * @return the scheduleId value. + */ + @Generated + public String getScheduleId() { + return this.scheduleId; + } + + /** + * Get the success property: Trigger success status of the schedule run. + * + * @return the success value. + */ + @Generated + public boolean isSuccess() { + return this.success; + } + + /** + * Get the triggerTime property: Trigger time of the schedule run. + * + * @return the triggerTime value. + */ + @Generated + public String getTriggerTime() { + return this.triggerTime; + } + + /** + * Get the error property: Error information for the schedule run. + * + * @return the error value. + */ + @Generated + public String getError() { + return this.error; + } + + /** + * Get the properties property: Properties of the schedule run. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("scheduleId", this.scheduleId); + jsonWriter.writeStringField("triggerTime", this.triggerTime); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScheduleRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScheduleRun 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 ScheduleRun. + */ + @Generated + public static ScheduleRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String runId = null; + String scheduleId = null; + boolean success = false; + Map properties = null; + String triggerTime = null; + String error = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + runId = reader.getString(); + } else if ("scheduleId".equals(fieldName)) { + scheduleId = reader.getString(); + } else if ("success".equals(fieldName)) { + success = reader.getBoolean(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else if ("triggerTime".equals(fieldName)) { + triggerTime = reader.getString(); + } else if ("error".equals(fieldName)) { + error = reader.getString(); + } else { + reader.skipChildren(); + } + } + ScheduleRun deserializedScheduleRun = new ScheduleRun(scheduleId); + deserializedScheduleRun.runId = runId; + deserializedScheduleRun.success = success; + deserializedScheduleRun.properties = properties; + deserializedScheduleRun.triggerTime = triggerTime; + deserializedScheduleRun.error = error; + return deserializedScheduleRun; + }); + } + + /* + * Identifier of the schedule run. + */ + @Generated + private String runId; + + /** + * Get the runId property: Identifier of the schedule run. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTask.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTask.java new file mode 100644 index 000000000000..170058244da3 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTask.java @@ -0,0 +1,140 @@ +// Copyright (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; + +/** + * Schedule task model. + */ +@Fluent +public class ScheduleTask implements JsonSerializable { + + /* + * Type of the task. + */ + @Generated + private ScheduleTaskType type = ScheduleTaskType.fromString("ScheduleTask"); + + /* + * Configuration for the task. + */ + @Generated + private Map configuration; + + /** + * Creates an instance of ScheduleTask class. + */ + @Generated + public ScheduleTask() { + } + + /** + * Get the type property: Type of the task. + * + * @return the type value. + */ + @Generated + public ScheduleTaskType getType() { + return this.type; + } + + /** + * Get the configuration property: Configuration for the task. + * + * @return the configuration value. + */ + @Generated + public Map getConfiguration() { + return this.configuration; + } + + /** + * Set the configuration property: Configuration for the task. + * + * @param configuration the configuration value to set. + * @return the ScheduleTask object itself. + */ + @Generated + public ScheduleTask setConfiguration(Map configuration) { + this.configuration = configuration; + 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.writeMapField("configuration", this.configuration, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScheduleTask from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScheduleTask 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 ScheduleTask. + */ + @Generated + public static ScheduleTask 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 ("Evaluation".equals(discriminatorValue)) { + return EvaluationScheduleTask.fromJson(readerToUse.reset()); + } else if ("Insight".equals(discriminatorValue)) { + return InsightScheduleTask.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ScheduleTask fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScheduleTask deserializedScheduleTask = new ScheduleTask(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("type".equals(fieldName)) { + deserializedScheduleTask.type = ScheduleTaskType.fromString(reader.getString()); + } else if ("configuration".equals(fieldName)) { + Map configuration = reader.readMap(reader1 -> reader1.getString()); + deserializedScheduleTask.configuration = configuration; + } else { + reader.skipChildren(); + } + } + return deserializedScheduleTask; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTaskType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTaskType.java new file mode 100644 index 000000000000..6151696d2c24 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ScheduleTaskType.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; + +/** + * Type of the task. + */ +public final class ScheduleTaskType extends ExpandableStringEnum { + + /** + * Evaluation task. + */ + @Generated + public static final ScheduleTaskType EVALUATION = fromString("Evaluation"); + + /** + * Insight task. + */ + @Generated + public static final ScheduleTaskType INSIGHT = fromString("Insight"); + + /** + * Creates a new instance of ScheduleTaskType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ScheduleTaskType() { + } + + /** + * Creates or finds a ScheduleTaskType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScheduleTaskType. + */ + @Generated + public static ScheduleTaskType fromString(String name) { + return fromString(name, ScheduleTaskType.class); + } + + /** + * Gets known ScheduleTaskType values. + * + * @return known ScheduleTaskType values. + */ + @Generated + public static Collection values() { + return values(ScheduleTaskType.class); + } +} 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/Target.java similarity index 65% rename from sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/InputData.java rename to sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Target.java index d6cf82e97c6b..333ef6cb1579 100644 --- 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/Target.java @@ -12,26 +12,26 @@ import java.io.IOException; /** - * Abstract data class. + * Base class for targets with discriminator support. */ @Immutable -public class InputData implements JsonSerializable { +public class Target implements JsonSerializable { /* - * Type of the data + * The type of target. */ @Generated - private String type = "InputData"; + private String type = "Target"; /** - * Creates an instance of InputData class. + * Creates an instance of Target class. */ @Generated - public InputData() { + public Target() { } /** - * Get the type property: Type of the data. + * Get the type property: The type of target. * * @return the type value. */ @@ -52,15 +52,15 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of InputData from the JsonReader. + * Reads an instance of Target 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. + * @return An instance of Target 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 Target. */ @Generated - public static InputData fromJson(JsonReader jsonReader) throws IOException { + public static Target fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String discriminatorValue = null; try (JsonReader readerToUse = reader.bufferObject()) { @@ -77,8 +77,12 @@ public static InputData fromJson(JsonReader jsonReader) throws IOException { } } // Use the discriminator value to determine which subtype should be deserialized. - if ("dataset".equals(discriminatorValue)) { - return InputDataset.fromJson(readerToUse.reset()); + if ("azure_ai_model".equals(discriminatorValue)) { + return AzureAIModelTarget.fromJson(readerToUse.reset()); + } else if ("azure_ai_assistant".equals(discriminatorValue)) { + return AzureAIAssistantTarget.fromJson(readerToUse.reset()); + } else if ("azure_ai_agent".equals(discriminatorValue)) { + return AzureAIAgentTarget.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } @@ -87,19 +91,19 @@ public static InputData fromJson(JsonReader jsonReader) throws IOException { } @Generated - static InputData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + static Target fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - InputData deserializedInputData = new InputData(); + Target deserializedTarget = new Target(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("type".equals(fieldName)) { - deserializedInputData.type = reader.getString(); + deserializedTarget.type = reader.getString(); } else { reader.skipChildren(); } } - return deserializedInputData; + return deserializedTarget; }); } } diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomyCategory.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomyCategory.java new file mode 100644 index 000000000000..83fc2727e483 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomyCategory.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.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; + +/** + * Taxonomy category definition. + */ +@Fluent +public final class TaxonomyCategory implements JsonSerializable { + + /* + * Unique identifier of the taxonomy category. + */ + @Generated + private final String id; + + /* + * Name of the taxonomy category. + */ + @Generated + private final String name; + + /* + * Description of the taxonomy category. + */ + @Generated + private String description; + + /* + * Risk category associated with this taxonomy category. + */ + @Generated + private final RiskCategory riskCategory; + + /* + * List of taxonomy sub categories. + */ + @Generated + private final List subCategories; + + /* + * Additional properties for the taxonomy category. + */ + @Generated + private Map properties; + + /** + * Creates an instance of TaxonomyCategory class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param riskCategory the riskCategory value to set. + * @param subCategories the subCategories value to set. + */ + @Generated + public TaxonomyCategory(String id, String name, RiskCategory riskCategory, + List subCategories) { + this.id = id; + this.name = name; + this.riskCategory = riskCategory; + this.subCategories = subCategories; + } + + /** + * Get the id property: Unique identifier of the taxonomy category. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: Name of the taxonomy category. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: Description of the taxonomy category. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the taxonomy category. + * + * @param description the description value to set. + * @return the TaxonomyCategory object itself. + */ + @Generated + public TaxonomyCategory setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the riskCategory property: Risk category associated with this taxonomy category. + * + * @return the riskCategory value. + */ + @Generated + public RiskCategory getRiskCategory() { + return this.riskCategory; + } + + /** + * Get the subCategories property: List of taxonomy sub categories. + * + * @return the subCategories value. + */ + @Generated + public List getSubCategories() { + return this.subCategories; + } + + /** + * Get the properties property: Additional properties for the taxonomy category. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties for the taxonomy category. + * + * @param properties the properties value to set. + * @return the TaxonomyCategory object itself. + */ + @Generated + public TaxonomyCategory setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("riskCategory", this.riskCategory == null ? null : this.riskCategory.toString()); + jsonWriter.writeArrayField("subCategories", this.subCategories, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaxonomyCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaxonomyCategory 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 TaxonomyCategory. + */ + @Generated + public static TaxonomyCategory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + RiskCategory riskCategory = null; + List subCategories = null; + String description = null; + Map 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 ("riskCategory".equals(fieldName)) { + riskCategory = RiskCategory.fromString(reader.getString()); + } else if ("subCategories".equals(fieldName)) { + subCategories = reader.readArray(reader1 -> TaxonomySubCategory.fromJson(reader1)); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + TaxonomyCategory deserializedTaxonomyCategory = new TaxonomyCategory(id, name, riskCategory, subCategories); + deserializedTaxonomyCategory.description = description; + deserializedTaxonomyCategory.properties = properties; + return deserializedTaxonomyCategory; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomySubCategory.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomySubCategory.java new file mode 100644 index 000000000000..5e327626001a --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TaxonomySubCategory.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.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; + +/** + * Taxonomy sub-category definition. + */ +@Fluent +public final class TaxonomySubCategory implements JsonSerializable { + + /* + * Unique identifier of the taxonomy sub-category. + */ + @Generated + private final String id; + + /* + * Name of the taxonomy sub-category. + */ + @Generated + private final String name; + + /* + * Description of the taxonomy sub-category. + */ + @Generated + private String description; + + /* + * List of taxonomy items under this sub-category. + */ + @Generated + private final boolean enabled; + + /* + * Additional properties for the taxonomy sub-category. + */ + @Generated + private Map properties; + + /** + * Creates an instance of TaxonomySubCategory class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param enabled the enabled value to set. + */ + @Generated + public TaxonomySubCategory(String id, String name, boolean enabled) { + this.id = id; + this.name = name; + this.enabled = enabled; + } + + /** + * Get the id property: Unique identifier of the taxonomy sub-category. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: Name of the taxonomy sub-category. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: Description of the taxonomy sub-category. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the taxonomy sub-category. + * + * @param description the description value to set. + * @return the TaxonomySubCategory object itself. + */ + @Generated + public TaxonomySubCategory setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the enabled property: List of taxonomy items under this sub-category. + * + * @return the enabled value. + */ + @Generated + public boolean isEnabled() { + return this.enabled; + } + + /** + * Get the properties property: Additional properties for the taxonomy sub-category. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties for the taxonomy sub-category. + * + * @param properties the properties value to set. + * @return the TaxonomySubCategory object itself. + */ + @Generated + public TaxonomySubCategory setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaxonomySubCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaxonomySubCategory 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 TaxonomySubCategory. + */ + @Generated + public static TaxonomySubCategory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + boolean enabled = false; + String description = null; + Map 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 ("enabled".equals(fieldName)) { + enabled = reader.getBoolean(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + TaxonomySubCategory deserializedTaxonomySubCategory = new TaxonomySubCategory(id, name, enabled); + deserializedTaxonomySubCategory.description = description; + deserializedTaxonomySubCategory.properties = properties; + return deserializedTaxonomySubCategory; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDescription.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDescription.java new file mode 100644 index 000000000000..1a74dd7f99e2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/ToolDescription.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.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; + +/** + * Description of a tool that can be used by an agent. + */ +@Fluent +public final class ToolDescription implements JsonSerializable { + + /* + * The name of the tool. + */ + @Generated + private String name; + + /* + * A brief description of the tool's purpose. + */ + @Generated + private String description; + + /** + * Creates an instance of ToolDescription class. + */ + @Generated + public ToolDescription() { + } + + /** + * Get the name property: The name of the tool. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the tool. + * + * @param name the name value to set. + * @return the ToolDescription object itself. + */ + @Generated + public ToolDescription setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: A brief description of the tool's purpose. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A brief description of the tool's purpose. + * + * @param description the description value to set. + * @return the ToolDescription object itself. + */ + @Generated + public ToolDescription setDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolDescription from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolDescription 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 ToolDescription. + */ + @Generated + public static ToolDescription fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolDescription deserializedToolDescription = new ToolDescription(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("name".equals(fieldName)) { + deserializedToolDescription.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedToolDescription.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedToolDescription; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TreatmentEffectType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TreatmentEffectType.java new file mode 100644 index 000000000000..1f590ea976f4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TreatmentEffectType.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; + +/** + * Treatment Effect Type. + */ +public final class TreatmentEffectType extends ExpandableStringEnum { + + /** + * Not enough samples to determine treatment effect. + */ + @Generated + public static final TreatmentEffectType TOO_FEW_SAMPLES = fromString("TooFewSamples"); + + /** + * No significant difference between treatment and baseline. + */ + @Generated + public static final TreatmentEffectType INCONCLUSIVE = fromString("Inconclusive"); + + /** + * Indicates the metric changed with statistical significance, but the direction is neutral. + */ + @Generated + public static final TreatmentEffectType CHANGED = fromString("Changed"); + + /** + * Indicates the treatment significantly improved the metric compared to baseline. + */ + @Generated + public static final TreatmentEffectType IMPROVED = fromString("Improved"); + + /** + * Indicates the treatment significantly degraded the metric compared to baseline. + */ + @Generated + public static final TreatmentEffectType DEGRADED = fromString("Degraded"); + + /** + * Creates a new instance of TreatmentEffectType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TreatmentEffectType() { + } + + /** + * Creates or finds a TreatmentEffectType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TreatmentEffectType. + */ + @Generated + public static TreatmentEffectType fromString(String name) { + return fromString(name, TreatmentEffectType.class); + } + + /** + * Gets known TreatmentEffectType values. + * + * @return known TreatmentEffectType values. + */ + @Generated + public static Collection values() { + return values(TreatmentEffectType.class); + } +} 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..e51fe7d7fe9f --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/Trigger.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; + +/** + * Base model for Trigger of the schedule. + */ +@Immutable +public class Trigger implements JsonSerializable { + + /* + * Type of the trigger. + */ + @Generated + private TriggerType type = TriggerType.fromString("Trigger"); + + /** + * Creates an instance of Trigger class. + */ + @Generated + public Trigger() { + } + + /** + * Get the type property: Type of the trigger. + * + * @return the type value. + */ + @Generated + public TriggerType 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 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 ("Cron".equals(discriminatorValue)) { + return CronTrigger.fromJson(readerToUse.reset()); + } else if ("Recurrence".equals(discriminatorValue)) { + return RecurrenceTrigger.fromJson(readerToUse.reset()); + } else if ("OneTime".equals(discriminatorValue)) { + return OneTimeTrigger.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 = TriggerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return deserializedTrigger; + }); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TriggerType.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TriggerType.java new file mode 100644 index 000000000000..7f7a82a847e4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/TriggerType.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; + +/** + * Type of the trigger. + */ +public final class TriggerType extends ExpandableStringEnum { + + /** + * Cron based trigger. + */ + @Generated + public static final TriggerType CRON = fromString("Cron"); + + /** + * Recurrence based trigger. + */ + @Generated + public static final TriggerType RECURRENCE = fromString("Recurrence"); + + /** + * One-time trigger. + */ + @Generated + public static final TriggerType ONE_TIME = fromString("OneTime"); + + /** + * Creates a new instance of TriggerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TriggerType() { + } + + /** + * Creates or finds a TriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerType. + */ + @Generated + public static TriggerType fromString(String name) { + return fromString(name, TriggerType.class); + } + + /** + * Gets known TriggerType values. + * + * @return known TriggerType values. + */ + @Generated + public static Collection values() { + return values(TriggerType.class); + } +} diff --git a/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeeklyRecurrenceSchedule.java b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeeklyRecurrenceSchedule.java new file mode 100644 index 000000000000..4afc16fb6c7c --- /dev/null +++ b/sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/WeeklyRecurrenceSchedule.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; +import java.util.List; + +/** + * Weekly recurrence schedule. + */ +@Immutable +public final class WeeklyRecurrenceSchedule extends RecurrenceSchedule { + + /* + * Recurrence type for the recurrence schedule. + */ + @Generated + private RecurrenceType type = RecurrenceType.WEEKLY; + + /* + * Days of the week for the recurrence schedule. + */ + @Generated + private final List daysOfWeek; + + /** + * Creates an instance of WeeklyRecurrenceSchedule class. + * + * @param daysOfWeek the daysOfWeek value to set. + */ + @Generated + public WeeklyRecurrenceSchedule(List daysOfWeek) { + this.daysOfWeek = daysOfWeek; + } + + /** + * Get the type property: Recurrence type for the recurrence schedule. + * + * @return the type value. + */ + @Generated + @Override + public RecurrenceType getType() { + return this.type; + } + + /** + * Get the daysOfWeek property: Days of the week for the recurrence schedule. + * + * @return the daysOfWeek value. + */ + @Generated + public List getDaysOfWeek() { + return this.daysOfWeek; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("daysOfWeek", this.daysOfWeek, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WeeklyRecurrenceSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WeeklyRecurrenceSchedule 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 WeeklyRecurrenceSchedule. + */ + @Generated + public static WeeklyRecurrenceSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List daysOfWeek = null; + RecurrenceType type = RecurrenceType.WEEKLY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("daysOfWeek".equals(fieldName)) { + daysOfWeek = reader.readArray(reader1 -> DayOfWeek.fromString(reader1.getString())); + } else if ("type".equals(fieldName)) { + type = RecurrenceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + WeeklyRecurrenceSchedule deserializedWeeklyRecurrenceSchedule = new WeeklyRecurrenceSchedule(daysOfWeek); + deserializedWeeklyRecurrenceSchedule.type = type; + return deserializedWeeklyRecurrenceSchedule; + }); + } +} 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 index 9fa6fc53dccd..97bc9ef5646a 100644 --- 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 @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) TypeSpec Code Generator. /** * - * Package containing the data models for Projects. + * Package containing the data models for AIProjects. * */ package com.azure.ai.projects.models; 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 index bfd5e37d8633..ab72e46a1021 100644 --- 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 @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) TypeSpec Code Generator. /** * - * Package containing the classes for Projects. + * Package containing the classes for AIProjects. * */ 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 index f4e04e9840bd..0250f035f79e 100644 --- a/sdk/ai/azure-ai-projects/src/main/java/module-info.java +++ b/sdk/ai/azure-ai-projects/src/main/java/module-info.java @@ -5,7 +5,6 @@ module com.azure.ai.projects { requires transitive com.azure.core; requires com.azure.storage.blob; - requires com.azure.ai.agents.persistent; requires openai.java.core; requires openai.java.client.okhttp; 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 index 5753fdf1f089..72b1ae56b0f3 100644 --- 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 @@ -15,128 +15,272 @@ "com.azure.ai.projects.ConnectionsClient.getConnectionWithResponse": "Azure.AI.Projects.Connections.get", "com.azure.ai.projects.ConnectionsClient.listConnections": "Azure.AI.Projects.Connections.list", "com.azure.ai.projects.DatasetsAsyncClient": "Azure.AI.Projects.Datasets", - "com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateDatasetVersion": "Azure.AI.Projects.Datasets.createOrUpdateVersion", - "com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.createOrUpdateVersion", - "com.azure.ai.projects.DatasetsAsyncClient.deleteDatasetVersion": "Azure.AI.Projects.Datasets.deleteVersion", - "com.azure.ai.projects.DatasetsAsyncClient.deleteDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.deleteVersion", + "com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateVersion": "Azure.AI.Projects.Datasets.createOrUpdateVersion", + "com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateVersionWithResponse": "Azure.AI.Projects.Datasets.createOrUpdateVersion", + "com.azure.ai.projects.DatasetsAsyncClient.deleteVersion": "Azure.AI.Projects.Datasets.deleteVersion", + "com.azure.ai.projects.DatasetsAsyncClient.deleteVersionWithResponse": "Azure.AI.Projects.Datasets.deleteVersion", "com.azure.ai.projects.DatasetsAsyncClient.getCredentials": "Azure.AI.Projects.Datasets.getCredentials", "com.azure.ai.projects.DatasetsAsyncClient.getCredentialsWithResponse": "Azure.AI.Projects.Datasets.getCredentials", "com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersion": "Azure.AI.Projects.Datasets.getVersion", "com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.getVersion", - "com.azure.ai.projects.DatasetsAsyncClient.listDatasetVersions": "Azure.AI.Projects.Datasets.listVersions", - "com.azure.ai.projects.DatasetsAsyncClient.listLatestDatasetVersions": "Azure.AI.Projects.Datasets.listLatest", + "com.azure.ai.projects.DatasetsAsyncClient.listLatest": "Azure.AI.Projects.Datasets.listLatest", + "com.azure.ai.projects.DatasetsAsyncClient.listVersions": "Azure.AI.Projects.Datasets.listVersions", "com.azure.ai.projects.DatasetsAsyncClient.pendingUpload": "Azure.AI.Projects.Datasets.startPendingUploadVersion", "com.azure.ai.projects.DatasetsAsyncClient.pendingUploadWithResponse": "Azure.AI.Projects.Datasets.startPendingUploadVersion", "com.azure.ai.projects.DatasetsClient": "Azure.AI.Projects.Datasets", - "com.azure.ai.projects.DatasetsClient.createOrUpdateDatasetVersion": "Azure.AI.Projects.Datasets.createOrUpdateVersion", - "com.azure.ai.projects.DatasetsClient.createOrUpdateDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.createOrUpdateVersion", - "com.azure.ai.projects.DatasetsClient.deleteDatasetVersion": "Azure.AI.Projects.Datasets.deleteVersion", - "com.azure.ai.projects.DatasetsClient.deleteDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.deleteVersion", + "com.azure.ai.projects.DatasetsClient.createOrUpdateVersion": "Azure.AI.Projects.Datasets.createOrUpdateVersion", + "com.azure.ai.projects.DatasetsClient.createOrUpdateVersionWithResponse": "Azure.AI.Projects.Datasets.createOrUpdateVersion", + "com.azure.ai.projects.DatasetsClient.deleteVersion": "Azure.AI.Projects.Datasets.deleteVersion", + "com.azure.ai.projects.DatasetsClient.deleteVersionWithResponse": "Azure.AI.Projects.Datasets.deleteVersion", "com.azure.ai.projects.DatasetsClient.getCredentials": "Azure.AI.Projects.Datasets.getCredentials", "com.azure.ai.projects.DatasetsClient.getCredentialsWithResponse": "Azure.AI.Projects.Datasets.getCredentials", "com.azure.ai.projects.DatasetsClient.getDatasetVersion": "Azure.AI.Projects.Datasets.getVersion", "com.azure.ai.projects.DatasetsClient.getDatasetVersionWithResponse": "Azure.AI.Projects.Datasets.getVersion", - "com.azure.ai.projects.DatasetsClient.listDatasetVersions": "Azure.AI.Projects.Datasets.listVersions", - "com.azure.ai.projects.DatasetsClient.listLatestDatasetVersions": "Azure.AI.Projects.Datasets.listLatest", + "com.azure.ai.projects.DatasetsClient.listLatest": "Azure.AI.Projects.Datasets.listLatest", + "com.azure.ai.projects.DatasetsClient.listVersions": "Azure.AI.Projects.Datasets.listVersions", "com.azure.ai.projects.DatasetsClient.pendingUpload": "Azure.AI.Projects.Datasets.startPendingUploadVersion", "com.azure.ai.projects.DatasetsClient.pendingUploadWithResponse": "Azure.AI.Projects.Datasets.startPendingUploadVersion", "com.azure.ai.projects.DeploymentsAsyncClient": "Azure.AI.Projects.Deployments", - "com.azure.ai.projects.DeploymentsAsyncClient.getDeployment": "Azure.AI.Projects.Deployments.get", - "com.azure.ai.projects.DeploymentsAsyncClient.getDeploymentWithResponse": "Azure.AI.Projects.Deployments.get", - "com.azure.ai.projects.DeploymentsAsyncClient.listDeployments": "Azure.AI.Projects.Deployments.list", + "com.azure.ai.projects.DeploymentsAsyncClient.get": "Azure.AI.Projects.Deployments.get", + "com.azure.ai.projects.DeploymentsAsyncClient.getWithResponse": "Azure.AI.Projects.Deployments.get", + "com.azure.ai.projects.DeploymentsAsyncClient.list": "Azure.AI.Projects.Deployments.list", "com.azure.ai.projects.DeploymentsClient": "Azure.AI.Projects.Deployments", - "com.azure.ai.projects.DeploymentsClient.getDeployment": "Azure.AI.Projects.Deployments.get", - "com.azure.ai.projects.DeploymentsClient.getDeploymentWithResponse": "Azure.AI.Projects.Deployments.get", - "com.azure.ai.projects.DeploymentsClient.listDeployments": "Azure.AI.Projects.Deployments.list", - "com.azure.ai.projects.EvaluationsAsyncClient": "Azure.AI.Projects.Evaluations", - "com.azure.ai.projects.EvaluationsAsyncClient.createAgentEvaluation": "Azure.AI.Projects.Evaluations.createAgentEvaluation", - "com.azure.ai.projects.EvaluationsAsyncClient.createAgentEvaluationWithResponse": "Azure.AI.Projects.Evaluations.createAgentEvaluation", - "com.azure.ai.projects.EvaluationsAsyncClient.createEvaluation": "Azure.AI.Projects.Evaluations.create", - "com.azure.ai.projects.EvaluationsAsyncClient.createEvaluationWithResponse": "Azure.AI.Projects.Evaluations.create", - "com.azure.ai.projects.EvaluationsAsyncClient.getEvaluation": "Azure.AI.Projects.Evaluations.get", - "com.azure.ai.projects.EvaluationsAsyncClient.getEvaluationWithResponse": "Azure.AI.Projects.Evaluations.get", - "com.azure.ai.projects.EvaluationsAsyncClient.listEvaluations": "Azure.AI.Projects.Evaluations.list", - "com.azure.ai.projects.EvaluationsClient": "Azure.AI.Projects.Evaluations", - "com.azure.ai.projects.EvaluationsClient.createAgentEvaluation": "Azure.AI.Projects.Evaluations.createAgentEvaluation", - "com.azure.ai.projects.EvaluationsClient.createAgentEvaluationWithResponse": "Azure.AI.Projects.Evaluations.createAgentEvaluation", - "com.azure.ai.projects.EvaluationsClient.createEvaluation": "Azure.AI.Projects.Evaluations.create", - "com.azure.ai.projects.EvaluationsClient.createEvaluationWithResponse": "Azure.AI.Projects.Evaluations.create", - "com.azure.ai.projects.EvaluationsClient.getEvaluation": "Azure.AI.Projects.Evaluations.get", - "com.azure.ai.projects.EvaluationsClient.getEvaluationWithResponse": "Azure.AI.Projects.Evaluations.get", - "com.azure.ai.projects.EvaluationsClient.listEvaluations": "Azure.AI.Projects.Evaluations.list", + "com.azure.ai.projects.DeploymentsClient.get": "Azure.AI.Projects.Deployments.get", + "com.azure.ai.projects.DeploymentsClient.getWithResponse": "Azure.AI.Projects.Deployments.get", + "com.azure.ai.projects.DeploymentsClient.list": "Azure.AI.Projects.Deployments.list", + "com.azure.ai.projects.EvaluationRulesAsyncClient": "Azure.AI.Projects.EvaluationRules", + "com.azure.ai.projects.EvaluationRulesAsyncClient.createOrUpdate": "Azure.AI.Projects.EvaluationRules.createOrUpdate", + "com.azure.ai.projects.EvaluationRulesAsyncClient.createOrUpdateWithResponse": "Azure.AI.Projects.EvaluationRules.createOrUpdate", + "com.azure.ai.projects.EvaluationRulesAsyncClient.delete": "Azure.AI.Projects.EvaluationRules.delete", + "com.azure.ai.projects.EvaluationRulesAsyncClient.deleteWithResponse": "Azure.AI.Projects.EvaluationRules.delete", + "com.azure.ai.projects.EvaluationRulesAsyncClient.get": "Azure.AI.Projects.EvaluationRules.get", + "com.azure.ai.projects.EvaluationRulesAsyncClient.getWithResponse": "Azure.AI.Projects.EvaluationRules.get", + "com.azure.ai.projects.EvaluationRulesAsyncClient.list": "Azure.AI.Projects.EvaluationRules.list", + "com.azure.ai.projects.EvaluationRulesClient": "Azure.AI.Projects.EvaluationRules", + "com.azure.ai.projects.EvaluationRulesClient.createOrUpdate": "Azure.AI.Projects.EvaluationRules.createOrUpdate", + "com.azure.ai.projects.EvaluationRulesClient.createOrUpdateWithResponse": "Azure.AI.Projects.EvaluationRules.createOrUpdate", + "com.azure.ai.projects.EvaluationRulesClient.delete": "Azure.AI.Projects.EvaluationRules.delete", + "com.azure.ai.projects.EvaluationRulesClient.deleteWithResponse": "Azure.AI.Projects.EvaluationRules.delete", + "com.azure.ai.projects.EvaluationRulesClient.get": "Azure.AI.Projects.EvaluationRules.get", + "com.azure.ai.projects.EvaluationRulesClient.getWithResponse": "Azure.AI.Projects.EvaluationRules.get", + "com.azure.ai.projects.EvaluationRulesClient.list": "Azure.AI.Projects.EvaluationRules.list", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient": "Azure.AI.Projects.EvaluationTaxonomies", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.create": "Azure.AI.Projects.EvaluationTaxonomies.create", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.createWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.create", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.delete": "Azure.AI.Projects.EvaluationTaxonomies.delete", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.deleteWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.delete", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.get": "Azure.AI.Projects.EvaluationTaxonomies.get", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.getWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.get", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.list": "Azure.AI.Projects.EvaluationTaxonomies.list", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.update": "Azure.AI.Projects.EvaluationTaxonomies.update", + "com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.updateWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.update", + "com.azure.ai.projects.EvaluationTaxonomiesClient": "Azure.AI.Projects.EvaluationTaxonomies", + "com.azure.ai.projects.EvaluationTaxonomiesClient.create": "Azure.AI.Projects.EvaluationTaxonomies.create", + "com.azure.ai.projects.EvaluationTaxonomiesClient.createWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.create", + "com.azure.ai.projects.EvaluationTaxonomiesClient.delete": "Azure.AI.Projects.EvaluationTaxonomies.delete", + "com.azure.ai.projects.EvaluationTaxonomiesClient.deleteWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.delete", + "com.azure.ai.projects.EvaluationTaxonomiesClient.get": "Azure.AI.Projects.EvaluationTaxonomies.get", + "com.azure.ai.projects.EvaluationTaxonomiesClient.getWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.get", + "com.azure.ai.projects.EvaluationTaxonomiesClient.list": "Azure.AI.Projects.EvaluationTaxonomies.list", + "com.azure.ai.projects.EvaluationTaxonomiesClient.update": "Azure.AI.Projects.EvaluationTaxonomies.update", + "com.azure.ai.projects.EvaluationTaxonomiesClient.updateWithResponse": "Azure.AI.Projects.EvaluationTaxonomies.update", + "com.azure.ai.projects.EvaluatorsAsyncClient": "Azure.AI.Projects.Evaluators", + "com.azure.ai.projects.EvaluatorsAsyncClient.createVersion": "Azure.AI.Projects.Evaluators.createVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.createVersionWithResponse": "Azure.AI.Projects.Evaluators.createVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.deleteVersion": "Azure.AI.Projects.Evaluators.deleteVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.deleteVersionWithResponse": "Azure.AI.Projects.Evaluators.deleteVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.getVersion": "Azure.AI.Projects.Evaluators.getVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.getVersionWithResponse": "Azure.AI.Projects.Evaluators.getVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.listLatestVersions": "Azure.AI.Projects.Evaluators.listLatestVersions", + "com.azure.ai.projects.EvaluatorsAsyncClient.listVersions": "Azure.AI.Projects.Evaluators.listVersions", + "com.azure.ai.projects.EvaluatorsAsyncClient.updateVersion": "Azure.AI.Projects.Evaluators.updateVersion", + "com.azure.ai.projects.EvaluatorsAsyncClient.updateVersionWithResponse": "Azure.AI.Projects.Evaluators.updateVersion", + "com.azure.ai.projects.EvaluatorsClient": "Azure.AI.Projects.Evaluators", + "com.azure.ai.projects.EvaluatorsClient.createVersion": "Azure.AI.Projects.Evaluators.createVersion", + "com.azure.ai.projects.EvaluatorsClient.createVersionWithResponse": "Azure.AI.Projects.Evaluators.createVersion", + "com.azure.ai.projects.EvaluatorsClient.deleteVersion": "Azure.AI.Projects.Evaluators.deleteVersion", + "com.azure.ai.projects.EvaluatorsClient.deleteVersionWithResponse": "Azure.AI.Projects.Evaluators.deleteVersion", + "com.azure.ai.projects.EvaluatorsClient.getVersion": "Azure.AI.Projects.Evaluators.getVersion", + "com.azure.ai.projects.EvaluatorsClient.getVersionWithResponse": "Azure.AI.Projects.Evaluators.getVersion", + "com.azure.ai.projects.EvaluatorsClient.listLatestVersions": "Azure.AI.Projects.Evaluators.listLatestVersions", + "com.azure.ai.projects.EvaluatorsClient.listVersions": "Azure.AI.Projects.Evaluators.listVersions", + "com.azure.ai.projects.EvaluatorsClient.updateVersion": "Azure.AI.Projects.Evaluators.updateVersion", + "com.azure.ai.projects.EvaluatorsClient.updateVersionWithResponse": "Azure.AI.Projects.Evaluators.updateVersion", "com.azure.ai.projects.IndexesAsyncClient": "Azure.AI.Projects.Indexes", - "com.azure.ai.projects.IndexesAsyncClient.createOrUpdateIndexVersion": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "com.azure.ai.projects.IndexesAsyncClient.createOrUpdateIndexVersionWithResponse": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "com.azure.ai.projects.IndexesAsyncClient.deleteIndexVersion": "Azure.AI.Projects.Indexes.deleteVersion", - "com.azure.ai.projects.IndexesAsyncClient.deleteIndexVersionWithResponse": "Azure.AI.Projects.Indexes.deleteVersion", - "com.azure.ai.projects.IndexesAsyncClient.getIndexVersion": "Azure.AI.Projects.Indexes.getVersion", - "com.azure.ai.projects.IndexesAsyncClient.getIndexVersionWithResponse": "Azure.AI.Projects.Indexes.getVersion", - "com.azure.ai.projects.IndexesAsyncClient.listIndexVersions": "Azure.AI.Projects.Indexes.listVersions", - "com.azure.ai.projects.IndexesAsyncClient.listLatestIndexVersions": "Azure.AI.Projects.Indexes.listLatest", + "com.azure.ai.projects.IndexesAsyncClient.createOrUpdate": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "com.azure.ai.projects.IndexesAsyncClient.createOrUpdateWithResponse": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "com.azure.ai.projects.IndexesAsyncClient.deleteVersion": "Azure.AI.Projects.Indexes.deleteVersion", + "com.azure.ai.projects.IndexesAsyncClient.deleteVersionWithResponse": "Azure.AI.Projects.Indexes.deleteVersion", + "com.azure.ai.projects.IndexesAsyncClient.getVersion": "Azure.AI.Projects.Indexes.getVersion", + "com.azure.ai.projects.IndexesAsyncClient.getVersionWithResponse": "Azure.AI.Projects.Indexes.getVersion", + "com.azure.ai.projects.IndexesAsyncClient.listLatest": "Azure.AI.Projects.Indexes.listLatest", + "com.azure.ai.projects.IndexesAsyncClient.listVersions": "Azure.AI.Projects.Indexes.listVersions", "com.azure.ai.projects.IndexesClient": "Azure.AI.Projects.Indexes", - "com.azure.ai.projects.IndexesClient.createOrUpdateIndexVersion": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "com.azure.ai.projects.IndexesClient.createOrUpdateIndexVersionWithResponse": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "com.azure.ai.projects.IndexesClient.deleteIndexVersion": "Azure.AI.Projects.Indexes.deleteVersion", - "com.azure.ai.projects.IndexesClient.deleteIndexVersionWithResponse": "Azure.AI.Projects.Indexes.deleteVersion", - "com.azure.ai.projects.IndexesClient.getIndexVersion": "Azure.AI.Projects.Indexes.getVersion", - "com.azure.ai.projects.IndexesClient.getIndexVersionWithResponse": "Azure.AI.Projects.Indexes.getVersion", - "com.azure.ai.projects.IndexesClient.listIndexVersions": "Azure.AI.Projects.Indexes.listVersions", - "com.azure.ai.projects.IndexesClient.listLatestIndexVersions": "Azure.AI.Projects.Indexes.listLatest", + "com.azure.ai.projects.IndexesClient.createOrUpdate": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "com.azure.ai.projects.IndexesClient.createOrUpdateWithResponse": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "com.azure.ai.projects.IndexesClient.deleteVersion": "Azure.AI.Projects.Indexes.deleteVersion", + "com.azure.ai.projects.IndexesClient.deleteVersionWithResponse": "Azure.AI.Projects.Indexes.deleteVersion", + "com.azure.ai.projects.IndexesClient.getVersion": "Azure.AI.Projects.Indexes.getVersion", + "com.azure.ai.projects.IndexesClient.getVersionWithResponse": "Azure.AI.Projects.Indexes.getVersion", + "com.azure.ai.projects.IndexesClient.listLatest": "Azure.AI.Projects.Indexes.listLatest", + "com.azure.ai.projects.IndexesClient.listVersions": "Azure.AI.Projects.Indexes.listVersions", + "com.azure.ai.projects.InsightsAsyncClient": "Azure.AI.Projects.Insights", + "com.azure.ai.projects.InsightsAsyncClient.generate": "Azure.AI.Projects.Insights.generate", + "com.azure.ai.projects.InsightsAsyncClient.generateWithResponse": "Azure.AI.Projects.Insights.generate", + "com.azure.ai.projects.InsightsAsyncClient.get": "Azure.AI.Projects.Insights.get", + "com.azure.ai.projects.InsightsAsyncClient.getWithResponse": "Azure.AI.Projects.Insights.get", + "com.azure.ai.projects.InsightsAsyncClient.list": "Azure.AI.Projects.Insights.list", + "com.azure.ai.projects.InsightsClient": "Azure.AI.Projects.Insights", + "com.azure.ai.projects.InsightsClient.generate": "Azure.AI.Projects.Insights.generate", + "com.azure.ai.projects.InsightsClient.generateWithResponse": "Azure.AI.Projects.Insights.generate", + "com.azure.ai.projects.InsightsClient.get": "Azure.AI.Projects.Insights.get", + "com.azure.ai.projects.InsightsClient.getWithResponse": "Azure.AI.Projects.Insights.get", + "com.azure.ai.projects.InsightsClient.list": "Azure.AI.Projects.Insights.list", "com.azure.ai.projects.RedTeamsAsyncClient": "Azure.AI.Projects.RedTeams", - "com.azure.ai.projects.RedTeamsAsyncClient.createRedTeam": "Azure.AI.Projects.RedTeams.create", - "com.azure.ai.projects.RedTeamsAsyncClient.createRedTeamWithResponse": "Azure.AI.Projects.RedTeams.create", - "com.azure.ai.projects.RedTeamsAsyncClient.getRedTeam": "Azure.AI.Projects.RedTeams.get", - "com.azure.ai.projects.RedTeamsAsyncClient.getRedTeamWithResponse": "Azure.AI.Projects.RedTeams.get", - "com.azure.ai.projects.RedTeamsAsyncClient.listRedTeams": "Azure.AI.Projects.RedTeams.list", + "com.azure.ai.projects.RedTeamsAsyncClient.create": "Azure.AI.Projects.RedTeams.create", + "com.azure.ai.projects.RedTeamsAsyncClient.createWithResponse": "Azure.AI.Projects.RedTeams.create", + "com.azure.ai.projects.RedTeamsAsyncClient.get": "Azure.AI.Projects.RedTeams.get", + "com.azure.ai.projects.RedTeamsAsyncClient.getWithResponse": "Azure.AI.Projects.RedTeams.get", + "com.azure.ai.projects.RedTeamsAsyncClient.list": "Azure.AI.Projects.RedTeams.list", "com.azure.ai.projects.RedTeamsClient": "Azure.AI.Projects.RedTeams", - "com.azure.ai.projects.RedTeamsClient.createRedTeam": "Azure.AI.Projects.RedTeams.create", - "com.azure.ai.projects.RedTeamsClient.createRedTeamWithResponse": "Azure.AI.Projects.RedTeams.create", - "com.azure.ai.projects.RedTeamsClient.getRedTeam": "Azure.AI.Projects.RedTeams.get", - "com.azure.ai.projects.RedTeamsClient.getRedTeamWithResponse": "Azure.AI.Projects.RedTeams.get", - "com.azure.ai.projects.RedTeamsClient.listRedTeams": "Azure.AI.Projects.RedTeams.list", - "com.azure.ai.projects.models.AgentEvaluation": "Azure.AI.Projects.AgentEvaluation", - "com.azure.ai.projects.models.AgentEvaluationRedactionConfiguration": "Azure.AI.Projects.AgentEvaluationRedactionConfiguration", - "com.azure.ai.projects.models.AgentEvaluationRequest": "Azure.AI.Projects.AgentEvaluationRequest", - "com.azure.ai.projects.models.AgentEvaluationResult": "Azure.AI.Projects.AgentEvaluationResult", - "com.azure.ai.projects.models.AgentEvaluationSamplingConfiguration": "Azure.AI.Projects.AgentEvaluationSamplingConfiguration", + "com.azure.ai.projects.RedTeamsClient.create": "Azure.AI.Projects.RedTeams.create", + "com.azure.ai.projects.RedTeamsClient.createWithResponse": "Azure.AI.Projects.RedTeams.create", + "com.azure.ai.projects.RedTeamsClient.get": "Azure.AI.Projects.RedTeams.get", + "com.azure.ai.projects.RedTeamsClient.getWithResponse": "Azure.AI.Projects.RedTeams.get", + "com.azure.ai.projects.RedTeamsClient.list": "Azure.AI.Projects.RedTeams.list", + "com.azure.ai.projects.SchedulesAsyncClient": "Azure.AI.Projects.Schedules", + "com.azure.ai.projects.SchedulesAsyncClient.createOrUpdate": "Azure.AI.Projects.Schedules.createOrUpdate", + "com.azure.ai.projects.SchedulesAsyncClient.createOrUpdateWithResponse": "Azure.AI.Projects.Schedules.createOrUpdate", + "com.azure.ai.projects.SchedulesAsyncClient.delete": "Azure.AI.Projects.Schedules.delete", + "com.azure.ai.projects.SchedulesAsyncClient.deleteWithResponse": "Azure.AI.Projects.Schedules.delete", + "com.azure.ai.projects.SchedulesAsyncClient.get": "Azure.AI.Projects.Schedules.get", + "com.azure.ai.projects.SchedulesAsyncClient.getRun": "Azure.AI.Projects.Schedules.getRun", + "com.azure.ai.projects.SchedulesAsyncClient.getRunWithResponse": "Azure.AI.Projects.Schedules.getRun", + "com.azure.ai.projects.SchedulesAsyncClient.getWithResponse": "Azure.AI.Projects.Schedules.get", + "com.azure.ai.projects.SchedulesAsyncClient.list": "Azure.AI.Projects.Schedules.list", + "com.azure.ai.projects.SchedulesAsyncClient.listRuns": "Azure.AI.Projects.Schedules.listRuns", + "com.azure.ai.projects.SchedulesClient": "Azure.AI.Projects.Schedules", + "com.azure.ai.projects.SchedulesClient.createOrUpdate": "Azure.AI.Projects.Schedules.createOrUpdate", + "com.azure.ai.projects.SchedulesClient.createOrUpdateWithResponse": "Azure.AI.Projects.Schedules.createOrUpdate", + "com.azure.ai.projects.SchedulesClient.delete": "Azure.AI.Projects.Schedules.delete", + "com.azure.ai.projects.SchedulesClient.deleteWithResponse": "Azure.AI.Projects.Schedules.delete", + "com.azure.ai.projects.SchedulesClient.get": "Azure.AI.Projects.Schedules.get", + "com.azure.ai.projects.SchedulesClient.getRun": "Azure.AI.Projects.Schedules.getRun", + "com.azure.ai.projects.SchedulesClient.getRunWithResponse": "Azure.AI.Projects.Schedules.getRun", + "com.azure.ai.projects.SchedulesClient.getWithResponse": "Azure.AI.Projects.Schedules.get", + "com.azure.ai.projects.SchedulesClient.list": "Azure.AI.Projects.Schedules.list", + "com.azure.ai.projects.SchedulesClient.listRuns": "Azure.AI.Projects.Schedules.listRuns", + "com.azure.ai.projects.models.AgentClusterInsightResult": "Azure.AI.Projects.AgentClusterInsightResult", + "com.azure.ai.projects.models.AgentClusterInsightsRequest": "Azure.AI.Projects.AgentClusterInsightsRequest", + "com.azure.ai.projects.models.AgentTaxonomyInput": "Azure.AI.Projects.AgentTaxonomyInput", + "com.azure.ai.projects.models.AgenticIdentityCredentials": "Azure.AI.Projects.AgenticIdentityCredentials", "com.azure.ai.projects.models.ApiKeyCredentials": "Azure.AI.Projects.ApiKeyCredentials", - "com.azure.ai.projects.models.AssetCredentialResult": "Azure.AI.Projects.AssetCredentialResponse", "com.azure.ai.projects.models.AttackStrategy": "Azure.AI.Projects.AttackStrategy", + "com.azure.ai.projects.models.AzureAIAgentTarget": "Azure.AI.Projects.AzureAIAgentTarget", + "com.azure.ai.projects.models.AzureAIAssistantTarget": "Azure.AI.Projects.AzureAIAssistantTarget", + "com.azure.ai.projects.models.AzureAIModelTarget": "Azure.AI.Projects.AzureAIModelTarget", "com.azure.ai.projects.models.AzureAISearchIndex": "Azure.AI.Projects.AzureAISearchIndex", "com.azure.ai.projects.models.AzureOpenAIModelConfiguration": "Azure.AI.Projects.AzureOpenAIModelConfiguration", "com.azure.ai.projects.models.BaseCredentials": "Azure.AI.Projects.BaseCredentials", "com.azure.ai.projects.models.BlobReference": "Azure.AI.Projects.BlobReference", + "com.azure.ai.projects.models.BlobReferenceSasCredential": "Azure.AI.Projects.SasCredential", + "com.azure.ai.projects.models.ChartCoordinate": "Azure.AI.Projects.ChartCoordinate", + "com.azure.ai.projects.models.ClusterInsightResult": "Azure.AI.Projects.ClusterInsightResult", + "com.azure.ai.projects.models.ClusterTokenUsage": "Azure.AI.Projects.ClusterTokenUsage", + "com.azure.ai.projects.models.CodeBasedEvaluatorDefinition": "Azure.AI.Projects.CodeBasedEvaluatorDefinition", "com.azure.ai.projects.models.Connection": "Azure.AI.Projects.Connection", "com.azure.ai.projects.models.ConnectionType": "Azure.AI.Projects.ConnectionType", + "com.azure.ai.projects.models.ContinuousEvaluationRuleAction": "Azure.AI.Projects.ContinuousEvaluationRuleAction", "com.azure.ai.projects.models.CosmosDBIndex": "Azure.AI.Projects.CosmosDBIndex", "com.azure.ai.projects.models.CredentialType": "Azure.AI.Projects.CredentialType", + "com.azure.ai.projects.models.CronTrigger": "Azure.AI.Projects.CronTrigger", "com.azure.ai.projects.models.CustomCredential": "Azure.AI.Projects.CustomCredential", + "com.azure.ai.projects.models.DailyRecurrenceSchedule": "Azure.AI.Projects.DailyRecurrenceSchedule", + "com.azure.ai.projects.models.DatasetCredential": "Azure.AI.Projects.AssetCredentialResponse", "com.azure.ai.projects.models.DatasetType": "Azure.AI.Projects.DatasetType", "com.azure.ai.projects.models.DatasetVersion": "Azure.AI.Projects.DatasetVersion", + "com.azure.ai.projects.models.DayOfWeek": "Azure.AI.Projects.DayOfWeek", "com.azure.ai.projects.models.Deployment": "Azure.AI.Projects.Deployment", "com.azure.ai.projects.models.DeploymentType": "Azure.AI.Projects.DeploymentType", "com.azure.ai.projects.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration", - "com.azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", - "com.azure.ai.projects.models.Evaluation": "Azure.AI.Projects.Evaluation", - "com.azure.ai.projects.models.EvaluatorConfiguration": "Azure.AI.Projects.EvaluatorConfiguration", + "com.azure.ai.projects.models.EntraIdCredentials": "Azure.AI.Projects.EntraIDCredentials", + "com.azure.ai.projects.models.EvaluationCompareReport": "Azure.AI.Projects.EvalCompareReport", + "com.azure.ai.projects.models.EvaluationComparisonRequest": "Azure.AI.Projects.EvaluationComparisonRequest", + "com.azure.ai.projects.models.EvaluationResult": "Azure.AI.Projects.EvalResult", + "com.azure.ai.projects.models.EvaluationResultSample": "Azure.AI.Projects.EvaluationResultSample", + "com.azure.ai.projects.models.EvaluationRule": "Azure.AI.Projects.EvaluationRule", + "com.azure.ai.projects.models.EvaluationRuleAction": "Azure.AI.Projects.EvaluationRuleAction", + "com.azure.ai.projects.models.EvaluationRuleActionType": "Azure.AI.Projects.EvaluationRuleActionType", + "com.azure.ai.projects.models.EvaluationRuleEventType": "Azure.AI.Projects.EvaluationRuleEventType", + "com.azure.ai.projects.models.EvaluationRuleFilter": "Azure.AI.Projects.EvaluationRuleFilter", + "com.azure.ai.projects.models.EvaluationRunClusterInsightResult": "Azure.AI.Projects.EvaluationRunClusterInsightResult", + "com.azure.ai.projects.models.EvaluationRunClusterInsightsRequest": "Azure.AI.Projects.EvaluationRunClusterInsightsRequest", + "com.azure.ai.projects.models.EvaluationRunResultCompareItem": "Azure.AI.Projects.EvalRunResultCompareItem", + "com.azure.ai.projects.models.EvaluationRunResultComparison": "Azure.AI.Projects.EvalRunResultComparison", + "com.azure.ai.projects.models.EvaluationRunResultSummary": "Azure.AI.Projects.EvalRunResultSummary", + "com.azure.ai.projects.models.EvaluationScheduleTask": "Azure.AI.Projects.EvaluationScheduleTask", + "com.azure.ai.projects.models.EvaluationScheduleTaskEvalRun": "Azure.AI.Projects.EvaluationScheduleTask.evalRun.anonymous", + "com.azure.ai.projects.models.EvaluationTaxonomy": "Azure.AI.Projects.EvaluationTaxonomy", + "com.azure.ai.projects.models.EvaluationTaxonomyInput": "Azure.AI.Projects.EvaluationTaxonomyInput", + "com.azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", + "com.azure.ai.projects.models.EvaluatorCategory": "Azure.AI.Projects.EvaluatorCategory", + "com.azure.ai.projects.models.EvaluatorDefinition": "Azure.AI.Projects.EvaluatorDefinition", + "com.azure.ai.projects.models.EvaluatorDefinitionType": "Azure.AI.Projects.EvaluatorDefinitionType", + "com.azure.ai.projects.models.EvaluatorMetric": "Azure.AI.Projects.EvaluatorMetric", + "com.azure.ai.projects.models.EvaluatorMetricDirection": "Azure.AI.Projects.EvaluatorMetricDirection", + "com.azure.ai.projects.models.EvaluatorMetricType": "Azure.AI.Projects.EvaluatorMetricType", + "com.azure.ai.projects.models.EvaluatorType": "Azure.AI.Projects.EvaluatorType", + "com.azure.ai.projects.models.EvaluatorVersion": "Azure.AI.Projects.EvaluatorVersion", "com.azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping", "com.azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion", "com.azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion", + "com.azure.ai.projects.models.HourlyRecurrenceSchedule": "Azure.AI.Projects.HourlyRecurrenceSchedule", + "com.azure.ai.projects.models.HumanEvaluationRuleAction": "Azure.AI.Projects.HumanEvaluationRuleAction", "com.azure.ai.projects.models.Index": "Azure.AI.Projects.Index", "com.azure.ai.projects.models.IndexType": "Azure.AI.Projects.IndexType", - "com.azure.ai.projects.models.InputData": "Azure.AI.Projects.InputData", - "com.azure.ai.projects.models.InputDataset": "Azure.AI.Projects.InputDataset", + "com.azure.ai.projects.models.Insight": "Azure.AI.Projects.Insight", + "com.azure.ai.projects.models.InsightCluster": "Azure.AI.Projects.InsightCluster", + "com.azure.ai.projects.models.InsightModelConfiguration": "Azure.AI.Projects.InsightModelConfiguration", + "com.azure.ai.projects.models.InsightRequest": "Azure.AI.Projects.InsightRequest", + "com.azure.ai.projects.models.InsightResult": "Azure.AI.Projects.InsightResult", + "com.azure.ai.projects.models.InsightSample": "Azure.AI.Projects.InsightSample", + "com.azure.ai.projects.models.InsightScheduleTask": "Azure.AI.Projects.InsightScheduleTask", + "com.azure.ai.projects.models.InsightSummary": "Azure.AI.Projects.InsightSummary", + "com.azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType", + "com.azure.ai.projects.models.InsightsMetadata": "Azure.AI.Projects.InsightsMetadata", + "com.azure.ai.projects.models.ListVersionsRequestType": "Azure.AI.Projects.listVersions.RequestType.anonymous", "com.azure.ai.projects.models.ManagedAzureAISearchIndex": "Azure.AI.Projects.ManagedAzureAISearchIndex", "com.azure.ai.projects.models.ModelDeployment": "Azure.AI.Projects.ModelDeployment", + "com.azure.ai.projects.models.ModelDeploymentSku": "Azure.AI.Projects.Sku", + "com.azure.ai.projects.models.ModelSamplingParams": "Azure.AI.Projects.ModelSamplingParams", + "com.azure.ai.projects.models.MonthlyRecurrenceSchedule": "Azure.AI.Projects.MonthlyRecurrenceSchedule", "com.azure.ai.projects.models.NoAuthenticationCredentials": "Azure.AI.Projects.NoAuthenticationCredentials", + "com.azure.ai.projects.models.OneTimeTrigger": "Azure.AI.Projects.OneTimeTrigger", + "com.azure.ai.projects.models.OperationStatus": "Azure.Core.Foundations.OperationState", "com.azure.ai.projects.models.PendingUploadRequest": "Azure.AI.Projects.PendingUploadRequest", "com.azure.ai.projects.models.PendingUploadResponse": "Azure.AI.Projects.PendingUploadResponse", "com.azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", + "com.azure.ai.projects.models.PromptBasedEvaluatorDefinition": "Azure.AI.Projects.PromptBasedEvaluatorDefinition", + "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.RecurrenceType": "Azure.AI.Projects.RecurrenceType", "com.azure.ai.projects.models.RedTeam": "Azure.AI.Projects.RedTeam", "com.azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory", - "com.azure.ai.projects.models.SasCredential": "Azure.AI.Projects.SasCredential", + "com.azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType", "com.azure.ai.projects.models.SasCredentials": "Azure.AI.Projects.SASCredentials", - "com.azure.ai.projects.models.Sku": "Azure.AI.Projects.Sku", - "com.azure.ai.projects.models.TargetConfig": "Azure.AI.Projects.TargetConfig" + "com.azure.ai.projects.models.Schedule": "Azure.AI.Projects.Schedule", + "com.azure.ai.projects.models.ScheduleProvisioningStatus": "Azure.AI.Projects.ScheduleProvisioningStatus", + "com.azure.ai.projects.models.ScheduleRun": "Azure.AI.Projects.ScheduleRun", + "com.azure.ai.projects.models.ScheduleTask": "Azure.AI.Projects.ScheduleTask", + "com.azure.ai.projects.models.ScheduleTaskType": "Azure.AI.Projects.ScheduleTaskType", + "com.azure.ai.projects.models.Target": "Azure.AI.Projects.Target", + "com.azure.ai.projects.models.TargetConfig": "Azure.AI.Projects.TargetConfig", + "com.azure.ai.projects.models.TaxonomyCategory": "Azure.AI.Projects.TaxonomyCategory", + "com.azure.ai.projects.models.TaxonomySubCategory": "Azure.AI.Projects.TaxonomySubCategory", + "com.azure.ai.projects.models.ToolDescription": "Azure.AI.Projects.ToolDescription", + "com.azure.ai.projects.models.TreatmentEffectType": "Azure.AI.Projects.TreatmentEffectType", + "com.azure.ai.projects.models.Trigger": "Azure.AI.Projects.Trigger", + "com.azure.ai.projects.models.TriggerType": "Azure.AI.Projects.TriggerType", + "com.azure.ai.projects.models.WeeklyRecurrenceSchedule": "Azure.AI.Projects.WeeklyRecurrenceSchedule" } } diff --git a/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_metadata.json b/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_metadata.json index 9cd844f0fff5..70da2789d13f 100644 --- a/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_metadata.json +++ b/sdk/ai/azure-ai-projects/src/main/resources/META-INF/azure-ai-projects_metadata.json @@ -1 +1 @@ -{"flavor":"azure","apiVersion":"2025-05-15-preview","crossLanguageDefinitions":{"com.azure.ai.projects.AIProjectClientBuilder":"Azure.AI.Projects","com.azure.ai.projects.ConnectionsAsyncClient":"Azure.AI.Projects.Connections","com.azure.ai.projects.ConnectionsAsyncClient.getConnection":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithCredentials":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithCredentialsWithResponse":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithResponse":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsAsyncClient.listConnections":"Azure.AI.Projects.Connections.list","com.azure.ai.projects.ConnectionsClient":"Azure.AI.Projects.Connections","com.azure.ai.projects.ConnectionsClient.getConnection":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsClient.getConnectionWithCredentials":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsClient.getConnectionWithCredentialsWithResponse":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsClient.getConnectionWithResponse":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsClient.listConnections":"Azure.AI.Projects.Connections.list","com.azure.ai.projects.DatasetsAsyncClient":"Azure.AI.Projects.Datasets","com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateDatasetVersion":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsAsyncClient.deleteDatasetVersion":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsAsyncClient.deleteDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsAsyncClient.getCredentials":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsAsyncClient.getCredentialsWithResponse":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersion":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsAsyncClient.listDatasetVersions":"Azure.AI.Projects.Datasets.listVersions","com.azure.ai.projects.DatasetsAsyncClient.listLatestDatasetVersions":"Azure.AI.Projects.Datasets.listLatest","com.azure.ai.projects.DatasetsAsyncClient.pendingUpload":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsAsyncClient.pendingUploadWithResponse":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsClient":"Azure.AI.Projects.Datasets","com.azure.ai.projects.DatasetsClient.createOrUpdateDatasetVersion":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsClient.createOrUpdateDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsClient.deleteDatasetVersion":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsClient.deleteDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsClient.getCredentials":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsClient.getCredentialsWithResponse":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsClient.getDatasetVersion":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsClient.getDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsClient.listDatasetVersions":"Azure.AI.Projects.Datasets.listVersions","com.azure.ai.projects.DatasetsClient.listLatestDatasetVersions":"Azure.AI.Projects.Datasets.listLatest","com.azure.ai.projects.DatasetsClient.pendingUpload":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsClient.pendingUploadWithResponse":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DeploymentsAsyncClient":"Azure.AI.Projects.Deployments","com.azure.ai.projects.DeploymentsAsyncClient.getDeployment":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsAsyncClient.getDeploymentWithResponse":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsAsyncClient.listDeployments":"Azure.AI.Projects.Deployments.list","com.azure.ai.projects.DeploymentsClient":"Azure.AI.Projects.Deployments","com.azure.ai.projects.DeploymentsClient.getDeployment":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsClient.getDeploymentWithResponse":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsClient.listDeployments":"Azure.AI.Projects.Deployments.list","com.azure.ai.projects.EvaluationsAsyncClient":"Azure.AI.Projects.Evaluations","com.azure.ai.projects.EvaluationsAsyncClient.createAgentEvaluation":"Azure.AI.Projects.Evaluations.createAgentEvaluation","com.azure.ai.projects.EvaluationsAsyncClient.createAgentEvaluationWithResponse":"Azure.AI.Projects.Evaluations.createAgentEvaluation","com.azure.ai.projects.EvaluationsAsyncClient.createEvaluation":"Azure.AI.Projects.Evaluations.create","com.azure.ai.projects.EvaluationsAsyncClient.createEvaluationWithResponse":"Azure.AI.Projects.Evaluations.create","com.azure.ai.projects.EvaluationsAsyncClient.getEvaluation":"Azure.AI.Projects.Evaluations.get","com.azure.ai.projects.EvaluationsAsyncClient.getEvaluationWithResponse":"Azure.AI.Projects.Evaluations.get","com.azure.ai.projects.EvaluationsAsyncClient.listEvaluations":"Azure.AI.Projects.Evaluations.list","com.azure.ai.projects.EvaluationsClient":"Azure.AI.Projects.Evaluations","com.azure.ai.projects.EvaluationsClient.createAgentEvaluation":"Azure.AI.Projects.Evaluations.createAgentEvaluation","com.azure.ai.projects.EvaluationsClient.createAgentEvaluationWithResponse":"Azure.AI.Projects.Evaluations.createAgentEvaluation","com.azure.ai.projects.EvaluationsClient.createEvaluation":"Azure.AI.Projects.Evaluations.create","com.azure.ai.projects.EvaluationsClient.createEvaluationWithResponse":"Azure.AI.Projects.Evaluations.create","com.azure.ai.projects.EvaluationsClient.getEvaluation":"Azure.AI.Projects.Evaluations.get","com.azure.ai.projects.EvaluationsClient.getEvaluationWithResponse":"Azure.AI.Projects.Evaluations.get","com.azure.ai.projects.EvaluationsClient.listEvaluations":"Azure.AI.Projects.Evaluations.list","com.azure.ai.projects.IndexesAsyncClient":"Azure.AI.Projects.Indexes","com.azure.ai.projects.IndexesAsyncClient.createOrUpdateIndexVersion":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesAsyncClient.createOrUpdateIndexVersionWithResponse":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesAsyncClient.deleteIndexVersion":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesAsyncClient.deleteIndexVersionWithResponse":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesAsyncClient.getIndexVersion":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesAsyncClient.getIndexVersionWithResponse":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesAsyncClient.listIndexVersions":"Azure.AI.Projects.Indexes.listVersions","com.azure.ai.projects.IndexesAsyncClient.listLatestIndexVersions":"Azure.AI.Projects.Indexes.listLatest","com.azure.ai.projects.IndexesClient":"Azure.AI.Projects.Indexes","com.azure.ai.projects.IndexesClient.createOrUpdateIndexVersion":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesClient.createOrUpdateIndexVersionWithResponse":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesClient.deleteIndexVersion":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesClient.deleteIndexVersionWithResponse":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesClient.getIndexVersion":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesClient.getIndexVersionWithResponse":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesClient.listIndexVersions":"Azure.AI.Projects.Indexes.listVersions","com.azure.ai.projects.IndexesClient.listLatestIndexVersions":"Azure.AI.Projects.Indexes.listLatest","com.azure.ai.projects.RedTeamsAsyncClient":"Azure.AI.Projects.RedTeams","com.azure.ai.projects.RedTeamsAsyncClient.createRedTeam":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsAsyncClient.createRedTeamWithResponse":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsAsyncClient.getRedTeam":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsAsyncClient.getRedTeamWithResponse":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsAsyncClient.listRedTeams":"Azure.AI.Projects.RedTeams.list","com.azure.ai.projects.RedTeamsClient":"Azure.AI.Projects.RedTeams","com.azure.ai.projects.RedTeamsClient.createRedTeam":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsClient.createRedTeamWithResponse":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsClient.getRedTeam":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsClient.getRedTeamWithResponse":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsClient.listRedTeams":"Azure.AI.Projects.RedTeams.list","com.azure.ai.projects.models.AgentEvaluation":"Azure.AI.Projects.AgentEvaluation","com.azure.ai.projects.models.AgentEvaluationRedactionConfiguration":"Azure.AI.Projects.AgentEvaluationRedactionConfiguration","com.azure.ai.projects.models.AgentEvaluationRequest":"Azure.AI.Projects.AgentEvaluationRequest","com.azure.ai.projects.models.AgentEvaluationResult":"Azure.AI.Projects.AgentEvaluationResult","com.azure.ai.projects.models.AgentEvaluationSamplingConfiguration":"Azure.AI.Projects.AgentEvaluationSamplingConfiguration","com.azure.ai.projects.models.ApiKeyCredentials":"Azure.AI.Projects.ApiKeyCredentials","com.azure.ai.projects.models.AssetCredentialResult":"Azure.AI.Projects.AssetCredentialResponse","com.azure.ai.projects.models.AttackStrategy":"Azure.AI.Projects.AttackStrategy","com.azure.ai.projects.models.AzureAISearchIndex":"Azure.AI.Projects.AzureAISearchIndex","com.azure.ai.projects.models.AzureOpenAIModelConfiguration":"Azure.AI.Projects.AzureOpenAIModelConfiguration","com.azure.ai.projects.models.BaseCredentials":"Azure.AI.Projects.BaseCredentials","com.azure.ai.projects.models.BlobReference":"Azure.AI.Projects.BlobReference","com.azure.ai.projects.models.Connection":"Azure.AI.Projects.Connection","com.azure.ai.projects.models.ConnectionType":"Azure.AI.Projects.ConnectionType","com.azure.ai.projects.models.CosmosDBIndex":"Azure.AI.Projects.CosmosDBIndex","com.azure.ai.projects.models.CredentialType":"Azure.AI.Projects.CredentialType","com.azure.ai.projects.models.CustomCredential":"Azure.AI.Projects.CustomCredential","com.azure.ai.projects.models.DatasetType":"Azure.AI.Projects.DatasetType","com.azure.ai.projects.models.DatasetVersion":"Azure.AI.Projects.DatasetVersion","com.azure.ai.projects.models.Deployment":"Azure.AI.Projects.Deployment","com.azure.ai.projects.models.DeploymentType":"Azure.AI.Projects.DeploymentType","com.azure.ai.projects.models.EmbeddingConfiguration":"Azure.AI.Projects.EmbeddingConfiguration","com.azure.ai.projects.models.EntraIDCredentials":"Azure.AI.Projects.EntraIDCredentials","com.azure.ai.projects.models.Evaluation":"Azure.AI.Projects.Evaluation","com.azure.ai.projects.models.EvaluatorConfiguration":"Azure.AI.Projects.EvaluatorConfiguration","com.azure.ai.projects.models.FieldMapping":"Azure.AI.Projects.FieldMapping","com.azure.ai.projects.models.FileDatasetVersion":"Azure.AI.Projects.FileDatasetVersion","com.azure.ai.projects.models.FolderDatasetVersion":"Azure.AI.Projects.FolderDatasetVersion","com.azure.ai.projects.models.Index":"Azure.AI.Projects.Index","com.azure.ai.projects.models.IndexType":"Azure.AI.Projects.IndexType","com.azure.ai.projects.models.InputData":"Azure.AI.Projects.InputData","com.azure.ai.projects.models.InputDataset":"Azure.AI.Projects.InputDataset","com.azure.ai.projects.models.ManagedAzureAISearchIndex":"Azure.AI.Projects.ManagedAzureAISearchIndex","com.azure.ai.projects.models.ModelDeployment":"Azure.AI.Projects.ModelDeployment","com.azure.ai.projects.models.NoAuthenticationCredentials":"Azure.AI.Projects.NoAuthenticationCredentials","com.azure.ai.projects.models.PendingUploadRequest":"Azure.AI.Projects.PendingUploadRequest","com.azure.ai.projects.models.PendingUploadResponse":"Azure.AI.Projects.PendingUploadResponse","com.azure.ai.projects.models.PendingUploadType":"Azure.AI.Projects.PendingUploadType","com.azure.ai.projects.models.RedTeam":"Azure.AI.Projects.RedTeam","com.azure.ai.projects.models.RiskCategory":"Azure.AI.Projects.RiskCategory","com.azure.ai.projects.models.SasCredential":"Azure.AI.Projects.SasCredential","com.azure.ai.projects.models.SasCredentials":"Azure.AI.Projects.SASCredentials","com.azure.ai.projects.models.Sku":"Azure.AI.Projects.Sku","com.azure.ai.projects.models.TargetConfig":"Azure.AI.Projects.TargetConfig"}} \ No newline at end of file +{"flavor":"azure","apiVersion":"2025-11-15-preview","crossLanguageDefinitions":{"com.azure.ai.projects.AIProjectClientBuilder":"Azure.AI.Projects","com.azure.ai.projects.ConnectionsAsyncClient":"Azure.AI.Projects.Connections","com.azure.ai.projects.ConnectionsAsyncClient.getConnection":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithCredentials":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithCredentialsWithResponse":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsAsyncClient.getConnectionWithResponse":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsAsyncClient.listConnections":"Azure.AI.Projects.Connections.list","com.azure.ai.projects.ConnectionsClient":"Azure.AI.Projects.Connections","com.azure.ai.projects.ConnectionsClient.getConnection":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsClient.getConnectionWithCredentials":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsClient.getConnectionWithCredentialsWithResponse":"Azure.AI.Projects.Connections.getWithCredentials","com.azure.ai.projects.ConnectionsClient.getConnectionWithResponse":"Azure.AI.Projects.Connections.get","com.azure.ai.projects.ConnectionsClient.listConnections":"Azure.AI.Projects.Connections.list","com.azure.ai.projects.DatasetsAsyncClient":"Azure.AI.Projects.Datasets","com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateVersion":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsAsyncClient.createOrUpdateVersionWithResponse":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsAsyncClient.deleteVersion":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsAsyncClient.deleteVersionWithResponse":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsAsyncClient.getCredentials":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsAsyncClient.getCredentialsWithResponse":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersion":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsAsyncClient.getDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsAsyncClient.listLatest":"Azure.AI.Projects.Datasets.listLatest","com.azure.ai.projects.DatasetsAsyncClient.listVersions":"Azure.AI.Projects.Datasets.listVersions","com.azure.ai.projects.DatasetsAsyncClient.pendingUpload":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsAsyncClient.pendingUploadWithResponse":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsClient":"Azure.AI.Projects.Datasets","com.azure.ai.projects.DatasetsClient.createOrUpdateVersion":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsClient.createOrUpdateVersionWithResponse":"Azure.AI.Projects.Datasets.createOrUpdateVersion","com.azure.ai.projects.DatasetsClient.deleteVersion":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsClient.deleteVersionWithResponse":"Azure.AI.Projects.Datasets.deleteVersion","com.azure.ai.projects.DatasetsClient.getCredentials":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsClient.getCredentialsWithResponse":"Azure.AI.Projects.Datasets.getCredentials","com.azure.ai.projects.DatasetsClient.getDatasetVersion":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsClient.getDatasetVersionWithResponse":"Azure.AI.Projects.Datasets.getVersion","com.azure.ai.projects.DatasetsClient.listLatest":"Azure.AI.Projects.Datasets.listLatest","com.azure.ai.projects.DatasetsClient.listVersions":"Azure.AI.Projects.Datasets.listVersions","com.azure.ai.projects.DatasetsClient.pendingUpload":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DatasetsClient.pendingUploadWithResponse":"Azure.AI.Projects.Datasets.startPendingUploadVersion","com.azure.ai.projects.DeploymentsAsyncClient":"Azure.AI.Projects.Deployments","com.azure.ai.projects.DeploymentsAsyncClient.get":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsAsyncClient.getWithResponse":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsAsyncClient.list":"Azure.AI.Projects.Deployments.list","com.azure.ai.projects.DeploymentsClient":"Azure.AI.Projects.Deployments","com.azure.ai.projects.DeploymentsClient.get":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsClient.getWithResponse":"Azure.AI.Projects.Deployments.get","com.azure.ai.projects.DeploymentsClient.list":"Azure.AI.Projects.Deployments.list","com.azure.ai.projects.EvaluationRulesAsyncClient":"Azure.AI.Projects.EvaluationRules","com.azure.ai.projects.EvaluationRulesAsyncClient.createOrUpdate":"Azure.AI.Projects.EvaluationRules.createOrUpdate","com.azure.ai.projects.EvaluationRulesAsyncClient.createOrUpdateWithResponse":"Azure.AI.Projects.EvaluationRules.createOrUpdate","com.azure.ai.projects.EvaluationRulesAsyncClient.delete":"Azure.AI.Projects.EvaluationRules.delete","com.azure.ai.projects.EvaluationRulesAsyncClient.deleteWithResponse":"Azure.AI.Projects.EvaluationRules.delete","com.azure.ai.projects.EvaluationRulesAsyncClient.get":"Azure.AI.Projects.EvaluationRules.get","com.azure.ai.projects.EvaluationRulesAsyncClient.getWithResponse":"Azure.AI.Projects.EvaluationRules.get","com.azure.ai.projects.EvaluationRulesAsyncClient.list":"Azure.AI.Projects.EvaluationRules.list","com.azure.ai.projects.EvaluationRulesClient":"Azure.AI.Projects.EvaluationRules","com.azure.ai.projects.EvaluationRulesClient.createOrUpdate":"Azure.AI.Projects.EvaluationRules.createOrUpdate","com.azure.ai.projects.EvaluationRulesClient.createOrUpdateWithResponse":"Azure.AI.Projects.EvaluationRules.createOrUpdate","com.azure.ai.projects.EvaluationRulesClient.delete":"Azure.AI.Projects.EvaluationRules.delete","com.azure.ai.projects.EvaluationRulesClient.deleteWithResponse":"Azure.AI.Projects.EvaluationRules.delete","com.azure.ai.projects.EvaluationRulesClient.get":"Azure.AI.Projects.EvaluationRules.get","com.azure.ai.projects.EvaluationRulesClient.getWithResponse":"Azure.AI.Projects.EvaluationRules.get","com.azure.ai.projects.EvaluationRulesClient.list":"Azure.AI.Projects.EvaluationRules.list","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient":"Azure.AI.Projects.EvaluationTaxonomies","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.create":"Azure.AI.Projects.EvaluationTaxonomies.create","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.createWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.create","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.delete":"Azure.AI.Projects.EvaluationTaxonomies.delete","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.deleteWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.delete","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.get":"Azure.AI.Projects.EvaluationTaxonomies.get","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.getWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.get","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.list":"Azure.AI.Projects.EvaluationTaxonomies.list","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.update":"Azure.AI.Projects.EvaluationTaxonomies.update","com.azure.ai.projects.EvaluationTaxonomiesAsyncClient.updateWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.update","com.azure.ai.projects.EvaluationTaxonomiesClient":"Azure.AI.Projects.EvaluationTaxonomies","com.azure.ai.projects.EvaluationTaxonomiesClient.create":"Azure.AI.Projects.EvaluationTaxonomies.create","com.azure.ai.projects.EvaluationTaxonomiesClient.createWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.create","com.azure.ai.projects.EvaluationTaxonomiesClient.delete":"Azure.AI.Projects.EvaluationTaxonomies.delete","com.azure.ai.projects.EvaluationTaxonomiesClient.deleteWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.delete","com.azure.ai.projects.EvaluationTaxonomiesClient.get":"Azure.AI.Projects.EvaluationTaxonomies.get","com.azure.ai.projects.EvaluationTaxonomiesClient.getWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.get","com.azure.ai.projects.EvaluationTaxonomiesClient.list":"Azure.AI.Projects.EvaluationTaxonomies.list","com.azure.ai.projects.EvaluationTaxonomiesClient.update":"Azure.AI.Projects.EvaluationTaxonomies.update","com.azure.ai.projects.EvaluationTaxonomiesClient.updateWithResponse":"Azure.AI.Projects.EvaluationTaxonomies.update","com.azure.ai.projects.EvaluatorsAsyncClient":"Azure.AI.Projects.Evaluators","com.azure.ai.projects.EvaluatorsAsyncClient.createVersion":"Azure.AI.Projects.Evaluators.createVersion","com.azure.ai.projects.EvaluatorsAsyncClient.createVersionWithResponse":"Azure.AI.Projects.Evaluators.createVersion","com.azure.ai.projects.EvaluatorsAsyncClient.deleteVersion":"Azure.AI.Projects.Evaluators.deleteVersion","com.azure.ai.projects.EvaluatorsAsyncClient.deleteVersionWithResponse":"Azure.AI.Projects.Evaluators.deleteVersion","com.azure.ai.projects.EvaluatorsAsyncClient.getVersion":"Azure.AI.Projects.Evaluators.getVersion","com.azure.ai.projects.EvaluatorsAsyncClient.getVersionWithResponse":"Azure.AI.Projects.Evaluators.getVersion","com.azure.ai.projects.EvaluatorsAsyncClient.listLatestVersions":"Azure.AI.Projects.Evaluators.listLatestVersions","com.azure.ai.projects.EvaluatorsAsyncClient.listVersions":"Azure.AI.Projects.Evaluators.listVersions","com.azure.ai.projects.EvaluatorsAsyncClient.updateVersion":"Azure.AI.Projects.Evaluators.updateVersion","com.azure.ai.projects.EvaluatorsAsyncClient.updateVersionWithResponse":"Azure.AI.Projects.Evaluators.updateVersion","com.azure.ai.projects.EvaluatorsClient":"Azure.AI.Projects.Evaluators","com.azure.ai.projects.EvaluatorsClient.createVersion":"Azure.AI.Projects.Evaluators.createVersion","com.azure.ai.projects.EvaluatorsClient.createVersionWithResponse":"Azure.AI.Projects.Evaluators.createVersion","com.azure.ai.projects.EvaluatorsClient.deleteVersion":"Azure.AI.Projects.Evaluators.deleteVersion","com.azure.ai.projects.EvaluatorsClient.deleteVersionWithResponse":"Azure.AI.Projects.Evaluators.deleteVersion","com.azure.ai.projects.EvaluatorsClient.getVersion":"Azure.AI.Projects.Evaluators.getVersion","com.azure.ai.projects.EvaluatorsClient.getVersionWithResponse":"Azure.AI.Projects.Evaluators.getVersion","com.azure.ai.projects.EvaluatorsClient.listLatestVersions":"Azure.AI.Projects.Evaluators.listLatestVersions","com.azure.ai.projects.EvaluatorsClient.listVersions":"Azure.AI.Projects.Evaluators.listVersions","com.azure.ai.projects.EvaluatorsClient.updateVersion":"Azure.AI.Projects.Evaluators.updateVersion","com.azure.ai.projects.EvaluatorsClient.updateVersionWithResponse":"Azure.AI.Projects.Evaluators.updateVersion","com.azure.ai.projects.IndexesAsyncClient":"Azure.AI.Projects.Indexes","com.azure.ai.projects.IndexesAsyncClient.createOrUpdate":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesAsyncClient.createOrUpdateWithResponse":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesAsyncClient.deleteVersion":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesAsyncClient.deleteVersionWithResponse":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesAsyncClient.getVersion":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesAsyncClient.getVersionWithResponse":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesAsyncClient.listLatest":"Azure.AI.Projects.Indexes.listLatest","com.azure.ai.projects.IndexesAsyncClient.listVersions":"Azure.AI.Projects.Indexes.listVersions","com.azure.ai.projects.IndexesClient":"Azure.AI.Projects.Indexes","com.azure.ai.projects.IndexesClient.createOrUpdate":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesClient.createOrUpdateWithResponse":"Azure.AI.Projects.Indexes.createOrUpdateVersion","com.azure.ai.projects.IndexesClient.deleteVersion":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesClient.deleteVersionWithResponse":"Azure.AI.Projects.Indexes.deleteVersion","com.azure.ai.projects.IndexesClient.getVersion":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesClient.getVersionWithResponse":"Azure.AI.Projects.Indexes.getVersion","com.azure.ai.projects.IndexesClient.listLatest":"Azure.AI.Projects.Indexes.listLatest","com.azure.ai.projects.IndexesClient.listVersions":"Azure.AI.Projects.Indexes.listVersions","com.azure.ai.projects.InsightsAsyncClient":"Azure.AI.Projects.Insights","com.azure.ai.projects.InsightsAsyncClient.generate":"Azure.AI.Projects.Insights.generate","com.azure.ai.projects.InsightsAsyncClient.generateWithResponse":"Azure.AI.Projects.Insights.generate","com.azure.ai.projects.InsightsAsyncClient.get":"Azure.AI.Projects.Insights.get","com.azure.ai.projects.InsightsAsyncClient.getWithResponse":"Azure.AI.Projects.Insights.get","com.azure.ai.projects.InsightsAsyncClient.list":"Azure.AI.Projects.Insights.list","com.azure.ai.projects.InsightsClient":"Azure.AI.Projects.Insights","com.azure.ai.projects.InsightsClient.generate":"Azure.AI.Projects.Insights.generate","com.azure.ai.projects.InsightsClient.generateWithResponse":"Azure.AI.Projects.Insights.generate","com.azure.ai.projects.InsightsClient.get":"Azure.AI.Projects.Insights.get","com.azure.ai.projects.InsightsClient.getWithResponse":"Azure.AI.Projects.Insights.get","com.azure.ai.projects.InsightsClient.list":"Azure.AI.Projects.Insights.list","com.azure.ai.projects.RedTeamsAsyncClient":"Azure.AI.Projects.RedTeams","com.azure.ai.projects.RedTeamsAsyncClient.create":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsAsyncClient.createWithResponse":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsAsyncClient.get":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsAsyncClient.getWithResponse":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsAsyncClient.list":"Azure.AI.Projects.RedTeams.list","com.azure.ai.projects.RedTeamsClient":"Azure.AI.Projects.RedTeams","com.azure.ai.projects.RedTeamsClient.create":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsClient.createWithResponse":"Azure.AI.Projects.RedTeams.create","com.azure.ai.projects.RedTeamsClient.get":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsClient.getWithResponse":"Azure.AI.Projects.RedTeams.get","com.azure.ai.projects.RedTeamsClient.list":"Azure.AI.Projects.RedTeams.list","com.azure.ai.projects.SchedulesAsyncClient":"Azure.AI.Projects.Schedules","com.azure.ai.projects.SchedulesAsyncClient.createOrUpdate":"Azure.AI.Projects.Schedules.createOrUpdate","com.azure.ai.projects.SchedulesAsyncClient.createOrUpdateWithResponse":"Azure.AI.Projects.Schedules.createOrUpdate","com.azure.ai.projects.SchedulesAsyncClient.delete":"Azure.AI.Projects.Schedules.delete","com.azure.ai.projects.SchedulesAsyncClient.deleteWithResponse":"Azure.AI.Projects.Schedules.delete","com.azure.ai.projects.SchedulesAsyncClient.get":"Azure.AI.Projects.Schedules.get","com.azure.ai.projects.SchedulesAsyncClient.getRun":"Azure.AI.Projects.Schedules.getRun","com.azure.ai.projects.SchedulesAsyncClient.getRunWithResponse":"Azure.AI.Projects.Schedules.getRun","com.azure.ai.projects.SchedulesAsyncClient.getWithResponse":"Azure.AI.Projects.Schedules.get","com.azure.ai.projects.SchedulesAsyncClient.list":"Azure.AI.Projects.Schedules.list","com.azure.ai.projects.SchedulesAsyncClient.listRuns":"Azure.AI.Projects.Schedules.listRuns","com.azure.ai.projects.SchedulesClient":"Azure.AI.Projects.Schedules","com.azure.ai.projects.SchedulesClient.createOrUpdate":"Azure.AI.Projects.Schedules.createOrUpdate","com.azure.ai.projects.SchedulesClient.createOrUpdateWithResponse":"Azure.AI.Projects.Schedules.createOrUpdate","com.azure.ai.projects.SchedulesClient.delete":"Azure.AI.Projects.Schedules.delete","com.azure.ai.projects.SchedulesClient.deleteWithResponse":"Azure.AI.Projects.Schedules.delete","com.azure.ai.projects.SchedulesClient.get":"Azure.AI.Projects.Schedules.get","com.azure.ai.projects.SchedulesClient.getRun":"Azure.AI.Projects.Schedules.getRun","com.azure.ai.projects.SchedulesClient.getRunWithResponse":"Azure.AI.Projects.Schedules.getRun","com.azure.ai.projects.SchedulesClient.getWithResponse":"Azure.AI.Projects.Schedules.get","com.azure.ai.projects.SchedulesClient.list":"Azure.AI.Projects.Schedules.list","com.azure.ai.projects.SchedulesClient.listRuns":"Azure.AI.Projects.Schedules.listRuns","com.azure.ai.projects.models.AgentClusterInsightResult":"Azure.AI.Projects.AgentClusterInsightResult","com.azure.ai.projects.models.AgentClusterInsightsRequest":"Azure.AI.Projects.AgentClusterInsightsRequest","com.azure.ai.projects.models.AgentTaxonomyInput":"Azure.AI.Projects.AgentTaxonomyInput","com.azure.ai.projects.models.AgenticIdentityCredentials":"Azure.AI.Projects.AgenticIdentityCredentials","com.azure.ai.projects.models.ApiKeyCredentials":"Azure.AI.Projects.ApiKeyCredentials","com.azure.ai.projects.models.AttackStrategy":"Azure.AI.Projects.AttackStrategy","com.azure.ai.projects.models.AzureAIAgentTarget":"Azure.AI.Projects.AzureAIAgentTarget","com.azure.ai.projects.models.AzureAIAssistantTarget":"Azure.AI.Projects.AzureAIAssistantTarget","com.azure.ai.projects.models.AzureAIModelTarget":"Azure.AI.Projects.AzureAIModelTarget","com.azure.ai.projects.models.AzureAISearchIndex":"Azure.AI.Projects.AzureAISearchIndex","com.azure.ai.projects.models.AzureOpenAIModelConfiguration":"Azure.AI.Projects.AzureOpenAIModelConfiguration","com.azure.ai.projects.models.BaseCredentials":"Azure.AI.Projects.BaseCredentials","com.azure.ai.projects.models.BlobReference":"Azure.AI.Projects.BlobReference","com.azure.ai.projects.models.BlobReferenceSasCredential":"Azure.AI.Projects.SasCredential","com.azure.ai.projects.models.ChartCoordinate":"Azure.AI.Projects.ChartCoordinate","com.azure.ai.projects.models.ClusterInsightResult":"Azure.AI.Projects.ClusterInsightResult","com.azure.ai.projects.models.ClusterTokenUsage":"Azure.AI.Projects.ClusterTokenUsage","com.azure.ai.projects.models.CodeBasedEvaluatorDefinition":"Azure.AI.Projects.CodeBasedEvaluatorDefinition","com.azure.ai.projects.models.Connection":"Azure.AI.Projects.Connection","com.azure.ai.projects.models.ConnectionType":"Azure.AI.Projects.ConnectionType","com.azure.ai.projects.models.ContinuousEvaluationRuleAction":"Azure.AI.Projects.ContinuousEvaluationRuleAction","com.azure.ai.projects.models.CosmosDBIndex":"Azure.AI.Projects.CosmosDBIndex","com.azure.ai.projects.models.CredentialType":"Azure.AI.Projects.CredentialType","com.azure.ai.projects.models.CronTrigger":"Azure.AI.Projects.CronTrigger","com.azure.ai.projects.models.CustomCredential":"Azure.AI.Projects.CustomCredential","com.azure.ai.projects.models.DailyRecurrenceSchedule":"Azure.AI.Projects.DailyRecurrenceSchedule","com.azure.ai.projects.models.DatasetCredential":"Azure.AI.Projects.AssetCredentialResponse","com.azure.ai.projects.models.DatasetType":"Azure.AI.Projects.DatasetType","com.azure.ai.projects.models.DatasetVersion":"Azure.AI.Projects.DatasetVersion","com.azure.ai.projects.models.DayOfWeek":"Azure.AI.Projects.DayOfWeek","com.azure.ai.projects.models.Deployment":"Azure.AI.Projects.Deployment","com.azure.ai.projects.models.DeploymentType":"Azure.AI.Projects.DeploymentType","com.azure.ai.projects.models.EmbeddingConfiguration":"Azure.AI.Projects.EmbeddingConfiguration","com.azure.ai.projects.models.EntraIdCredentials":"Azure.AI.Projects.EntraIDCredentials","com.azure.ai.projects.models.EvaluationCompareReport":"Azure.AI.Projects.EvalCompareReport","com.azure.ai.projects.models.EvaluationComparisonRequest":"Azure.AI.Projects.EvaluationComparisonRequest","com.azure.ai.projects.models.EvaluationResult":"Azure.AI.Projects.EvalResult","com.azure.ai.projects.models.EvaluationResultSample":"Azure.AI.Projects.EvaluationResultSample","com.azure.ai.projects.models.EvaluationRule":"Azure.AI.Projects.EvaluationRule","com.azure.ai.projects.models.EvaluationRuleAction":"Azure.AI.Projects.EvaluationRuleAction","com.azure.ai.projects.models.EvaluationRuleActionType":"Azure.AI.Projects.EvaluationRuleActionType","com.azure.ai.projects.models.EvaluationRuleEventType":"Azure.AI.Projects.EvaluationRuleEventType","com.azure.ai.projects.models.EvaluationRuleFilter":"Azure.AI.Projects.EvaluationRuleFilter","com.azure.ai.projects.models.EvaluationRunClusterInsightResult":"Azure.AI.Projects.EvaluationRunClusterInsightResult","com.azure.ai.projects.models.EvaluationRunClusterInsightsRequest":"Azure.AI.Projects.EvaluationRunClusterInsightsRequest","com.azure.ai.projects.models.EvaluationRunResultCompareItem":"Azure.AI.Projects.EvalRunResultCompareItem","com.azure.ai.projects.models.EvaluationRunResultComparison":"Azure.AI.Projects.EvalRunResultComparison","com.azure.ai.projects.models.EvaluationRunResultSummary":"Azure.AI.Projects.EvalRunResultSummary","com.azure.ai.projects.models.EvaluationScheduleTask":"Azure.AI.Projects.EvaluationScheduleTask","com.azure.ai.projects.models.EvaluationScheduleTaskEvalRun":"Azure.AI.Projects.EvaluationScheduleTask.evalRun.anonymous","com.azure.ai.projects.models.EvaluationTaxonomy":"Azure.AI.Projects.EvaluationTaxonomy","com.azure.ai.projects.models.EvaluationTaxonomyInput":"Azure.AI.Projects.EvaluationTaxonomyInput","com.azure.ai.projects.models.EvaluationTaxonomyInputType":"Azure.AI.Projects.EvaluationTaxonomyInputType","com.azure.ai.projects.models.EvaluatorCategory":"Azure.AI.Projects.EvaluatorCategory","com.azure.ai.projects.models.EvaluatorDefinition":"Azure.AI.Projects.EvaluatorDefinition","com.azure.ai.projects.models.EvaluatorDefinitionType":"Azure.AI.Projects.EvaluatorDefinitionType","com.azure.ai.projects.models.EvaluatorMetric":"Azure.AI.Projects.EvaluatorMetric","com.azure.ai.projects.models.EvaluatorMetricDirection":"Azure.AI.Projects.EvaluatorMetricDirection","com.azure.ai.projects.models.EvaluatorMetricType":"Azure.AI.Projects.EvaluatorMetricType","com.azure.ai.projects.models.EvaluatorType":"Azure.AI.Projects.EvaluatorType","com.azure.ai.projects.models.EvaluatorVersion":"Azure.AI.Projects.EvaluatorVersion","com.azure.ai.projects.models.FieldMapping":"Azure.AI.Projects.FieldMapping","com.azure.ai.projects.models.FileDatasetVersion":"Azure.AI.Projects.FileDatasetVersion","com.azure.ai.projects.models.FolderDatasetVersion":"Azure.AI.Projects.FolderDatasetVersion","com.azure.ai.projects.models.HourlyRecurrenceSchedule":"Azure.AI.Projects.HourlyRecurrenceSchedule","com.azure.ai.projects.models.HumanEvaluationRuleAction":"Azure.AI.Projects.HumanEvaluationRuleAction","com.azure.ai.projects.models.Index":"Azure.AI.Projects.Index","com.azure.ai.projects.models.IndexType":"Azure.AI.Projects.IndexType","com.azure.ai.projects.models.Insight":"Azure.AI.Projects.Insight","com.azure.ai.projects.models.InsightCluster":"Azure.AI.Projects.InsightCluster","com.azure.ai.projects.models.InsightModelConfiguration":"Azure.AI.Projects.InsightModelConfiguration","com.azure.ai.projects.models.InsightRequest":"Azure.AI.Projects.InsightRequest","com.azure.ai.projects.models.InsightResult":"Azure.AI.Projects.InsightResult","com.azure.ai.projects.models.InsightSample":"Azure.AI.Projects.InsightSample","com.azure.ai.projects.models.InsightScheduleTask":"Azure.AI.Projects.InsightScheduleTask","com.azure.ai.projects.models.InsightSummary":"Azure.AI.Projects.InsightSummary","com.azure.ai.projects.models.InsightType":"Azure.AI.Projects.InsightType","com.azure.ai.projects.models.InsightsMetadata":"Azure.AI.Projects.InsightsMetadata","com.azure.ai.projects.models.ListVersionsRequestType":"Azure.AI.Projects.listVersions.RequestType.anonymous","com.azure.ai.projects.models.ManagedAzureAISearchIndex":"Azure.AI.Projects.ManagedAzureAISearchIndex","com.azure.ai.projects.models.ModelDeployment":"Azure.AI.Projects.ModelDeployment","com.azure.ai.projects.models.ModelDeploymentSku":"Azure.AI.Projects.Sku","com.azure.ai.projects.models.ModelSamplingParams":"Azure.AI.Projects.ModelSamplingParams","com.azure.ai.projects.models.MonthlyRecurrenceSchedule":"Azure.AI.Projects.MonthlyRecurrenceSchedule","com.azure.ai.projects.models.NoAuthenticationCredentials":"Azure.AI.Projects.NoAuthenticationCredentials","com.azure.ai.projects.models.OneTimeTrigger":"Azure.AI.Projects.OneTimeTrigger","com.azure.ai.projects.models.OperationStatus":"Azure.Core.Foundations.OperationState","com.azure.ai.projects.models.PendingUploadRequest":"Azure.AI.Projects.PendingUploadRequest","com.azure.ai.projects.models.PendingUploadResponse":"Azure.AI.Projects.PendingUploadResponse","com.azure.ai.projects.models.PendingUploadType":"Azure.AI.Projects.PendingUploadType","com.azure.ai.projects.models.PromptBasedEvaluatorDefinition":"Azure.AI.Projects.PromptBasedEvaluatorDefinition","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.RecurrenceType":"Azure.AI.Projects.RecurrenceType","com.azure.ai.projects.models.RedTeam":"Azure.AI.Projects.RedTeam","com.azure.ai.projects.models.RiskCategory":"Azure.AI.Projects.RiskCategory","com.azure.ai.projects.models.SampleType":"Azure.AI.Projects.SampleType","com.azure.ai.projects.models.SasCredentials":"Azure.AI.Projects.SASCredentials","com.azure.ai.projects.models.Schedule":"Azure.AI.Projects.Schedule","com.azure.ai.projects.models.ScheduleProvisioningStatus":"Azure.AI.Projects.ScheduleProvisioningStatus","com.azure.ai.projects.models.ScheduleRun":"Azure.AI.Projects.ScheduleRun","com.azure.ai.projects.models.ScheduleTask":"Azure.AI.Projects.ScheduleTask","com.azure.ai.projects.models.ScheduleTaskType":"Azure.AI.Projects.ScheduleTaskType","com.azure.ai.projects.models.Target":"Azure.AI.Projects.Target","com.azure.ai.projects.models.TargetConfig":"Azure.AI.Projects.TargetConfig","com.azure.ai.projects.models.TaxonomyCategory":"Azure.AI.Projects.TaxonomyCategory","com.azure.ai.projects.models.TaxonomySubCategory":"Azure.AI.Projects.TaxonomySubCategory","com.azure.ai.projects.models.ToolDescription":"Azure.AI.Projects.ToolDescription","com.azure.ai.projects.models.TreatmentEffectType":"Azure.AI.Projects.TreatmentEffectType","com.azure.ai.projects.models.Trigger":"Azure.AI.Projects.Trigger","com.azure.ai.projects.models.TriggerType":"Azure.AI.Projects.TriggerType","com.azure.ai.projects.models.WeeklyRecurrenceSchedule":"Azure.AI.Projects.WeeklyRecurrenceSchedule"},"generatedFiles":["src/main/java/com/azure/ai/projects/AIProjectClientBuilder.java","src/main/java/com/azure/ai/projects/AIProjectsServiceVersion.java","src/main/java/com/azure/ai/projects/ConnectionsAsyncClient.java","src/main/java/com/azure/ai/projects/ConnectionsClient.java","src/main/java/com/azure/ai/projects/DatasetsAsyncClient.java","src/main/java/com/azure/ai/projects/DatasetsClient.java","src/main/java/com/azure/ai/projects/DeploymentsAsyncClient.java","src/main/java/com/azure/ai/projects/DeploymentsClient.java","src/main/java/com/azure/ai/projects/EvaluationRulesAsyncClient.java","src/main/java/com/azure/ai/projects/EvaluationRulesClient.java","src/main/java/com/azure/ai/projects/EvaluationTaxonomiesAsyncClient.java","src/main/java/com/azure/ai/projects/EvaluationTaxonomiesClient.java","src/main/java/com/azure/ai/projects/EvaluatorsAsyncClient.java","src/main/java/com/azure/ai/projects/EvaluatorsClient.java","src/main/java/com/azure/ai/projects/IndexesAsyncClient.java","src/main/java/com/azure/ai/projects/IndexesClient.java","src/main/java/com/azure/ai/projects/InsightsAsyncClient.java","src/main/java/com/azure/ai/projects/InsightsClient.java","src/main/java/com/azure/ai/projects/RedTeamsAsyncClient.java","src/main/java/com/azure/ai/projects/RedTeamsClient.java","src/main/java/com/azure/ai/projects/SchedulesAsyncClient.java","src/main/java/com/azure/ai/projects/SchedulesClient.java","src/main/java/com/azure/ai/projects/implementation/AIProjectClientImpl.java","src/main/java/com/azure/ai/projects/implementation/ConnectionsImpl.java","src/main/java/com/azure/ai/projects/implementation/DatasetsImpl.java","src/main/java/com/azure/ai/projects/implementation/DeploymentsImpl.java","src/main/java/com/azure/ai/projects/implementation/EvaluationRulesImpl.java","src/main/java/com/azure/ai/projects/implementation/EvaluationTaxonomiesImpl.java","src/main/java/com/azure/ai/projects/implementation/EvaluatorsImpl.java","src/main/java/com/azure/ai/projects/implementation/IndexesImpl.java","src/main/java/com/azure/ai/projects/implementation/InsightsImpl.java","src/main/java/com/azure/ai/projects/implementation/JsonMergePatchHelper.java","src/main/java/com/azure/ai/projects/implementation/RedTeamsImpl.java","src/main/java/com/azure/ai/projects/implementation/SchedulesImpl.java","src/main/java/com/azure/ai/projects/implementation/package-info.java","src/main/java/com/azure/ai/projects/models/AgentClusterInsightResult.java","src/main/java/com/azure/ai/projects/models/AgentClusterInsightsRequest.java","src/main/java/com/azure/ai/projects/models/AgentTaxonomyInput.java","src/main/java/com/azure/ai/projects/models/AgenticIdentityCredentials.java","src/main/java/com/azure/ai/projects/models/ApiKeyCredentials.java","src/main/java/com/azure/ai/projects/models/AttackStrategy.java","src/main/java/com/azure/ai/projects/models/AzureAIAgentTarget.java","src/main/java/com/azure/ai/projects/models/AzureAIAssistantTarget.java","src/main/java/com/azure/ai/projects/models/AzureAIModelTarget.java","src/main/java/com/azure/ai/projects/models/AzureAISearchIndex.java","src/main/java/com/azure/ai/projects/models/AzureOpenAIModelConfiguration.java","src/main/java/com/azure/ai/projects/models/BaseCredentials.java","src/main/java/com/azure/ai/projects/models/BlobReference.java","src/main/java/com/azure/ai/projects/models/BlobReferenceSasCredential.java","src/main/java/com/azure/ai/projects/models/ChartCoordinate.java","src/main/java/com/azure/ai/projects/models/ClusterInsightResult.java","src/main/java/com/azure/ai/projects/models/ClusterTokenUsage.java","src/main/java/com/azure/ai/projects/models/CodeBasedEvaluatorDefinition.java","src/main/java/com/azure/ai/projects/models/Connection.java","src/main/java/com/azure/ai/projects/models/ConnectionType.java","src/main/java/com/azure/ai/projects/models/ContinuousEvaluationRuleAction.java","src/main/java/com/azure/ai/projects/models/CosmosDBIndex.java","src/main/java/com/azure/ai/projects/models/CredentialType.java","src/main/java/com/azure/ai/projects/models/CronTrigger.java","src/main/java/com/azure/ai/projects/models/CustomCredential.java","src/main/java/com/azure/ai/projects/models/DailyRecurrenceSchedule.java","src/main/java/com/azure/ai/projects/models/DatasetCredential.java","src/main/java/com/azure/ai/projects/models/DatasetType.java","src/main/java/com/azure/ai/projects/models/DatasetVersion.java","src/main/java/com/azure/ai/projects/models/DayOfWeek.java","src/main/java/com/azure/ai/projects/models/Deployment.java","src/main/java/com/azure/ai/projects/models/DeploymentType.java","src/main/java/com/azure/ai/projects/models/EmbeddingConfiguration.java","src/main/java/com/azure/ai/projects/models/EntraIdCredentials.java","src/main/java/com/azure/ai/projects/models/EvaluationCompareReport.java","src/main/java/com/azure/ai/projects/models/EvaluationComparisonRequest.java","src/main/java/com/azure/ai/projects/models/EvaluationResult.java","src/main/java/com/azure/ai/projects/models/EvaluationResultSample.java","src/main/java/com/azure/ai/projects/models/EvaluationRule.java","src/main/java/com/azure/ai/projects/models/EvaluationRuleAction.java","src/main/java/com/azure/ai/projects/models/EvaluationRuleActionType.java","src/main/java/com/azure/ai/projects/models/EvaluationRuleEventType.java","src/main/java/com/azure/ai/projects/models/EvaluationRuleFilter.java","src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightResult.java","src/main/java/com/azure/ai/projects/models/EvaluationRunClusterInsightsRequest.java","src/main/java/com/azure/ai/projects/models/EvaluationRunResultCompareItem.java","src/main/java/com/azure/ai/projects/models/EvaluationRunResultComparison.java","src/main/java/com/azure/ai/projects/models/EvaluationRunResultSummary.java","src/main/java/com/azure/ai/projects/models/EvaluationScheduleTask.java","src/main/java/com/azure/ai/projects/models/EvaluationScheduleTaskEvalRun.java","src/main/java/com/azure/ai/projects/models/EvaluationTaxonomy.java","src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInput.java","src/main/java/com/azure/ai/projects/models/EvaluationTaxonomyInputType.java","src/main/java/com/azure/ai/projects/models/EvaluatorCategory.java","src/main/java/com/azure/ai/projects/models/EvaluatorDefinition.java","src/main/java/com/azure/ai/projects/models/EvaluatorDefinitionType.java","src/main/java/com/azure/ai/projects/models/EvaluatorMetric.java","src/main/java/com/azure/ai/projects/models/EvaluatorMetricDirection.java","src/main/java/com/azure/ai/projects/models/EvaluatorMetricType.java","src/main/java/com/azure/ai/projects/models/EvaluatorType.java","src/main/java/com/azure/ai/projects/models/EvaluatorVersion.java","src/main/java/com/azure/ai/projects/models/FieldMapping.java","src/main/java/com/azure/ai/projects/models/FileDatasetVersion.java","src/main/java/com/azure/ai/projects/models/FolderDatasetVersion.java","src/main/java/com/azure/ai/projects/models/HourlyRecurrenceSchedule.java","src/main/java/com/azure/ai/projects/models/HumanEvaluationRuleAction.java","src/main/java/com/azure/ai/projects/models/Index.java","src/main/java/com/azure/ai/projects/models/IndexType.java","src/main/java/com/azure/ai/projects/models/Insight.java","src/main/java/com/azure/ai/projects/models/InsightCluster.java","src/main/java/com/azure/ai/projects/models/InsightModelConfiguration.java","src/main/java/com/azure/ai/projects/models/InsightRequest.java","src/main/java/com/azure/ai/projects/models/InsightResult.java","src/main/java/com/azure/ai/projects/models/InsightSample.java","src/main/java/com/azure/ai/projects/models/InsightScheduleTask.java","src/main/java/com/azure/ai/projects/models/InsightSummary.java","src/main/java/com/azure/ai/projects/models/InsightType.java","src/main/java/com/azure/ai/projects/models/InsightsMetadata.java","src/main/java/com/azure/ai/projects/models/ListVersionsRequestType.java","src/main/java/com/azure/ai/projects/models/ManagedAzureAISearchIndex.java","src/main/java/com/azure/ai/projects/models/ModelDeployment.java","src/main/java/com/azure/ai/projects/models/ModelDeploymentSku.java","src/main/java/com/azure/ai/projects/models/ModelSamplingParams.java","src/main/java/com/azure/ai/projects/models/MonthlyRecurrenceSchedule.java","src/main/java/com/azure/ai/projects/models/NoAuthenticationCredentials.java","src/main/java/com/azure/ai/projects/models/OneTimeTrigger.java","src/main/java/com/azure/ai/projects/models/OperationStatus.java","src/main/java/com/azure/ai/projects/models/PendingUploadRequest.java","src/main/java/com/azure/ai/projects/models/PendingUploadResponse.java","src/main/java/com/azure/ai/projects/models/PendingUploadType.java","src/main/java/com/azure/ai/projects/models/PromptBasedEvaluatorDefinition.java","src/main/java/com/azure/ai/projects/models/RecurrenceSchedule.java","src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java","src/main/java/com/azure/ai/projects/models/RecurrenceType.java","src/main/java/com/azure/ai/projects/models/RedTeam.java","src/main/java/com/azure/ai/projects/models/RiskCategory.java","src/main/java/com/azure/ai/projects/models/SampleType.java","src/main/java/com/azure/ai/projects/models/SasCredentials.java","src/main/java/com/azure/ai/projects/models/Schedule.java","src/main/java/com/azure/ai/projects/models/ScheduleProvisioningStatus.java","src/main/java/com/azure/ai/projects/models/ScheduleRun.java","src/main/java/com/azure/ai/projects/models/ScheduleTask.java","src/main/java/com/azure/ai/projects/models/ScheduleTaskType.java","src/main/java/com/azure/ai/projects/models/Target.java","src/main/java/com/azure/ai/projects/models/TargetConfig.java","src/main/java/com/azure/ai/projects/models/TaxonomyCategory.java","src/main/java/com/azure/ai/projects/models/TaxonomySubCategory.java","src/main/java/com/azure/ai/projects/models/ToolDescription.java","src/main/java/com/azure/ai/projects/models/TreatmentEffectType.java","src/main/java/com/azure/ai/projects/models/Trigger.java","src/main/java/com/azure/ai/projects/models/TriggerType.java","src/main/java/com/azure/ai/projects/models/WeeklyRecurrenceSchedule.java","src/main/java/com/azure/ai/projects/models/package-info.java","src/main/java/com/azure/ai/projects/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsAsyncSample.java index 3ea758d537b8..64f25ab3fc9c 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsAsyncSample.java @@ -1,50 +1,50 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.agents.persistent.PersistentAgentsAdministrationAsyncClient; -import com.azure.ai.agents.persistent.PersistentAgentsAsyncClient; -import com.azure.ai.agents.persistent.models.CreateAgentOptions; -import com.azure.ai.agents.persistent.models.PersistentAgent; -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; -import reactor.core.publisher.Mono; - -public class AgentsAsyncSample { - - private static PersistentAgentsAsyncClient agentsAsyncClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()) - .buildPersistentAgentsAsyncClient(); - private static PersistentAgentsAdministrationAsyncClient administrationAsyncClient - = agentsAsyncClient.getPersistentAgentsAdministrationAsyncClient(); - - public static void main(String[] args) { - // Using block() to wait for the async operations to complete in the sample - PersistentAgent createdAgent = createAgent().block(); - deleteAgent(createdAgent.getId()).block(); - } - - public static Mono createAgent() { - // BEGIN:com.azure.ai.projects.AgentsAsyncSample.createAgent - - String agentName = "basic_example"; - CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") - .setName(agentName) - .setInstructions("You are a helpful agent"); - - return administrationAsyncClient.createAgent(createAgentOptions) - .doOnNext(agent -> System.out.println("Agent created: " + agent.getId())); - - // END:com.azure.ai.projects.AgentsAsyncSample.createAgent - } - - public static Mono deleteAgent(String agentId) { - // BEGIN:com.azure.ai.projects.AgentsAsyncSample.deleteAgent - - return administrationAsyncClient.deleteAgent(agentId) - .doOnSuccess(aVoid -> System.out.println("Agent deleted: " + agentId)); - - // END:com.azure.ai.projects.AgentsAsyncSample.deleteAgent - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.agents.persistent.PersistentAgentsAdministrationAsyncClient; +//import com.azure.ai.agents.persistent.PersistentAgentsAsyncClient; +//import com.azure.ai.agents.persistent.models.CreateAgentOptions; +//import com.azure.ai.agents.persistent.models.PersistentAgent; +//import com.azure.core.util.Configuration; +//import com.azure.identity.DefaultAzureCredentialBuilder; +//import reactor.core.publisher.Mono; +// +//public class AgentsAsyncSample { +// +// private static PersistentAgentsAsyncClient agentsAsyncClient +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()) +// .buildPersistentAgentsAsyncClient(); +// private static PersistentAgentsAdministrationAsyncClient administrationAsyncClient +// = agentsAsyncClient.getPersistentAgentsAdministrationAsyncClient(); +// +// public static void main(String[] args) { +// // Using block() to wait for the async operations to complete in the sample +// PersistentAgent createdAgent = createAgent().block(); +// deleteAgent(createdAgent.getId()).block(); +// } +// +// public static Mono createAgent() { +// // BEGIN:com.azure.ai.projects.AgentsAsyncSample.createAgent +// +// String agentName = "basic_example"; +// CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") +// .setName(agentName) +// .setInstructions("You are a helpful agent"); +// +// return administrationAsyncClient.createAgent(createAgentOptions) +// .doOnNext(agent -> System.out.println("Agent created: " + agent.getId())); +// +// // END:com.azure.ai.projects.AgentsAsyncSample.createAgent +// } +// +// public static Mono deleteAgent(String agentId) { +// // BEGIN:com.azure.ai.projects.AgentsAsyncSample.deleteAgent +// +// return administrationAsyncClient.deleteAgent(agentId) +// .doOnSuccess(aVoid -> System.out.println("Agent deleted: " + agentId)); +// +// // END:com.azure.ai.projects.AgentsAsyncSample.deleteAgent +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsSample.java index 50ca1bb3783a..e6ab8bc6b846 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/AgentsSample.java @@ -1,49 +1,49 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.agents.persistent.PersistentAgentsAdministrationClient; -import com.azure.ai.agents.persistent.PersistentAgentsClient; -import com.azure.ai.agents.persistent.PersistentAgentsClientBuilder; -import com.azure.ai.agents.persistent.models.CreateAgentOptions; -import com.azure.ai.agents.persistent.models.PersistentAgent; -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; - -public class AgentsSample { - - private static PersistentAgentsClient agentsClient - = new PersistentAgentsClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()) - .buildClient(); - private static PersistentAgentsAdministrationClient administrationClient - = agentsClient.getPersistentAgentsAdministrationClient(); - - public static void main(String[] args) { - PersistentAgent createdAgent = createAgent(); - deleteAgent(createdAgent.getId()); - } - - public static PersistentAgent createAgent() { - // BEGIN:com.azure.ai.projects.AgentsSample.createAgent - - String agentName = "basic_example"; - CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") - .setName(agentName) - .setInstructions("You are a helpful agent"); - PersistentAgent agent = administrationClient.createAgent(createAgentOptions); - System.out.println("Agent created: " + agent.getId()); - return agent; - - // END:com.azure.ai.projects.AgentsSample.createAgent - } - - public static void deleteAgent(String agentId) { - // BEGIN:com.azure.ai.projects.AgentsSample.deleteAgent - - administrationClient.deleteAgent(agentId); - System.out.println("Agent deleted: " + agentId); - - // END:com.azure.ai.projects.AgentsSample.deleteAgent - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.agents.persistent.PersistentAgentsAdministrationClient; +//import com.azure.ai.agents.persistent.PersistentAgentsClient; +//import com.azure.ai.agents.persistent.PersistentAgentsClientBuilder; +//import com.azure.ai.agents.persistent.models.CreateAgentOptions; +//import com.azure.ai.agents.persistent.models.PersistentAgent; +//import com.azure.core.util.Configuration; +//import com.azure.identity.DefaultAzureCredentialBuilder; +// +//public class AgentsSample { +// +// private static PersistentAgentsClient agentsClient +// = new PersistentAgentsClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()) +// .buildClient(); +// private static PersistentAgentsAdministrationClient administrationClient +// = agentsClient.getPersistentAgentsAdministrationClient(); +// +// public static void main(String[] args) { +// PersistentAgent createdAgent = createAgent(); +// deleteAgent(createdAgent.getId()); +// } +// +// public static PersistentAgent createAgent() { +// // BEGIN:com.azure.ai.projects.AgentsSample.createAgent +// +// String agentName = "basic_example"; +// CreateAgentOptions createAgentOptions = new CreateAgentOptions("gpt-4o-mini") +// .setName(agentName) +// .setInstructions("You are a helpful agent"); +// PersistentAgent agent = administrationClient.createAgent(createAgentOptions); +// System.out.println("Agent created: " + agent.getId()); +// return agent; +// +// // END:com.azure.ai.projects.AgentsSample.createAgent +// } +// +// public static void deleteAgent(String agentId) { +// // BEGIN:com.azure.ai.projects.AgentsSample.deleteAgent +// +// administrationClient.deleteAgent(agentId); +// System.out.println("Agent deleted: " + agentId); +// +// // END:com.azure.ai.projects.AgentsSample.deleteAgent +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ConnectionsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ConnectionsSample.java index e3e13ed33a7e..d2842827bf7e 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ConnectionsSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/ConnectionsSample.java @@ -10,25 +10,26 @@ public class ConnectionsSample { private static ConnectionsClient connectionsClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("AZURE_AI_PROJECTS_ENDPOINT", "endpoint")) .credential(new DefaultAzureCredentialBuilder().build()) .buildConnectionsClient(); public static void main(String[] args) { - //listConnections(); - //getConnectionWithoutCredentials(); - //getConnectionWithCredentials(); +// listConnections(); +// getConnectionWithoutCredentials(); +// getConnectionWithCredentials(); } public static void listConnections() { // BEGIN:com.azure.ai.projects.ConnectionsSample.listConnections - PagedIterable connections = connectionsClient.listConnections(); for (Connection connection : connections) { - System.out.printf("Connection name: %s%n", connection.getName()); + System.out.println("Connection name: " + connection.getName()); + System.out.println("Connection type: " + connection.getType()); + System.out.println("Connection credential type: " + connection.getCredentials().getType()); + System.out.println("-------------------------------------------------"); } - // END:com.azure.ai.projects.ConnectionsSample.listConnections } @@ -36,7 +37,7 @@ public static void getConnectionWithoutCredentials() { // BEGIN:com.azure.ai.projects.ConnectionsSample.getConnectionWithoutCredentials String connectionName = Configuration.getGlobalConfiguration().get("TEST_CONNECTION_NAME", ""); - Connection connection = connectionsClient.getConnection(connectionName, false); + Connection connection = connectionsClient.getConnection(connectionName); System.out.printf("Connection name: %s%n", connection.getName()); @@ -47,7 +48,7 @@ public static void getConnectionWithCredentials() { // BEGIN:com.azure.ai.projects.ConnectionsSample.getConnectionWithCredentials String connectionName = Configuration.getGlobalConfiguration().get("TEST_CONNECTION_NAME", ""); - Connection connection = connectionsClient.getConnection(connectionName, true); + Connection connection = connectionsClient.getConnectionWithCredentials(connectionName); System.out.printf("Connection name: %s%n", connection.getName()); System.out.printf("Connection credentials: %s%n", connection.getCredentials().getType()); diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsAsyncSample.java index 9194b03b1812..e8dece1d5c38 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsAsyncSample.java @@ -54,7 +54,7 @@ public static Flux listDatasets() { // BEGIN:com.azure.ai.projects.DatasetsAsyncSample.listDatasets System.out.println("Listing all datasets (latest versions):"); - return datasetsAsyncClient.listLatestDatasetVersions() + return datasetsAsyncClient.listLatest() .doOnNext(dataset -> { System.out.println("\nDataset name: " + dataset.getName()); System.out.println("Dataset Id: " + dataset.getId()); @@ -74,7 +74,7 @@ public static Flux listDatasetVersions() { String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "test"); System.out.println("Listing all versions of dataset: " + datasetName); - return datasetsAsyncClient.listDatasetVersions(datasetName) + return datasetsAsyncClient.listVersions(datasetName) .doOnNext(version -> { System.out.println("\nDataset name: " + version.getName()); System.out.println("Dataset version: " + version.getVersion()); @@ -117,7 +117,7 @@ public static Mono deleteDataset() { String datasetVersion = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); // Delete the specific version of the dataset - return datasetsAsyncClient.deleteDatasetVersion(datasetName, datasetVersion) + return datasetsAsyncClient.deleteVersion(datasetName, datasetVersion) .doOnSuccess(unused -> System.out.println("Deleted dataset: " + datasetName + ", version: " + datasetVersion)); @@ -137,7 +137,7 @@ public static Mono createOrUpdateDataset() { .setDescription("Sample dataset created via SDK"); // Create or update the dataset - return datasetsAsyncClient.createOrUpdateDatasetVersion( + return datasetsAsyncClient.createOrUpdateVersion( datasetName, datasetVersion, fileDataset diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsSample.java index c8100783ce7e..11a55260d45d 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DatasetsSample.java @@ -53,7 +53,7 @@ public static void listDatasets() { // BEGIN:com.azure.ai.projects.DatasetsSample.listDatasets System.out.println("Listing all datasets (latest versions):"); - datasetsClient.listLatestDatasetVersions().forEach(dataset -> { + datasetsClient.listLatest().forEach(dataset -> { System.out.println("\nDataset name: " + dataset.getName()); System.out.println("Dataset Id: " + dataset.getId()); System.out.println("Dataset version: " + dataset.getVersion()); @@ -72,7 +72,7 @@ public static void listDatasetVersions() { String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "test"); System.out.println("Listing all versions of dataset: " + datasetName); - datasetsClient.listDatasetVersions(datasetName).forEach(version -> { + datasetsClient.listVersions(datasetName).forEach(version -> { System.out.println("\nDataset name: " + version.getName()); System.out.println("Dataset version: " + version.getVersion()); System.out.println("Dataset type: " + version.getType()); @@ -113,7 +113,7 @@ public static void deleteDataset() { String datasetVersion = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); // Delete the specific version of the dataset - datasetsClient.deleteDatasetVersion(datasetName, datasetVersion); + datasetsClient.deleteVersion(datasetName, datasetVersion); System.out.println("Deleted dataset: " + datasetName + ", version: " + datasetVersion); @@ -133,7 +133,7 @@ public static void createOrUpdateDataset() { .setDescription("Sample dataset created via SDK"); // Create or update the dataset - FileDatasetVersion createdDataset = (FileDatasetVersion) datasetsClient.createOrUpdateDatasetVersion( + FileDatasetVersion createdDataset = (FileDatasetVersion) datasetsClient.createOrUpdateVersion( datasetName, datasetVersion, fileDataset diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsAsyncSample.java index 9e5d5109a76e..9e42fda0123c 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsAsyncSample.java @@ -24,7 +24,7 @@ public static void main(String[] args) { public static Flux listDeployments() { // BEGIN:com.azure.ai.projects.DeploymentsAsyncSample.listDeployments - return deploymentsAsyncClient.listDeployments() + return deploymentsAsyncClient.list() .doOnNext(deployment -> System.out.printf("Deployment name: %s%n", deployment.getName())); // END:com.azure.ai.projects.DeploymentsAsyncSample.listDeployments @@ -34,7 +34,7 @@ public static Mono getDeployment() { // BEGIN:com.azure.ai.projects.DeploymentsAsyncSample.getDeployment String deploymentName = Configuration.getGlobalConfiguration().get("DEPLOYMENT_NAME", ""); - return deploymentsAsyncClient.getDeployment(deploymentName) + return deploymentsAsyncClient.get(deploymentName) .doOnNext(deployment -> { System.out.printf("Deployment name: %s%n", deployment.getName()); System.out.printf("Deployment type: %s%n", deployment.getType().getValue()); diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsSample.java index 0cbd38a1af94..921374791812 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/DeploymentsSample.java @@ -23,7 +23,7 @@ public static void main(String[] args) { public static void listDeployments() { // BEGIN:com.azure.ai.projects.DeploymentsSample.listDeployments - PagedIterable deployments = deploymentsClient.listDeployments(); + PagedIterable deployments = deploymentsClient.list(); for (Deployment deployment : deployments) { System.out.printf("Deployment name: %s%n", deployment.getName()); } @@ -35,7 +35,7 @@ public static void getDeployment() { // BEGIN:com.azure.ai.projects.DeploymentsSample.getDeployment String deploymentName = Configuration.getGlobalConfiguration().get("DEPLOYMENT_NAME", ""); - Deployment deployment = deploymentsClient.getDeployment(deploymentName); + Deployment deployment = deploymentsClient.get(deploymentName); System.out.printf("Deployment name: %s%n", deployment.getName()); System.out.printf("Deployment type: %s%n", deployment.getType().getValue()); diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsAsyncSample.java index e38cde8948b1..fe77c8f56868 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsAsyncSample.java @@ -1,143 +1,143 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.projects.models.Evaluation; -import com.azure.ai.projects.models.EvaluatorConfiguration; -import com.azure.ai.projects.models.EvaluatorId; -import com.azure.ai.projects.models.InputDataset; -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 reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import java.util.HashMap; -import java.util.Map; - -public class EvaluationsAsyncSample { - private static AIProjectClientBuilder clientBuilder - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()); - - private static EvaluationsAsyncClient evaluationsAsyncClient = clientBuilder.buildEvaluationsAsyncClient(); - private static DatasetsAsyncClient datasetsAsyncClient = clientBuilder.buildDatasetsAsyncClient(); - - public static void main(String[] args) { - //createEvaluation().block(); - //getEvaluation().block(); - listEvaluations().blockLast(); - } - - public static Flux listEvaluations() { - // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.listEvaluations - - System.out.println("Listing all evaluations:"); - return evaluationsAsyncClient.listEvaluations() - .doOnNext(evaluation -> { - System.out.println("Display Name: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - - if (evaluation.getDescription() != null) { - System.out.println("Description: " + evaluation.getDescription()); - } - - System.out.println("Evaluators:"); - evaluation.getEvaluators().forEach((name, evaluator) -> { - System.out.println(" - " + name + ": " + evaluator.getId()); - }); - }); - - // END:com.azure.ai.projects.EvaluationsAsyncSample.listEvaluations - } - - public static Mono getEvaluation() { - // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.getEvaluation - - String evaluationId = Configuration.getGlobalConfiguration().get("EVALUATION_ID", "my-evaluation-id"); - - return evaluationsAsyncClient.getEvaluation(evaluationId) - .doOnNext(evaluation -> { - System.out.println("Retrieved evaluation:"); - System.out.println("Display Name: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - System.out.println("Data Type: " + evaluation.getData().getType()); - - if (evaluation.getDescription() != null) { - System.out.println("Description: " + evaluation.getDescription()); - } - - if (evaluation.getTags() != null) { - System.out.println("Tags:"); - evaluation.getTags().forEach((key, value) -> { - System.out.println(" " + key + ": " + value); - }); - } - - System.out.println("Evaluators:"); - evaluation.getEvaluators().forEach((name, evaluator) -> { - System.out.println(" - " + name + ": " + evaluator.getId()); - - if (evaluator.getDataMapping() != null) { - System.out.println(" Data Mapping:"); - evaluator.getDataMapping().forEach((k, v) -> { - System.out.println(" " + k + " -> " + v); - }); - } - }); - }); - - // END:com.azure.ai.projects.EvaluationsAsyncSample.getEvaluation - } - - public static Mono createEvaluation() { - // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.createEvaluation - - // Create an evaluation definition - String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "my-dataset"); - String version = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); - String modelEndpoint = Configuration.getGlobalConfiguration().get("MODEL_ENDPOINT", "https://your-model-endpoint.com"); - String modelApiKey = Configuration.getGlobalConfiguration().get("MODEL_API_KEY", "your-model-api-key"); - String modelName = Configuration.getGlobalConfiguration().get("MODEL_NAME", "gpt-4o-mini"); - - - return datasetsAsyncClient.getDatasetVersion(datasetName, version) - .flatMap(datasetVersion -> { - InputDataset dataset = new InputDataset(datasetVersion.getId()); - Evaluation evaluation = new Evaluation( - dataset, - mapOf("relevance", - new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) - .setInitParams(mapOf("deployment_name", BinaryData.fromObject(modelName))))) - .setDisplayName("Sample Evaluation") - .setDescription("This is a sample evaluation created using the SDK"); - - // Create the evaluation - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setHeader("model-endpoint", modelEndpoint); - requestOptions.setHeader("api-key", modelApiKey); - - return evaluationsAsyncClient.createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions) - .map(response -> response.getValue().toObject(Evaluation.class)); - }) - .doOnNext(createdEvaluation -> { - System.out.println("Created evaluation:"); - System.out.println("Display Name: " + createdEvaluation.getDisplayName()); - System.out.println("Status: " + createdEvaluation.getStatus()); - }); - - // END:com.azure.ai.projects.EvaluationsAsyncSample.createEvaluation - } - - // 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; - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.projects.models.Evaluation; +//import com.azure.ai.projects.models.EvaluatorConfiguration; +//import com.azure.ai.projects.models.EvaluatorId; +//import com.azure.ai.projects.models.InputDataset; +//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 reactor.core.publisher.Flux; +//import reactor.core.publisher.Mono; +//import java.util.HashMap; +//import java.util.Map; +// +//public class EvaluationsAsyncSample { +// private static AIProjectClientBuilder clientBuilder +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()); +// +// private static EvaluationsAsyncClient evaluationsAsyncClient = clientBuilder.buildEvaluationsAsyncClient(); +// private static DatasetsAsyncClient datasetsAsyncClient = clientBuilder.buildDatasetsAsyncClient(); +// +// public static void main(String[] args) { +// //createEvaluation().block(); +// //getEvaluation().block(); +// listEvaluations().blockLast(); +// } +// +// public static Flux listEvaluations() { +// // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.listEvaluations +// +// System.out.println("Listing all evaluations:"); +// return evaluationsAsyncClient.getOpenAIClient().list() +// .doOnNext(evaluation -> { +// System.out.println("Display Name: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// +// if (evaluation.getDescription() != null) { +// System.out.println("Description: " + evaluation.getDescription()); +// } +// +// System.out.println("Evaluators:"); +// evaluation.getEvaluators().forEach((name, evaluator) -> { +// System.out.println(" - " + name + ": " + evaluator.getId()); +// }); +// }); +// +// // END:com.azure.ai.projects.EvaluationsAsyncSample.listEvaluations +// } +// +// public static Mono getEvaluation() { +// // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.getEvaluation +// +// String evaluationId = Configuration.getGlobalConfiguration().get("EVALUATION_ID", "my-evaluation-id"); +// +// return evaluationsAsyncClient.getEvaluation(evaluationId) +// .doOnNext(evaluation -> { +// System.out.println("Retrieved evaluation:"); +// System.out.println("Display Name: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// System.out.println("Data Type: " + evaluation.getData().getType()); +// +// if (evaluation.getDescription() != null) { +// System.out.println("Description: " + evaluation.getDescription()); +// } +// +// if (evaluation.getTags() != null) { +// System.out.println("Tags:"); +// evaluation.getTags().forEach((key, value) -> { +// System.out.println(" " + key + ": " + value); +// }); +// } +// +// System.out.println("Evaluators:"); +// evaluation.getEvaluators().forEach((name, evaluator) -> { +// System.out.println(" - " + name + ": " + evaluator.getId()); +// +// if (evaluator.getDataMapping() != null) { +// System.out.println(" Data Mapping:"); +// evaluator.getDataMapping().forEach((k, v) -> { +// System.out.println(" " + k + " -> " + v); +// }); +// } +// }); +// }); +// +// // END:com.azure.ai.projects.EvaluationsAsyncSample.getEvaluation +// } +// +// public static Mono createEvaluation() { +// // BEGIN:com.azure.ai.projects.EvaluationsAsyncSample.createEvaluation +// +// // Create an evaluation definition +// String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "my-dataset"); +// String version = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); +// String modelEndpoint = Configuration.getGlobalConfiguration().get("MODEL_ENDPOINT", "https://your-model-endpoint.com"); +// String modelApiKey = Configuration.getGlobalConfiguration().get("MODEL_API_KEY", "your-model-api-key"); +// String modelName = Configuration.getGlobalConfiguration().get("MODEL_NAME", "gpt-4o-mini"); +// +// +// return datasetsAsyncClient.getDatasetVersion(datasetName, version) +// .flatMap(datasetVersion -> { +// InputDataset dataset = new InputDataset(datasetVersion.getId()); +// Evaluation evaluation = new Evaluation( +// dataset, +// mapOf("relevance", +// new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) +// .setInitParams(mapOf("deployment_name", BinaryData.fromObject(modelName))))) +// .setDisplayName("Sample Evaluation") +// .setDescription("This is a sample evaluation created using the SDK"); +// +// // Create the evaluation +// RequestOptions requestOptions = new RequestOptions(); +// requestOptions.setHeader("model-endpoint", modelEndpoint); +// requestOptions.setHeader("api-key", modelApiKey); +// +// return evaluationsAsyncClient.createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions) +// .map(response -> response.getValue().toObject(Evaluation.class)); +// }) +// .doOnNext(createdEvaluation -> { +// System.out.println("Created evaluation:"); +// System.out.println("Display Name: " + createdEvaluation.getDisplayName()); +// System.out.println("Status: " + createdEvaluation.getStatus()); +// }); +// +// // END:com.azure.ai.projects.EvaluationsAsyncSample.createEvaluation +// } +// +// // 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/EvaluationsSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsSample.java index d4f908ea901f..bc8a2b052f0b 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/EvaluationsSample.java @@ -1,139 +1,139 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.projects.models.DatasetVersion; -import com.azure.ai.projects.models.Evaluation; -import com.azure.ai.projects.models.EvaluatorConfiguration; -import com.azure.ai.projects.models.EvaluatorId; -import com.azure.ai.projects.models.InputDataset; -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 java.util.HashMap; -import java.util.Map; - -public class EvaluationsSample { - private static AIProjectClientBuilder clientBuilder - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()); - - private static EvaluationsClient evaluationsClient = clientBuilder.buildEvaluationsClient(); - private static DatasetsClient datasetsClient = clientBuilder.buildDatasetsClient(); - - - public static void main(String[] args) { - - createEvaluation(); - - //getEvaluation(); - //listEvaluations(); - } - - public static void listEvaluations() { - // BEGIN:com.azure.ai.projects.EvaluationsSample.listEvaluations - - System.out.println("Listing all evaluations:"); - evaluationsClient.listEvaluations().forEach(evaluation -> { - System.out.println("Display Name: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - System.out.println("Data Type: " + evaluation.getData().getType()); - - if (evaluation.getDescription() != null) { - System.out.println("Description: " + evaluation.getDescription()); - } - - System.out.println("Evaluators:"); - evaluation.getEvaluators().forEach((name, evaluator) -> { - System.out.println(" - " + name + ": " + evaluator.getId()); - }); - }); - - // END:com.azure.ai.projects.EvaluationsSample.listEvaluations - } - - public static void getEvaluation() { - // BEGIN:com.azure.ai.projects.EvaluationsSample.getEvaluation - - String evaluationId = Configuration.getGlobalConfiguration().get("EVALUATION_ID", "my-evaluation-id"); - - Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); - - System.out.println("Retrieved evaluation:"); - System.out.println("Display Name: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - System.out.println("Data Type: " + evaluation.getData().getType()); - - if (evaluation.getDescription() != null) { - System.out.println("Description: " + evaluation.getDescription()); - } - - if (evaluation.getTags() != null) { - System.out.println("Tags:"); - evaluation.getTags().forEach((key, value) -> { - System.out.println(" " + key + ": " + value); - }); - } - - System.out.println("Evaluators:"); - evaluation.getEvaluators().forEach((name, evaluator) -> { - System.out.println(" - " + name + ": " + evaluator.getId()); - - if (evaluator.getDataMapping() != null) { - System.out.println(" Data Mapping:"); - evaluator.getDataMapping().forEach((k, v) -> { - System.out.println(" " + k + " -> " + v); - }); - } - }); - - // END:com.azure.ai.projects.EvaluationsSample.getEvaluation - } - - public static void createEvaluation() { - // BEGIN:com.azure.ai.projects.EvaluationsSample.createEvaluation - - // Create an evaluation definition - String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "my-dataset"); - String version = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); - String modelEndpoint = Configuration.getGlobalConfiguration().get("MODEL_ENDPOINT", "https://your-model-endpoint.com"); - String modelApiKey = Configuration.getGlobalConfiguration().get("MODEL_API_KEY", "your-model-api-key"); - String modelName = Configuration.getGlobalConfiguration().get("MODEL_NAME", "gpt-4o-mini"); - DatasetVersion datasetVersion = datasetsClient.getDatasetVersion(datasetName, version); - - InputDataset dataset = new InputDataset(datasetVersion.getId()); - Evaluation evaluation = new Evaluation( - dataset, - mapOf("relevance", - new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) - .setInitParams(mapOf("deployment_name", BinaryData.fromObject(modelName))))) - .setDisplayName("Sample Evaluation") - .setDescription("This is a sample evaluation created using the SDK"); - - // Create the evaluation - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setHeader("model-endpoint", modelEndpoint); - requestOptions.setHeader("api-key", modelApiKey); - Evaluation createdEvaluation = evaluationsClient.createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions).getValue() - .toObject(Evaluation.class); - - System.out.println("Created evaluation:"); - System.out.println("Display Name: " + createdEvaluation.getDisplayName()); - System.out.println("Status: " + createdEvaluation.getStatus()); - - // END:com.azure.ai.projects.EvaluationsSample.createEvaluation - } - - // 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; - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.projects.models.DatasetVersion; +//import com.azure.ai.projects.models.Evaluation; +//import com.azure.ai.projects.models.EvaluatorConfiguration; +//import com.azure.ai.projects.models.EvaluatorId; +//import com.azure.ai.projects.models.InputDataset; +//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 java.util.HashMap; +//import java.util.Map; +// +//public class EvaluationsSample { +// private static AIProjectClientBuilder clientBuilder +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()); +// +// private static EvaluationsClient evaluationsClient = clientBuilder.buildEvaluationsClient(); +// private static DatasetsClient datasetsClient = clientBuilder.buildDatasetsClient(); +// +// +// public static void main(String[] args) { +// +// createEvaluation(); +// +// //getEvaluation(); +// //listEvaluations(); +// } +// +// public static void listEvaluations() { +// // BEGIN:com.azure.ai.projects.EvaluationsSample.listEvaluations +// +// System.out.println("Listing all evaluations:"); +// evaluationsClient.listEvaluations().forEach(evaluation -> { +// System.out.println("Display Name: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// System.out.println("Data Type: " + evaluation.getData().getType()); +// +// if (evaluation.getDescription() != null) { +// System.out.println("Description: " + evaluation.getDescription()); +// } +// +// System.out.println("Evaluators:"); +// evaluation.getEvaluators().forEach((name, evaluator) -> { +// System.out.println(" - " + name + ": " + evaluator.getId()); +// }); +// }); +// +// // END:com.azure.ai.projects.EvaluationsSample.listEvaluations +// } +// +// public static void getEvaluation() { +// // BEGIN:com.azure.ai.projects.EvaluationsSample.getEvaluation +// +// String evaluationId = Configuration.getGlobalConfiguration().get("EVALUATION_ID", "my-evaluation-id"); +// +// Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); +// +// System.out.println("Retrieved evaluation:"); +// System.out.println("Display Name: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// System.out.println("Data Type: " + evaluation.getData().getType()); +// +// if (evaluation.getDescription() != null) { +// System.out.println("Description: " + evaluation.getDescription()); +// } +// +// if (evaluation.getTags() != null) { +// System.out.println("Tags:"); +// evaluation.getTags().forEach((key, value) -> { +// System.out.println(" " + key + ": " + value); +// }); +// } +// +// System.out.println("Evaluators:"); +// evaluation.getEvaluators().forEach((name, evaluator) -> { +// System.out.println(" - " + name + ": " + evaluator.getId()); +// +// if (evaluator.getDataMapping() != null) { +// System.out.println(" Data Mapping:"); +// evaluator.getDataMapping().forEach((k, v) -> { +// System.out.println(" " + k + " -> " + v); +// }); +// } +// }); +// +// // END:com.azure.ai.projects.EvaluationsSample.getEvaluation +// } +// +// public static void createEvaluation() { +// // BEGIN:com.azure.ai.projects.EvaluationsSample.createEvaluation +// +// // Create an evaluation definition +// String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "my-dataset"); +// String version = Configuration.getGlobalConfiguration().get("DATASET_VERSION", "1.0"); +// String modelEndpoint = Configuration.getGlobalConfiguration().get("MODEL_ENDPOINT", "https://your-model-endpoint.com"); +// String modelApiKey = Configuration.getGlobalConfiguration().get("MODEL_API_KEY", "your-model-api-key"); +// String modelName = Configuration.getGlobalConfiguration().get("MODEL_NAME", "gpt-4o-mini"); +// DatasetVersion datasetVersion = datasetsClient.getDatasetVersion(datasetName, version); +// +// InputDataset dataset = new InputDataset(datasetVersion.getId()); +// Evaluation evaluation = new Evaluation( +// dataset, +// mapOf("relevance", +// new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) +// .setInitParams(mapOf("deployment_name", BinaryData.fromObject(modelName))))) +// .setDisplayName("Sample Evaluation") +// .setDescription("This is a sample evaluation created using the SDK"); +// +// // Create the evaluation +// RequestOptions requestOptions = new RequestOptions(); +// requestOptions.setHeader("model-endpoint", modelEndpoint); +// requestOptions.setHeader("api-key", modelApiKey); +// Evaluation createdEvaluation = evaluationsClient.createEvaluationWithResponse(BinaryData.fromObject(evaluation), requestOptions).getValue() +// .toObject(Evaluation.class); +// +// System.out.println("Created evaluation:"); +// System.out.println("Display Name: " + createdEvaluation.getDisplayName()); +// System.out.println("Status: " + createdEvaluation.getStatus()); +// +// // END:com.azure.ai.projects.EvaluationsSample.createEvaluation +// } +// +// // 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/IndexesAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesAsyncSample.java index bc52c1fd8d35..c492de5f5bc2 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesAsyncSample.java @@ -33,7 +33,7 @@ public static Mono createOrUpdateIndex() { String aiSearchConnectionName = Configuration.getGlobalConfiguration().get("AI_SEARCH_CONNECTION_NAME", ""); String aiSearchIndexName = Configuration.getGlobalConfiguration().get("AI_SEARCH_INDEX_NAME", ""); - return indexesAsyncClient.createOrUpdateIndexVersion( + return indexesAsyncClient.createOrUpdate( indexName, indexVersion, new AzureAISearchIndex() @@ -47,7 +47,7 @@ public static Mono createOrUpdateIndex() { public static Flux listIndexes() { // BEGIN:com.azure.ai.projects.IndexesAsyncSample.listIndexes - return indexesAsyncClient.listLatestIndexVersions() + return indexesAsyncClient.listLatest() .doOnNext(index -> { System.out.println("Index name: " + index.getName()); System.out.println("Index version: " + index.getVersion()); @@ -61,7 +61,7 @@ public static Flux listIndexVersions() { String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); - return indexesAsyncClient.listIndexVersions(indexName) + return indexesAsyncClient.listVersions(indexName) .doOnNext(index -> { System.out.println("Index name: " + index.getName()); System.out.println("Index version: " + index.getVersion()); @@ -77,7 +77,7 @@ public static Mono getIndex() { String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "1.0"); - return indexesAsyncClient.getIndexVersion(indexName, indexVersion) + return indexesAsyncClient.getVersion(indexName, indexVersion) .doOnNext(index -> { System.out.println("Retrieved index:"); System.out.println("Name: " + index.getName()); @@ -95,7 +95,7 @@ public static Mono deleteIndex() { String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "1.0"); // Delete the index version - return indexesAsyncClient.deleteIndexVersion(indexName, indexVersion) + return indexesAsyncClient.deleteVersion(indexName, indexVersion) .doOnSuccess(unused -> System.out.println("Deleted index: " + indexName + ", version: " + indexVersion)); diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesSample.java index cd9cb4d02b4e..a283c20bd8b0 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/IndexesSample.java @@ -10,28 +10,27 @@ public class IndexesSample { private static IndexesClient indexesClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("AZURE_AI_PROJECTS_ENDPOINT", "endpoint")) .credential(new DefaultAzureCredentialBuilder().build()) .buildIndexesClient(); public static void main(String[] args) { // Uncomment the sample you want to run - //createOrUpdateIndex(); - //listIndexVersions(); - //getIndex(); - //deleteIndex(); - //listIndexes(); +// createOrUpdateIndex(); +// listIndexVersions(); +// getIndex(); +// deleteIndex(); +// listIndexes(); } public static void createOrUpdateIndex() { // BEGIN:com.azure.ai.projects.IndexesGetSample.createOrUpdateIndex - String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "2.0"); String aiSearchConnectionName = Configuration.getGlobalConfiguration().get("AI_SEARCH_CONNECTION_NAME", ""); String aiSearchIndexName = Configuration.getGlobalConfiguration().get("AI_SEARCH_INDEX_NAME", ""); - Index index = indexesClient.createOrUpdateIndexVersion( + Index index = indexesClient.createOrUpdate( indexName, indexVersion, new AzureAISearchIndex() @@ -40,18 +39,17 @@ public static void createOrUpdateIndex() { ); System.out.println("Index created: " + index.getName()); - // END:com.azure.ai.projects.IndexesGetSample.createOrUpdateIndex } public static void listIndexes() { // BEGIN:com.azure.ai.projects.IndexesListSample.listIndexes - - indexesClient.listLatestIndexVersions().forEach(index -> { + indexesClient.listLatest().forEach(index -> { System.out.println("Index name: " + index.getName()); System.out.println("Index version: " + index.getVersion()); + System.out.println("Index description: " + index.getDescription()); + System.out.println("-------------------------------------------------"); }); - // END:com.azure.ai.projects.IndexesListSample.listIndexes } @@ -60,7 +58,7 @@ public static void listIndexVersions() { String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); - indexesClient.listIndexVersions(indexName).forEach(index -> { + indexesClient.listVersions(indexName).forEach(index -> { System.out.println("Index name: " + index.getName()); System.out.println("Index version: " + index.getVersion()); System.out.println("Index type: " + index.getType()); @@ -75,7 +73,7 @@ public static void getIndex() { String indexName = Configuration.getGlobalConfiguration().get("INDEX_NAME", "my-index"); String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "1.0"); - Index index = indexesClient.getIndexVersion(indexName, indexVersion); + Index index = indexesClient.getVersion(indexName, indexVersion); System.out.println("Retrieved index:"); System.out.println("Name: " + index.getName()); @@ -92,7 +90,7 @@ public static void deleteIndex() { String indexVersion = Configuration.getGlobalConfiguration().get("INDEX_VERSION", "1.0"); // Delete the index version - indexesClient.deleteIndexVersion(indexName, indexVersion); + indexesClient.deleteVersion(indexName, indexVersion); System.out.println("Deleted index: " + indexName + ", version: " + indexVersion); diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/InferenceOpenAISample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/InferenceOpenAISample.java index 99383aea0bc3..cdfe061e0090 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/InferenceOpenAISample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/InferenceOpenAISample.java @@ -1,37 +1,37 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.openai.models.chat.completions.ChatCompletion; -import com.openai.models.chat.completions.ChatCompletionCreateParams; - -public class InferenceOpenAISample { - - private static InferenceClient inferenceClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()) - .openAIConnectionName(Configuration.getGlobalConfiguration().get("OPENAI_CONNECTION_NAME", "")) - .buildInferenceClient(); - - public static void main(String[] args) { - openAIConnectedSample(); - } - - public static void openAIConnectedSample() { - // BEGIN: com.azure.ai.projects.InferenceOpenAISample.openAIConnectedSample - - ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() - .addUserMessage("Say this is a test") - .model("gpt-4o-mini") - .build(); - ChatCompletion chatCompletion = inferenceClient.getOpenAIClient().chat().completions().create(params); - for (ChatCompletion.Choice choice : chatCompletion.choices()) { - System.out.println("Choice index: " + choice.index()); - System.out.println("Message content: " + choice.message().content().get()); - } - - // END: com.azure.ai.projects.InferenceOpenAISample.openAIConnectedSample - } -} +//package com.azure.ai.projects; +// +//import com.azure.core.util.Configuration; +//import com.azure.identity.DefaultAzureCredentialBuilder; +//import com.openai.models.chat.completions.ChatCompletion; +//import com.openai.models.chat.completions.ChatCompletionCreateParams; +// +//public class InferenceOpenAISample { +// +// private static InferenceClient inferenceClient +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()) +// .openAIConnectionName(Configuration.getGlobalConfiguration().get("OPENAI_CONNECTION_NAME", "")) +// .buildInferenceClient(); +// +// public static void main(String[] args) { +// openAIConnectedSample(); +// } +// +// public static void openAIConnectedSample() { +// // BEGIN: com.azure.ai.projects.InferenceOpenAISample.openAIConnectedSample +// +// ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() +// .addUserMessage("Say this is a test") +// .model("gpt-4o-mini") +// .build(); +// ChatCompletion chatCompletion = inferenceClient.getOpenAIClient().chat().completions().create(params); +// for (ChatCompletion.Choice choice : chatCompletion.choices()) { +// System.out.println("Choice index: " + choice.index()); +// System.out.println("Message content: " + choice.message().content().get()); +// } +// +// // END: com.azure.ai.projects.InferenceOpenAISample.openAIConnectedSample +// } +//} 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 index 52d1b33e83df..5506e884b24f 100644 --- 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 @@ -4,9 +4,32 @@ package com.azure.ai.projects; +import com.openai.services.blocking.EvalService; + public final class ReadmeSamples { public void readmeSamples() { // BEGIN: com.azure.ai.projects.readme // END: com.azure.ai.projects.readme + + // BEGIN: com.azure.ai.projects.clientInitialization + AIProjectClientBuilder builder = new AIProjectClientBuilder(); + + ConnectionsClient connectionsClient = builder.buildConnectionsClient(); + DatasetsClient datasetsClient = builder.buildDatasetsClient(); + DeploymentsClient deploymentsClient = builder.buildDeploymentsClient(); + EvaluationRulesClient evaluationRulesClient = builder.buildEvaluationRulesClient(); + EvaluationsClient evaluationsClient = builder.buildEvaluationsClient(); + EvaluationTaxonomiesClient evaluationTaxonomiesClient = builder.buildEvaluationTaxonomiesClient(); + EvaluatorsClient evaluatorsClient = builder.buildEvaluatorsClient(); + IndexesClient indexesClient = builder.buildIndexesClient(); + InsightsClient insightsClient = builder.buildInsightsClient(); + RedTeamsClient redTeamsClient = builder.buildRedTeamsClient(); + SchedulesClient schedulesClient = builder.buildSchedulesClient(); + // END: com.azure.ai.projects.clientInitialization + + // BEGIN: com.azure.ai.projects.evaluationsClientInit + EvalService evalService = evaluationsClient.getOpenAIClient(); + // END: com.azure.ai.projects.evaluationsClientInit + } } diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetryAsyncSample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetryAsyncSample.java index a4fc9a02e57b..c1fd87ff5dca 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetryAsyncSample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetryAsyncSample.java @@ -1,35 +1,35 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; -import reactor.core.publisher.Mono; -import java.time.Duration; - -public class TelemetryAsyncSample { - - private static TelemetryAsyncClient telemetryAsyncClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()) - .buildTelemetryAsyncClient(); - - public static void main(String[] args) { - - getConnectionString() - .block(Duration.ofMinutes(1)); - } - - public static Mono getConnectionString() { - // BEGIN:com.azure.ai.projects.TelemetryAsyncSample.getConnectionString - - return telemetryAsyncClient.getConnectionString() - .doOnNext(connectionString -> - System.out.println("Connection string (async): " + connectionString)) - .doOnError(error -> - System.err.println("Error retrieving connection string: " + error.getMessage())) - .then(); - - // END:com.azure.ai.projects.TelemetryAsyncSample.getConnectionString - } -} +//package com.azure.ai.projects; +// +//import com.azure.core.util.Configuration; +//import com.azure.identity.DefaultAzureCredentialBuilder; +//import reactor.core.publisher.Mono; +//import java.time.Duration; +// +//public class TelemetryAsyncSample { +// +// private static TelemetryAsyncClient telemetryAsyncClient +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()) +// .buildTelemetryAsyncClient(); +// +// public static void main(String[] args) { +// +// getConnectionString() +// .block(Duration.ofMinutes(1)); +// } +// +// public static Mono getConnectionString() { +// // BEGIN:com.azure.ai.projects.TelemetryAsyncSample.getConnectionString +// +// return telemetryAsyncClient.getConnectionString() +// .doOnNext(connectionString -> +// System.out.println("Connection string (async): " + connectionString)) +// .doOnError(error -> +// System.err.println("Error retrieving connection string: " + error.getMessage())) +// .then(); +// +// // END:com.azure.ai.projects.TelemetryAsyncSample.getConnectionString +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetrySample.java b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetrySample.java index cae00926f3da..824bc30168c0 100644 --- a/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetrySample.java +++ b/sdk/ai/azure-ai-projects/src/samples/java/com/azure/ai/projects/TelemetrySample.java @@ -1,27 +1,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; - -public class TelemetrySample { - - private static TelemetryClient telemetryClient - = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .credential(new DefaultAzureCredentialBuilder().build()) - .buildTelemetryClient(); - - public static void main(String[] args) { - getConnectionString(); - } - - public static void getConnectionString() { - // BEGIN:com.azure.ai.projects.TelemetrySample.getConnectionString - - String connectionString = telemetryClient.getConnectionString(); - System.out.println("Connection string: " + connectionString); - - // END:com.azure.ai.projects.TelemetrySample.getConnectionString - } -} +//package com.azure.ai.projects; +// +//import com.azure.core.util.Configuration; +//import com.azure.identity.DefaultAzureCredentialBuilder; +// +//public class TelemetrySample { +// +// private static TelemetryClient telemetryClient +// = new AIProjectClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) +// .credential(new DefaultAzureCredentialBuilder().build()) +// .buildTelemetryClient(); +// +// public static void main(String[] args) { +// getConnectionString(); +// } +// +// public static void getConnectionString() { +// // BEGIN:com.azure.ai.projects.TelemetrySample.getConnectionString +// +// String connectionString = telemetryClient.getConnectionString(); +// System.out.println("Connection string: " + connectionString); +// +// // END:com.azure.ai.projects.TelemetrySample.getConnectionString +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ClientTestBase.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ClientTestBase.java index f01fcb97af5b..a52d0eda05ca 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ClientTestBase.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ClientTestBase.java @@ -49,8 +49,9 @@ protected AIProjectClientBuilder getClientBuilder(HttpClient httpClient) { } String version = Configuration.getGlobalConfiguration().get("SERVICE_VERSION"); - ProjectsServiceVersion serviceVersion - = version != null ? ProjectsServiceVersion.valueOf(version) : ProjectsServiceVersion.V2025_05_15_PREVIEW; + AIProjectsServiceVersion serviceVersion = version != null + ? AIProjectsServiceVersion.valueOf(version) + : AIProjectsServiceVersion.V2025_05_15_PREVIEW; builder.serviceVersion(serviceVersion); return builder; } diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsAsyncClientTest.java index 036f354cb82e..cbb2af539ac8 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsAsyncClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/ConnectionsAsyncClientTest.java @@ -8,6 +8,7 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; @@ -18,6 +19,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class ConnectionsAsyncClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -113,7 +115,7 @@ public void testGetConnectionWithoutCredentialsAsync(HttpClient httpClient) { String connectionName = Configuration.getGlobalConfiguration().get("TEST_CONNECTION_NAME", "agentaisearch2aqa"); - Mono connectionMono = connectionsAsyncClient.getConnection(connectionName, false); + Mono connectionMono = connectionsAsyncClient.getConnection(connectionName); try { // Test retrieving a connection 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 index 42f744391973..d037b1408a14 100644 --- 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 @@ -7,11 +7,13 @@ import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class ConnectionsClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -107,7 +109,7 @@ public void testGetConnectionWithoutCredentials(HttpClient httpClient) { String connectionName = Configuration.getGlobalConfiguration().get("TEST_CONNECTION_NAME", "agentaisearch2aqa"); try { - Connection connection = connectionsClient.getConnection(connectionName, false); + Connection connection = connectionsClient.getConnection(connectionName); // Verify the connection properties assertValidConnection(connection, connectionName, null, null); diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsAsyncClientTest.java index 4db94863bce4..1640c373357a 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsAsyncClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsAsyncClientTest.java @@ -23,6 +23,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class DatasetsAsyncClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -35,7 +36,7 @@ private void setup(HttpClient httpClient) { /** * Helper method to validate common properties of a DatasetVersion - * + * * @param datasetVersion The dataset version to validate * @param expectedName The expected name of the dataset * @param expectedVersion The expected version string @@ -50,7 +51,7 @@ private void assertDatasetVersion(DatasetVersion datasetVersion, String expected /** * Helper method to validate common properties of a FileDatasetVersion - * + * * @param fileDatasetVersion The file dataset version to validate * @param expectedName The expected name of the dataset * @param expectedVersion The expected version string @@ -122,8 +123,7 @@ public void testListDatasets(HttpClient httpClient) { // Collect datasets into a list List datasetsList = new ArrayList<>(); - StepVerifier.create(datasetsAsyncClient.listLatestDatasetVersions().doOnNext(datasetsList::add).then()) - .verifyComplete(); + StepVerifier.create(datasetsAsyncClient.listLatest().doOnNext(datasetsList::add).then()).verifyComplete(); // Verify we found at least one dataset Assertions.assertFalse(datasetsList.isEmpty(), "Expected at least one dataset"); @@ -145,7 +145,7 @@ public void testListDatasetVersions(HttpClient httpClient) { // Collect dataset versions into a list List versionsList = new ArrayList<>(); - StepVerifier.create(datasetsAsyncClient.listDatasetVersions(datasetName).doOnNext(versionsList::add).then()) + StepVerifier.create(datasetsAsyncClient.listVersions(datasetName).doOnNext(versionsList::add).then()) .verifyComplete(); // Verify we found at least one version @@ -186,7 +186,7 @@ public void testCreateOrUpdateDataset(HttpClient httpClient) { FileDatasetVersion fileDataset = new FileDatasetVersion().setDataUri(dataUri).setDescription("Test dataset created via SDK tests"); - StepVerifier.create(datasetsAsyncClient.createOrUpdateDatasetVersion(datasetName, datasetVersion, fileDataset)) + StepVerifier.create(datasetsAsyncClient.createOrUpdateVersion(datasetName, datasetVersion, fileDataset)) .assertNext(createdDataset -> { FileDatasetVersion fileDatasetVersion = (FileDatasetVersion) createdDataset; assertFileDatasetVersion(fileDatasetVersion, datasetName, datasetVersion, dataUri); @@ -236,7 +236,7 @@ public void testDeleteDataset(HttpClient httpClient) throws FileNotFoundExceptio datasetsAsyncClient.createDatasetWithFile(datasetName, datasetVersion, filePath).block(); // We need to ensure the dataset is created before continuing // Delete the dataset - StepVerifier.create(datasetsAsyncClient.deleteDatasetVersion(datasetName, datasetVersion)).verifyComplete(); + StepVerifier.create(datasetsAsyncClient.deleteVersion(datasetName, datasetVersion)).verifyComplete(); // Verify deletion - this should cause an error StepVerifier.create(datasetsAsyncClient.getDatasetVersion(datasetName, datasetVersion)) diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsClientTest.java index bee2fe52123e..28fa7a406c2e 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DatasetsClientTest.java @@ -22,6 +22,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class DatasetsClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -118,7 +119,7 @@ public void testListDatasets(HttpClient httpClient) { setup(httpClient); // Verify that listing datasets returns results - Iterable datasets = datasetsClient.listLatestDatasetVersions(); + Iterable datasets = datasetsClient.listLatest(); Assertions.assertNotNull(datasets); // Verify that at least one dataset can be retrieved @@ -137,7 +138,7 @@ public void testListDatasetVersions(HttpClient httpClient) { String datasetName = Configuration.getGlobalConfiguration().get("DATASET_NAME", "my-dataset"); // Verify that listing dataset versions returns results - Iterable versions = datasetsClient.listDatasetVersions(datasetName); + Iterable versions = datasetsClient.listVersions(datasetName); Assertions.assertNotNull(versions); // Verify that at least one dataset version can be retrieved @@ -179,8 +180,8 @@ public void testCreateOrUpdateDataset(HttpClient httpClient) { = new FileDatasetVersion().setDataUri(dataUri).setDescription("Test dataset created via SDK tests"); // Create or update the dataset - FileDatasetVersion createdDataset = (FileDatasetVersion) datasetsClient - .createOrUpdateDatasetVersion(datasetName, datasetVersion, fileDataset); + FileDatasetVersion createdDataset + = (FileDatasetVersion) datasetsClient.createOrUpdateVersion(datasetName, datasetVersion, fileDataset); // Verify the created dataset assertFileDatasetVersion(createdDataset, datasetName, datasetVersion, dataUri); @@ -229,7 +230,7 @@ public void testDeleteDataset(HttpClient httpClient) throws FileNotFoundExceptio Assertions.assertNotNull(createdDataset); // Delete the dataset - datasetsClient.deleteDatasetVersion(datasetName, datasetVersion); + datasetsClient.deleteVersion(datasetName, datasetVersion); // Verify deletion - this should throw ResourceNotFoundException try { diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsAsyncClientTest.java index db99a07be3eb..112406fd725a 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsAsyncClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsAsyncClientTest.java @@ -8,6 +8,7 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -17,6 +18,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class DeploymentsAsyncClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -53,7 +55,7 @@ public void testListDeployments(HttpClient httpClient) { setup(httpClient); // Verify that listing deployments returns results - PagedFlux deploymentsFlux = deploymentsAsyncClient.listDeployments(); + PagedFlux deploymentsFlux = deploymentsAsyncClient.list(); Assertions.assertNotNull(deploymentsFlux); // Collect all deployments and verify @@ -76,8 +78,7 @@ public void testListDeploymentsWithFilters(HttpClient httpClient) { // Test listing deployments with model publisher filter String testPublisher = "openai"; - PagedFlux publisherFilteredDeployments - = deploymentsAsyncClient.listDeployments(testPublisher, null, null); + PagedFlux publisherFilteredDeployments = deploymentsAsyncClient.list(testPublisher, null, null); Assertions.assertNotNull(publisherFilteredDeployments); // Verify filtered deployments @@ -89,8 +90,7 @@ public void testListDeploymentsWithFilters(HttpClient httpClient) { // Test listing deployments with model name filter String testModelName = "gpt-4o-mini"; - PagedFlux modelNameFilteredDeployments - = deploymentsAsyncClient.listDeployments(null, testModelName, null); + PagedFlux modelNameFilteredDeployments = deploymentsAsyncClient.list(null, testModelName, null); Assertions.assertNotNull(modelNameFilteredDeployments); // Verify filtered deployments @@ -102,7 +102,7 @@ public void testListDeploymentsWithFilters(HttpClient httpClient) { // Test listing deployments with deployment type filter PagedFlux typeFilteredDeployments - = deploymentsAsyncClient.listDeployments(null, null, DeploymentType.MODEL_DEPLOYMENT); + = deploymentsAsyncClient.list(null, null, DeploymentType.MODEL_DEPLOYMENT); Assertions.assertNotNull(typeFilteredDeployments); // Verify filtered deployments @@ -120,7 +120,7 @@ public void testGetDeployment(HttpClient httpClient) { String deploymentName = Configuration.getGlobalConfiguration().get("TEST_DEPLOYMENT_NAME", "gpt-4o-mini"); - StepVerifier.create(deploymentsAsyncClient.getDeployment(deploymentName)).assertNext(deployment -> { + StepVerifier.create(deploymentsAsyncClient.get(deploymentName)).assertNext(deployment -> { assertValidDeployment(deployment, deploymentName, null); System.out.println("Deployment retrieved successfully: " + deployment.getName()); }).verifyComplete(); @@ -133,7 +133,7 @@ public void testGetDeploymentAndVerifyType(HttpClient httpClient) { String deploymentName = Configuration.getGlobalConfiguration().get("TEST_DEPLOYMENT_NAME", "gpt-4o-mini"); - StepVerifier.create(deploymentsAsyncClient.getDeployment(deploymentName)).assertNext(deployment -> { + StepVerifier.create(deploymentsAsyncClient.get(deploymentName)).assertNext(deployment -> { assertValidDeployment(deployment, deploymentName, DeploymentType.MODEL_DEPLOYMENT); System.out.println("Deployment type successfully verified for: " + deployment.getName()); }).verifyComplete(); @@ -146,11 +146,9 @@ public void testGetDeploymentNotFound(HttpClient httpClient) { String nonExistentDeploymentName = "non-existent-deployment-name"; - StepVerifier.create(deploymentsAsyncClient.getDeployment(nonExistentDeploymentName)) - .expectErrorMatches(error -> { - System.out.println("Expected error received: " + error.getMessage()); - return error.getMessage().contains("404") || error.getMessage().contains("Not Found"); - }) - .verify(); + StepVerifier.create(deploymentsAsyncClient.get(nonExistentDeploymentName)).expectErrorMatches(error -> { + System.out.println("Expected error received: " + error.getMessage()); + return error.getMessage().contains("404") || error.getMessage().contains("Not Found"); + }).verify(); } } diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsClientTest.java index e9032e45064c..c37e686304c0 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/DeploymentsClientTest.java @@ -7,11 +7,13 @@ import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class DeploymentsClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -48,7 +50,7 @@ public void testListDeployments(HttpClient httpClient) { setup(httpClient); // Verify that listing deployments returns results - Iterable deployments = deploymentsClient.listDeployments(); + Iterable deployments = deploymentsClient.list(); Assertions.assertNotNull(deployments); // Verify that at least one deployment can be retrieved if available @@ -72,18 +74,17 @@ public void testListDeploymentsWithFilters(HttpClient httpClient) { // Test listing deployments with model publisher filter String testPublisher = "openai"; - Iterable filteredDeployments = deploymentsClient.listDeployments(testPublisher, null, null); + Iterable filteredDeployments = deploymentsClient.list(testPublisher, null, null); Assertions.assertNotNull(filteredDeployments); // Test listing deployments with model name filter String testModelName = "gpt-4o-mini"; - Iterable modelNameFilteredDeployments - = deploymentsClient.listDeployments(null, testModelName, null); + Iterable modelNameFilteredDeployments = deploymentsClient.list(null, testModelName, null); Assertions.assertNotNull(modelNameFilteredDeployments); // Test listing deployments with deployment type filter Iterable typeFilteredDeployments - = deploymentsClient.listDeployments(null, null, DeploymentType.MODEL_DEPLOYMENT); + = deploymentsClient.list(null, null, DeploymentType.MODEL_DEPLOYMENT); Assertions.assertNotNull(typeFilteredDeployments); // Verify that all returned deployments have the correct type @@ -100,7 +101,7 @@ public void testGetDeployment(HttpClient httpClient) { String deploymentName = Configuration.getGlobalConfiguration().get("TEST_DEPLOYMENT_NAME", "gpt-4o-mini"); try { - Deployment deployment = deploymentsClient.getDeployment(deploymentName); + Deployment deployment = deploymentsClient.get(deploymentName); // Verify the deployment properties assertValidDeployment(deployment, deploymentName, null); @@ -123,7 +124,7 @@ public void testGetDeploymentAndVerifyType(HttpClient httpClient) { String deploymentName = Configuration.getGlobalConfiguration().get("TEST_DEPLOYMENT_NAME", "gpt-4o-mini"); try { - Deployment deployment = deploymentsClient.getDeployment(deploymentName); + Deployment deployment = deploymentsClient.get(deploymentName); // Verify the deployment properties assertValidDeployment(deployment, deploymentName, DeploymentType.MODEL_DEPLOYMENT); diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsAsyncClientTest.java index c2bc48c80838..2e86712c06b3 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsAsyncClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsAsyncClientTest.java @@ -1,180 +1,180 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.projects.models.DatasetVersion; -import com.azure.ai.projects.models.Evaluation; -import com.azure.ai.projects.models.EvaluatorConfiguration; -import com.azure.ai.projects.models.EvaluatorId; -import com.azure.ai.projects.models.InputDataset; -import com.azure.core.http.HttpClient; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Configuration; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; - -public class EvaluationsAsyncClientTest extends ClientTestBase { - - private AIProjectClientBuilder clientBuilder; - private EvaluationsAsyncClient evaluationsAsyncClient; - private DatasetsAsyncClient datasetsAsyncClient; - - private void setup(HttpClient httpClient) { - clientBuilder = getClientBuilder(httpClient); - evaluationsAsyncClient = clientBuilder.buildEvaluationsAsyncClient(); - datasetsAsyncClient = clientBuilder.buildDatasetsAsyncClient(); - } - - /** - * Helper method to verify an Evaluation has valid properties. - * @param evaluation The evaluation to validate - * @param expectedDisplayName The expected display name of the evaluation, or null if no specific name is expected - * @param expectedStatus The expected status, or null if no specific status is expected - */ - private void assertValidEvaluation(Evaluation evaluation, String expectedDisplayName, String expectedStatus) { - Assertions.assertNotNull(evaluation); - Assertions.assertNotNull(evaluation.getDisplayName()); - Assertions.assertNotNull(evaluation.getStatus()); - Assertions.assertNotNull(evaluation.getData()); - Assertions.assertNotNull(evaluation.getData().getType()); - Assertions.assertNotNull(evaluation.getEvaluators()); - Assertions.assertFalse(evaluation.getEvaluators().isEmpty()); - - if (expectedDisplayName != null) { - Assertions.assertEquals(expectedDisplayName, evaluation.getDisplayName()); - } - - if (expectedStatus != null) { - Assertions.assertEquals(expectedStatus, evaluation.getStatus()); - } - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testListEvaluationsAsync(HttpClient httpClient) { - setup(httpClient); - - // Verify that listing evaluations returns results - AtomicBoolean hasAtLeastOneEvaluation = new AtomicBoolean(false); - - StepVerifier.create(evaluationsAsyncClient.listEvaluations().take(1)).assertNext(evaluation -> { - hasAtLeastOneEvaluation.set(true); - assertValidEvaluation(evaluation, null, null); - }).verifyComplete(); - - // Note: This test will pass even if there are no evaluations, - // as we're only verifying the API works correctly - System.out.println("Evaluation list retrieved successfully" - + (hasAtLeastOneEvaluation.get() ? " with at least one evaluation" : " (empty list)")); - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testGetEvaluationAsync(HttpClient httpClient) { - setup(httpClient); - - String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); - - StepVerifier.create(evaluationsAsyncClient.getEvaluation(evaluationId).doOnNext(evaluation -> { - // Verify the evaluation properties - assertValidEvaluation(evaluation, null, null); - - if (evaluation.getTags() != null) { - // Verify tags are properly structured if present - evaluation.getTags().forEach((key, value) -> { - Assertions.assertNotNull(key); - Assertions.assertNotNull(value); - }); - } - - System.out.println("Evaluation retrieved successfully: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - }).timeout(Duration.ofSeconds(30))).verifyComplete(); - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testCreateEvaluationAsync(HttpClient httpClient) { - setup(httpClient); - - String datasetName = Configuration.getGlobalConfiguration().get("TEST_DATASET_NAME", "test-dataset"); - String version = Configuration.getGlobalConfiguration().get("TEST_DATASET_VERSION", "1"); - - // Get a dataset to use for the evaluation - Mono datasetVersionMono = datasetsAsyncClient.getDatasetVersion(datasetName, version); - - StepVerifier.create(datasetVersionMono.flatMap(datasetVersion -> { - // Create evaluation definition - InputDataset dataset = new InputDataset(datasetVersion.getId()); - Evaluation evaluationToCreate = new Evaluation(dataset, - mapOf("relevance", - new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) - .setInitParams(mapOf("deployment_name", BinaryData.fromObject("gpt-4o"))))) - .setDisplayName("Test Async Evaluation " + System.currentTimeMillis()) - .setDescription("This is a test evaluation created by the EvaluationsAsyncClientTest"); - - // Create the evaluation - return evaluationsAsyncClient.createEvaluation(evaluationToCreate); - })).assertNext(createdEvaluation -> { - // Verify the created evaluation - assertValidEvaluation(createdEvaluation, null, null); - Assertions.assertTrue(createdEvaluation.getDisplayName().startsWith("Test Async Evaluation")); - Assertions.assertTrue(createdEvaluation.getEvaluators().containsKey("relevance")); - - System.out.println("Evaluation created successfully: " + createdEvaluation.getDisplayName()); - System.out.println("Initial status: " + createdEvaluation.getStatus()); - }).verifyComplete(); - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testEvaluationStatusCheckAsync(HttpClient httpClient) { - setup(httpClient); - - String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); - - StepVerifier.create(evaluationsAsyncClient.getEvaluation(evaluationId)).assertNext(evaluation -> { - // Verify status is one of the expected values - Assertions.assertNotNull(evaluation.getStatus()); - String status = evaluation.getStatus(); - - // Status should be one of: Running, Succeeded, Failed, Canceled, etc. - boolean isValidStatus = "Running".equals(status) - || "Succeeded".equals(status) - || "Failed".equals(status) - || "Canceled".equals(status) - || "Queued".equals(status) - || "Created".equals(status); - - Assertions.assertTrue(isValidStatus, "Unexpected evaluation status: " + status); - - System.out.println("Evaluation status check passed: " + status); - }).verifyComplete(); - } - - // Helper method for creating maps - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - @SuppressWarnings("unchecked") - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.projects.models.DatasetVersion; +//import com.azure.ai.projects.models.Evaluation; +//import com.azure.ai.projects.models.EvaluatorConfiguration; +//import com.azure.ai.projects.models.EvaluatorId; +//import com.azure.ai.projects.models.InputDataset; +//import com.azure.core.http.HttpClient; +//import com.azure.core.util.BinaryData; +//import com.azure.core.util.Configuration; +//import org.junit.jupiter.api.Assertions; +//import org.junit.jupiter.api.Disabled; +//import org.junit.jupiter.params.ParameterizedTest; +//import org.junit.jupiter.params.provider.MethodSource; +//import reactor.core.publisher.Mono; +//import reactor.test.StepVerifier; +//import java.time.Duration; +//import java.util.HashMap; +//import java.util.Map; +//import java.util.concurrent.atomic.AtomicBoolean; +// +//import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +// +//public class EvaluationsAsyncClientTest extends ClientTestBase { +// +// private AIProjectClientBuilder clientBuilder; +// private EvaluationsAsyncClient evaluationsAsyncClient; +// private DatasetsAsyncClient datasetsAsyncClient; +// +// private void setup(HttpClient httpClient) { +// clientBuilder = getClientBuilder(httpClient); +// evaluationsAsyncClient = clientBuilder.buildEvaluationsAsyncClient(); +// datasetsAsyncClient = clientBuilder.buildDatasetsAsyncClient(); +// } +// +// /** +// * Helper method to verify an Evaluation has valid properties. +// * @param evaluation The evaluation to validate +// * @param expectedDisplayName The expected display name of the evaluation, or null if no specific name is expected +// * @param expectedStatus The expected status, or null if no specific status is expected +// */ +// private void assertValidEvaluation(Evaluation evaluation, String expectedDisplayName, String expectedStatus) { +// Assertions.assertNotNull(evaluation); +// Assertions.assertNotNull(evaluation.getDisplayName()); +// Assertions.assertNotNull(evaluation.getStatus()); +// Assertions.assertNotNull(evaluation.getData()); +// Assertions.assertNotNull(evaluation.getData().getType()); +// Assertions.assertNotNull(evaluation.getEvaluators()); +// Assertions.assertFalse(evaluation.getEvaluators().isEmpty()); +// +// if (expectedDisplayName != null) { +// Assertions.assertEquals(expectedDisplayName, evaluation.getDisplayName()); +// } +// +// if (expectedStatus != null) { +// Assertions.assertEquals(expectedStatus, evaluation.getStatus()); +// } +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testListEvaluationsAsync(HttpClient httpClient) { +// setup(httpClient); +// +// // Verify that listing evaluations returns results +// AtomicBoolean hasAtLeastOneEvaluation = new AtomicBoolean(false); +// +// StepVerifier.create(evaluationsAsyncClient.listEvaluations().take(1)).assertNext(evaluation -> { +// hasAtLeastOneEvaluation.set(true); +// assertValidEvaluation(evaluation, null, null); +// }).verifyComplete(); +// +// // Note: This test will pass even if there are no evaluations, +// // as we're only verifying the API works correctly +// System.out.println("Evaluation list retrieved successfully" +// + (hasAtLeastOneEvaluation.get() ? " with at least one evaluation" : " (empty list)")); +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testGetEvaluationAsync(HttpClient httpClient) { +// setup(httpClient); +// +// String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); +// +// StepVerifier.create(evaluationsAsyncClient.getEvaluation(evaluationId).doOnNext(evaluation -> { +// // Verify the evaluation properties +// assertValidEvaluation(evaluation, null, null); +// +// if (evaluation.getTags() != null) { +// // Verify tags are properly structured if present +// evaluation.getTags().forEach((key, value) -> { +// Assertions.assertNotNull(key); +// Assertions.assertNotNull(value); +// }); +// } +// +// System.out.println("Evaluation retrieved successfully: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// }).timeout(Duration.ofSeconds(30))).verifyComplete(); +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testCreateEvaluationAsync(HttpClient httpClient) { +// setup(httpClient); +// +// String datasetName = Configuration.getGlobalConfiguration().get("TEST_DATASET_NAME", "test-dataset"); +// String version = Configuration.getGlobalConfiguration().get("TEST_DATASET_VERSION", "1"); +// +// // Get a dataset to use for the evaluation +// Mono datasetVersionMono = datasetsAsyncClient.getDatasetVersion(datasetName, version); +// +// StepVerifier.create(datasetVersionMono.flatMap(datasetVersion -> { +// // Create evaluation definition +// InputDataset dataset = new InputDataset(datasetVersion.getId()); +// Evaluation evaluationToCreate = new Evaluation(dataset, +// mapOf("relevance", +// new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) +// .setInitParams(mapOf("deployment_name", BinaryData.fromObject("gpt-4o"))))) +// .setDisplayName("Test Async Evaluation " + System.currentTimeMillis()) +// .setDescription("This is a test evaluation created by the EvaluationsAsyncClientTest"); +// +// // Create the evaluation +// return evaluationsAsyncClient.createEvaluation(evaluationToCreate); +// })).assertNext(createdEvaluation -> { +// // Verify the created evaluation +// assertValidEvaluation(createdEvaluation, null, null); +// Assertions.assertTrue(createdEvaluation.getDisplayName().startsWith("Test Async Evaluation")); +// Assertions.assertTrue(createdEvaluation.getEvaluators().containsKey("relevance")); +// +// System.out.println("Evaluation created successfully: " + createdEvaluation.getDisplayName()); +// System.out.println("Initial status: " + createdEvaluation.getStatus()); +// }).verifyComplete(); +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testEvaluationStatusCheckAsync(HttpClient httpClient) { +// setup(httpClient); +// +// String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); +// +// StepVerifier.create(evaluationsAsyncClient.getEvaluation(evaluationId)).assertNext(evaluation -> { +// // Verify status is one of the expected values +// Assertions.assertNotNull(evaluation.getStatus()); +// String status = evaluation.getStatus(); +// +// // Status should be one of: Running, Succeeded, Failed, Canceled, etc. +// boolean isValidStatus = "Running".equals(status) +// || "Succeeded".equals(status) +// || "Failed".equals(status) +// || "Canceled".equals(status) +// || "Queued".equals(status) +// || "Created".equals(status); +// +// Assertions.assertTrue(isValidStatus, "Unexpected evaluation status: " + status); +// +// System.out.println("Evaluation status check passed: " + status); +// }).verifyComplete(); +// } +// +// // Helper method for creating maps +// private static Map mapOf(Object... inputs) { +// Map map = new HashMap<>(); +// for (int i = 0; i < inputs.length; i += 2) { +// String key = (String) inputs[i]; +// @SuppressWarnings("unchecked") +// T value = (T) inputs[i + 1]; +// map.put(key, value); +// } +// return map; +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsClientTest.java index 714385eb3fae..b71bb9c0fad6 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/EvaluationsClientTest.java @@ -1,197 +1,197 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.projects; - -import com.azure.ai.projects.models.DatasetVersion; -import com.azure.ai.projects.models.Evaluation; -import com.azure.ai.projects.models.EvaluatorConfiguration; -import com.azure.ai.projects.models.EvaluatorId; -import com.azure.ai.projects.models.InputDataset; -import com.azure.core.http.HttpClient; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Configuration; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import java.util.HashMap; -import java.util.Map; - -import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; - -public class EvaluationsClientTest extends ClientTestBase { - - private AIProjectClientBuilder clientBuilder; - private EvaluationsClient evaluationsClient; - private DatasetsClient datasetsClient; - - private void setup(HttpClient httpClient) { - clientBuilder = getClientBuilder(httpClient); - evaluationsClient = clientBuilder.buildEvaluationsClient(); - datasetsClient = clientBuilder.buildDatasetsClient(); - } - - /** - * Helper method to verify an Evaluation has valid properties. - * @param evaluation The evaluation to validate - * @param expectedDisplayName The expected display name of the evaluation, or null if no specific name is expected - * @param expectedStatus The expected status, or null if no specific status is expected - */ - private void assertValidEvaluation(Evaluation evaluation, String expectedDisplayName, String expectedStatus) { - Assertions.assertNotNull(evaluation); - Assertions.assertNotNull(evaluation.getDisplayName()); - Assertions.assertNotNull(evaluation.getStatus()); - Assertions.assertNotNull(evaluation.getData()); - Assertions.assertNotNull(evaluation.getData().getType()); - Assertions.assertNotNull(evaluation.getEvaluators()); - Assertions.assertFalse(evaluation.getEvaluators().isEmpty()); - - if (expectedDisplayName != null) { - Assertions.assertEquals(expectedDisplayName, evaluation.getDisplayName()); - } - - if (expectedStatus != null) { - Assertions.assertEquals(expectedStatus, evaluation.getStatus()); - } - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testListEvaluations(HttpClient httpClient) { - setup(httpClient); - - // Verify that listing evaluations returns results - Iterable evaluations = evaluationsClient.listEvaluations(); - Assertions.assertNotNull(evaluations); - - // Verify that at least one evaluation can be retrieved if available - boolean hasAtLeastOneEvaluation = false; - for (Evaluation evaluation : evaluations) { - hasAtLeastOneEvaluation = true; - assertValidEvaluation(evaluation, null, null); - break; - } - - // Note: This test will pass even if there are no evaluations, - // as we're only verifying the API works correctly - System.out.println("Evaluation list retrieved successfully" - + (hasAtLeastOneEvaluation ? " with at least one evaluation" : " (empty list)")); - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testGetEvaluation(HttpClient httpClient) { - setup(httpClient); - - String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); - - try { - Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); - - // Verify the evaluation properties - assertValidEvaluation(evaluation, null, null); - - if (evaluation.getTags() != null) { - // Verify tags are properly structured if present - evaluation.getTags().forEach((key, value) -> { - Assertions.assertNotNull(key); - Assertions.assertNotNull(value); - }); - } - - System.out.println("Evaluation retrieved successfully: " + evaluation.getDisplayName()); - System.out.println("Status: " + evaluation.getStatus()); - } catch (Exception e) { - // If the evaluation doesn't exist, this will throw a ResourceNotFoundException - // We'll handle this case by printing a message and passing the test - System.out.println("Evaluation not found: " + evaluationId); - Assertions.assertTrue(e.getMessage().contains("404") || e.getMessage().contains("Not Found")); - } - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testCreateEvaluation(HttpClient httpClient) { - setup(httpClient); - - String datasetName = Configuration.getGlobalConfiguration().get("TEST_DATASET_NAME", "test-dataset"); - String version = Configuration.getGlobalConfiguration().get("TEST_DATASET_VERSION", "1"); - - try { - // Get a dataset to use for the evaluation - DatasetVersion datasetVersion = datasetsClient.getDatasetVersion(datasetName, version); - - // Create evaluation definition - InputDataset dataset = new InputDataset(datasetVersion.getId()); - Evaluation evaluationToCreate = new Evaluation(dataset, - mapOf("relevance", - new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) - .setInitParams(mapOf("deployment_name", BinaryData.fromObject("gpt-4o"))))) - .setDisplayName("Test Evaluation " + System.currentTimeMillis()) - .setDescription("This is a test evaluation created by the EvaluationsClientTest"); - - // Create the evaluation - Evaluation createdEvaluation = evaluationsClient.createEvaluation(evaluationToCreate); - - // Verify the created evaluation - assertValidEvaluation(createdEvaluation, evaluationToCreate.getDisplayName(), null); - Assertions.assertEquals(evaluationToCreate.getDescription(), createdEvaluation.getDescription()); - Assertions.assertTrue(createdEvaluation.getEvaluators().containsKey("relevance")); - - System.out.println("Evaluation created successfully: " + createdEvaluation.getDisplayName()); - System.out.println("Initial status: " + createdEvaluation.getStatus()); - } catch (Exception e) { - // If the dataset doesn't exist or there's another issue - System.out.println("Failed to create evaluation: " + e.getMessage()); - throw e; - } - } - - @Disabled - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") - public void testEvaluationStatusCheck(HttpClient httpClient) { - setup(httpClient); - - String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); - - try { - Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); - - // Verify status is one of the expected values - Assertions.assertNotNull(evaluation.getStatus()); - String status = evaluation.getStatus(); - - // Status should be one of: Running, Succeeded, Failed, Canceled, etc. - boolean isValidStatus = "Running".equals(status) - || "Succeeded".equals(status) - || "Failed".equals(status) - || "Canceled".equals(status) - || "Queued".equals(status) - || "Created".equals(status); - - Assertions.assertTrue(isValidStatus, "Unexpected evaluation status: " + status); - - System.out.println("Evaluation status check passed: " + status); - } catch (Exception e) { - // If the evaluation doesn't exist, this will throw a ResourceNotFoundException - System.out.println("Evaluation not found for status check: " + evaluationId); - Assertions.assertTrue(e.getMessage().contains("404") || e.getMessage().contains("Not Found")); - } - } - - // Helper method for creating maps - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - @SuppressWarnings("unchecked") - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} +//package com.azure.ai.projects; +// +//import com.azure.ai.projects.models.DatasetVersion; +//import com.azure.ai.projects.models.Evaluation; +//import com.azure.ai.projects.models.EvaluatorConfiguration; +//import com.azure.ai.projects.models.EvaluatorId; +//import com.azure.ai.projects.models.InputDataset; +//import com.azure.core.http.HttpClient; +//import com.azure.core.util.BinaryData; +//import com.azure.core.util.Configuration; +//import org.junit.jupiter.api.Assertions; +//import org.junit.jupiter.api.Disabled; +//import org.junit.jupiter.params.ParameterizedTest; +//import org.junit.jupiter.params.provider.MethodSource; +//import java.util.HashMap; +//import java.util.Map; +// +//import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +// +//public class EvaluationsClientTest extends ClientTestBase { +// +// private AIProjectClientBuilder clientBuilder; +// private EvaluationsClient evaluationsClient; +// private DatasetsClient datasetsClient; +// +// private void setup(HttpClient httpClient) { +// clientBuilder = getClientBuilder(httpClient); +// evaluationsClient = clientBuilder.buildEvaluationsClient(); +// datasetsClient = clientBuilder.buildDatasetsClient(); +// } +// +// /** +// * Helper method to verify an Evaluation has valid properties. +// * @param evaluation The evaluation to validate +// * @param expectedDisplayName The expected display name of the evaluation, or null if no specific name is expected +// * @param expectedStatus The expected status, or null if no specific status is expected +// */ +// private void assertValidEvaluation(Evaluation evaluation, String expectedDisplayName, String expectedStatus) { +// Assertions.assertNotNull(evaluation); +// Assertions.assertNotNull(evaluation.getDisplayName()); +// Assertions.assertNotNull(evaluation.getStatus()); +// Assertions.assertNotNull(evaluation.getData()); +// Assertions.assertNotNull(evaluation.getData().getType()); +// Assertions.assertNotNull(evaluation.getEvaluators()); +// Assertions.assertFalse(evaluation.getEvaluators().isEmpty()); +// +// if (expectedDisplayName != null) { +// Assertions.assertEquals(expectedDisplayName, evaluation.getDisplayName()); +// } +// +// if (expectedStatus != null) { +// Assertions.assertEquals(expectedStatus, evaluation.getStatus()); +// } +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testListEvaluations(HttpClient httpClient) { +// setup(httpClient); +// +// // Verify that listing evaluations returns results +// Iterable evaluations = evaluationsClient.listEvaluations(); +// Assertions.assertNotNull(evaluations); +// +// // Verify that at least one evaluation can be retrieved if available +// boolean hasAtLeastOneEvaluation = false; +// for (Evaluation evaluation : evaluations) { +// hasAtLeastOneEvaluation = true; +// assertValidEvaluation(evaluation, null, null); +// break; +// } +// +// // Note: This test will pass even if there are no evaluations, +// // as we're only verifying the API works correctly +// System.out.println("Evaluation list retrieved successfully" +// + (hasAtLeastOneEvaluation ? " with at least one evaluation" : " (empty list)")); +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testGetEvaluation(HttpClient httpClient) { +// setup(httpClient); +// +// String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); +// +// try { +// Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); +// +// // Verify the evaluation properties +// assertValidEvaluation(evaluation, null, null); +// +// if (evaluation.getTags() != null) { +// // Verify tags are properly structured if present +// evaluation.getTags().forEach((key, value) -> { +// Assertions.assertNotNull(key); +// Assertions.assertNotNull(value); +// }); +// } +// +// System.out.println("Evaluation retrieved successfully: " + evaluation.getDisplayName()); +// System.out.println("Status: " + evaluation.getStatus()); +// } catch (Exception e) { +// // If the evaluation doesn't exist, this will throw a ResourceNotFoundException +// // We'll handle this case by printing a message and passing the test +// System.out.println("Evaluation not found: " + evaluationId); +// Assertions.assertTrue(e.getMessage().contains("404") || e.getMessage().contains("Not Found")); +// } +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testCreateEvaluation(HttpClient httpClient) { +// setup(httpClient); +// +// String datasetName = Configuration.getGlobalConfiguration().get("TEST_DATASET_NAME", "test-dataset"); +// String version = Configuration.getGlobalConfiguration().get("TEST_DATASET_VERSION", "1"); +// +// try { +// // Get a dataset to use for the evaluation +// DatasetVersion datasetVersion = datasetsClient.getDatasetVersion(datasetName, version); +// +// // Create evaluation definition +// InputDataset dataset = new InputDataset(datasetVersion.getId()); +// Evaluation evaluationToCreate = new Evaluation(dataset, +// mapOf("relevance", +// new EvaluatorConfiguration(EvaluatorId.RELEVANCE.getValue()) +// .setInitParams(mapOf("deployment_name", BinaryData.fromObject("gpt-4o"))))) +// .setDisplayName("Test Evaluation " + System.currentTimeMillis()) +// .setDescription("This is a test evaluation created by the EvaluationsClientTest"); +// +// // Create the evaluation +// Evaluation createdEvaluation = evaluationsClient.createEvaluation(evaluationToCreate); +// +// // Verify the created evaluation +// assertValidEvaluation(createdEvaluation, evaluationToCreate.getDisplayName(), null); +// Assertions.assertEquals(evaluationToCreate.getDescription(), createdEvaluation.getDescription()); +// Assertions.assertTrue(createdEvaluation.getEvaluators().containsKey("relevance")); +// +// System.out.println("Evaluation created successfully: " + createdEvaluation.getDisplayName()); +// System.out.println("Initial status: " + createdEvaluation.getStatus()); +// } catch (Exception e) { +// // If the dataset doesn't exist or there's another issue +// System.out.println("Failed to create evaluation: " + e.getMessage()); +// throw e; +// } +// } +// +// @Disabled +// @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) +// @MethodSource("com.azure.ai.projects.TestUtils#getTestParameters") +// public void testEvaluationStatusCheck(HttpClient httpClient) { +// setup(httpClient); +// +// String evaluationId = Configuration.getGlobalConfiguration().get("TEST_EVALUATION_ID", "test-evaluation-id"); +// +// try { +// Evaluation evaluation = evaluationsClient.getEvaluation(evaluationId); +// +// // Verify status is one of the expected values +// Assertions.assertNotNull(evaluation.getStatus()); +// String status = evaluation.getStatus(); +// +// // Status should be one of: Running, Succeeded, Failed, Canceled, etc. +// boolean isValidStatus = "Running".equals(status) +// || "Succeeded".equals(status) +// || "Failed".equals(status) +// || "Canceled".equals(status) +// || "Queued".equals(status) +// || "Created".equals(status); +// +// Assertions.assertTrue(isValidStatus, "Unexpected evaluation status: " + status); +// +// System.out.println("Evaluation status check passed: " + status); +// } catch (Exception e) { +// // If the evaluation doesn't exist, this will throw a ResourceNotFoundException +// System.out.println("Evaluation not found for status check: " + evaluationId); +// Assertions.assertTrue(e.getMessage().contains("404") || e.getMessage().contains("Not Found")); +// } +// } +// +// // Helper method for creating maps +// private static Map mapOf(Object... inputs) { +// Map map = new HashMap<>(); +// for (int i = 0; i < inputs.length; i += 2) { +// String key = (String) inputs[i]; +// @SuppressWarnings("unchecked") +// T value = (T) inputs[i + 1]; +// map.put(key, value); +// } +// return map; +// } +//} diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesAsyncClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesAsyncClientTest.java index 2cb2576f960b..e6f25cc9ce0e 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesAsyncClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesAsyncClientTest.java @@ -18,6 +18,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class IndexesAsyncClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -59,7 +60,7 @@ public void testListIndexesAsync(HttpClient httpClient) { List indexList = new ArrayList<>(); // Verify that listing indexes returns results - StepVerifier.create(indexesAsyncClient.listLatestIndexVersions().doOnNext(index -> { + StepVerifier.create(indexesAsyncClient.listLatest().doOnNext(index -> { indexList.add(index); assertValidIndex(index, null, null); })).expectComplete().verify(Duration.ofMinutes(1)); @@ -78,7 +79,7 @@ public void testListIndexVersionsAsync(HttpClient httpClient) { List versionList = new ArrayList<>(); // Verify that listing index versions returns results or appropriate error - StepVerifier.create(indexesAsyncClient.listIndexVersions(indexName).doOnNext(index -> { + StepVerifier.create(indexesAsyncClient.listVersions(indexName).doOnNext(index -> { versionList.add(index); assertValidIndex(index, indexName, null); }).onErrorResume(e -> { @@ -102,7 +103,7 @@ public void testGetIndexAsync(HttpClient httpClient) { String indexName = Configuration.getGlobalConfiguration().get("TEST_INDEX_NAME", "test-index"); String indexVersion = Configuration.getGlobalConfiguration().get("TEST_INDEX_VERSION", "1.0"); - StepVerifier.create(indexesAsyncClient.getIndexVersion(indexName, indexVersion).doOnNext(index -> { + StepVerifier.create(indexesAsyncClient.getVersion(indexName, indexVersion).doOnNext(index -> { // Verify the index properties assertValidIndex(index, indexName, indexVersion); System.out @@ -134,8 +135,8 @@ public void testCreateOrUpdateIndexAsync(HttpClient httpClient) { AzureAISearchIndex searchIndex = new AzureAISearchIndex().setConnectionName(aiSearchConnectionName).setIndexName(aiSearchIndexName); - StepVerifier.create(indexesAsyncClient.createOrUpdateIndexVersion(indexName, indexVersion, searchIndex) - .doOnNext(createdIndex -> { + StepVerifier + .create(indexesAsyncClient.createOrUpdate(indexName, indexVersion, searchIndex).doOnNext(createdIndex -> { // Verify the created/updated index assertValidIndex(createdIndex, indexName, indexVersion); @@ -147,7 +148,10 @@ public void testCreateOrUpdateIndexAsync(HttpClient httpClient) { System.out.println("Index created/updated successfully: " + createdIndex.getName() + " (version " + createdIndex.getVersion() + ")"); - })).expectNextCount(1).expectComplete().verify(Duration.ofMinutes(1)); + })) + .expectNextCount(1) + .expectComplete() + .verify(Duration.ofMinutes(1)); } @Disabled @@ -160,12 +164,12 @@ public void testDeleteIndexAsync(HttpClient httpClient) { String indexVersion = Configuration.getGlobalConfiguration().get("TEST_INDEX_VERSION", "1.0"); // First verify the index exists - indexesAsyncClient.getIndexVersion(indexName, indexVersion) + indexesAsyncClient.getVersion(indexName, indexVersion) .doOnNext(index -> assertValidIndex(index, indexName, indexVersion)) - .flatMap(index -> indexesAsyncClient.deleteIndexVersion(indexName, indexVersion)) + .flatMap(index -> indexesAsyncClient.deleteVersion(indexName, indexVersion)) .doOnSuccess(unused -> System.out.println("Index deletion request submitted")) .then(Mono.delay(Duration.ofSeconds(2))) // Give some time for the deletion to complete - .then(indexesAsyncClient.getIndexVersion(indexName, indexVersion)) + .then(indexesAsyncClient.getVersion(indexName, indexVersion)) .doOnNext(deletedIndex -> Assertions .fail("Index should have been deleted but was found: " + deletedIndex.getName())) .onErrorResume(e -> { diff --git a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesClientTest.java b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesClientTest.java index 6e884a703846..a821d7919969 100644 --- a/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesClientTest.java +++ b/sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/IndexesClientTest.java @@ -13,6 +13,7 @@ import static com.azure.ai.projects.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +@Disabled("Disabled for lack of recordings. Needs to be enabled on the Public Preview release.") public class IndexesClientTest extends ClientTestBase { private AIProjectClientBuilder clientBuilder; @@ -51,7 +52,7 @@ public void testListIndexes(HttpClient httpClient) { setup(httpClient); // Verify that listing indexes returns results - Iterable indexes = indexesClient.listLatestIndexVersions(); + Iterable indexes = indexesClient.listLatest(); Assertions.assertNotNull(indexes); // Verify that at least one index can be retrieved if available @@ -78,7 +79,7 @@ public void testListIndexVersions(HttpClient httpClient) { try { // Verify that listing index versions returns results - Iterable indexVersions = indexesClient.listIndexVersions(indexName); + Iterable indexVersions = indexesClient.listVersions(indexName); Assertions.assertNotNull(indexVersions); // Verify that at least one index version can be retrieved if available @@ -109,7 +110,7 @@ public void testGetIndex(HttpClient httpClient) { String indexVersion = Configuration.getGlobalConfiguration().get("TEST_INDEX_VERSION", "1.0"); try { - Index index = indexesClient.getIndexVersion(indexName, indexVersion); + Index index = indexesClient.getVersion(indexName, indexVersion); // Verify the index properties assertValidIndex(index, indexName, indexVersion); @@ -145,7 +146,7 @@ public void testCreateOrUpdateIndex(HttpClient httpClient) { = new AzureAISearchIndex().setConnectionName(aiSearchConnectionName).setIndexName(aiSearchIndexName); // Create or update the index - Index createdIndex = indexesClient.createOrUpdateIndexVersion(indexName, indexVersion, searchIndex); + Index createdIndex = indexesClient.createOrUpdate(indexName, indexVersion, searchIndex); // Verify the created/updated index assertValidIndex(createdIndex, indexName, indexVersion); @@ -175,15 +176,15 @@ public void testDeleteIndex(HttpClient httpClient) { try { // First verify the index exists - Index index = indexesClient.getIndexVersion(indexName, indexVersion); + Index index = indexesClient.getVersion(indexName, indexVersion); assertValidIndex(index, indexName, indexVersion); // Delete the index - indexesClient.deleteIndexVersion(indexName, indexVersion); + indexesClient.deleteVersion(indexName, indexVersion); // Try to get the deleted index - should throw ResourceNotFoundException try { - Index deletedIndex = indexesClient.getIndexVersion(indexName, indexVersion); + Index deletedIndex = indexesClient.getVersion(indexName, indexVersion); Assertions.fail("Index should have been deleted but was found: " + deletedIndex.getName()); } catch (Exception e) { // Expected exception