diff --git a/.github/workflows/pr-lint.yaml b/.github/workflows/pr-lint.yaml index 8543ac16b..54750e3a3 100644 --- a/.github/workflows/pr-lint.yaml +++ b/.github/workflows/pr-lint.yaml @@ -26,6 +26,7 @@ jobs: PromptRegistry Grounding RPT + Batch headerPattern: '^(\w.+): (?:\[(\w.+)\] )?(.+)$' headerPatternCorrespondence: type, scope, subject # for available types, check: diff --git a/.pipeline/checkstyle-suppressions.xml b/.pipeline/checkstyle-suppressions.xml index 519684154..4190a8ca4 100644 --- a/.pipeline/checkstyle-suppressions.xml +++ b/.pipeline/checkstyle-suppressions.xml @@ -15,6 +15,7 @@ + diff --git a/core-services/batch/pom.xml b/core-services/batch/pom.xml new file mode 100644 index 000000000..c3ad4656c --- /dev/null +++ b/core-services/batch/pom.xml @@ -0,0 +1,165 @@ + + + 4.0.0 + + com.sap.ai.sdk + sdk-parent + 1.19.0-SNAPSHOT + ../../pom.xml + + batch + SAP Batch API Client + SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service. This is the client for consuming SAP Batch Service API. + https://github.com/SAP/ai-sdk-java?tab=readme-ov-file#documentation + + SAP SE + https://www.sap.com + + + + The Apache Software License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + SAP + cloudsdk@sap.com + SAP SE + https://www.sap.com + + + + scm:git:git://github.com/SAP/ai-sdk-java.git + scm:git:ssh://github.com:SAP/ai-sdk-java.git + https://github.com/SAP/ai-sdk-java/tree/main + + + ${project.basedir}/../../ + 13% + 17% + 14% + 2% + 21% + 77% + + + + + com.sap.cloud.sdk.datamodel + openapi-core-apache + + + com.sap.ai.sdk + core + + + com.sap.cloud.sdk.cloudplatform + cloudplatform-connectivity + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + com.google.code.findbugs + jsr305 + + + + org.projectlombok + lombok + provided + + + + org.wiremock + wiremock + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.assertj + assertj-core + test + + + org.apache.httpcomponents.core5 + httpcore5 + test + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity + + + + + + + + generate + + false + + generate + + + + + + com.sap.cloud.sdk.datamodel + openapi-generator-maven-plugin + + ${project.basedir}/src/main/java + true + COMPILE + true + + + + batch + + generate + + generate-sources + + ${project.basedir}/src/main/resources/spec/batch-service.yaml + com.sap.ai.sdk.batch.generated.model + com.sap.ai.sdk.batch.generated.client + + apache-httpclient + create + protected + true + true + true + true + true + \. + 3 + + + + + + + + + + diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/client/BatchesApi.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/client/BatchesApi.java new file mode 100644 index 000000000..b58ba8e55 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/client/BatchesApi.java @@ -0,0 +1,495 @@ +package com.sap.ai.sdk.batch.generated.client; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.ai.sdk.batch.generated.model.BatchCancelResponse; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequest; +import com.sap.ai.sdk.batch.generated.model.BatchCreateResponse; +import com.sap.ai.sdk.batch.generated.model.BatchDeleteResponse; +import com.sap.ai.sdk.batch.generated.model.BatchDetailResponse; +import com.sap.ai.sdk.batch.generated.model.BatchListResponse; +import com.sap.ai.sdk.batch.generated.model.BatchStatusResponse; +import com.sap.ai.sdk.core.AiCoreService; +import com.sap.cloud.sdk.services.openapi.apache.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.apiclient.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.apiclient.Pair; +import com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; +import java.util.UUID; +import javax.annotation.Nonnull; + +/** + * LLM Batch Service API in version 0.0.1. + * + *

The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP + * AI Core. Instead of making individual inference calls, users can submit a batch of requests as a + * JSONL file stored in an object store, and the service processes them in the background. The batch + * job will be completed in a 24h time window and the results will be stored in the provided object + * store. + */ +public class BatchesApi extends BaseApi { + + /** Instantiates this API class to invoke operations on the LLM Batch Service API */ + public BatchesApi() { + super(new AiCoreService().getApiClient()); + } + + /** + * Instantiates this API class to invoke operations on the LLM Batch Service API + * + * @param aiCoreService The configured connectivity instance to AI Core + */ + public BatchesApi(@Nonnull final AiCoreService aiCoreService) { + super(aiCoreService.getApiClient()); + } + + private BatchesApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * Creates a new API instance with additional default headers. + * + * @param defaultHeaders Additional headers to include in all requests + * @return A new API instance with the combined headers + */ + public BatchesApi withDefaultHeaders(@Nonnull final Map defaultHeaders) { + final var api = new BatchesApi(apiClient); + api.defaultHeaders.putAll(this.defaultHeaders); + api.defaultHeaders.putAll(defaultHeaders); + return api; + } + + /** + * Cancel a batch + * + *

Cancel a batch processing job that is currently in progress. The batch will be scheduled for + * cancellation. + * + *

202 - Batch job scheduled for cancellation + * + *

404 - Batch job not found + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @param batchId The unique identifier of the batch job. + * @return BatchCancelResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchCancelResponse cancelBatch( + @Nonnull final String aiResourceGroup, @Nonnull final UUID batchId) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling cancelBatch") + .statusCode(400); + } + + // verify the required parameter 'batchId' is set + if (batchId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'batchId' when calling cancelBatch") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/llm-batch-service/v1/batches/{batch_id}/cancel" + .replaceAll( + "\\{" + "batch_id" + "\\}", + ApiClient.escapeString(ApiClient.parameterToString(batchId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + * Create a new batch job + * + *

Create a new LLM batch processing job. The batch job processes input data from the specified + * URI and writes results to the output URI. + * + *

202 - Batch job scheduled + * + *

400 - Bad request + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @param batchCreateRequest The value for the parameter batchCreateRequest + * @return BatchCreateResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchCreateResponse createBatch( + @Nonnull final String aiResourceGroup, @Nonnull final BatchCreateRequest batchCreateRequest) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling createBatch") + .statusCode(400); + } + + // verify the required parameter 'batchCreateRequest' is set + if (batchCreateRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'batchCreateRequest' when calling createBatch") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/llm-batch-service/v1/batches"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + batchCreateRequest, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + * Delete a Batch job (only for cancelled, completed, or failed batches) + * + *

Delete a batch processing job. Only batches in a terminal state (cancelled, completed, or + * failed) can be deleted. + * + *

202 - Batch job deleted + * + *

400 - Bad request - Batch job not in deletable state + * + *

404 - Batch job not found + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @param batchId The unique identifier of the batch job. + * @return BatchDeleteResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchDeleteResponse deleteBatch( + @Nonnull final String aiResourceGroup, @Nonnull final UUID batchId) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling deleteBatch") + .statusCode(400); + } + + // verify the required parameter 'batchId' is set + if (batchId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'batchId' when calling deleteBatch") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/llm-batch-service/v1/batches/{batch_id}" + .replaceAll( + "\\{" + "batch_id" + "\\}", + ApiClient.escapeString(ApiClient.parameterToString(batchId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + * Get Batch job details + * + *

Retrieve the details of a specific batch processing job, including its configuration and + * current status. + * + *

200 - Batch job details + * + *

404 - Batch job not found + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @param batchId The unique identifier of the batch job. + * @return BatchDetailResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchDetailResponse getBatchById( + @Nonnull final String aiResourceGroup, @Nonnull final UUID batchId) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getBatchById") + .statusCode(400); + } + + // verify the required parameter 'batchId' is set + if (batchId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'batchId' when calling getBatchById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/llm-batch-service/v1/batches/{batch_id}" + .replaceAll( + "\\{" + "batch_id" + "\\}", + ApiClient.escapeString(ApiClient.parameterToString(batchId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + * Get Batch job status + * + *

Retrieve the current status of a specific batch processing job. + * + *

200 - Batch job status + * + *

404 - Batch job not found + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @param batchId The unique identifier of the batch job. + * @return BatchStatusResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchStatusResponse getBatchStatus( + @Nonnull final String aiResourceGroup, @Nonnull final UUID batchId) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getBatchStatus") + .statusCode(400); + } + + // verify the required parameter 'batchId' is set + if (batchId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'batchId' when calling getBatchStatus") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/llm-batch-service/v1/batches/{batch_id}/status" + .replaceAll( + "\\{" + "batch_id" + "\\}", + ApiClient.escapeString(ApiClient.parameterToString(batchId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + * List all batches + * + *

Retrieve a list of all batch processing jobs for the current tenant. + * + *

200 - List of batches + * + *

500 - Internal server error + * + * @param aiResourceGroup Specify the resource group to use for the request + * @return BatchListResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public BatchListResponse listBatches(@Nonnull final String aiResourceGroup) + throws OpenApiRequestException { + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling listBatches") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/llm-batch-service/v1/batches"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(defaultHeaders); + final Map localVarFormParams = new HashMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.put("AI-Resource-Group", ApiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = + new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCancelResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCancelResponse.java new file mode 100644 index 000000000..5aee3da5b --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCancelResponse.java @@ -0,0 +1,247 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchCancelResponse */ +// CHECKSTYLE:OFF +public class BatchCancelResponse +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCancelResponse. */ + protected BatchCancelResponse() {} + + /** + * Set the id of this {@link BatchCancelResponse} instance and return the same instance. + * + * @param id The id of this {@link BatchCancelResponse} + * @return The same instance of this {@link BatchCancelResponse} class + */ + @Nonnull + public BatchCancelResponse id(@Nullable final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link BatchCancelResponse} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link BatchCancelResponse} instance. + * + * @param id The id of this {@link BatchCancelResponse} + */ + public void setId(@Nullable final UUID id) { + this.id = id; + } + + /** + * Set the createdAt of this {@link BatchCancelResponse} instance and return the same instance. + * + * @param createdAt The createdAt of this {@link BatchCancelResponse} + * @return The same instance of this {@link BatchCancelResponse} class + */ + @Nonnull + public BatchCancelResponse createdAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt The createdAt of this {@link BatchCancelResponse} instance. + */ + @Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Set the createdAt of this {@link BatchCancelResponse} instance. + * + * @param createdAt The createdAt of this {@link BatchCancelResponse} + */ + public void setCreatedAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Set the message of this {@link BatchCancelResponse} instance and return the same instance. + * + * @param message The message of this {@link BatchCancelResponse} + * @return The same instance of this {@link BatchCancelResponse} class + */ + @Nonnull + public BatchCancelResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link BatchCancelResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link BatchCancelResponse} instance. + * + * @param message The message of this {@link BatchCancelResponse} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCancelResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCancelResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchCancelResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCancelResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (createdAt != null) declaredFields.put("createdAt", createdAt); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCancelResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCancelResponse batchCancelResponse = (BatchCancelResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchCancelResponse.cloudSdkCustomFields) + && Objects.equals(this.id, batchCancelResponse.id) + && Objects.equals(this.createdAt, batchCancelResponse.createdAt) + && Objects.equals(this.message, batchCancelResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCancelResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchCancelResponse} instance. No arguments are required. */ + public static BatchCancelResponse create() { + return new BatchCancelResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequest.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequest.java new file mode 100644 index 000000000..d1911585c --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequest.java @@ -0,0 +1,388 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchCreateRequest */ +// CHECKSTYLE:OFF +public class BatchCreateRequest +// CHECKSTYLE:ON +{ + /** Type of batch processing */ + public enum TypeEnum { + /** The LLM_NATIVE option of this BatchCreateRequest */ + LLM_NATIVE("llm-native"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this BatchCreateRequest */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type BatchCreateRequest + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("input") + private BatchCreateRequestInput input; + + @JsonProperty("output") + private BatchCreateRequestOutput output; + + @JsonProperty("spec") + private BatchCreateRequestSpec spec; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCreateRequest. */ + protected BatchCreateRequest() {} + + /** + * Set the type of this {@link BatchCreateRequest} instance and return the same instance. + * + * @param type Type of batch processing + * @return The same instance of this {@link BatchCreateRequest} class + */ + @Nonnull + public BatchCreateRequest type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of batch processing + * + * @return type The type of this {@link BatchCreateRequest} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link BatchCreateRequest} instance. + * + * @param type Type of batch processing + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the input of this {@link BatchCreateRequest} instance and return the same instance. + * + * @param input The input of this {@link BatchCreateRequest} + * @return The same instance of this {@link BatchCreateRequest} class + */ + @Nonnull + public BatchCreateRequest input(@Nonnull final BatchCreateRequestInput input) { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link BatchCreateRequest} instance. + */ + @Nonnull + public BatchCreateRequestInput getInput() { + return input; + } + + /** + * Set the input of this {@link BatchCreateRequest} instance. + * + * @param input The input of this {@link BatchCreateRequest} + */ + public void setInput(@Nonnull final BatchCreateRequestInput input) { + this.input = input; + } + + /** + * Set the output of this {@link BatchCreateRequest} instance and return the same instance. + * + * @param output The output of this {@link BatchCreateRequest} + * @return The same instance of this {@link BatchCreateRequest} class + */ + @Nonnull + public BatchCreateRequest output(@Nonnull final BatchCreateRequestOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output The output of this {@link BatchCreateRequest} instance. + */ + @Nonnull + public BatchCreateRequestOutput getOutput() { + return output; + } + + /** + * Set the output of this {@link BatchCreateRequest} instance. + * + * @param output The output of this {@link BatchCreateRequest} + */ + public void setOutput(@Nonnull final BatchCreateRequestOutput output) { + this.output = output; + } + + /** + * Set the spec of this {@link BatchCreateRequest} instance and return the same instance. + * + * @param spec The spec of this {@link BatchCreateRequest} + * @return The same instance of this {@link BatchCreateRequest} class + */ + @Nonnull + public BatchCreateRequest spec(@Nonnull final BatchCreateRequestSpec spec) { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link BatchCreateRequest} instance. + */ + @Nonnull + public BatchCreateRequestSpec getSpec() { + return spec; + } + + /** + * Set the spec of this {@link BatchCreateRequest} instance. + * + * @param spec The spec of this {@link BatchCreateRequest} + */ + public void setSpec(@Nonnull final BatchCreateRequestSpec spec) { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCreateRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCreateRequest} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("BatchCreateRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCreateRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + if (spec != null) declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCreateRequest} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCreateRequest batchCreateRequest = (BatchCreateRequest) o; + return Objects.equals(this.cloudSdkCustomFields, batchCreateRequest.cloudSdkCustomFields) + && Objects.equals(this.type, batchCreateRequest.type) + && Objects.equals(this.input, batchCreateRequest.input) + && Objects.equals(this.output, batchCreateRequest.output) + && Objects.equals(this.spec, batchCreateRequest.spec); + } + + @Override + public int hashCode() { + return Objects.hash(type, input, output, spec, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCreateRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link BatchCreateRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> + (input) -> + (output) -> + (spec) -> + new BatchCreateRequest().type(type).input(input).output(output).spec(spec); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link BatchCreateRequest} instance. + * + * @param type Type of batch processing + * @return The BatchCreateRequest builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the input of this {@link BatchCreateRequest} instance. + * + * @param input The input of this {@link BatchCreateRequest} + * @return The BatchCreateRequest builder. + */ + Builder2 input(@Nonnull final BatchCreateRequestInput input); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the output of this {@link BatchCreateRequest} instance. + * + * @param output The output of this {@link BatchCreateRequest} + * @return The BatchCreateRequest builder. + */ + Builder3 output(@Nonnull final BatchCreateRequestOutput output); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the spec of this {@link BatchCreateRequest} instance. + * + * @param spec The spec of this {@link BatchCreateRequest} + * @return The BatchCreateRequest instance. + */ + BatchCreateRequest spec(@Nonnull final BatchCreateRequestSpec spec); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestInput.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestInput.java new file mode 100644 index 000000000..f5e8537ef --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestInput.java @@ -0,0 +1,185 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchCreateRequestInput */ +// CHECKSTYLE:OFF +public class BatchCreateRequestInput +// CHECKSTYLE:ON +{ + @JsonProperty("uri") + private String uri; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCreateRequestInput. */ + protected BatchCreateRequestInput() {} + + /** + * Set the uri of this {@link BatchCreateRequestInput} instance and return the same instance. + * + * @param uri Input file URI (must be .jsonl file) + * @return The same instance of this {@link BatchCreateRequestInput} class + */ + @Nonnull + public BatchCreateRequestInput uri(@Nonnull final String uri) { + this.uri = uri; + return this; + } + + /** + * Input file URI (must be .jsonl file) + * + * @return uri The uri of this {@link BatchCreateRequestInput} instance. + */ + @Nonnull + public String getUri() { + return uri; + } + + /** + * Set the uri of this {@link BatchCreateRequestInput} instance. + * + * @param uri Input file URI (must be .jsonl file) + */ + public void setUri(@Nonnull final String uri) { + this.uri = uri; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCreateRequestInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCreateRequestInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchCreateRequestInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCreateRequestInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (uri != null) declaredFields.put("uri", uri); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCreateRequestInput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCreateRequestInput batchCreateRequestInput = (BatchCreateRequestInput) o; + return Objects.equals(this.cloudSdkCustomFields, batchCreateRequestInput.cloudSdkCustomFields) + && Objects.equals(this.uri, batchCreateRequestInput.uri); + } + + @Override + public int hashCode() { + return Objects.hash(uri, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCreateRequestInput {\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * BatchCreateRequestInput} instance with all required arguments. + */ + public static Builder create() { + return (uri) -> new BatchCreateRequestInput().uri(uri); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the uri of this {@link BatchCreateRequestInput} instance. + * + * @param uri Input file URI (must be .jsonl file) + * @return The BatchCreateRequestInput instance. + */ + BatchCreateRequestInput uri(@Nonnull final String uri); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestOutput.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestOutput.java new file mode 100644 index 000000000..257241328 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestOutput.java @@ -0,0 +1,185 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchCreateRequestOutput */ +// CHECKSTYLE:OFF +public class BatchCreateRequestOutput +// CHECKSTYLE:ON +{ + @JsonProperty("uri") + private String uri; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCreateRequestOutput. */ + protected BatchCreateRequestOutput() {} + + /** + * Set the uri of this {@link BatchCreateRequestOutput} instance and return the same instance. + * + * @param uri Output directory URI + * @return The same instance of this {@link BatchCreateRequestOutput} class + */ + @Nonnull + public BatchCreateRequestOutput uri(@Nonnull final String uri) { + this.uri = uri; + return this; + } + + /** + * Output directory URI + * + * @return uri The uri of this {@link BatchCreateRequestOutput} instance. + */ + @Nonnull + public String getUri() { + return uri; + } + + /** + * Set the uri of this {@link BatchCreateRequestOutput} instance. + * + * @param uri Output directory URI + */ + public void setUri(@Nonnull final String uri) { + this.uri = uri; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCreateRequestOutput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCreateRequestOutput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchCreateRequestOutput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCreateRequestOutput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (uri != null) declaredFields.put("uri", uri); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCreateRequestOutput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCreateRequestOutput batchCreateRequestOutput = (BatchCreateRequestOutput) o; + return Objects.equals(this.cloudSdkCustomFields, batchCreateRequestOutput.cloudSdkCustomFields) + && Objects.equals(this.uri, batchCreateRequestOutput.uri); + } + + @Override + public int hashCode() { + return Objects.hash(uri, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCreateRequestOutput {\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * BatchCreateRequestOutput} instance with all required arguments. + */ + public static Builder create() { + return (uri) -> new BatchCreateRequestOutput().uri(uri); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the uri of this {@link BatchCreateRequestOutput} instance. + * + * @param uri Output directory URI + * @return The BatchCreateRequestOutput instance. + */ + BatchCreateRequestOutput uri(@Nonnull final String uri); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestSpec.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestSpec.java new file mode 100644 index 000000000..8261af1b9 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateRequestSpec.java @@ -0,0 +1,233 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Batch job specification */ +// CHECKSTYLE:OFF +public class BatchCreateRequestSpec +// CHECKSTYLE:ON +{ + @JsonProperty("provider") + private String provider; + + @JsonProperty("model") + private String model; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCreateRequestSpec. */ + protected BatchCreateRequestSpec() {} + + /** + * Set the provider of this {@link BatchCreateRequestSpec} instance and return the same instance. + * + * @param provider LLM provider name + * @return The same instance of this {@link BatchCreateRequestSpec} class + */ + @Nonnull + public BatchCreateRequestSpec provider(@Nonnull final String provider) { + this.provider = provider; + return this; + } + + /** + * LLM provider name + * + * @return provider The provider of this {@link BatchCreateRequestSpec} instance. + */ + @Nonnull + public String getProvider() { + return provider; + } + + /** + * Set the provider of this {@link BatchCreateRequestSpec} instance. + * + * @param provider LLM provider name + */ + public void setProvider(@Nonnull final String provider) { + this.provider = provider; + } + + /** + * Set the model of this {@link BatchCreateRequestSpec} instance and return the same instance. + * + * @param model Model name + * @return The same instance of this {@link BatchCreateRequestSpec} class + */ + @Nonnull + public BatchCreateRequestSpec model(@Nonnull final String model) { + this.model = model; + return this; + } + + /** + * Model name + * + * @return model The model of this {@link BatchCreateRequestSpec} instance. + */ + @Nonnull + public String getModel() { + return model; + } + + /** + * Set the model of this {@link BatchCreateRequestSpec} instance. + * + * @param model Model name + */ + public void setModel(@Nonnull final String model) { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCreateRequestSpec}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCreateRequestSpec} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchCreateRequestSpec has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCreateRequestSpec} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (provider != null) declaredFields.put("provider", provider); + if (model != null) declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCreateRequestSpec} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCreateRequestSpec batchCreateRequestSpec = (BatchCreateRequestSpec) o; + return Objects.equals(this.cloudSdkCustomFields, batchCreateRequestSpec.cloudSdkCustomFields) + && Objects.equals(this.provider, batchCreateRequestSpec.provider) + && Objects.equals(this.model, batchCreateRequestSpec.model); + } + + @Override + public int hashCode() { + return Objects.hash(provider, model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCreateRequestSpec {\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link BatchCreateRequestSpec} + * instance with all required arguments. + */ + public static Builder create() { + return (provider) -> (model) -> new BatchCreateRequestSpec().provider(provider).model(model); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the provider of this {@link BatchCreateRequestSpec} instance. + * + * @param provider LLM provider name + * @return The BatchCreateRequestSpec builder. + */ + Builder1 provider(@Nonnull final String provider); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the model of this {@link BatchCreateRequestSpec} instance. + * + * @param model Model name + * @return The BatchCreateRequestSpec instance. + */ + BatchCreateRequestSpec model(@Nonnull final String model); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateResponse.java new file mode 100644 index 000000000..43a2cbb49 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchCreateResponse.java @@ -0,0 +1,284 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchCreateResponse */ +// CHECKSTYLE:OFF +public class BatchCreateResponse +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + @JsonProperty("status") + private String status; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchCreateResponse. */ + protected BatchCreateResponse() {} + + /** + * Set the id of this {@link BatchCreateResponse} instance and return the same instance. + * + * @param id The id of this {@link BatchCreateResponse} + * @return The same instance of this {@link BatchCreateResponse} class + */ + @Nonnull + public BatchCreateResponse id(@Nullable final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link BatchCreateResponse} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link BatchCreateResponse} instance. + * + * @param id The id of this {@link BatchCreateResponse} + */ + public void setId(@Nullable final UUID id) { + this.id = id; + } + + /** + * Set the createdAt of this {@link BatchCreateResponse} instance and return the same instance. + * + * @param createdAt The createdAt of this {@link BatchCreateResponse} + * @return The same instance of this {@link BatchCreateResponse} class + */ + @Nonnull + public BatchCreateResponse createdAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt The createdAt of this {@link BatchCreateResponse} instance. + */ + @Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Set the createdAt of this {@link BatchCreateResponse} instance. + * + * @param createdAt The createdAt of this {@link BatchCreateResponse} + */ + public void setCreatedAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Set the status of this {@link BatchCreateResponse} instance and return the same instance. + * + * @param status The status of this {@link BatchCreateResponse} + * @return The same instance of this {@link BatchCreateResponse} class + */ + @Nonnull + public BatchCreateResponse status(@Nullable final String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link BatchCreateResponse} instance. + */ + @Nonnull + public String getStatus() { + return status; + } + + /** + * Set the status of this {@link BatchCreateResponse} instance. + * + * @param status The status of this {@link BatchCreateResponse} + */ + public void setStatus(@Nullable final String status) { + this.status = status; + } + + /** + * Set the message of this {@link BatchCreateResponse} instance and return the same instance. + * + * @param message The message of this {@link BatchCreateResponse} + * @return The same instance of this {@link BatchCreateResponse} class + */ + @Nonnull + public BatchCreateResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link BatchCreateResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link BatchCreateResponse} instance. + * + * @param message The message of this {@link BatchCreateResponse} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchCreateResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchCreateResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchCreateResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchCreateResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (createdAt != null) declaredFields.put("createdAt", createdAt); + if (status != null) declaredFields.put("status", status); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchCreateResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchCreateResponse batchCreateResponse = (BatchCreateResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchCreateResponse.cloudSdkCustomFields) + && Objects.equals(this.id, batchCreateResponse.id) + && Objects.equals(this.createdAt, batchCreateResponse.createdAt) + && Objects.equals(this.status, batchCreateResponse.status) + && Objects.equals(this.message, batchCreateResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, status, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchCreateResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchCreateResponse} instance. No arguments are required. */ + public static BatchCreateResponse create() { + return new BatchCreateResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDeleteResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDeleteResponse.java new file mode 100644 index 000000000..39174a036 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDeleteResponse.java @@ -0,0 +1,247 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchDeleteResponse */ +// CHECKSTYLE:OFF +public class BatchDeleteResponse +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchDeleteResponse. */ + protected BatchDeleteResponse() {} + + /** + * Set the id of this {@link BatchDeleteResponse} instance and return the same instance. + * + * @param id The id of this {@link BatchDeleteResponse} + * @return The same instance of this {@link BatchDeleteResponse} class + */ + @Nonnull + public BatchDeleteResponse id(@Nullable final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link BatchDeleteResponse} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link BatchDeleteResponse} instance. + * + * @param id The id of this {@link BatchDeleteResponse} + */ + public void setId(@Nullable final UUID id) { + this.id = id; + } + + /** + * Set the createdAt of this {@link BatchDeleteResponse} instance and return the same instance. + * + * @param createdAt The createdAt of this {@link BatchDeleteResponse} + * @return The same instance of this {@link BatchDeleteResponse} class + */ + @Nonnull + public BatchDeleteResponse createdAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt The createdAt of this {@link BatchDeleteResponse} instance. + */ + @Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Set the createdAt of this {@link BatchDeleteResponse} instance. + * + * @param createdAt The createdAt of this {@link BatchDeleteResponse} + */ + public void setCreatedAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Set the message of this {@link BatchDeleteResponse} instance and return the same instance. + * + * @param message The message of this {@link BatchDeleteResponse} + * @return The same instance of this {@link BatchDeleteResponse} class + */ + @Nonnull + public BatchDeleteResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link BatchDeleteResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link BatchDeleteResponse} instance. + * + * @param message The message of this {@link BatchDeleteResponse} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchDeleteResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchDeleteResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchDeleteResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchDeleteResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (createdAt != null) declaredFields.put("createdAt", createdAt); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchDeleteResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchDeleteResponse batchDeleteResponse = (BatchDeleteResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchDeleteResponse.cloudSdkCustomFields) + && Objects.equals(this.id, batchDeleteResponse.id) + && Objects.equals(this.createdAt, batchDeleteResponse.createdAt) + && Objects.equals(this.message, batchDeleteResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchDeleteResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchDeleteResponse} instance. No arguments are required. */ + public static BatchDeleteResponse create() { + return new BatchDeleteResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponse.java new file mode 100644 index 000000000..fa40bde1c --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponse.java @@ -0,0 +1,433 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchDetailResponse */ +// CHECKSTYLE:OFF +public class BatchDetailResponse +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("type") + private String type; + + @JsonProperty("provider") + private String provider; + + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + @JsonProperty("input") + private BatchDetailResponseInput input; + + @JsonProperty("output") + private BatchDetailResponseInput output; + + @JsonProperty("spec") + private Object spec; + + @JsonProperty("status") + private BatchDetailResponseStatus status; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchDetailResponse. */ + protected BatchDetailResponse() {} + + /** + * Set the id of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param id The id of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse id(@Nullable final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link BatchDetailResponse} instance. + * + * @param id The id of this {@link BatchDetailResponse} + */ + public void setId(@Nullable final UUID id) { + this.id = id; + } + + /** + * Set the type of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param type The type of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse type(@Nullable final String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public String getType() { + return type; + } + + /** + * Set the type of this {@link BatchDetailResponse} instance. + * + * @param type The type of this {@link BatchDetailResponse} + */ + public void setType(@Nullable final String type) { + this.type = type; + } + + /** + * Set the provider of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param provider The provider of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse provider(@Nullable final String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * + * @return provider The provider of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public String getProvider() { + return provider; + } + + /** + * Set the provider of this {@link BatchDetailResponse} instance. + * + * @param provider The provider of this {@link BatchDetailResponse} + */ + public void setProvider(@Nullable final String provider) { + this.provider = provider; + } + + /** + * Set the createdAt of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param createdAt The createdAt of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse createdAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt The createdAt of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Set the createdAt of this {@link BatchDetailResponse} instance. + * + * @param createdAt The createdAt of this {@link BatchDetailResponse} + */ + public void setCreatedAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Set the input of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param input The input of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse input(@Nullable final BatchDetailResponseInput input) { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public BatchDetailResponseInput getInput() { + return input; + } + + /** + * Set the input of this {@link BatchDetailResponse} instance. + * + * @param input The input of this {@link BatchDetailResponse} + */ + public void setInput(@Nullable final BatchDetailResponseInput input) { + this.input = input; + } + + /** + * Set the output of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param output The output of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse output(@Nullable final BatchDetailResponseInput output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output The output of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public BatchDetailResponseInput getOutput() { + return output; + } + + /** + * Set the output of this {@link BatchDetailResponse} instance. + * + * @param output The output of this {@link BatchDetailResponse} + */ + public void setOutput(@Nullable final BatchDetailResponseInput output) { + this.output = output; + } + + /** + * Set the spec of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param spec The spec of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse spec(@Nullable final Object spec) { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public Object getSpec() { + return spec; + } + + /** + * Set the spec of this {@link BatchDetailResponse} instance. + * + * @param spec The spec of this {@link BatchDetailResponse} + */ + public void setSpec(@Nullable final Object spec) { + this.spec = spec; + } + + /** + * Set the status of this {@link BatchDetailResponse} instance and return the same instance. + * + * @param status The status of this {@link BatchDetailResponse} + * @return The same instance of this {@link BatchDetailResponse} class + */ + @Nonnull + public BatchDetailResponse status(@Nullable final BatchDetailResponseStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link BatchDetailResponse} instance. + */ + @Nonnull + public BatchDetailResponseStatus getStatus() { + return status; + } + + /** + * Set the status of this {@link BatchDetailResponse} instance. + * + * @param status The status of this {@link BatchDetailResponse} + */ + public void setStatus(@Nullable final BatchDetailResponseStatus status) { + this.status = status; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchDetailResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchDetailResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchDetailResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchDetailResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (type != null) declaredFields.put("type", type); + if (provider != null) declaredFields.put("provider", provider); + if (createdAt != null) declaredFields.put("createdAt", createdAt); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + if (spec != null) declaredFields.put("spec", spec); + if (status != null) declaredFields.put("status", status); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchDetailResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchDetailResponse batchDetailResponse = (BatchDetailResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchDetailResponse.cloudSdkCustomFields) + && Objects.equals(this.id, batchDetailResponse.id) + && Objects.equals(this.type, batchDetailResponse.type) + && Objects.equals(this.provider, batchDetailResponse.provider) + && Objects.equals(this.createdAt, batchDetailResponse.createdAt) + && Objects.equals(this.input, batchDetailResponse.input) + && Objects.equals(this.output, batchDetailResponse.output) + && Objects.equals(this.spec, batchDetailResponse.spec) + && Objects.equals(this.status, batchDetailResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash( + id, type, provider, createdAt, input, output, spec, status, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchDetailResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchDetailResponse} instance. No arguments are required. */ + public static BatchDetailResponse create() { + return new BatchDetailResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseInput.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseInput.java new file mode 100644 index 000000000..e51d28cec --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseInput.java @@ -0,0 +1,171 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchDetailResponseInput */ +// CHECKSTYLE:OFF +public class BatchDetailResponseInput +// CHECKSTYLE:ON +{ + @JsonProperty("uri") + private String uri; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchDetailResponseInput. */ + protected BatchDetailResponseInput() {} + + /** + * Set the uri of this {@link BatchDetailResponseInput} instance and return the same instance. + * + * @param uri The uri of this {@link BatchDetailResponseInput} + * @return The same instance of this {@link BatchDetailResponseInput} class + */ + @Nonnull + public BatchDetailResponseInput uri(@Nullable final String uri) { + this.uri = uri; + return this; + } + + /** + * Get uri + * + * @return uri The uri of this {@link BatchDetailResponseInput} instance. + */ + @Nonnull + public String getUri() { + return uri; + } + + /** + * Set the uri of this {@link BatchDetailResponseInput} instance. + * + * @param uri The uri of this {@link BatchDetailResponseInput} + */ + public void setUri(@Nullable final String uri) { + this.uri = uri; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchDetailResponseInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchDetailResponseInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchDetailResponseInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchDetailResponseInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (uri != null) declaredFields.put("uri", uri); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchDetailResponseInput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchDetailResponseInput batchDetailResponseInput = (BatchDetailResponseInput) o; + return Objects.equals(this.cloudSdkCustomFields, batchDetailResponseInput.cloudSdkCustomFields) + && Objects.equals(this.uri, batchDetailResponseInput.uri); + } + + @Override + public int hashCode() { + return Objects.hash(uri, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchDetailResponseInput {\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchDetailResponseInput} instance. No arguments are required. */ + public static BatchDetailResponseInput create() { + return new BatchDetailResponseInput(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseStatus.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseStatus.java new file mode 100644 index 000000000..8fe0d3843 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchDetailResponseStatus.java @@ -0,0 +1,287 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchDetailResponseStatus */ +// CHECKSTYLE:OFF +public class BatchDetailResponseStatus +// CHECKSTYLE:ON +{ + @JsonProperty("current_status") + private String currentStatus; + + @JsonProperty("target_status") + private String targetStatus; + + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchDetailResponseStatus. */ + protected BatchDetailResponseStatus() {} + + /** + * Set the currentStatus of this {@link BatchDetailResponseStatus} instance and return the same + * instance. + * + * @param currentStatus The currentStatus of this {@link BatchDetailResponseStatus} + * @return The same instance of this {@link BatchDetailResponseStatus} class + */ + @Nonnull + public BatchDetailResponseStatus currentStatus(@Nullable final String currentStatus) { + this.currentStatus = currentStatus; + return this; + } + + /** + * Get currentStatus + * + * @return currentStatus The currentStatus of this {@link BatchDetailResponseStatus} instance. + */ + @Nonnull + public String getCurrentStatus() { + return currentStatus; + } + + /** + * Set the currentStatus of this {@link BatchDetailResponseStatus} instance. + * + * @param currentStatus The currentStatus of this {@link BatchDetailResponseStatus} + */ + public void setCurrentStatus(@Nullable final String currentStatus) { + this.currentStatus = currentStatus; + } + + /** + * Set the targetStatus of this {@link BatchDetailResponseStatus} instance and return the same + * instance. + * + * @param targetStatus The targetStatus of this {@link BatchDetailResponseStatus} + * @return The same instance of this {@link BatchDetailResponseStatus} class + */ + @Nonnull + public BatchDetailResponseStatus targetStatus(@Nullable final String targetStatus) { + this.targetStatus = targetStatus; + return this; + } + + /** + * Get targetStatus + * + * @return targetStatus The targetStatus of this {@link BatchDetailResponseStatus} instance. + */ + @Nonnull + public String getTargetStatus() { + return targetStatus; + } + + /** + * Set the targetStatus of this {@link BatchDetailResponseStatus} instance. + * + * @param targetStatus The targetStatus of this {@link BatchDetailResponseStatus} + */ + public void setTargetStatus(@Nullable final String targetStatus) { + this.targetStatus = targetStatus; + } + + /** + * Set the updatedAt of this {@link BatchDetailResponseStatus} instance and return the same + * instance. + * + * @param updatedAt The updatedAt of this {@link BatchDetailResponseStatus} + * @return The same instance of this {@link BatchDetailResponseStatus} class + */ + @Nonnull + public BatchDetailResponseStatus updatedAt(@Nullable final OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * + * @return updatedAt The updatedAt of this {@link BatchDetailResponseStatus} instance. + */ + @Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Set the updatedAt of this {@link BatchDetailResponseStatus} instance. + * + * @param updatedAt The updatedAt of this {@link BatchDetailResponseStatus} + */ + public void setUpdatedAt(@Nullable final OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * Set the message of this {@link BatchDetailResponseStatus} instance and return the same + * instance. + * + * @param message The message of this {@link BatchDetailResponseStatus} + * @return The same instance of this {@link BatchDetailResponseStatus} class + */ + @Nonnull + public BatchDetailResponseStatus message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link BatchDetailResponseStatus} instance. + */ + @Nullable + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link BatchDetailResponseStatus} instance. + * + * @param message The message of this {@link BatchDetailResponseStatus} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchDetailResponseStatus}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchDetailResponseStatus} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchDetailResponseStatus has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchDetailResponseStatus} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (currentStatus != null) declaredFields.put("currentStatus", currentStatus); + if (targetStatus != null) declaredFields.put("targetStatus", targetStatus); + if (updatedAt != null) declaredFields.put("updatedAt", updatedAt); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchDetailResponseStatus} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchDetailResponseStatus batchDetailResponseStatus = (BatchDetailResponseStatus) o; + return Objects.equals(this.cloudSdkCustomFields, batchDetailResponseStatus.cloudSdkCustomFields) + && Objects.equals(this.currentStatus, batchDetailResponseStatus.currentStatus) + && Objects.equals(this.targetStatus, batchDetailResponseStatus.targetStatus) + && Objects.equals(this.updatedAt, batchDetailResponseStatus.updatedAt) + && Objects.equals(this.message, batchDetailResponseStatus.message); + } + + @Override + public int hashCode() { + return Objects.hash(currentStatus, targetStatus, updatedAt, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchDetailResponseStatus {\n"); + sb.append(" currentStatus: ").append(toIndentedString(currentStatus)).append("\n"); + sb.append(" targetStatus: ").append(toIndentedString(targetStatus)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchDetailResponseStatus} instance. No arguments are required. */ + public static BatchDetailResponseStatus create() { + return new BatchDetailResponseStatus(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponse.java new file mode 100644 index 000000000..5fcd8beeb --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponse.java @@ -0,0 +1,226 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchListResponse */ +// CHECKSTYLE:OFF +public class BatchListResponse +// CHECKSTYLE:ON +{ + @JsonProperty("count") + private Integer count; + + @JsonProperty("resources") + private List resources = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchListResponse. */ + protected BatchListResponse() {} + + /** + * Set the count of this {@link BatchListResponse} instance and return the same instance. + * + * @param count The count of this {@link BatchListResponse} + * @return The same instance of this {@link BatchListResponse} class + */ + @Nonnull + public BatchListResponse count(@Nullable final Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link BatchListResponse} instance. + */ + @Nonnull + public Integer getCount() { + return count; + } + + /** + * Set the count of this {@link BatchListResponse} instance. + * + * @param count The count of this {@link BatchListResponse} + */ + public void setCount(@Nullable final Integer count) { + this.count = count; + } + + /** + * Set the resources of this {@link BatchListResponse} instance and return the same instance. + * + * @param resources The resources of this {@link BatchListResponse} + * @return The same instance of this {@link BatchListResponse} class + */ + @Nonnull + public BatchListResponse resources( + @Nullable final List resources) { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link BatchListResponse}. + * + * @param resourcesItem The resources that should be added + * @return The same instance of type {@link BatchListResponse} + */ + @Nonnull + public BatchListResponse addResourcesItem( + @Nonnull final BatchListResponseResourcesInner resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link BatchListResponse} instance. + */ + @Nonnull + public List getResources() { + return resources; + } + + /** + * Set the resources of this {@link BatchListResponse} instance. + * + * @param resources The resources of this {@link BatchListResponse} + */ + public void setResources(@Nullable final List resources) { + this.resources = resources; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchListResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchListResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("BatchListResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchListResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (count != null) declaredFields.put("count", count); + if (resources != null) declaredFields.put("resources", resources); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchListResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchListResponse batchListResponse = (BatchListResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchListResponse.cloudSdkCustomFields) + && Objects.equals(this.count, batchListResponse.count) + && Objects.equals(this.resources, batchListResponse.resources); + } + + @Override + public int hashCode() { + return Objects.hash(count, resources, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchListResponse {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchListResponse} instance. No arguments are required. */ + public static BatchListResponse create() { + return new BatchListResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponseResourcesInner.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponseResourcesInner.java new file mode 100644 index 000000000..04da2b794 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchListResponseResourcesInner.java @@ -0,0 +1,330 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchListResponseResourcesInner */ +// CHECKSTYLE:OFF +public class BatchListResponseResourcesInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("type") + private String type; + + @JsonProperty("provider") + private String provider; + + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + @JsonProperty("status") + private String status; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchListResponseResourcesInner. */ + protected BatchListResponseResourcesInner() {} + + /** + * Set the id of this {@link BatchListResponseResourcesInner} instance and return the same + * instance. + * + * @param id The id of this {@link BatchListResponseResourcesInner} + * @return The same instance of this {@link BatchListResponseResourcesInner} class + */ + @Nonnull + public BatchListResponseResourcesInner id(@Nullable final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link BatchListResponseResourcesInner} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link BatchListResponseResourcesInner} instance. + * + * @param id The id of this {@link BatchListResponseResourcesInner} + */ + public void setId(@Nullable final UUID id) { + this.id = id; + } + + /** + * Set the type of this {@link BatchListResponseResourcesInner} instance and return the same + * instance. + * + * @param type The type of this {@link BatchListResponseResourcesInner} + * @return The same instance of this {@link BatchListResponseResourcesInner} class + */ + @Nonnull + public BatchListResponseResourcesInner type(@Nullable final String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link BatchListResponseResourcesInner} instance. + */ + @Nonnull + public String getType() { + return type; + } + + /** + * Set the type of this {@link BatchListResponseResourcesInner} instance. + * + * @param type The type of this {@link BatchListResponseResourcesInner} + */ + public void setType(@Nullable final String type) { + this.type = type; + } + + /** + * Set the provider of this {@link BatchListResponseResourcesInner} instance and return the same + * instance. + * + * @param provider The provider of this {@link BatchListResponseResourcesInner} + * @return The same instance of this {@link BatchListResponseResourcesInner} class + */ + @Nonnull + public BatchListResponseResourcesInner provider(@Nullable final String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * + * @return provider The provider of this {@link BatchListResponseResourcesInner} instance. + */ + @Nonnull + public String getProvider() { + return provider; + } + + /** + * Set the provider of this {@link BatchListResponseResourcesInner} instance. + * + * @param provider The provider of this {@link BatchListResponseResourcesInner} + */ + public void setProvider(@Nullable final String provider) { + this.provider = provider; + } + + /** + * Set the createdAt of this {@link BatchListResponseResourcesInner} instance and return the same + * instance. + * + * @param createdAt The createdAt of this {@link BatchListResponseResourcesInner} + * @return The same instance of this {@link BatchListResponseResourcesInner} class + */ + @Nonnull + public BatchListResponseResourcesInner createdAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt The createdAt of this {@link BatchListResponseResourcesInner} instance. + */ + @Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Set the createdAt of this {@link BatchListResponseResourcesInner} instance. + * + * @param createdAt The createdAt of this {@link BatchListResponseResourcesInner} + */ + public void setCreatedAt(@Nullable final OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * Set the status of this {@link BatchListResponseResourcesInner} instance and return the same + * instance. + * + * @param status The status of this {@link BatchListResponseResourcesInner} + * @return The same instance of this {@link BatchListResponseResourcesInner} class + */ + @Nonnull + public BatchListResponseResourcesInner status(@Nullable final String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link BatchListResponseResourcesInner} instance. + */ + @Nonnull + public String getStatus() { + return status; + } + + /** + * Set the status of this {@link BatchListResponseResourcesInner} instance. + * + * @param status The status of this {@link BatchListResponseResourcesInner} + */ + public void setStatus(@Nullable final String status) { + this.status = status; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchListResponseResourcesInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchListResponseResourcesInner} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchListResponseResourcesInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchListResponseResourcesInner} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (type != null) declaredFields.put("type", type); + if (provider != null) declaredFields.put("provider", provider); + if (createdAt != null) declaredFields.put("createdAt", createdAt); + if (status != null) declaredFields.put("status", status); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchListResponseResourcesInner} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchListResponseResourcesInner batchListResponseResourcesInner = + (BatchListResponseResourcesInner) o; + return Objects.equals( + this.cloudSdkCustomFields, batchListResponseResourcesInner.cloudSdkCustomFields) + && Objects.equals(this.id, batchListResponseResourcesInner.id) + && Objects.equals(this.type, batchListResponseResourcesInner.type) + && Objects.equals(this.provider, batchListResponseResourcesInner.provider) + && Objects.equals(this.createdAt, batchListResponseResourcesInner.createdAt) + && Objects.equals(this.status, batchListResponseResourcesInner.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, provider, createdAt, status, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchListResponseResourcesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchListResponseResourcesInner} instance. No arguments are required. */ + public static BatchListResponseResourcesInner create() { + return new BatchListResponseResourcesInner(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchStatusResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchStatusResponse.java new file mode 100644 index 000000000..16524c15b --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/BatchStatusResponse.java @@ -0,0 +1,284 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** BatchStatusResponse */ +// CHECKSTYLE:OFF +public class BatchStatusResponse +// CHECKSTYLE:ON +{ + @JsonProperty("current_status") + private String currentStatus; + + @JsonProperty("target_status") + private String targetStatus; + + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BatchStatusResponse. */ + protected BatchStatusResponse() {} + + /** + * Set the currentStatus of this {@link BatchStatusResponse} instance and return the same + * instance. + * + * @param currentStatus The currentStatus of this {@link BatchStatusResponse} + * @return The same instance of this {@link BatchStatusResponse} class + */ + @Nonnull + public BatchStatusResponse currentStatus(@Nullable final String currentStatus) { + this.currentStatus = currentStatus; + return this; + } + + /** + * Get currentStatus + * + * @return currentStatus The currentStatus of this {@link BatchStatusResponse} instance. + */ + @Nonnull + public String getCurrentStatus() { + return currentStatus; + } + + /** + * Set the currentStatus of this {@link BatchStatusResponse} instance. + * + * @param currentStatus The currentStatus of this {@link BatchStatusResponse} + */ + public void setCurrentStatus(@Nullable final String currentStatus) { + this.currentStatus = currentStatus; + } + + /** + * Set the targetStatus of this {@link BatchStatusResponse} instance and return the same instance. + * + * @param targetStatus The targetStatus of this {@link BatchStatusResponse} + * @return The same instance of this {@link BatchStatusResponse} class + */ + @Nonnull + public BatchStatusResponse targetStatus(@Nullable final String targetStatus) { + this.targetStatus = targetStatus; + return this; + } + + /** + * Get targetStatus + * + * @return targetStatus The targetStatus of this {@link BatchStatusResponse} instance. + */ + @Nonnull + public String getTargetStatus() { + return targetStatus; + } + + /** + * Set the targetStatus of this {@link BatchStatusResponse} instance. + * + * @param targetStatus The targetStatus of this {@link BatchStatusResponse} + */ + public void setTargetStatus(@Nullable final String targetStatus) { + this.targetStatus = targetStatus; + } + + /** + * Set the updatedAt of this {@link BatchStatusResponse} instance and return the same instance. + * + * @param updatedAt The updatedAt of this {@link BatchStatusResponse} + * @return The same instance of this {@link BatchStatusResponse} class + */ + @Nonnull + public BatchStatusResponse updatedAt(@Nullable final OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * + * @return updatedAt The updatedAt of this {@link BatchStatusResponse} instance. + */ + @Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Set the updatedAt of this {@link BatchStatusResponse} instance. + * + * @param updatedAt The updatedAt of this {@link BatchStatusResponse} + */ + public void setUpdatedAt(@Nullable final OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * Set the message of this {@link BatchStatusResponse} instance and return the same instance. + * + * @param message The message of this {@link BatchStatusResponse} + * @return The same instance of this {@link BatchStatusResponse} class + */ + @Nonnull + public BatchStatusResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link BatchStatusResponse} instance. + */ + @Nullable + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link BatchStatusResponse} instance. + * + * @param message The message of this {@link BatchStatusResponse} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link BatchStatusResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BatchStatusResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "BatchStatusResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BatchStatusResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (currentStatus != null) declaredFields.put("currentStatus", currentStatus); + if (targetStatus != null) declaredFields.put("targetStatus", targetStatus); + if (updatedAt != null) declaredFields.put("updatedAt", updatedAt); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BatchStatusResponse} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final BatchStatusResponse batchStatusResponse = (BatchStatusResponse) o; + return Objects.equals(this.cloudSdkCustomFields, batchStatusResponse.cloudSdkCustomFields) + && Objects.equals(this.currentStatus, batchStatusResponse.currentStatus) + && Objects.equals(this.targetStatus, batchStatusResponse.targetStatus) + && Objects.equals(this.updatedAt, batchStatusResponse.updatedAt) + && Objects.equals(this.message, batchStatusResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(currentStatus, targetStatus, updatedAt, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BatchStatusResponse {\n"); + sb.append(" currentStatus: ").append(toIndentedString(currentStatus)).append("\n"); + sb.append(" targetStatus: ").append(toIndentedString(targetStatus)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link BatchStatusResponse} instance. No arguments are required. */ + public static BatchStatusResponse create() { + return new BatchStatusResponse(); + } +} diff --git a/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/ErrorResponse.java b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/ErrorResponse.java new file mode 100644 index 000000000..68864c4a2 --- /dev/null +++ b/core-services/batch/src/main/java/com/sap/ai/sdk/batch/generated/model/ErrorResponse.java @@ -0,0 +1,232 @@ +/* + * LLM Batch Service API + * The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.batch.generated.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** ErrorResponse */ +// CHECKSTYLE:OFF +public class ErrorResponse +// CHECKSTYLE:ON +{ + @JsonProperty("request_id") + private String requestId; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ErrorResponse. */ + protected ErrorResponse() {} + + /** + * Set the requestId of this {@link ErrorResponse} instance and return the same instance. + * + * @param requestId Unique identifier for the request, used for tracing. + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse requestId(@Nonnull final String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Unique identifier for the request, used for tracing. + * + * @return requestId The requestId of this {@link ErrorResponse} instance. + */ + @Nonnull + public String getRequestId() { + return requestId; + } + + /** + * Set the requestId of this {@link ErrorResponse} instance. + * + * @param requestId Unique identifier for the request, used for tracing. + */ + public void setRequestId(@Nonnull final String requestId) { + this.requestId = requestId; + } + + /** + * Set the message of this {@link ErrorResponse} instance and return the same instance. + * + * @param message A human-readable error message. + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * A human-readable error message. + * + * @return message The message of this {@link ErrorResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ErrorResponse} instance. + * + * @param message A human-readable error message. + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("ErrorResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (requestId != null) declaredFields.put("requestId", requestId); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.cloudSdkCustomFields, errorResponse.cloudSdkCustomFields) + && Objects.equals(this.requestId, errorResponse.requestId) + && Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(requestId, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link ErrorResponse} instance + * with all required arguments. + */ + public static Builder create() { + return (requestId) -> (message) -> new ErrorResponse().requestId(requestId).message(message); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the requestId of this {@link ErrorResponse} instance. + * + * @param requestId Unique identifier for the request, used for tracing. + * @return The ErrorResponse builder. + */ + Builder1 requestId(@Nonnull final String requestId); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the message of this {@link ErrorResponse} instance. + * + * @param message A human-readable error message. + * @return The ErrorResponse instance. + */ + ErrorResponse message(@Nonnull final String message); + } +} diff --git a/core-services/batch/src/main/resources/spec/batch-service.yaml b/core-services/batch/src/main/resources/spec/batch-service.yaml new file mode 100644 index 000000000..9adf5e826 --- /dev/null +++ b/core-services/batch/src/main/resources/spec/batch-service.yaml @@ -0,0 +1,510 @@ +openapi: 3.0.0 +info: + title: LLM Batch Service API + description: The LLM Batch Service enables asynchronous, large-scale processing of LLM requests through SAP AI Core. Instead of making individual inference calls, users can submit a batch of requests as a JSONL file stored in an object store, and the service processes them in the background. The batch job will be completed in a 24h time window and the results will be stored in the provided object store. + version: 0.0.1 +x-sap-shortText: Process large-scale LLM requests asynchronously in batch mode. +externalDocs: + description: SAP AI Core - Generative AI Hub documentation + url: https://help.sap.com/docs/sap-ai-core/generative-ai/generative-ai-hub +servers: + - url: https://api.ai.{region}.ml.hana.ondemand.com/v2 + description: Production endpoint for SAP AI Core + variables: + region: + enum: + - prod.eu-central-1.aws + - prodeuonly.eu-central-1.aws + - prod-eu20.westeurope.azure + - prod-eu30.europe-west3.gcp + - prod.us-east-1.aws + - prod-us21.eastus.azure + - prod-us30.us-central1.gcp + default: prod.eu-central-1.aws + +paths: + /llm-batch-service/v1/batches: + post: + summary: Create a new batch job + description: Create a new LLM batch processing job. The batch job processes input data from the specified URI and writes results to the output URI. + operationId: batch_service.controller.batch_controller.create_batch + x-sap-cloud-sdk-operation-name: createBatch + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BatchCreateRequest' + responses: + '202': + description: Batch job scheduled + content: + application/json: + schema: + $ref: '#/components/schemas/BatchCreateResponse' + example: + id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + created_at: "2026-04-30T10:00:00Z" + status: "PENDING" + message: "Batch job scheduled" + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Input URI must point to a .jsonl file" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + + get: + summary: List all batches + description: Retrieve a list of all batch processing jobs for the current tenant. + operationId: batch_service.controller.batch_controller.list_batches + x-sap-cloud-sdk-operation-name: listBatches + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + responses: + '200': + description: List of batches + content: + application/json: + schema: + $ref: '#/components/schemas/BatchListResponse' + example: + count: 2 + resources: + - id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: "llm-native" + provider: "azure-openai" + created_at: "2026-04-30T10:00:00Z" + status: "COMPLETED" + - id: "b2c3d4e5-f6a7-8901-bcde-f12345678901" + type: "llm-native" + provider: "azure-openai" + created_at: "2026-04-30T11:00:00Z" + status: "RUNNING" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + + /llm-batch-service/v1/batches/{batch_id}: + get: + summary: Get Batch job details + description: Retrieve the details of a specific batch processing job, including its configuration and current status. + operationId: batch_service.controller.batch_controller.get_batch_by_id + x-sap-cloud-sdk-operation-name: getBatchById + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + - name: batch_id + in: path + required: true + description: The unique identifier of the batch job. + schema: + type: string + format: uuid + responses: + '200': + description: Batch job details + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDetailResponse' + example: + id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: "llm-native" + provider: "azure-openai" + created_at: "2026-04-30T10:00:00Z" + input: + uri: "ai://my-object-store/input/batch-input.jsonl" + output: + uri: "ai://my-object-store/output/" + spec: + model: "gpt-4.1-mini" + status: + current_status: "COMPLETED" + target_status: "COMPLETED" + updated_at: "2026-04-30T12:00:00Z" + message: null + '404': + description: Batch job not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Batch job not found" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + + delete: + summary: Delete a Batch job (only for cancelled, completed, or failed batches) + description: Delete a batch processing job. Only batches in a terminal state (cancelled, completed, or failed) can be deleted. + operationId: batch_service.controller.batch_controller.delete_batch + x-sap-cloud-sdk-operation-name: deleteBatch + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + - name: batch_id + in: path + required: true + description: The unique identifier of the batch job. + schema: + type: string + format: uuid + responses: + '202': + description: Batch job deleted + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDeleteResponse' + example: + id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + created_at: "2026-04-30T10:00:00Z" + message: "Batch job deleted successfully" + '400': + description: Bad request - Batch job not in deletable state + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Batch job can only be deleted when in CANCELLED, COMPLETED, FAILED state. Current status: RUNNING" + '404': + description: Batch job not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Batch job not found" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + + /llm-batch-service/v1/batches/{batch_id}/status: + get: + summary: Get Batch job status + description: Retrieve the current status of a specific batch processing job. + operationId: batch_service.controller.batch_controller.get_batch_status + x-sap-cloud-sdk-operation-name: getBatchStatus + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + - name: batch_id + in: path + required: true + description: The unique identifier of the batch job. + schema: + type: string + format: uuid + responses: + '200': + description: Batch job status + content: + application/json: + schema: + $ref: '#/components/schemas/BatchStatusResponse' + example: + current_status: "RUNNING" + target_status: "COMPLETED" + updated_at: "2026-04-30T11:30:00Z" + message: null + '404': + description: Batch job not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Batch job not found" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + + /llm-batch-service/v1/batches/{batch_id}/cancel: + patch: + summary: Cancel a batch + description: Cancel a batch processing job that is currently in progress. The batch will be scheduled for cancellation. + operationId: batch_service.controller.batch_controller.cancel_batch + x-sap-cloud-sdk-operation-name: cancelBatch + tags: + - Batches + parameters: + - $ref: '#/components/parameters/ResourceGroup' + - name: batch_id + in: path + required: true + description: The unique identifier of the batch job. + schema: + type: string + format: uuid + responses: + '202': + description: Batch job scheduled for cancellation + content: + application/json: + schema: + $ref: '#/components/schemas/BatchCancelResponse' + example: + id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + created_at: "2026-04-30T10:00:00Z" + message: "Batch job scheduled for cancellation" + '404': + description: Batch job not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Batch job not found" + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: "Internal Server Error" + +components: + parameters: + ResourceGroup: + name: AI-Resource-Group + in: header + required: true + schema: + type: string + description: Specify the resource group to use for the request + securitySchemes: + Oauth2: + type: oauth2 + description: OAuth client credentials (client ID and secret) are required. These + can be requested from SAP BTP cloud cockpit. + flows: + clientCredentials: + tokenUrl: https://(subdomain_identity_zone).authentication.(host)/oauth/token + scopes: {} + schemas: + BatchCreateRequest: + type: object + required: + - type + - input + - output + - spec + properties: + type: + type: string + enum: [llm-native] + description: Type of batch processing + input: + type: object + required: + - uri + properties: + uri: + type: string + description: Input file URI (must be .jsonl file) + output: + type: object + required: + - uri + properties: + uri: + type: string + description: Output directory URI + spec: + type: object + description: Batch job specification + required: + - provider + - model + properties: + provider: + type: string + description: LLM provider name + model: + type: string + description: Model name + + BatchCreateResponse: + type: object + properties: + id: + type: string + format: uuid + created_at: + type: string + format: date-time + nullable: true + status: + type: string + message: + type: string + + BatchListResponse: + type: object + properties: + count: + type: integer + resources: + type: array + items: + type: object + properties: + id: + type: string + format: uuid + type: + type: string + provider: + type: string + created_at: + type: string + format: date-time + status: + type: string + + BatchDetailResponse: + type: object + properties: + id: + type: string + format: uuid + type: + type: string + provider: + type: string + created_at: + type: string + format: date-time + input: + type: object + properties: + uri: + type: string + output: + type: object + properties: + uri: + type: string + spec: + type: object + status: + type: object + properties: + current_status: + type: string + target_status: + type: string + updated_at: + type: string + format: date-time + message: + type: string + nullable: true + + BatchStatusResponse: + type: object + properties: + current_status: + type: string + target_status: + type: string + updated_at: + type: string + format: date-time + message: + type: string + nullable: true + + BatchCancelResponse: + type: object + properties: + id: + type: string + format: uuid + created_at: + type: string + format: date-time + message: + type: string + + BatchDeleteResponse: + type: object + properties: + id: + type: string + format: uuid + created_at: + type: string + format: date-time + message: + type: string + + ErrorResponse: + type: object + required: + - request_id + - message + properties: + request_id: + type: string + description: Unique identifier for the request, used for tracing. + example: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + message: + type: string + description: A human-readable error message. + example: "Input URI must point to a .jsonl file" diff --git a/core-services/batch/src/test/java/com/sap/ai/sdk/batch/BatchUnitTest.java b/core-services/batch/src/test/java/com/sap/ai/sdk/batch/BatchUnitTest.java new file mode 100644 index 000000000..44a97bc5b --- /dev/null +++ b/core-services/batch/src/test/java/com/sap/ai/sdk/batch/BatchUnitTest.java @@ -0,0 +1,176 @@ +package com.sap.ai.sdk.batch; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.sap.ai.sdk.batch.generated.model.BatchCreateRequest.TypeEnum.LLM_NATIVE; +import static org.assertj.core.api.Assertions.assertThat; + +import com.sap.ai.sdk.batch.generated.client.BatchesApi; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequest; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestInput; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestOutput; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestSpec; +import java.util.UUID; +import lombok.val; +import org.apache.hc.core5.http.HttpStatus; +import org.junit.jupiter.api.Test; + +/** + * Test that queries are on the right URL, with the right headers. Also check that the received + * response is parsed correctly in the generated client. + */ +class BatchUnitTest extends WireMockTestServerBatch { + private static final String AI_RESOURCE_GROUP = "ai-sdk-java-e2e"; + private static final UUID BATCH_ID = UUID.fromString("89307094-2cc9-4ef1-9e1b-0fe0733aeb3e"); + private static final UUID NEW_BATCH_ID = UUID.fromString("27126ef7-d176-4f29-84db-2d64c001ad63"); + + @Test + void testList() { + wireMockServer.stubFor( + get(urlPathEqualTo("/v2/llm-batch-service/v1/batches")) + .withHeader("AI-Resource-Group", equalTo(AI_RESOURCE_GROUP)) + .willReturn( + aResponse() + .withStatus(HttpStatus.SC_OK) + .withHeader("content-type", "application/json") + .withBody( + """ + { + "count": 1, + "resources": [ + { + "id": "89307094-2cc9-4ef1-9e1b-0fe0733aeb3e", + "type": "llm-native", + "provider": "azure-openai", + "created_at": "2026-05-06T13:04:39.732861Z", + "status": "COMPLETED" + } + ] + } + """))); + + val batchList = new BatchesApi(aiCoreService).listBatches(AI_RESOURCE_GROUP); + + assertThat(batchList.getCount()).isEqualTo(1); + assertThat(batchList.getResources()).hasSize(1); + + val batch = batchList.getResources().get(0); + + assertThat(batch.getId()).isEqualTo(BATCH_ID); + assertThat(batch.getType()).isEqualTo("llm-native"); + assertThat(batch.getProvider()).isEqualTo("azure-openai"); + assertThat(batch.getCreatedAt()).isEqualTo("2026-05-06T13:04:39.732861Z"); + assertThat(batch.getStatus()).isEqualTo("COMPLETED"); + } + + @Test + void testGet() { + wireMockServer.stubFor( + get(urlPathEqualTo("/v2/llm-batch-service/v1/batches/" + BATCH_ID)) + .withHeader("AI-Resource-Group", equalTo(AI_RESOURCE_GROUP)) + .willReturn( + aResponse() + .withStatus(HttpStatus.SC_OK) + .withHeader("content-type", "application/json") + .withBody( + """ + { + "id": "27126ef7-d176-4f29-84db-2d64c001ad63", + "type": "llm-native", + "provider": "azure-openai", + "created_at": "2026-05-06T13:56:19.257546Z", + "input": { + "uri": "ai://s3secret/input-batch.jsonl" + }, + "output": { + "uri": "ai://s3secret/" + }, + "spec": { + "model": "gpt-4.1" + }, + "status": { + "current_status": "PENDING", + "target_status": "COMPLETED", + "updated_at": "2026-05-06T13:56:19.257546Z", + "message": null + } + } + """))); + + val batch = new BatchesApi(aiCoreService).getBatchById(AI_RESOURCE_GROUP, BATCH_ID); + + assertThat(batch).isNotNull(); + assertThat(batch.getId()).isEqualTo(NEW_BATCH_ID); + assertThat(batch.getType()).isEqualTo("llm-native"); + assertThat(batch.getProvider()).isEqualTo("azure-openai"); + assertThat(batch.getCreatedAt()).isEqualTo("2026-05-06T13:56:19.257546Z"); + assertThat(batch.getStatus().getCurrentStatus()).isEqualTo("PENDING"); + assertThat(batch.getInput().getUri()).isEqualTo("ai://s3secret/input-batch.jsonl"); + assertThat(batch.getOutput().getUri()).isEqualTo("ai://s3secret/"); + assertThat(batch.getSpec()).isNotNull(); + } + + @Test + void testCreate() { + wireMockServer.stubFor( + post(urlPathEqualTo("/v2/llm-batch-service/v1/batches")) + .withHeader("AI-Resource-Group", equalTo(AI_RESOURCE_GROUP)) + .willReturn( + aResponse() + .withStatus(HttpStatus.SC_ACCEPTED) + .withHeader("content-type", "application/json") + .withBody( + """ + { + "id": "27126ef7-d176-4f29-84db-2d64c001ad63", + "created_at": "2026-05-06T13:56:19.257546+00:00", + "status": "PENDING", + "message": "Batch job scheduled" + } + """))); + + val input = BatchCreateRequestInput.create().uri("ai://s3secret/input-batch.jsonl"); + val output = BatchCreateRequestOutput.create().uri("ai://s3secret/"); + val spec = BatchCreateRequestSpec.create().provider("azure-openai").model("gpt-4.1"); + + val batchCreateRequest = + BatchCreateRequest.create().type(LLM_NATIVE).input(input).output(output).spec(spec); + + val createResponse = + new BatchesApi(aiCoreService).createBatch(AI_RESOURCE_GROUP, batchCreateRequest); + + assertThat(createResponse.getId()).isEqualTo(NEW_BATCH_ID); + assertThat(createResponse.getCreatedAt()).isEqualTo("2026-05-06T13:56:19.257546+00:00"); + assertThat(createResponse.getStatus()).isEqualTo("PENDING"); + assertThat(createResponse.getMessage()).isEqualTo("Batch job scheduled"); + } + + @Test + void testDelete() { + wireMockServer.stubFor( + delete(urlPathEqualTo("/v2/llm-batch-service/v1/batches/" + BATCH_ID)) + .withHeader("AI-Resource-Group", equalTo(AI_RESOURCE_GROUP)) + .willReturn( + aResponse() + .withStatus(HttpStatus.SC_ACCEPTED) + .withHeader("content-type", "application/json") + .withBody( + """ + { + "id": "89307094-2cc9-4ef1-9e1b-0fe0733aeb3e", + "created_at": "2026-05-06T13:04:39.732861Z", + "message": "Batch job deleted successfully" + } + """))); + + val deleteResponse = new BatchesApi(aiCoreService).deleteBatch(AI_RESOURCE_GROUP, BATCH_ID); + + assertThat(deleteResponse.getId()).isEqualTo(BATCH_ID); + assertThat(deleteResponse.getCreatedAt()).isEqualTo("2026-05-06T13:04:39.732861Z"); + assertThat(deleteResponse.getMessage()).isEqualTo("Batch job deleted successfully"); + } +} diff --git a/core-services/batch/src/test/java/com/sap/ai/sdk/batch/WireMockTestServerBatch.java b/core-services/batch/src/test/java/com/sap/ai/sdk/batch/WireMockTestServerBatch.java new file mode 100644 index 000000000..eb3f4faa5 --- /dev/null +++ b/core-services/batch/src/test/java/com/sap/ai/sdk/batch/WireMockTestServerBatch.java @@ -0,0 +1,35 @@ +package com.sap.ai.sdk.batch; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.sap.ai.sdk.core.AiCoreService; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import lombok.val; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +/** Test server for batch unit tests. */ +public abstract class WireMockTestServerBatch { + private static final WireMockConfiguration WIREMOCK_CONFIGURATION = + wireMockConfig().dynamicPort(); + + public static WireMockServer wireMockServer; + public static AiCoreService aiCoreService; + + @BeforeAll + static void setup() { + wireMockServer = new WireMockServer(WIREMOCK_CONFIGURATION); + wireMockServer.start(); + + val destination = DefaultHttpDestination.builder(wireMockServer.baseUrl() + "/v2/").build(); + aiCoreService = new AiCoreService().withBaseDestination(destination); + } + + // Reset WireMock before each test to ensure clean state + @AfterEach + void reset() { + wireMockServer.resetAll(); + } +} diff --git a/logback.xml b/logback.xml index 2bbaaa365..07b2c17fa 100644 --- a/logback.xml +++ b/logback.xml @@ -12,8 +12,8 @@ - - + + diff --git a/pom.xml b/pom.xml index 9a9c0da6f..85278142e 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ core orchestration + core-services/batch core-services/document-grounding core-services/prompt-registry foundation-models/openai @@ -216,6 +217,11 @@ orchestration ${project.version} + + com.sap.ai.sdk + batch + ${project.version} + com.sap.ai.sdk document-grounding @@ -661,6 +667,7 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma com/sap/ai/sdk/grounding/model/* com/sap/ai/sdk/prompt/registry/client/* com/sap/ai/sdk/prompt/registry/model/* + com/sap/ai/sdk/batch/generated/** diff --git a/sample-code/spring-app/pom.xml b/sample-code/spring-app/pom.xml index db44e119d..0f773e73e 100644 --- a/sample-code/spring-app/pom.xml +++ b/sample-code/spring-app/pom.xml @@ -92,6 +92,10 @@ com.sap.ai.sdk orchestration + + com.sap.ai.sdk + batch + com.sap.ai.sdk document-grounding @@ -215,6 +219,10 @@ com.fasterxml.jackson.core jackson-core + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ch.qos.logback @@ -265,10 +273,6 @@ assertj-core test - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java new file mode 100644 index 000000000..51fd31485 --- /dev/null +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java @@ -0,0 +1,128 @@ +package com.sap.ai.sdk.app.controllers; + +import com.sap.ai.sdk.batch.generated.client.BatchesApi; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequest; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequest.TypeEnum; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestInput; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestOutput; +import com.sap.ai.sdk.batch.generated.model.BatchCreateRequestSpec; +import com.sap.ai.sdk.batch.generated.model.BatchCreateResponse; +import com.sap.ai.sdk.batch.generated.model.BatchDeleteResponse; +import com.sap.ai.sdk.batch.generated.model.BatchDetailResponse; +import com.sap.ai.sdk.batch.generated.model.BatchListResponse; +import com.sap.ai.sdk.core.client.FileApi; +import com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.UUID; +import javax.annotation.Nonnull; +import lombok.val; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** LLM Batch Service API for managing LLM batch processing jobs */ +@RestController +@SuppressWarnings("unused") +@RequestMapping("/batch") +public class BatchController { + + private static final BatchesApi CLIENT = new BatchesApi(); + + /** For reading S3 bucket file contents */ + public static FileApi FILE_CLIENT = new FileApi(); + + /** Resource group that the S3 Bucket Object store is on */ + public static final String RESOURCE_GROUP = "ai-sdk-java-e2e"; + + /** Directory path for batch output files in the object store. */ + public static final String S3_DIRECTORY = "s3secret/batch-output/"; + + /** Batch output file name */ + public static final String OUTPUT_JSONL = "/output.jsonl"; + + /** + * Create a new batch job + * + * @return response object + */ + @GetMapping("/create") + @Nonnull + public BatchCreateResponse create() { + // The S3 Bucket was created in AI Launchpad > AI Core Administration > Object store secrets + // The credentials can be accessed from the BTP Cockpit > Instances > s3 Object Store + return CLIENT.createBatch( + RESOURCE_GROUP, + BatchCreateRequest.create() + .type(TypeEnum.LLM_NATIVE) + .input(BatchCreateRequestInput.create().uri("ai://s3secret/input-batch.jsonl")) + .output(BatchCreateRequestOutput.create().uri("ai://" + S3_DIRECTORY)) + .spec(BatchCreateRequestSpec.create().provider("azure-openai").model("gpt-4.1"))); + } + + /** + * List all batch jobs + * + * @return response object + */ + @GetMapping("list") + @Nonnull + public BatchListResponse list() { + return CLIENT.listBatches(RESOURCE_GROUP); + } + + /** + * Get batch job for an id + * + * @param id the id of the batch job + * @return the response object + */ + @GetMapping("/get/{id}") + @Nonnull + public BatchDetailResponse get(@Nonnull @PathVariable("id") final String id) { + return CLIENT.getBatchById(RESOURCE_GROUP, UUID.fromString(id)); + } + + /** + * Delete batch job for an id + * + * @param id the id of the batch job + * @return the response object + */ + @GetMapping("delete/{id}") + @Nonnull + public BatchDeleteResponse delete(@Nonnull @PathVariable("id") final String id) { + return CLIENT.deleteBatch(RESOURCE_GROUP, UUID.fromString(id)); + } + + /** + * Read the content of a batch output in the S3 bucket + * + * @param id the id of the batch job + * @return the content of the batch output file + */ + @GetMapping("/read/{id}") + @Nonnull + public String read(@Nonnull @PathVariable("id") final String id) { + final UUID validatedId = UUID.fromString(id); + val filePath = S3_DIRECTORY + validatedId + OUTPUT_JSONL; + try { + val downloadedFile = FILE_CLIENT.download(filePath, RESOURCE_GROUP); + val content = Files.readAllBytes(downloadedFile.toPath()); + // Clean up temporary file + val ignore = downloadedFile.delete(); + + if (content.length == 0) { + return "No file found"; + } else { + return new String(content, StandardCharsets.UTF_8); + } + + } catch (OpenApiRequestException e) { + return "Error downloading file"; + } catch (Exception e) { + return "Error reading file"; + } + } +} diff --git a/sample-code/spring-app/src/main/resources/static/index.html b/sample-code/spring-app/src/main/resources/static/index.html index 2458e2e5f..6e9c50354 100644 --- a/sample-code/spring-app/src/main/resources/static/index.html +++ b/sample-code/spring-app/src/main/resources/static/index.html @@ -1261,6 +1261,92 @@

📚 Prompt Registry

+ +
+
+
+
+

📂 Batch API

+
+ Batch API calls together to reduce the number of HTTP connections your client has to make. + For more information, check the Batch API Documentation +
+
+
    +
  • +
    + + +
    + Create a new batch job. +
    +
    +
  • +
+
    +
  • +
    + + +
    + List all batch jobs. +
    +
    +
  • +
+
    +
  • +
    + + +
    + Get a batch job for an id. +
    +
    +
  • +
+
    +
  • +
    + + +
    + Delete a batch job for an id. +
    +
    +
  • +
+
    +
  • +
    + + +
    + Read the content of a batch output in the S3 bucket. +
    +
    +
  • +
+
+
+
diff --git a/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/BatchTest.java b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/BatchTest.java new file mode 100644 index 000000000..04cf28a5b --- /dev/null +++ b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/BatchTest.java @@ -0,0 +1,54 @@ +package com.sap.ai.sdk.app.controllers; + +import static com.sap.ai.sdk.app.controllers.BatchController.FILE_CLIENT; +import static com.sap.ai.sdk.app.controllers.BatchController.OUTPUT_JSONL; +import static com.sap.ai.sdk.app.controllers.BatchController.RESOURCE_GROUP; +import static com.sap.ai.sdk.app.controllers.BatchController.S3_DIRECTORY; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +import com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException; +import lombok.val; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class BatchTest { + + static BatchController controller = new BatchController(); + + @BeforeAll + public static void yesterdaysCleanup() { + for (val batchJob : controller.list().getResources()) { + if (batchJob.getCreatedAt().isBefore(java.time.OffsetDateTime.now().minusDays(1)) + && (batchJob.getStatus().equals("CANCELLED") + || batchJob.getStatus().equals("COMPLETED") + || batchJob.getStatus().equals("FAILED"))) { + String id = batchJob.getId().toString(); + val response = controller.delete(id); + System.out.println("Delete batch: " + response.getMessage()); + + // Clean up old batch output files from object store. + // Object store content can be accessed from an S3 bucket reader with the following + // credentials + // BTP Cockpit -> Instances -> s3 -> credentials + String filePath = S3_DIRECTORY + id + OUTPUT_JSONL; + try { + FILE_CLIENT.delete(filePath, RESOURCE_GROUP); + System.out.println("Deleted file: " + filePath); + } catch (OpenApiRequestException e) { + System.err.println("Error deleting file " + filePath + ": " + e.getMessage()); + } + } + } + } + + @Test + public void testBatch() { + val createResponse = controller.create(); + assertThat(createResponse.getMessage()).contains("Batch job scheduled"); + assertThat(createResponse.getStatus()).isEqualTo("PENDING"); + val id = createResponse.getId().toString(); + + val getResponse = controller.get(id); + assertThat(getResponse.getStatus().getCurrentStatus()).isEqualTo("PENDING"); + } +}