From 4a88b378402457c157b85127813aa0e46ac83f77 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 12:17:03 +0100 Subject: [PATCH 01/17] Drafting yaml response part --- .../src/main/resources/spec/sap-rpt.yaml | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml new file mode 100644 index 000000000..7a4d7f4c6 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -0,0 +1,201 @@ +openapi: 3.0.0 + +info: + title: SAP RPT API + description: SAP RPT API for predictive insights using in-context learning on structured business data. + version: 0.0.1-SNAPSHOT + +paths: + /deployments/{deployment-id}/completions: + post: + summary: Predict targets using SAP RPT model with structured data. + operationId: Completions_Create + parameters: + - name: deployment-id + in: path + required: true + schema: + type: string + example: davinci + description: Deployment id of the model which was deployed. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + type: object + description: Structured table data containing context rows and query rows. + properties: + context: + type: array + description: Context rows used for in-context learning. + items: + type: object + additionalProperties: true + query: + type: array + description: Query rows for which predictions should be made. + items: + type: object + additionalProperties: true + prediction_config: + type: object + description: Configuration for prediction targets. + properties: + target_columns: + type: array + description: List of target columns to predict. + items: + type: object + properties: + column_name: + type: string + description: Name of the target column. + prediction_placeholder: + type: string + description: Placeholder value indicating which cells to predict. + required: + - prediction_placeholder + index_column: + type: string + description: Optional column name to use as index in the response. + responses: + '200': + description: Successful response with predictive insights. + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The generated UUID4 for this request (useful for logging). + example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" + status: + $ref: '#/components/schemas/Status' + predictions: + type: array + description: Array of prediction objects sequence-aligned with the order of the query rows in the request. + items: + type: object + description: Prediction object that may contain target column predictions and optional index column. + additionalProperties: + oneOf: + - type: string + description: Index column value (when index_column parameter is specified). + - type: array + description: Array of predictions for a target column. + items: + type: object + properties: + prediction: + oneOf: + - type: string + description: Predicted value for classification tasks. + - type: number + format: float + description: Predicted value for regression tasks. + confidence: + type: number + format: float + nullable: true + description: The confidence score for this prediction (for classification tasks only). + metadata: + type: object + description: Metadata about the prediction request. + properties: + num_rows: + type: integer + description: The total number of input rows. + num_columns: + type: integer + description: The total number of input columns. + num_predictions: + type: integer + description: The number of table cells containing the specified placeholder values summed over all target columns. + num_query_rows: + type: integer + description: The number of query rows for which a prediction was made. + '400': + description: Bad Request - Invalid input. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '422': + description: Unprocessable Content - Invalid input. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerErrorResponse' + +components: + schemas: + Status: + type: object + description: Status object indicating the result of the request. + properties: + code: + type: integer + description: The numeric status code. + enum: [ 0, 1, 2, 3 ] + message: + type: string + description: The status message text. + + ErrorDetail: + type: object + description: Validation error detail in pydantic format. + properties: + loc: + type: array + description: Location of the error in the request structure. + items: + oneOf: + - type: string + - type: integer + msg: + type: string + description: Error message. + type: + type: string + description: Error type. + + ErrorResponse: + type: object + description: Error response with status and validation details. + properties: + status: + allOf: + - $ref: '#/components/schemas/Status' + - properties: + code: + enum: [ 2 ] + example: 2 + message: + example: "Invalid input" + detail: + type: array + description: Array of validation errors in pydantic format. + items: + $ref: '#/components/schemas/ErrorDetail' + + InternalServerErrorResponse: + type: object + properties: + status: + type: integer + enum: [ 3 ] + example: 3 + message: + type: string + example: "Internal server error" \ No newline at end of file From 8363a6f7ff2c10959ff2d3588bee2b882fab0ee5 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 12:32:30 +0100 Subject: [PATCH 02/17] Reorganize and add more spec components --- .../src/main/resources/spec/sap-rpt.yaml | 163 +++++++++--------- 1 file changed, 86 insertions(+), 77 deletions(-) diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml index 7a4d7f4c6..9e4877db9 100644 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -68,57 +68,7 @@ paths: content: application/json: schema: - type: object - properties: - id: - type: string - description: The generated UUID4 for this request (useful for logging). - example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" - status: - $ref: '#/components/schemas/Status' - predictions: - type: array - description: Array of prediction objects sequence-aligned with the order of the query rows in the request. - items: - type: object - description: Prediction object that may contain target column predictions and optional index column. - additionalProperties: - oneOf: - - type: string - description: Index column value (when index_column parameter is specified). - - type: array - description: Array of predictions for a target column. - items: - type: object - properties: - prediction: - oneOf: - - type: string - description: Predicted value for classification tasks. - - type: number - format: float - description: Predicted value for regression tasks. - confidence: - type: number - format: float - nullable: true - description: The confidence score for this prediction (for classification tasks only). - metadata: - type: object - description: Metadata about the prediction request. - properties: - num_rows: - type: integer - description: The total number of input rows. - num_columns: - type: integer - description: The total number of input columns. - num_predictions: - type: integer - description: The number of table cells containing the specified placeholder values summed over all target columns. - num_query_rows: - type: integer - description: The number of query rows for which a prediction was made. + $ref: '#/components/schemas/TabCompletionResponse' '400': description: Bad Request - Invalid input. content: @@ -140,35 +90,66 @@ paths: components: schemas: - Status: + TabCompletionResponse: type: object - description: Status object indicating the result of the request. + description: Successful tabular prediction response. properties: - code: - type: integer - description: The numeric status code. - enum: [ 0, 1, 2, 3 ] - message: + id: type: string - description: The status message text. - - ErrorDetail: - type: object - description: Validation error detail in pydantic format. - properties: - loc: + description: The generated UUID4 for this request (useful for logging). + example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" + status: + $ref: '#/components/schemas/Status' + predictions: type: array - description: Location of the error in the request structure. + description: Array of prediction results sequence-aligned with the order of the query rows in the request. items: - oneOf: - - type: string - - type: integer - msg: - type: string - description: Error message. - type: - type: string - description: Error type. + $ref: '#/components/schemas/PredictionResults' + metadata: + $ref: '#/components/schemas/Metadata' + PredictionResults: + type: object + description: Prediction results for a query row that may contain target column predictions and optional index column. + additionalProperties: + oneOf: + - type: string + description: Index column value (when index_column parameter is specified). + - type: array + description: Array of predictions for a target column. + items: + $ref: '#/components/schemas/Prediction' + Prediction: + type: object + description: Individual prediction result for a cell. + properties: + prediction: + oneOf: + - type: string + description: Predicted value for classification tasks. + - type: number + format: float + description: Predicted value for regression tasks. + confidence: + type: number + format: float + nullable: true + description: The confidence score for this prediction (for classification tasks only). + Metadata: + type: object + description: Metadata about the prediction request. + properties: + num_rows: + type: integer + description: The total number of input rows. + num_columns: + type: integer + description: The total number of input columns. + num_predictions: + type: integer + description: The number of table cells containing the specified placeholder values summed over all target columns. + num_query_rows: + type: integer + description: The number of query rows for which a prediction was made. ErrorResponse: type: object @@ -188,9 +169,9 @@ components: description: Array of validation errors in pydantic format. items: $ref: '#/components/schemas/ErrorDetail' - InternalServerErrorResponse: type: object + description: Internal server error response. properties: status: type: integer @@ -198,4 +179,32 @@ components: example: 3 message: type: string - example: "Internal server error" \ No newline at end of file + example: "Internal server error" + ErrorDetail: + type: object + description: Validation error detail in pydantic format. + properties: + loc: + type: array + description: Location of the error in the request structure. + items: + oneOf: + - type: string + - type: integer + msg: + type: string + description: Error message. + type: + type: string + description: Error type. + Status: + type: object + description: Status object indicating the result of the request. + properties: + code: + type: integer + description: The numeric status code. + enum: [ 0, 1, 2, 3 ] + message: + type: string + description: The status message text. \ No newline at end of file From 920963f7bc49300b1fb1d7441a5a8f72409c8089 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 13:14:52 +0100 Subject: [PATCH 03/17] Draft full request and response components in spec --- .../src/main/resources/spec/sap-rpt.yaml | 145 ++++++++++++------ 1 file changed, 100 insertions(+), 45 deletions(-) diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml index 9e4877db9..167517d3f 100644 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -23,52 +23,14 @@ paths: content: application/json: schema: - type: object - properties: - data: - type: object - description: Structured table data containing context rows and query rows. - properties: - context: - type: array - description: Context rows used for in-context learning. - items: - type: object - additionalProperties: true - query: - type: array - description: Query rows for which predictions should be made. - items: - type: object - additionalProperties: true - prediction_config: - type: object - description: Configuration for prediction targets. - properties: - target_columns: - type: array - description: List of target columns to predict. - items: - type: object - properties: - column_name: - type: string - description: Name of the target column. - prediction_placeholder: - type: string - description: Placeholder value indicating which cells to predict. - required: - - prediction_placeholder - index_column: - type: string - description: Optional column name to use as index in the response. + $ref: '#/components/schemas/TabCompletionPostRequest' responses: '200': description: Successful response with predictive insights. content: application/json: schema: - $ref: '#/components/schemas/TabCompletionResponse' + $ref: '#/components/schemas/TabCompletionPostResponse' '400': description: Bad Request - Invalid input. content: @@ -90,7 +52,100 @@ paths: components: schemas: - TabCompletionResponse: + TabCompletionPostRequest: + type: object + description: Request for tabular prediction. Must provide data as either rows or columns (mutually exclusive). + properties: + prediction_config: + $ref: '#/components/schemas/PredictionConfig' + index_column: + type: string + description: Optional column name used to identify rows. Not used as input feature, but returned in response. + example: "ID" + rows: + type: array + description: Table data organized by rows (mutually exclusive with columns). + items: + type: object + additionalProperties: true + example: + - PRODUCT: "Couch" + PRICE: 999.99 + ORDERDATE: "28-11-2025" + ID: "35" + COSTCENTER: "[PREDICT]" + columns: + type: object + description: Table data organized by columns (mutually exclusive with rows). + additionalProperties: + type: array + items: { } + example: + PRODUCT: [ "Couch", "Office Chair", "Server Rack" ] + PRICE: [ 999.99, 150.8, 2200.00 ] + ORDERDATE: [ "28-11-2025", "02-11-2025", "01-11-2025" ] + ID: [ "35", "44", "104" ] + COSTCENTER: [ "[PREDICT]", "Office Furniture", "Data Infrastructure" ] + data_schema: + $ref: '#/components/schemas/DataSchema' + parse_data_types: + type: boolean + description: Whether to parse data types when data_schema is not provided eg. interpret date, numeric + default: true + oneOf: + - required: [ prediction_config, rows ] + - required: [ prediction_config, columns ] + PredictionConfig: + type: object + description: Configuration specifying which columns to predict. + properties: + target_columns: + type: array + description: Array of target column configurations for prediction. + minItems: 1 + items: + $ref: '#/components/schemas/TargetColumn' + TargetColumn: + type: object + description: Configuration for a target column to predict. + required: + - prediction_placeholder + properties: + name: + type: string + description: Name of the column to predict. + example: "COSTCENTER" + prediction_placeholder: + type: string + description: Value used as placeholder in cells where prediction is needed. + example: "[PREDICT]" + task_type: + type: string + enum: [ classification, regression ] + description: (Optional) Type of prediction task. If omitted, model attempts to infer task type. + DataSchema: + type: object + description: (Optional) Schema definition for column data types. If omitted and parse_data_types is true, data types will be inferred. + additionalProperties: + $ref: '#/components/schemas/ColumnDataType' + example: + PRODUCT: + dtype: "string" + PRICE: + dtype: "numeric" + ORDERDATE: + dtype: "date" + ColumnDataType: + type: object + description: Data type specification for a column. + properties: + dtype: + type: string + enum: [ string, numeric, date ] + description: Data type for the column. + example: "string" + + TabCompletionPostResponse: type: object description: Successful tabular prediction response. properties: @@ -99,7 +154,7 @@ components: description: The generated UUID4 for this request (useful for logging). example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" status: - $ref: '#/components/schemas/Status' + $ref: '#/components/schemas/ErrorStatus' predictions: type: array description: Array of prediction results sequence-aligned with the order of the query rows in the request. @@ -157,7 +212,7 @@ components: properties: status: allOf: - - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/ErrorStatus' - properties: code: enum: [ 2 ] @@ -197,9 +252,9 @@ components: type: type: string description: Error type. - Status: + ErrorStatus: type: object - description: Status object indicating the result of the request. + description: ErrorStatus object indicating the result of the request. properties: code: type: integer From 53d8fa8e10a0f2b4798fb1d85f939a7112606f81 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 13:51:11 +0100 Subject: [PATCH 04/17] Setting up new sap-rpt sub-module --- .pipeline/checkstyle-suppressions.xml | 1 + foundation-models/sap-rpt/pom.xml | 99 ++++ .../rpt/generated/model/ColumnDataType.java | 229 ++++++++++ .../rpt/generated/model/ErrorDetail.java | 258 +++++++++++ .../generated/model/ErrorDetailLocInner.java | 49 ++ .../rpt/generated/model/ErrorResponse.java | 221 +++++++++ .../generated/model/ErrorResponseStatus.java | 262 +++++++++++ .../rpt/generated/model/ErrorStatus.java | 269 +++++++++++ .../model/InternalServerErrorResponse.java | 265 +++++++++++ .../rpt/generated/model/Metadata.java | 281 ++++++++++++ .../rpt/generated/model/Prediction.java | 204 +++++++++ .../rpt/generated/model/PredictionConfig.java | 184 ++++++++ .../generated/model/PredictionPrediction.java | 49 ++ .../model/PredictionResultsValue.java | 54 +++ .../model/TabCompletionPostRequest.java | 429 ++++++++++++++++++ .../model/TabCompletionPostResponse.java | 303 +++++++++++++ .../rpt/generated/model/TargetColumn.java | 321 +++++++++++++ pom.xml | 3 + 18 files changed, 3481 insertions(+) create mode 100644 foundation-models/sap-rpt/pom.xml create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java diff --git a/.pipeline/checkstyle-suppressions.xml b/.pipeline/checkstyle-suppressions.xml index 84779d480..519684154 100644 --- a/.pipeline/checkstyle-suppressions.xml +++ b/.pipeline/checkstyle-suppressions.xml @@ -9,6 +9,7 @@ + diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml new file mode 100644 index 000000000..b1cf39576 --- /dev/null +++ b/foundation-models/sap-rpt/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + com.sap.ai.sdk + sdk-parent + 1.15.0-SNAPSHOT + ../../pom.xml + + com.sap.ai.sdk.foundationmodels + sap-rpt + SAP RPT Model 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 RPT model for in-context learning predictions on tabular data. + 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}/../../ + + + + + com.fasterxml.jackson.core + jackson-annotations + + + com.google.code.findbugs + jsr305 + + + + + generate + + false + + generate + + + + + + com.sap.cloud.sdk.datamodel + openapi-generator-maven-plugin + + ${project.basedir}/src/main/java + true + COMPILE + true + + + + sap-rpt + + generate + + generate-sources + + ${project.basedir}/src/main/resources/spec/sap-rpt.yaml + com.sap.ai.sdk.foundationmodels.rpt.generated.model + com.sap.ai.sdk.foundationmodels.rpt.generated.client + false + + create + true + true + true + true + + + + + + + + + + diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java new file mode 100644 index 000000000..1b80dfa35 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java @@ -0,0 +1,229 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Data type specification for a column. */ +// CHECKSTYLE:OFF +public class ColumnDataType +// CHECKSTYLE:ON +{ + /** Data type for the column. */ + public enum DtypeEnum { + /** The STRING option of this ColumnDataType */ + STRING("string"), + + /** The NUMERIC option of this ColumnDataType */ + NUMERIC("numeric"), + + /** The DATE option of this ColumnDataType */ + DATE("date"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this ColumnDataType */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + DtypeEnum(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 ColumnDataType + */ + @JsonCreator + @Nonnull + public static DtypeEnum fromValue(@Nonnull final String value) { + for (DtypeEnum b : DtypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("dtype") + private DtypeEnum dtype; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the dtype of this {@link ColumnDataType} instance and return the same instance. + * + * @param dtype Data type for the column. + * @return The same instance of this {@link ColumnDataType} class + */ + @Nonnull + public ColumnDataType dtype(@Nullable final DtypeEnum dtype) { + this.dtype = dtype; + return this; + } + + /** + * Data type for the column. + * + * @return dtype The dtype of this {@link ColumnDataType} instance. + */ + @Nonnull + public DtypeEnum getDtype() { + return dtype; + } + + /** + * Set the dtype of this {@link ColumnDataType} instance. + * + * @param dtype Data type for the column. + */ + public void setDtype(@Nullable final DtypeEnum dtype) { + this.dtype = dtype; + } + + /** + * Get the names of the unrecognizable properties of the {@link ColumnDataType}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ColumnDataType} 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("ColumnDataType has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ColumnDataType} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (dtype != null) declaredFields.put("dtype", dtype); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ColumnDataType} 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 ColumnDataType columnDataType = (ColumnDataType) o; + return Objects.equals(this.cloudSdkCustomFields, columnDataType.cloudSdkCustomFields) + && Objects.equals(this.dtype, columnDataType.dtype); + } + + @Override + public int hashCode() { + return Objects.hash(dtype, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ColumnDataType {\n"); + sb.append(" dtype: ").append(toIndentedString(dtype)).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 ColumnDataType} instance. No arguments are required. */ + public static ColumnDataType create() { + return new ColumnDataType(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java new file mode 100644 index 000000000..0a4e07ce3 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java @@ -0,0 +1,258 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Validation error detail in pydantic format. */ +// CHECKSTYLE:OFF +public class ErrorDetail +// CHECKSTYLE:ON +{ + @JsonProperty("loc") + private List loc = new ArrayList<>(); + + @JsonProperty("msg") + private String msg; + + @JsonProperty("type") + private String type; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the loc of this {@link ErrorDetail} instance and return the same instance. + * + * @param loc Location of the error in the request structure. + * @return The same instance of this {@link ErrorDetail} class + */ + @Nonnull + public ErrorDetail loc(@Nullable final List loc) { + this.loc = loc; + return this; + } + + /** + * Add one loc instance to this {@link ErrorDetail}. + * + * @param locItem The loc that should be added + * @return The same instance of type {@link ErrorDetail} + */ + @Nonnull + public ErrorDetail addLocItem(@Nonnull final ErrorDetailLocInner locItem) { + if (this.loc == null) { + this.loc = new ArrayList<>(); + } + this.loc.add(locItem); + return this; + } + + /** + * Location of the error in the request structure. + * + * @return loc The loc of this {@link ErrorDetail} instance. + */ + @Nonnull + public List getLoc() { + return loc; + } + + /** + * Set the loc of this {@link ErrorDetail} instance. + * + * @param loc Location of the error in the request structure. + */ + public void setLoc(@Nullable final List loc) { + this.loc = loc; + } + + /** + * Set the msg of this {@link ErrorDetail} instance and return the same instance. + * + * @param msg Error message. + * @return The same instance of this {@link ErrorDetail} class + */ + @Nonnull + public ErrorDetail msg(@Nullable final String msg) { + this.msg = msg; + return this; + } + + /** + * Error message. + * + * @return msg The msg of this {@link ErrorDetail} instance. + */ + @Nonnull + public String getMsg() { + return msg; + } + + /** + * Set the msg of this {@link ErrorDetail} instance. + * + * @param msg Error message. + */ + public void setMsg(@Nullable final String msg) { + this.msg = msg; + } + + /** + * Set the type of this {@link ErrorDetail} instance and return the same instance. + * + * @param type Error type. + * @return The same instance of this {@link ErrorDetail} class + */ + @Nonnull + public ErrorDetail type(@Nullable final String type) { + this.type = type; + return this; + } + + /** + * Error type. + * + * @return type The type of this {@link ErrorDetail} instance. + */ + @Nonnull + public String getType() { + return type; + } + + /** + * Set the type of this {@link ErrorDetail} instance. + * + * @param type Error type. + */ + public void setType(@Nullable final String type) { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorDetail}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorDetail} 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("ErrorDetail has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorDetail} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (loc != null) declaredFields.put("loc", loc); + if (msg != null) declaredFields.put("msg", msg); + if (type != null) declaredFields.put("type", type); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorDetail} 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 ErrorDetail errorDetail = (ErrorDetail) o; + return Objects.equals(this.cloudSdkCustomFields, errorDetail.cloudSdkCustomFields) + && Objects.equals(this.loc, errorDetail.loc) + && Objects.equals(this.msg, errorDetail.msg) + && Objects.equals(this.type, errorDetail.type); + } + + @Override + public int hashCode() { + return Objects.hash(loc, msg, type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorDetail {\n"); + sb.append(" loc: ").append(toIndentedString(loc)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 ErrorDetail} instance. No arguments are required. */ + public static ErrorDetail create() { + return new ErrorDetail(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java new file mode 100644 index 000000000..f1f778d48 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java @@ -0,0 +1,49 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import javax.annotation.Nonnull; + +/** ErrorDetailLocInner */ +public interface ErrorDetailLocInner { + /** Helper class to create {@code String } that implements {@link ErrorDetailLocInner}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements ErrorDetailLocInner {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** Helper class to create {@code Integer } that implements {@link ErrorDetailLocInner}. */ + record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) + implements ErrorDetailLocInner {} + + /** + * Creator to enable deserialization of {@code Integer }. + * + * @param val the value to use + * @return a new instance of {@link InnerInteger}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerInteger create(@Nonnull final Integer val) { + return new InnerInteger(val); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java new file mode 100644 index 000000000..848709ba6 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java @@ -0,0 +1,221 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Error response with status and validation details. */ +// CHECKSTYLE:OFF +public class ErrorResponse +// CHECKSTYLE:ON +{ + @JsonProperty("status") + private ErrorResponseStatus status; + + @JsonProperty("detail") + private List detail = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the status of this {@link ErrorResponse} instance and return the same instance. + * + * @param status The status of this {@link ErrorResponse} + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse status(@Nullable final ErrorResponseStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link ErrorResponse} instance. + */ + @Nonnull + public ErrorResponseStatus getStatus() { + return status; + } + + /** + * Set the status of this {@link ErrorResponse} instance. + * + * @param status The status of this {@link ErrorResponse} + */ + public void setStatus(@Nullable final ErrorResponseStatus status) { + this.status = status; + } + + /** + * Set the detail of this {@link ErrorResponse} instance and return the same instance. + * + * @param detail Array of validation errors in pydantic format. + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse detail(@Nullable final List detail) { + this.detail = detail; + return this; + } + + /** + * Add one detail instance to this {@link ErrorResponse}. + * + * @param detailItem The detail that should be added + * @return The same instance of type {@link ErrorResponse} + */ + @Nonnull + public ErrorResponse addDetailItem(@Nonnull final ErrorDetail detailItem) { + if (this.detail == null) { + this.detail = new ArrayList<>(); + } + this.detail.add(detailItem); + return this; + } + + /** + * Array of validation errors in pydantic format. + * + * @return detail The detail of this {@link ErrorResponse} instance. + */ + @Nonnull + public List getDetail() { + return detail; + } + + /** + * Set the detail of this {@link ErrorResponse} instance. + * + * @param detail Array of validation errors in pydantic format. + */ + public void setDetail(@Nullable final List detail) { + this.detail = detail; + } + + /** + * 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 (status != null) declaredFields.put("status", status); + if (detail != null) declaredFields.put("detail", detail); + 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.status, errorResponse.status) + && Objects.equals(this.detail, errorResponse.detail); + } + + @Override + public int hashCode() { + return Objects.hash(status, detail, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).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 ErrorResponse} instance. No arguments are required. */ + public static ErrorResponse create() { + return new ErrorResponse(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java new file mode 100644 index 000000000..70c6ee8d3 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java @@ -0,0 +1,262 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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.math.BigDecimal; +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; + +/** ErrorResponseStatus */ +// CHECKSTYLE:OFF +public class ErrorResponseStatus +// CHECKSTYLE:ON +{ + /** Gets or Sets code */ + public enum CodeEnum { + /** The NUMBER_2 option of this ErrorResponseStatus */ + NUMBER_2(new BigDecimal("2")), + + /** The NUMBER_unknown_default_open_api option of this ErrorResponseStatus */ + NUMBER_unknown_default_open_api(new BigDecimal("11184809")); + + private BigDecimal value; + + CodeEnum(BigDecimal value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public BigDecimal 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 ErrorResponseStatus + */ + @JsonCreator + @Nonnull + public static CodeEnum fromValue(@Nonnull final BigDecimal value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return NUMBER_unknown_default_open_api; + } + } + + @JsonProperty("code") + private CodeEnum code; + + @JsonProperty("message") + private Object message = null; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the code of this {@link ErrorResponseStatus} instance and return the same instance. + * + * @param code The code of this {@link ErrorResponseStatus} + * @return The same instance of this {@link ErrorResponseStatus} class + */ + @Nonnull + public ErrorResponseStatus code(@Nullable final CodeEnum code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code The code of this {@link ErrorResponseStatus} instance. + */ + @Nonnull + public CodeEnum getCode() { + return code; + } + + /** + * Set the code of this {@link ErrorResponseStatus} instance. + * + * @param code The code of this {@link ErrorResponseStatus} + */ + public void setCode(@Nullable final CodeEnum code) { + this.code = code; + } + + /** + * Set the message of this {@link ErrorResponseStatus} instance and return the same instance. + * + * @param message The message of this {@link ErrorResponseStatus} + * @return The same instance of this {@link ErrorResponseStatus} class + */ + @Nonnull + public ErrorResponseStatus message(@Nullable final Object message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link ErrorResponseStatus} instance. + */ + @Nullable + public Object getMessage() { + return message; + } + + /** + * Set the message of this {@link ErrorResponseStatus} instance. + * + * @param message The message of this {@link ErrorResponseStatus} + */ + public void setMessage(@Nullable final Object message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorResponseStatus}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorResponseStatus} 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( + "ErrorResponseStatus has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorResponseStatus} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorResponseStatus} 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 ErrorResponseStatus errorResponseStatus = (ErrorResponseStatus) o; + return Objects.equals(this.cloudSdkCustomFields, errorResponseStatus.cloudSdkCustomFields) + && Objects.equals(this.code, errorResponseStatus.code) + && Objects.equals(this.message, errorResponseStatus.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponseStatus {\n"); + sb.append(" code: ").append(toIndentedString(code)).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 ErrorResponseStatus} instance. No arguments are required. */ + public static ErrorResponseStatus create() { + return new ErrorResponseStatus(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java new file mode 100644 index 000000000..39ec93844 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java @@ -0,0 +1,269 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** ErrorStatus object indicating the result of the request. */ +// CHECKSTYLE:OFF +public class ErrorStatus +// CHECKSTYLE:ON +{ + /** The numeric status code. */ + public enum CodeEnum { + /** The NUMBER_0 option of this ErrorStatus */ + NUMBER_0(0), + + /** The NUMBER_1 option of this ErrorStatus */ + NUMBER_1(1), + + /** The NUMBER_2 option of this ErrorStatus */ + NUMBER_2(2), + + /** The NUMBER_3 option of this ErrorStatus */ + NUMBER_3(3), + + /** The NUMBER_unknown_default_open_api option of this ErrorStatus */ + NUMBER_unknown_default_open_api(11184809); + + private Integer value; + + CodeEnum(Integer value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public Integer 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 ErrorStatus + */ + @JsonCreator + @Nonnull + public static CodeEnum fromValue(@Nonnull final Integer value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return NUMBER_unknown_default_open_api; + } + } + + @JsonProperty("code") + private CodeEnum code; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the code of this {@link ErrorStatus} instance and return the same instance. + * + * @param code The numeric status code. + * @return The same instance of this {@link ErrorStatus} class + */ + @Nonnull + public ErrorStatus code(@Nullable final CodeEnum code) { + this.code = code; + return this; + } + + /** + * The numeric status code. + * + * @return code The code of this {@link ErrorStatus} instance. + */ + @Nonnull + public CodeEnum getCode() { + return code; + } + + /** + * Set the code of this {@link ErrorStatus} instance. + * + * @param code The numeric status code. + */ + public void setCode(@Nullable final CodeEnum code) { + this.code = code; + } + + /** + * Set the message of this {@link ErrorStatus} instance and return the same instance. + * + * @param message The status message text. + * @return The same instance of this {@link ErrorStatus} class + */ + @Nonnull + public ErrorStatus message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * The status message text. + * + * @return message The message of this {@link ErrorStatus} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ErrorStatus} instance. + * + * @param message The status message text. + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorStatus}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorStatus} 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("ErrorStatus has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorStatus} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorStatus} 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 ErrorStatus errorStatus = (ErrorStatus) o; + return Objects.equals(this.cloudSdkCustomFields, errorStatus.cloudSdkCustomFields) + && Objects.equals(this.code, errorStatus.code) + && Objects.equals(this.message, errorStatus.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorStatus {\n"); + sb.append(" code: ").append(toIndentedString(code)).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 ErrorStatus} instance. No arguments are required. */ + public static ErrorStatus create() { + return new ErrorStatus(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java new file mode 100644 index 000000000..2a081eb7d --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java @@ -0,0 +1,265 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Internal server error response. */ +// CHECKSTYLE:OFF +public class InternalServerErrorResponse +// CHECKSTYLE:ON +{ + /** Gets or Sets status */ + public enum StatusEnum { + /** The NUMBER_3 option of this InternalServerErrorResponse */ + NUMBER_3(3), + + /** The NUMBER_unknown_default_open_api option of this InternalServerErrorResponse */ + NUMBER_unknown_default_open_api(11184809); + + private Integer value; + + StatusEnum(Integer value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public Integer 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 InternalServerErrorResponse + */ + @JsonCreator + @Nonnull + public static StatusEnum fromValue(@Nonnull final Integer value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return NUMBER_unknown_default_open_api; + } + } + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the status of this {@link InternalServerErrorResponse} instance and return the same + * instance. + * + * @param status The status of this {@link InternalServerErrorResponse} + * @return The same instance of this {@link InternalServerErrorResponse} class + */ + @Nonnull + public InternalServerErrorResponse status(@Nullable final StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link InternalServerErrorResponse} instance. + */ + @Nonnull + public StatusEnum getStatus() { + return status; + } + + /** + * Set the status of this {@link InternalServerErrorResponse} instance. + * + * @param status The status of this {@link InternalServerErrorResponse} + */ + public void setStatus(@Nullable final StatusEnum status) { + this.status = status; + } + + /** + * Set the message of this {@link InternalServerErrorResponse} instance and return the same + * instance. + * + * @param message The message of this {@link InternalServerErrorResponse} + * @return The same instance of this {@link InternalServerErrorResponse} class + */ + @Nonnull + public InternalServerErrorResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link InternalServerErrorResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link InternalServerErrorResponse} instance. + * + * @param message The message of this {@link InternalServerErrorResponse} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link InternalServerErrorResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link InternalServerErrorResponse} + * 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( + "InternalServerErrorResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link InternalServerErrorResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (status != null) declaredFields.put("status", status); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link InternalServerErrorResponse} 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 InternalServerErrorResponse internalServerErrorResponse = (InternalServerErrorResponse) o; + return Objects.equals( + this.cloudSdkCustomFields, internalServerErrorResponse.cloudSdkCustomFields) + && Objects.equals(this.status, internalServerErrorResponse.status) + && Objects.equals(this.message, internalServerErrorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(status, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class InternalServerErrorResponse {\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 InternalServerErrorResponse} instance. No arguments are required. */ + public static InternalServerErrorResponse create() { + return new InternalServerErrorResponse(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java new file mode 100644 index 000000000..eb55e16e0 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java @@ -0,0 +1,281 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Metadata about the prediction request. */ +// CHECKSTYLE:OFF +public class Metadata +// CHECKSTYLE:ON +{ + @JsonProperty("num_rows") + private Integer numRows; + + @JsonProperty("num_columns") + private Integer numColumns; + + @JsonProperty("num_predictions") + private Integer numPredictions; + + @JsonProperty("num_query_rows") + private Integer numQueryRows; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the numRows of this {@link Metadata} instance and return the same instance. + * + * @param numRows The total number of input rows. + * @return The same instance of this {@link Metadata} class + */ + @Nonnull + public Metadata numRows(@Nullable final Integer numRows) { + this.numRows = numRows; + return this; + } + + /** + * The total number of input rows. + * + * @return numRows The numRows of this {@link Metadata} instance. + */ + @Nonnull + public Integer getNumRows() { + return numRows; + } + + /** + * Set the numRows of this {@link Metadata} instance. + * + * @param numRows The total number of input rows. + */ + public void setNumRows(@Nullable final Integer numRows) { + this.numRows = numRows; + } + + /** + * Set the numColumns of this {@link Metadata} instance and return the same instance. + * + * @param numColumns The total number of input columns. + * @return The same instance of this {@link Metadata} class + */ + @Nonnull + public Metadata numColumns(@Nullable final Integer numColumns) { + this.numColumns = numColumns; + return this; + } + + /** + * The total number of input columns. + * + * @return numColumns The numColumns of this {@link Metadata} instance. + */ + @Nonnull + public Integer getNumColumns() { + return numColumns; + } + + /** + * Set the numColumns of this {@link Metadata} instance. + * + * @param numColumns The total number of input columns. + */ + public void setNumColumns(@Nullable final Integer numColumns) { + this.numColumns = numColumns; + } + + /** + * Set the numPredictions of this {@link Metadata} instance and return the same instance. + * + * @param numPredictions The number of table cells containing the specified placeholder values + * summed over all target columns. + * @return The same instance of this {@link Metadata} class + */ + @Nonnull + public Metadata numPredictions(@Nullable final Integer numPredictions) { + this.numPredictions = numPredictions; + return this; + } + + /** + * The number of table cells containing the specified placeholder values summed over all target + * columns. + * + * @return numPredictions The numPredictions of this {@link Metadata} instance. + */ + @Nonnull + public Integer getNumPredictions() { + return numPredictions; + } + + /** + * Set the numPredictions of this {@link Metadata} instance. + * + * @param numPredictions The number of table cells containing the specified placeholder values + * summed over all target columns. + */ + public void setNumPredictions(@Nullable final Integer numPredictions) { + this.numPredictions = numPredictions; + } + + /** + * Set the numQueryRows of this {@link Metadata} instance and return the same instance. + * + * @param numQueryRows The number of query rows for which a prediction was made. + * @return The same instance of this {@link Metadata} class + */ + @Nonnull + public Metadata numQueryRows(@Nullable final Integer numQueryRows) { + this.numQueryRows = numQueryRows; + return this; + } + + /** + * The number of query rows for which a prediction was made. + * + * @return numQueryRows The numQueryRows of this {@link Metadata} instance. + */ + @Nonnull + public Integer getNumQueryRows() { + return numQueryRows; + } + + /** + * Set the numQueryRows of this {@link Metadata} instance. + * + * @param numQueryRows The number of query rows for which a prediction was made. + */ + public void setNumQueryRows(@Nullable final Integer numQueryRows) { + this.numQueryRows = numQueryRows; + } + + /** + * Get the names of the unrecognizable properties of the {@link Metadata}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Metadata} 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("Metadata has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Metadata} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (numRows != null) declaredFields.put("numRows", numRows); + if (numColumns != null) declaredFields.put("numColumns", numColumns); + if (numPredictions != null) declaredFields.put("numPredictions", numPredictions); + if (numQueryRows != null) declaredFields.put("numQueryRows", numQueryRows); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Metadata} 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 Metadata metadata = (Metadata) o; + return Objects.equals(this.cloudSdkCustomFields, metadata.cloudSdkCustomFields) + && Objects.equals(this.numRows, metadata.numRows) + && Objects.equals(this.numColumns, metadata.numColumns) + && Objects.equals(this.numPredictions, metadata.numPredictions) + && Objects.equals(this.numQueryRows, metadata.numQueryRows); + } + + @Override + public int hashCode() { + return Objects.hash(numRows, numColumns, numPredictions, numQueryRows, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Metadata {\n"); + sb.append(" numRows: ").append(toIndentedString(numRows)).append("\n"); + sb.append(" numColumns: ").append(toIndentedString(numColumns)).append("\n"); + sb.append(" numPredictions: ").append(toIndentedString(numPredictions)).append("\n"); + sb.append(" numQueryRows: ").append(toIndentedString(numQueryRows)).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 Metadata} instance. No arguments are required. */ + public static Metadata create() { + return new Metadata(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java new file mode 100644 index 000000000..62cf6b19e --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java @@ -0,0 +1,204 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Individual prediction result for a cell. */ +// CHECKSTYLE:OFF +public class Prediction +// CHECKSTYLE:ON +{ + @JsonProperty("prediction") + private PredictionPrediction prediction; + + @JsonProperty("confidence") + private Float confidence; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the prediction of this {@link Prediction} instance and return the same instance. + * + * @param prediction The prediction of this {@link Prediction} + * @return The same instance of this {@link Prediction} class + */ + @Nonnull + public Prediction prediction(@Nullable final PredictionPrediction prediction) { + this.prediction = prediction; + return this; + } + + /** + * Get prediction + * + * @return prediction The prediction of this {@link Prediction} instance. + */ + @Nonnull + public PredictionPrediction getPrediction() { + return prediction; + } + + /** + * Set the prediction of this {@link Prediction} instance. + * + * @param prediction The prediction of this {@link Prediction} + */ + public void setPrediction(@Nullable final PredictionPrediction prediction) { + this.prediction = prediction; + } + + /** + * Set the confidence of this {@link Prediction} instance and return the same instance. + * + * @param confidence The confidence score for this prediction (for classification tasks only). + * @return The same instance of this {@link Prediction} class + */ + @Nonnull + public Prediction confidence(@Nullable final Float confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence score for this prediction (for classification tasks only). + * + * @return confidence The confidence of this {@link Prediction} instance. + */ + @Nullable + public Float getConfidence() { + return confidence; + } + + /** + * Set the confidence of this {@link Prediction} instance. + * + * @param confidence The confidence score for this prediction (for classification tasks only). + */ + public void setConfidence(@Nullable final Float confidence) { + this.confidence = confidence; + } + + /** + * Get the names of the unrecognizable properties of the {@link Prediction}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Prediction} 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("Prediction has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Prediction} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (prediction != null) declaredFields.put("prediction", prediction); + if (confidence != null) declaredFields.put("confidence", confidence); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Prediction} 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 Prediction prediction = (Prediction) o; + return Objects.equals(this.cloudSdkCustomFields, prediction.cloudSdkCustomFields) + && Objects.equals(this.prediction, prediction.prediction) + && Objects.equals(this.confidence, prediction.confidence); + } + + @Override + public int hashCode() { + return Objects.hash(prediction, confidence, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Prediction {\n"); + sb.append(" prediction: ").append(toIndentedString(prediction)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).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 Prediction} instance. No arguments are required. */ + public static Prediction create() { + return new Prediction(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java new file mode 100644 index 000000000..2d2bb77d7 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java @@ -0,0 +1,184 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Configuration specifying which columns to predict. */ +// CHECKSTYLE:OFF +public class PredictionConfig +// CHECKSTYLE:ON +{ + @JsonProperty("target_columns") + private List targetColumns = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the targetColumns of this {@link PredictionConfig} instance and return the same instance. + * + * @param targetColumns Array of target column configurations for prediction. + * @return The same instance of this {@link PredictionConfig} class + */ + @Nonnull + public PredictionConfig targetColumns(@Nullable final List targetColumns) { + this.targetColumns = targetColumns; + return this; + } + + /** + * Add one targetColumns instance to this {@link PredictionConfig}. + * + * @param targetColumnsItem The targetColumns that should be added + * @return The same instance of type {@link PredictionConfig} + */ + @Nonnull + public PredictionConfig addTargetColumnsItem(@Nonnull final TargetColumn targetColumnsItem) { + if (this.targetColumns == null) { + this.targetColumns = new ArrayList<>(); + } + this.targetColumns.add(targetColumnsItem); + return this; + } + + /** + * Array of target column configurations for prediction. + * + * @return targetColumns The targetColumns of this {@link PredictionConfig} instance. + */ + @Nonnull + public List getTargetColumns() { + return targetColumns; + } + + /** + * Set the targetColumns of this {@link PredictionConfig} instance. + * + * @param targetColumns Array of target column configurations for prediction. + */ + public void setTargetColumns(@Nullable final List targetColumns) { + this.targetColumns = targetColumns; + } + + /** + * Get the names of the unrecognizable properties of the {@link PredictionConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PredictionConfig} 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("PredictionConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PredictionConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (targetColumns != null) declaredFields.put("targetColumns", targetColumns); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PredictionConfig} 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 PredictionConfig predictionConfig = (PredictionConfig) o; + return Objects.equals(this.cloudSdkCustomFields, predictionConfig.cloudSdkCustomFields) + && Objects.equals(this.targetColumns, predictionConfig.targetColumns); + } + + @Override + public int hashCode() { + return Objects.hash(targetColumns, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PredictionConfig {\n"); + sb.append(" targetColumns: ").append(toIndentedString(targetColumns)).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 PredictionConfig} instance. No arguments are required. */ + public static PredictionConfig create() { + return new PredictionConfig(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java new file mode 100644 index 000000000..d6998b9d4 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java @@ -0,0 +1,49 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import javax.annotation.Nonnull; + +/** PredictionPrediction */ +public interface PredictionPrediction { + /** Helper class to create {@code Float } that implements {@link PredictionPrediction}. */ + record InnerFloat(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Float value) + implements PredictionPrediction {} + + /** + * Creator to enable deserialization of {@code Float }. + * + * @param val the value to use + * @return a new instance of {@link InnerFloat}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerFloat create(@Nonnull final Float val) { + return new InnerFloat(val); + } + + /** Helper class to create {@code String } that implements {@link PredictionPrediction}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements PredictionPrediction {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java new file mode 100644 index 000000000..0feb84fb4 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java @@ -0,0 +1,54 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import java.util.List; +import javax.annotation.Nonnull; + +/** PredictionResultsValue */ +public interface PredictionResultsValue { + /** + * Helper class to create {@code List } that implements {@link + * PredictionResultsValue}. + */ + record ListOfPredictions( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements PredictionResultsValue {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val the value to use + * @return a new instance of {@link ListOfPredictions}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfPredictions createListOfPredictions(@Nonnull final List val) { + return new ListOfPredictions(val); + } + + /** Helper class to create {@code String } that implements {@link PredictionResultsValue}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements PredictionResultsValue {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java new file mode 100644 index 000000000..7c176e645 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java @@ -0,0 +1,429 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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.HashMap; +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; + +/** + * Request for tabular prediction. Must provide data as either rows or columns (mutually exclusive). + */ +// CHECKSTYLE:OFF +public class TabCompletionPostRequest +// CHECKSTYLE:ON +{ + @JsonProperty("prediction_config") + private PredictionConfig predictionConfig; + + @JsonProperty("index_column") + private String indexColumn; + + @JsonProperty("rows") + private List> rows = new ArrayList<>(); + + @JsonProperty("columns") + private Map> columns = new HashMap<>(); + + @JsonProperty("data_schema") + private Map dataSchema = new HashMap<>(); + + @JsonProperty("parse_data_types") + private Boolean parseDataTypes = true; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the predictionConfig of this {@link TabCompletionPostRequest} instance and return the same + * instance. + * + * @param predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest predictionConfig( + @Nullable final PredictionConfig predictionConfig) { + this.predictionConfig = predictionConfig; + return this; + } + + /** + * Get predictionConfig + * + * @return predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} + * instance. + */ + @Nonnull + public PredictionConfig getPredictionConfig() { + return predictionConfig; + } + + /** + * Set the predictionConfig of this {@link TabCompletionPostRequest} instance. + * + * @param predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} + */ + public void setPredictionConfig(@Nullable final PredictionConfig predictionConfig) { + this.predictionConfig = predictionConfig; + } + + /** + * Set the indexColumn of this {@link TabCompletionPostRequest} instance and return the same + * instance. + * + * @param indexColumn Optional column name used to identify rows. Not used as input feature, but + * returned in response. + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest indexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + return this; + } + + /** + * Optional column name used to identify rows. Not used as input feature, but returned in + * response. + * + * @return indexColumn The indexColumn of this {@link TabCompletionPostRequest} instance. + */ + @Nonnull + public String getIndexColumn() { + return indexColumn; + } + + /** + * Set the indexColumn of this {@link TabCompletionPostRequest} instance. + * + * @param indexColumn Optional column name used to identify rows. Not used as input feature, but + * returned in response. + */ + public void setIndexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + } + + /** + * Set the rows of this {@link TabCompletionPostRequest} instance and return the same instance. + * + * @param rows Table data organized by rows (mutually exclusive with columns). + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest rows(@Nullable final List> rows) { + this.rows = rows; + return this; + } + + /** + * Add one rows instance to this {@link TabCompletionPostRequest}. + * + * @param rowsItem The rows that should be added + * @return The same instance of type {@link TabCompletionPostRequest} + */ + @Nonnull + public TabCompletionPostRequest addRowsItem(@Nonnull final Map rowsItem) { + if (this.rows == null) { + this.rows = new ArrayList<>(); + } + this.rows.add(rowsItem); + return this; + } + + /** + * Table data organized by rows (mutually exclusive with columns). + * + * @return rows The rows of this {@link TabCompletionPostRequest} instance. + */ + @Nonnull + public List> getRows() { + return rows; + } + + /** + * Set the rows of this {@link TabCompletionPostRequest} instance. + * + * @param rows Table data organized by rows (mutually exclusive with columns). + */ + public void setRows(@Nullable final List> rows) { + this.rows = rows; + } + + /** + * Set the columns of this {@link TabCompletionPostRequest} instance and return the same instance. + * + * @param columns Table data organized by columns (mutually exclusive with rows). + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest columns(@Nullable final Map> columns) { + this.columns = columns; + return this; + } + + /** + * Put one columns instance to this {@link TabCompletionPostRequest} instance. + * + * @param key The String key of this columns instance + * @param columnsItem The columns that should be added under the given key + * @return The same instance of type {@link TabCompletionPostRequest} + */ + @Nonnull + public TabCompletionPostRequest putcolumnsItem( + @Nonnull final String key, @Nonnull final List columnsItem) { + if (this.columns == null) { + this.columns = new HashMap<>(); + } + this.columns.put(key, columnsItem); + return this; + } + + /** + * Table data organized by columns (mutually exclusive with rows). + * + * @return columns The columns of this {@link TabCompletionPostRequest} instance. + */ + @Nonnull + public Map> getColumns() { + return columns; + } + + /** + * Set the columns of this {@link TabCompletionPostRequest} instance. + * + * @param columns Table data organized by columns (mutually exclusive with rows). + */ + public void setColumns(@Nullable final Map> columns) { + this.columns = columns; + } + + /** + * Set the dataSchema of this {@link TabCompletionPostRequest} instance and return the same + * instance. + * + * @param dataSchema (Optional) Schema definition for column data types. If omitted and + * parse_data_types is true, data types will be inferred. + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest dataSchema( + @Nullable final Map dataSchema) { + this.dataSchema = dataSchema; + return this; + } + + /** + * Put one dataSchema instance to this {@link TabCompletionPostRequest} instance. + * + * @param key The String key of this dataSchema instance + * @param dataSchemaItem The dataSchema that should be added under the given key + * @return The same instance of type {@link TabCompletionPostRequest} + */ + @Nonnull + public TabCompletionPostRequest putdataSchemaItem( + @Nonnull final String key, @Nonnull final ColumnDataType dataSchemaItem) { + if (this.dataSchema == null) { + this.dataSchema = new HashMap<>(); + } + this.dataSchema.put(key, dataSchemaItem); + return this; + } + + /** + * (Optional) Schema definition for column data types. If omitted and parse_data_types is true, + * data types will be inferred. + * + * @return dataSchema The dataSchema of this {@link TabCompletionPostRequest} instance. + */ + @Nonnull + public Map getDataSchema() { + return dataSchema; + } + + /** + * Set the dataSchema of this {@link TabCompletionPostRequest} instance. + * + * @param dataSchema (Optional) Schema definition for column data types. If omitted and + * parse_data_types is true, data types will be inferred. + */ + public void setDataSchema(@Nullable final Map dataSchema) { + this.dataSchema = dataSchema; + } + + /** + * Set the parseDataTypes of this {@link TabCompletionPostRequest} instance and return the same + * instance. + * + * @param parseDataTypes Whether to parse data types when data_schema is not provided eg. + * interpret date, numeric + * @return The same instance of this {@link TabCompletionPostRequest} class + */ + @Nonnull + public TabCompletionPostRequest parseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + return this; + } + + /** + * Whether to parse data types when data_schema is not provided eg. interpret date, numeric + * + * @return parseDataTypes The parseDataTypes of this {@link TabCompletionPostRequest} instance. + */ + @Nonnull + public Boolean isParseDataTypes() { + return parseDataTypes; + } + + /** + * Set the parseDataTypes of this {@link TabCompletionPostRequest} instance. + * + * @param parseDataTypes Whether to parse data types when data_schema is not provided eg. + * interpret date, numeric + */ + public void setParseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + } + + /** + * Get the names of the unrecognizable properties of the {@link TabCompletionPostRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TabCompletionPostRequest} 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( + "TabCompletionPostRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TabCompletionPostRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (predictionConfig != null) declaredFields.put("predictionConfig", predictionConfig); + if (indexColumn != null) declaredFields.put("indexColumn", indexColumn); + if (rows != null) declaredFields.put("rows", rows); + if (columns != null) declaredFields.put("columns", columns); + if (dataSchema != null) declaredFields.put("dataSchema", dataSchema); + if (parseDataTypes != null) declaredFields.put("parseDataTypes", parseDataTypes); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TabCompletionPostRequest} 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 TabCompletionPostRequest tabCompletionPostRequest = (TabCompletionPostRequest) o; + return Objects.equals(this.cloudSdkCustomFields, tabCompletionPostRequest.cloudSdkCustomFields) + && Objects.equals(this.predictionConfig, tabCompletionPostRequest.predictionConfig) + && Objects.equals(this.indexColumn, tabCompletionPostRequest.indexColumn) + && Objects.equals(this.rows, tabCompletionPostRequest.rows) + && Objects.equals(this.columns, tabCompletionPostRequest.columns) + && Objects.equals(this.dataSchema, tabCompletionPostRequest.dataSchema) + && Objects.equals(this.parseDataTypes, tabCompletionPostRequest.parseDataTypes); + } + + @Override + public int hashCode() { + return Objects.hash( + predictionConfig, + indexColumn, + rows, + columns, + dataSchema, + parseDataTypes, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TabCompletionPostRequest {\n"); + sb.append(" predictionConfig: ").append(toIndentedString(predictionConfig)).append("\n"); + sb.append(" indexColumn: ").append(toIndentedString(indexColumn)).append("\n"); + sb.append(" rows: ").append(toIndentedString(rows)).append("\n"); + sb.append(" columns: ").append(toIndentedString(columns)).append("\n"); + sb.append(" dataSchema: ").append(toIndentedString(dataSchema)).append("\n"); + sb.append(" parseDataTypes: ").append(toIndentedString(parseDataTypes)).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 TabCompletionPostRequest} instance. No arguments are required. */ + public static TabCompletionPostRequest create() { + return new TabCompletionPostRequest(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java new file mode 100644 index 000000000..981c022f9 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java @@ -0,0 +1,303 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Successful tabular prediction response. */ +// CHECKSTYLE:OFF +public class TabCompletionPostResponse +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("status") + private ErrorStatus status; + + @JsonProperty("predictions") + private List> predictions = new ArrayList<>(); + + @JsonProperty("metadata") + private Metadata metadata; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link TabCompletionPostResponse} instance and return the same instance. + * + * @param id The generated UUID4 for this request (useful for logging). + * @return The same instance of this {@link TabCompletionPostResponse} class + */ + @Nonnull + public TabCompletionPostResponse id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * The generated UUID4 for this request (useful for logging). + * + * @return id The id of this {@link TabCompletionPostResponse} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link TabCompletionPostResponse} instance. + * + * @param id The generated UUID4 for this request (useful for logging). + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the status of this {@link TabCompletionPostResponse} instance and return the same instance. + * + * @param status The status of this {@link TabCompletionPostResponse} + * @return The same instance of this {@link TabCompletionPostResponse} class + */ + @Nonnull + public TabCompletionPostResponse status(@Nullable final ErrorStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link TabCompletionPostResponse} instance. + */ + @Nonnull + public ErrorStatus getStatus() { + return status; + } + + /** + * Set the status of this {@link TabCompletionPostResponse} instance. + * + * @param status The status of this {@link TabCompletionPostResponse} + */ + public void setStatus(@Nullable final ErrorStatus status) { + this.status = status; + } + + /** + * Set the predictions of this {@link TabCompletionPostResponse} instance and return the same + * instance. + * + * @param predictions Array of prediction results sequence-aligned with the order of the query + * rows in the request. + * @return The same instance of this {@link TabCompletionPostResponse} class + */ + @Nonnull + public TabCompletionPostResponse predictions( + @Nullable final List> predictions) { + this.predictions = predictions; + return this; + } + + /** + * Add one predictions instance to this {@link TabCompletionPostResponse}. + * + * @param predictionsItem The predictions that should be added + * @return The same instance of type {@link TabCompletionPostResponse} + */ + @Nonnull + public TabCompletionPostResponse addPredictionsItem( + @Nonnull final Map predictionsItem) { + if (this.predictions == null) { + this.predictions = new ArrayList<>(); + } + this.predictions.add(predictionsItem); + return this; + } + + /** + * Array of prediction results sequence-aligned with the order of the query rows in the request. + * + * @return predictions The predictions of this {@link TabCompletionPostResponse} instance. + */ + @Nonnull + public List> getPredictions() { + return predictions; + } + + /** + * Set the predictions of this {@link TabCompletionPostResponse} instance. + * + * @param predictions Array of prediction results sequence-aligned with the order of the query + * rows in the request. + */ + public void setPredictions( + @Nullable final List> predictions) { + this.predictions = predictions; + } + + /** + * Set the metadata of this {@link TabCompletionPostResponse} instance and return the same + * instance. + * + * @param metadata The metadata of this {@link TabCompletionPostResponse} + * @return The same instance of this {@link TabCompletionPostResponse} class + */ + @Nonnull + public TabCompletionPostResponse metadata(@Nullable final Metadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link TabCompletionPostResponse} instance. + */ + @Nonnull + public Metadata getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link TabCompletionPostResponse} instance. + * + * @param metadata The metadata of this {@link TabCompletionPostResponse} + */ + public void setMetadata(@Nullable final Metadata metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link TabCompletionPostResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TabCompletionPostResponse} 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( + "TabCompletionPostResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TabCompletionPostResponse} 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 (status != null) declaredFields.put("status", status); + if (predictions != null) declaredFields.put("predictions", predictions); + if (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TabCompletionPostResponse} 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 TabCompletionPostResponse tabCompletionPostResponse = (TabCompletionPostResponse) o; + return Objects.equals(this.cloudSdkCustomFields, tabCompletionPostResponse.cloudSdkCustomFields) + && Objects.equals(this.id, tabCompletionPostResponse.id) + && Objects.equals(this.status, tabCompletionPostResponse.status) + && Objects.equals(this.predictions, tabCompletionPostResponse.predictions) + && Objects.equals(this.metadata, tabCompletionPostResponse.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, predictions, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TabCompletionPostResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" predictions: ").append(toIndentedString(predictions)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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 TabCompletionPostResponse} instance. No arguments are required. */ + public static TabCompletionPostResponse create() { + return new TabCompletionPostResponse(); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java new file mode 100644 index 000000000..1bee31586 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java @@ -0,0 +1,321 @@ +/* + * SAP RPT API + * SAP RPT API for predictive insights using in-context learning on structured business data. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Configuration for a target column to predict. */ +// CHECKSTYLE:OFF +public class TargetColumn +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("prediction_placeholder") + private String predictionPlaceholder; + + /** (Optional) Type of prediction task. If omitted, model attempts to infer task type. */ + public enum TaskTypeEnum { + /** The CLASSIFICATION option of this TargetColumn */ + CLASSIFICATION("classification"), + + /** The REGRESSION option of this TargetColumn */ + REGRESSION("regression"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this TargetColumn */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TaskTypeEnum(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 TargetColumn + */ + @JsonCreator + @Nonnull + public static TaskTypeEnum fromValue(@Nonnull final String value) { + for (TaskTypeEnum b : TaskTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("task_type") + private TaskTypeEnum taskType; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link TargetColumn} instance and return the same instance. + * + * @param name Name of the column to predict. + * @return The same instance of this {@link TargetColumn} class + */ + @Nonnull + public TargetColumn name(@Nullable final String name) { + this.name = name; + return this; + } + + /** + * Name of the column to predict. + * + * @return name The name of this {@link TargetColumn} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link TargetColumn} instance. + * + * @param name Name of the column to predict. + */ + public void setName(@Nullable final String name) { + this.name = name; + } + + /** + * Set the predictionPlaceholder of this {@link TargetColumn} instance and return the same + * instance. + * + * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. + * @return The same instance of this {@link TargetColumn} class + */ + @Nonnull + public TargetColumn predictionPlaceholder(@Nonnull final String predictionPlaceholder) { + this.predictionPlaceholder = predictionPlaceholder; + return this; + } + + /** + * Value used as placeholder in cells where prediction is needed. + * + * @return predictionPlaceholder The predictionPlaceholder of this {@link TargetColumn} instance. + */ + @Nonnull + public String getPredictionPlaceholder() { + return predictionPlaceholder; + } + + /** + * Set the predictionPlaceholder of this {@link TargetColumn} instance. + * + * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. + */ + public void setPredictionPlaceholder(@Nonnull final String predictionPlaceholder) { + this.predictionPlaceholder = predictionPlaceholder; + } + + /** + * Set the taskType of this {@link TargetColumn} instance and return the same instance. + * + * @param taskType (Optional) Type of prediction task. If omitted, model attempts to infer task + * type. + * @return The same instance of this {@link TargetColumn} class + */ + @Nonnull + public TargetColumn taskType(@Nullable final TaskTypeEnum taskType) { + this.taskType = taskType; + return this; + } + + /** + * (Optional) Type of prediction task. If omitted, model attempts to infer task type. + * + * @return taskType The taskType of this {@link TargetColumn} instance. + */ + @Nonnull + public TaskTypeEnum getTaskType() { + return taskType; + } + + /** + * Set the taskType of this {@link TargetColumn} instance. + * + * @param taskType (Optional) Type of prediction task. If omitted, model attempts to infer task + * type. + */ + public void setTaskType(@Nullable final TaskTypeEnum taskType) { + this.taskType = taskType; + } + + /** + * Get the names of the unrecognizable properties of the {@link TargetColumn}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TargetColumn} 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("TargetColumn has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TargetColumn} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (predictionPlaceholder != null) + declaredFields.put("predictionPlaceholder", predictionPlaceholder); + if (taskType != null) declaredFields.put("taskType", taskType); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TargetColumn} 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 TargetColumn targetColumn = (TargetColumn) o; + return Objects.equals(this.cloudSdkCustomFields, targetColumn.cloudSdkCustomFields) + && Objects.equals(this.name, targetColumn.name) + && Objects.equals(this.predictionPlaceholder, targetColumn.predictionPlaceholder) + && Objects.equals(this.taskType, targetColumn.taskType); + } + + @Override + public int hashCode() { + return Objects.hash(name, predictionPlaceholder, taskType, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TargetColumn {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" predictionPlaceholder: ") + .append(toIndentedString(predictionPlaceholder)) + .append("\n"); + sb.append(" taskType: ").append(toIndentedString(taskType)).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 TargetColumn} instance + * with all required arguments. + */ + public static Builder create() { + return (predictionPlaceholder) -> + new TargetColumn().predictionPlaceholder(predictionPlaceholder); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the predictionPlaceholder of this {@link TargetColumn} instance. + * + * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. + * @return The TargetColumn instance. + */ + TargetColumn predictionPlaceholder(@Nonnull final String predictionPlaceholder); + } +} diff --git a/pom.xml b/pom.xml index a6b0ab581..991899c07 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,7 @@ core-services/document-grounding core-services/prompt-registry foundation-models/openai + foundation-models/sap-rpt scm:git:git://github.com/SAP/ai-sdk-java.git @@ -652,6 +653,7 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma com/sap/ai/sdk/core/client/* com/sap/ai/sdk/core/model/* com/sap/ai/sdk/foundationmodels/openai/generated/model/* + com/sap/ai/sdk/foundationmodels/rpt/generated/** com/sap/ai/sdk/orchestration/model/* com/sap/ai/sdk/grounding/client/* com/sap/ai/sdk/grounding/model/* @@ -679,6 +681,7 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma com/sap/ai/sdk/core/model/* com/sap/ai/sdk/orchestration/model/* com/sap/ai/sdk/foundationmodels/openai/generated/model/* + com/sap/ai/sdk/foundationmodels/rpt/generated/** com/sap/ai/sdk/grounding/client/* com/sap/ai/sdk/grounding/model/* com/sap/ai/sdk/prompt/registry/model/* From 3d4c9790cb77ba600aef242b19896a7047e55d24 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 14:37:07 +0100 Subject: [PATCH 05/17] Minor component renaming --- ...tadata.java => TabCompletionMetadata.java} | 81 ++++++++++--------- .../model/TabCompletionPostResponse.java | 8 +- .../src/main/resources/spec/sap-rpt.yaml | 7 +- 3 files changed, 50 insertions(+), 46 deletions(-) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{Metadata.java => TabCompletionMetadata.java} (67%) diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java similarity index 67% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java index eb55e16e0..fac9536f3 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Metadata.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java @@ -23,9 +23,9 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Metadata about the prediction request. */ +/** TabCompletionMetadata about the prediction request. */ // CHECKSTYLE:OFF -public class Metadata +public class TabCompletionMetadata // CHECKSTYLE:ON { @JsonProperty("num_rows") @@ -44,13 +44,13 @@ public class Metadata private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the numRows of this {@link Metadata} instance and return the same instance. + * Set the numRows of this {@link TabCompletionMetadata} instance and return the same instance. * * @param numRows The total number of input rows. - * @return The same instance of this {@link Metadata} class + * @return The same instance of this {@link TabCompletionMetadata} class */ @Nonnull - public Metadata numRows(@Nullable final Integer numRows) { + public TabCompletionMetadata numRows(@Nullable final Integer numRows) { this.numRows = numRows; return this; } @@ -58,7 +58,7 @@ public Metadata numRows(@Nullable final Integer numRows) { /** * The total number of input rows. * - * @return numRows The numRows of this {@link Metadata} instance. + * @return numRows The numRows of this {@link TabCompletionMetadata} instance. */ @Nonnull public Integer getNumRows() { @@ -66,7 +66,7 @@ public Integer getNumRows() { } /** - * Set the numRows of this {@link Metadata} instance. + * Set the numRows of this {@link TabCompletionMetadata} instance. * * @param numRows The total number of input rows. */ @@ -75,13 +75,13 @@ public void setNumRows(@Nullable final Integer numRows) { } /** - * Set the numColumns of this {@link Metadata} instance and return the same instance. + * Set the numColumns of this {@link TabCompletionMetadata} instance and return the same instance. * * @param numColumns The total number of input columns. - * @return The same instance of this {@link Metadata} class + * @return The same instance of this {@link TabCompletionMetadata} class */ @Nonnull - public Metadata numColumns(@Nullable final Integer numColumns) { + public TabCompletionMetadata numColumns(@Nullable final Integer numColumns) { this.numColumns = numColumns; return this; } @@ -89,7 +89,7 @@ public Metadata numColumns(@Nullable final Integer numColumns) { /** * The total number of input columns. * - * @return numColumns The numColumns of this {@link Metadata} instance. + * @return numColumns The numColumns of this {@link TabCompletionMetadata} instance. */ @Nonnull public Integer getNumColumns() { @@ -97,7 +97,7 @@ public Integer getNumColumns() { } /** - * Set the numColumns of this {@link Metadata} instance. + * Set the numColumns of this {@link TabCompletionMetadata} instance. * * @param numColumns The total number of input columns. */ @@ -106,14 +106,15 @@ public void setNumColumns(@Nullable final Integer numColumns) { } /** - * Set the numPredictions of this {@link Metadata} instance and return the same instance. + * Set the numPredictions of this {@link TabCompletionMetadata} instance and return the same + * instance. * * @param numPredictions The number of table cells containing the specified placeholder values * summed over all target columns. - * @return The same instance of this {@link Metadata} class + * @return The same instance of this {@link TabCompletionMetadata} class */ @Nonnull - public Metadata numPredictions(@Nullable final Integer numPredictions) { + public TabCompletionMetadata numPredictions(@Nullable final Integer numPredictions) { this.numPredictions = numPredictions; return this; } @@ -122,7 +123,7 @@ public Metadata numPredictions(@Nullable final Integer numPredictions) { * The number of table cells containing the specified placeholder values summed over all target * columns. * - * @return numPredictions The numPredictions of this {@link Metadata} instance. + * @return numPredictions The numPredictions of this {@link TabCompletionMetadata} instance. */ @Nonnull public Integer getNumPredictions() { @@ -130,7 +131,7 @@ public Integer getNumPredictions() { } /** - * Set the numPredictions of this {@link Metadata} instance. + * Set the numPredictions of this {@link TabCompletionMetadata} instance. * * @param numPredictions The number of table cells containing the specified placeholder values * summed over all target columns. @@ -140,13 +141,14 @@ public void setNumPredictions(@Nullable final Integer numPredictions) { } /** - * Set the numQueryRows of this {@link Metadata} instance and return the same instance. + * Set the numQueryRows of this {@link TabCompletionMetadata} instance and return the same + * instance. * * @param numQueryRows The number of query rows for which a prediction was made. - * @return The same instance of this {@link Metadata} class + * @return The same instance of this {@link TabCompletionMetadata} class */ @Nonnull - public Metadata numQueryRows(@Nullable final Integer numQueryRows) { + public TabCompletionMetadata numQueryRows(@Nullable final Integer numQueryRows) { this.numQueryRows = numQueryRows; return this; } @@ -154,7 +156,7 @@ public Metadata numQueryRows(@Nullable final Integer numQueryRows) { /** * The number of query rows for which a prediction was made. * - * @return numQueryRows The numQueryRows of this {@link Metadata} instance. + * @return numQueryRows The numQueryRows of this {@link TabCompletionMetadata} instance. */ @Nonnull public Integer getNumQueryRows() { @@ -162,7 +164,7 @@ public Integer getNumQueryRows() { } /** - * Set the numQueryRows of this {@link Metadata} instance. + * Set the numQueryRows of this {@link TabCompletionMetadata} instance. * * @param numQueryRows The number of query rows for which a prediction was made. */ @@ -171,7 +173,7 @@ public void setNumQueryRows(@Nullable final Integer numQueryRows) { } /** - * Get the names of the unrecognizable properties of the {@link Metadata}. + * Get the names of the unrecognizable properties of the {@link TabCompletionMetadata}. * * @return The set of properties names */ @@ -182,7 +184,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link Metadata} instance. + * Get the value of an unrecognizable property of this {@link TabCompletionMetadata} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -193,14 +195,15 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("Metadata has no field with name '" + name + "'."); + throw new NoSuchElementException( + "TabCompletionMetadata has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link Metadata} instance including unrecognized - * properties. + * Get the value of all properties of this {@link TabCompletionMetadata} instance including + * unrecognized properties. * * @return The map of all properties */ @@ -216,8 +219,8 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link Metadata} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link TabCompletionMetadata} 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 @@ -235,12 +238,12 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final Metadata metadata = (Metadata) o; - return Objects.equals(this.cloudSdkCustomFields, metadata.cloudSdkCustomFields) - && Objects.equals(this.numRows, metadata.numRows) - && Objects.equals(this.numColumns, metadata.numColumns) - && Objects.equals(this.numPredictions, metadata.numPredictions) - && Objects.equals(this.numQueryRows, metadata.numQueryRows); + final TabCompletionMetadata tabCompletionMetadata = (TabCompletionMetadata) o; + return Objects.equals(this.cloudSdkCustomFields, tabCompletionMetadata.cloudSdkCustomFields) + && Objects.equals(this.numRows, tabCompletionMetadata.numRows) + && Objects.equals(this.numColumns, tabCompletionMetadata.numColumns) + && Objects.equals(this.numPredictions, tabCompletionMetadata.numPredictions) + && Objects.equals(this.numQueryRows, tabCompletionMetadata.numQueryRows); } @Override @@ -252,7 +255,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class Metadata {\n"); + sb.append("class TabCompletionMetadata {\n"); sb.append(" numRows: ").append(toIndentedString(numRows)).append("\n"); sb.append(" numColumns: ").append(toIndentedString(numColumns)).append("\n"); sb.append(" numPredictions: ").append(toIndentedString(numPredictions)).append("\n"); @@ -274,8 +277,8 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link Metadata} instance. No arguments are required. */ - public static Metadata create() { - return new Metadata(); + /** Create a new {@link TabCompletionMetadata} instance. No arguments are required. */ + public static TabCompletionMetadata create() { + return new TabCompletionMetadata(); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java index 981c022f9..1d3115ad7 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java @@ -40,7 +40,7 @@ public class TabCompletionPostResponse private List> predictions = new ArrayList<>(); @JsonProperty("metadata") - private Metadata metadata; + private TabCompletionMetadata metadata; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -167,7 +167,7 @@ public void setPredictions( * @return The same instance of this {@link TabCompletionPostResponse} class */ @Nonnull - public TabCompletionPostResponse metadata(@Nullable final Metadata metadata) { + public TabCompletionPostResponse metadata(@Nullable final TabCompletionMetadata metadata) { this.metadata = metadata; return this; } @@ -178,7 +178,7 @@ public TabCompletionPostResponse metadata(@Nullable final Metadata metadata) { * @return metadata The metadata of this {@link TabCompletionPostResponse} instance. */ @Nonnull - public Metadata getMetadata() { + public TabCompletionMetadata getMetadata() { return metadata; } @@ -187,7 +187,7 @@ public Metadata getMetadata() { * * @param metadata The metadata of this {@link TabCompletionPostResponse} */ - public void setMetadata(@Nullable final Metadata metadata) { + public void setMetadata(@Nullable final TabCompletionMetadata metadata) { this.metadata = metadata; } diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml index 167517d3f..843725ed3 100644 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -1,3 +1,4 @@ +# Unofficial OpenAPI specification for SAP RPT API. openapi: 3.0.0 info: @@ -161,7 +162,7 @@ components: items: $ref: '#/components/schemas/PredictionResults' metadata: - $ref: '#/components/schemas/Metadata' + $ref: '#/components/schemas/TabCompletionMetadata' PredictionResults: type: object description: Prediction results for a query row that may contain target column predictions and optional index column. @@ -189,9 +190,9 @@ components: format: float nullable: true description: The confidence score for this prediction (for classification tasks only). - Metadata: + TabCompletionMetadata: type: object - description: Metadata about the prediction request. + description: TabCompletionMetadata about the prediction request. properties: num_rows: type: integer From faa656a3534b99c625e37d5d5218497d9397df21 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 20 Jan 2026 18:15:35 +0100 Subject: [PATCH 06/17] Complete working draft with e2e test --- foundation-models/sap-rpt/pom.xml | 43 +++++++- .../sdk/foundationmodels/rpt/RptClient.java | 52 +++++++++ .../ai/sdk/foundationmodels/rpt/RptModel.java | 33 ++++++ .../rpt/generated/client/PredictApi.java | 104 ++++++++++++++++++ .../model/TabCompletionPostResponse.java | 8 +- ...orStatus.java => TabCompletionStatus.java} | 67 +++++------ .../src/main/resources/spec/sap-rpt.yaml | 20 ++-- .../foundationmodels/rpt/RptClientTest.java | 90 +++++++++++++++ 8 files changed, 366 insertions(+), 51 deletions(-) create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{ErrorStatus.java => TabCompletionStatus.java} (70%) create mode 100644 foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index b1cf39576..bfa856e11 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -40,6 +40,26 @@ + + com.sap.ai.sdk + core + + + com.sap.cloud.sdk.cloudplatform + cloudplatform-connectivity + + + com.sap.cloud.sdk.datamodel + openapi-core + + + org.springframework + spring-core + + + org.springframework + spring-web + com.fasterxml.jackson.core jackson-annotations @@ -48,6 +68,27 @@ com.google.code.findbugs jsr305 + + com.google.guava + guava + + + + org.projectlombok + lombok + provided + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.assertj + assertj-core + test + @@ -80,7 +121,7 @@ ${project.basedir}/src/main/resources/spec/sap-rpt.yaml com.sap.ai.sdk.foundationmodels.rpt.generated.model com.sap.ai.sdk.foundationmodels.rpt.generated.client - false + true create true diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java new file mode 100644 index 000000000..40e5d997e --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -0,0 +1,52 @@ +package com.sap.ai.sdk.foundationmodels.rpt; + +import com.sap.ai.sdk.core.AiCoreService; +import com.sap.ai.sdk.core.DeploymentResolutionException; +import com.sap.ai.sdk.foundationmodels.rpt.generated.client.PredictApi; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostRequest; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostResponse; +import javax.annotation.Nonnull; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; + +/** Client for interacting with SAP RPT foundation models. */ +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public class RptClient { + @Nonnull private final PredictApi api; + + /** + * Creates a new RptClient for the specified foundation model. + * + * @param foundationModel The foundation model to use. + * @return A new instance of RptClient. + * @throws DeploymentResolutionException If there is an error resolving the deployment. + */ + @Nonnull + public static RptClient forModel(@Nonnull final RptModel foundationModel) + throws DeploymentResolutionException { + final var destination = new AiCoreService().getInferenceDestination().forModel(foundationModel); + return new RptClient(new PredictApi(destination)); + } + + /** + * Predict targets using SAP RPT model with structured data. + * + *

+ * + *

200 - Successful response with predictive insights. + * + *

400 - Bad Request - Invalid input. + * + *

422 - Unprocessable Content - Invalid input. + * + *

500 - Internal Server Error. + * + * @param requestBody The value for the parameter tabCompletionPostRequest + * @return TabCompletionPostResponse + */ + @Nonnull + public TabCompletionPostResponse tabCompletion( + @Nonnull final TabCompletionPostRequest requestBody) { + return api.completionsCreate(requestBody); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java new file mode 100644 index 000000000..ab906b1e6 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java @@ -0,0 +1,33 @@ +package com.sap.ai.sdk.foundationmodels.rpt; + +import com.sap.ai.sdk.core.AiModel; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Represents an SAP RPT foundation model. + * + *

Example models: + * + * @param name The name of the model. + * @param version The version of the model (optional). + */ +public record RptModel(@Nonnull String name, @Nullable String version) implements AiModel { + + /** SAP RPT 1 Small model. */ + public static final RptModel SAP_RPT_1_SMALL = new RptModel("sap-rpt-1-small", null); + + /** SAP RPT 1 Large model. */ + public static final RptModel SAP_RPT_1_LARGE = new RptModel("sap-rpt-1-large", null); + + /** + * Create a new instance of RptModel with the provided version. + * + * @param version The version of the model. + * @return The new instance of RptModel. + */ + @Nonnull + public RptModel withVersion(@Nonnull final String version) { + return new RptModel(name, version); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java new file mode 100644 index 000000000..09ee03c37 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java @@ -0,0 +1,104 @@ +package com.sap.ai.sdk.foundationmodels.rpt.generated.client; + +import com.google.common.annotations.Beta; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostRequest; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostResponse; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import java.util.List; +import javax.annotation.Nonnull; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * SAP RPT API in version 0.0.1-SNAPSHOT. + * + *

SAP RPT API for predictive insights using in-context learning on structured business data. + */ +public class PredictApi extends AbstractOpenApiService { + /** + * Instantiates this API class to invoke operations on the SAP RPT API. + * + * @param httpDestination The destination that API should be used with + */ + public PredictApi(@Nonnull final Destination httpDestination) { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the SAP RPT API based on a given {@link + * ApiClient}. + * + * @param apiClient ApiClient to invoke the API on + */ + @Beta + public PredictApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * Predict targets using SAP RPT model with structured data. + * + *

+ * + *

200 - Successful response with predictive insights. + * + *

400 - Bad Request - Invalid input. + * + *

422 - Unprocessable Content - Invalid input. + * + *

500 - Internal Server Error. + * + * @param tabCompletionPostRequest The value for the parameter tabCompletionPostRequest + * @return TabCompletionPostResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public TabCompletionPostResponse completionsCreate( + @Nonnull final TabCompletionPostRequest tabCompletionPostRequest) + throws OpenApiRequestException { + final Object localVarPostBody = tabCompletionPostRequest; + + // verify the required parameter 'tabCompletionPostRequest' is set + if (tabCompletionPostRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'tabCompletionPostRequest' when calling completionsCreate"); + } + + final String localVarPath = UriComponentsBuilder.fromPath("/predict").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java index 1d3115ad7..a6b527ef0 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java @@ -34,7 +34,7 @@ public class TabCompletionPostResponse private String id; @JsonProperty("status") - private ErrorStatus status; + private TabCompletionStatus status; @JsonProperty("predictions") private List> predictions = new ArrayList<>(); @@ -83,7 +83,7 @@ public void setId(@Nullable final String id) { * @return The same instance of this {@link TabCompletionPostResponse} class */ @Nonnull - public TabCompletionPostResponse status(@Nullable final ErrorStatus status) { + public TabCompletionPostResponse status(@Nullable final TabCompletionStatus status) { this.status = status; return this; } @@ -94,7 +94,7 @@ public TabCompletionPostResponse status(@Nullable final ErrorStatus status) { * @return status The status of this {@link TabCompletionPostResponse} instance. */ @Nonnull - public ErrorStatus getStatus() { + public TabCompletionStatus getStatus() { return status; } @@ -103,7 +103,7 @@ public ErrorStatus getStatus() { * * @param status The status of this {@link TabCompletionPostResponse} */ - public void setStatus(@Nullable final ErrorStatus status) { + public void setStatus(@Nullable final TabCompletionStatus status) { this.status = status; } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java similarity index 70% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java index 39ec93844..7f198caec 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorStatus.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java @@ -25,26 +25,26 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** ErrorStatus object indicating the result of the request. */ +/** TabCompletionStatus object indicating the result of the request. */ // CHECKSTYLE:OFF -public class ErrorStatus +public class TabCompletionStatus // CHECKSTYLE:ON { /** The numeric status code. */ public enum CodeEnum { - /** The NUMBER_0 option of this ErrorStatus */ + /** The NUMBER_0 option of this TabCompletionStatus */ NUMBER_0(0), - /** The NUMBER_1 option of this ErrorStatus */ + /** The NUMBER_1 option of this TabCompletionStatus */ NUMBER_1(1), - /** The NUMBER_2 option of this ErrorStatus */ + /** The NUMBER_2 option of this TabCompletionStatus */ NUMBER_2(2), - /** The NUMBER_3 option of this ErrorStatus */ + /** The NUMBER_3 option of this TabCompletionStatus */ NUMBER_3(3), - /** The NUMBER_unknown_default_open_api option of this ErrorStatus */ + /** The NUMBER_unknown_default_open_api option of this TabCompletionStatus */ NUMBER_unknown_default_open_api(11184809); private Integer value; @@ -79,7 +79,7 @@ public String toString() { * Get the enum value from a String value * * @param value The String value - * @return The enum value of type ErrorStatus + * @return The enum value of type TabCompletionStatus */ @JsonCreator @Nonnull @@ -103,13 +103,13 @@ public static CodeEnum fromValue(@Nonnull final Integer value) { private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the code of this {@link ErrorStatus} instance and return the same instance. + * Set the code of this {@link TabCompletionStatus} instance and return the same instance. * * @param code The numeric status code. - * @return The same instance of this {@link ErrorStatus} class + * @return The same instance of this {@link TabCompletionStatus} class */ @Nonnull - public ErrorStatus code(@Nullable final CodeEnum code) { + public TabCompletionStatus code(@Nullable final CodeEnum code) { this.code = code; return this; } @@ -117,7 +117,7 @@ public ErrorStatus code(@Nullable final CodeEnum code) { /** * The numeric status code. * - * @return code The code of this {@link ErrorStatus} instance. + * @return code The code of this {@link TabCompletionStatus} instance. */ @Nonnull public CodeEnum getCode() { @@ -125,7 +125,7 @@ public CodeEnum getCode() { } /** - * Set the code of this {@link ErrorStatus} instance. + * Set the code of this {@link TabCompletionStatus} instance. * * @param code The numeric status code. */ @@ -134,13 +134,13 @@ public void setCode(@Nullable final CodeEnum code) { } /** - * Set the message of this {@link ErrorStatus} instance and return the same instance. + * Set the message of this {@link TabCompletionStatus} instance and return the same instance. * * @param message The status message text. - * @return The same instance of this {@link ErrorStatus} class + * @return The same instance of this {@link TabCompletionStatus} class */ @Nonnull - public ErrorStatus message(@Nullable final String message) { + public TabCompletionStatus message(@Nullable final String message) { this.message = message; return this; } @@ -148,7 +148,7 @@ public ErrorStatus message(@Nullable final String message) { /** * The status message text. * - * @return message The message of this {@link ErrorStatus} instance. + * @return message The message of this {@link TabCompletionStatus} instance. */ @Nonnull public String getMessage() { @@ -156,7 +156,7 @@ public String getMessage() { } /** - * Set the message of this {@link ErrorStatus} instance. + * Set the message of this {@link TabCompletionStatus} instance. * * @param message The status message text. */ @@ -165,7 +165,7 @@ public void setMessage(@Nullable final String message) { } /** - * Get the names of the unrecognizable properties of the {@link ErrorStatus}. + * Get the names of the unrecognizable properties of the {@link TabCompletionStatus}. * * @return The set of properties names */ @@ -176,7 +176,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link ErrorStatus} instance. + * Get the value of an unrecognizable property of this {@link TabCompletionStatus} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -187,14 +187,15 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("ErrorStatus has no field with name '" + name + "'."); + throw new NoSuchElementException( + "TabCompletionStatus has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ErrorStatus} instance including unrecognized - * properties. + * Get the value of all properties of this {@link TabCompletionStatus} instance including + * unrecognized properties. * * @return The map of all properties */ @@ -208,8 +209,8 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link ErrorStatus} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link TabCompletionStatus} 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 @@ -227,10 +228,10 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final ErrorStatus errorStatus = (ErrorStatus) o; - return Objects.equals(this.cloudSdkCustomFields, errorStatus.cloudSdkCustomFields) - && Objects.equals(this.code, errorStatus.code) - && Objects.equals(this.message, errorStatus.message); + final TabCompletionStatus tabCompletionStatus = (TabCompletionStatus) o; + return Objects.equals(this.cloudSdkCustomFields, tabCompletionStatus.cloudSdkCustomFields) + && Objects.equals(this.code, tabCompletionStatus.code) + && Objects.equals(this.message, tabCompletionStatus.message); } @Override @@ -242,7 +243,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ErrorStatus {\n"); + sb.append("class TabCompletionStatus {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); cloudSdkCustomFields.forEach( @@ -262,8 +263,8 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link ErrorStatus} instance. No arguments are required. */ - public static ErrorStatus create() { - return new ErrorStatus(); + /** Create a new {@link TabCompletionStatus} instance. No arguments are required. */ + public static TabCompletionStatus create() { + return new TabCompletionStatus(); } } diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml index 843725ed3..56a3f2e49 100644 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -7,18 +7,12 @@ info: version: 0.0.1-SNAPSHOT paths: - /deployments/{deployment-id}/completions: + /predict: post: + tags: + - Predict summary: Predict targets using SAP RPT model with structured data. operationId: Completions_Create - parameters: - - name: deployment-id - in: path - required: true - schema: - type: string - example: davinci - description: Deployment id of the model which was deployed. requestBody: required: true content: @@ -155,7 +149,7 @@ components: description: The generated UUID4 for this request (useful for logging). example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" status: - $ref: '#/components/schemas/ErrorStatus' + $ref: '#/components/schemas/TabCompletionStatus' predictions: type: array description: Array of prediction results sequence-aligned with the order of the query rows in the request. @@ -213,7 +207,7 @@ components: properties: status: allOf: - - $ref: '#/components/schemas/ErrorStatus' + - $ref: '#/components/schemas/TabCompletionStatus' - properties: code: enum: [ 2 ] @@ -253,9 +247,9 @@ components: type: type: string description: Error type. - ErrorStatus: + TabCompletionStatus: type: object - description: ErrorStatus object indicating the result of the request. + description: TabCompletionStatus object indicating the result of the request. properties: code: type: integer diff --git a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java new file mode 100644 index 000000000..1018dcbf5 --- /dev/null +++ b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java @@ -0,0 +1,90 @@ +package com.sap.ai.sdk.foundationmodels.rpt; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.*; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class RptClientTest { + + @Test + void testTabCompletionWithRowsFormat() { + final var request = + TabCompletionPostRequest.create() + .predictionConfig( + PredictionConfig.create() + .targetColumns( + List.of( + TargetColumn.create() + .predictionPlaceholder("[PREDICT]") + .name("COSTCENTER") + .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)))) + .indexColumn("ID") + .rows( + List.of( + Map.of( + "PRODUCT", "Couch", + "PRICE", 999.99, + "ORDERDATE", "28-11-2025", + "ID", "35", + "COSTCENTER", "[PREDICT]"), + Map.of( + "PRODUCT", "Office Chair", + "PRICE", 150.8, + "ORDERDATE", "02-11-2025", + "ID", "44", + "COSTCENTER", "Office Furniture"), + Map.of( + "PRODUCT", "Server Rack", + "PRICE", 2200.00, + "ORDERDATE", "01-11-2025", + "ID", "104", + "COSTCENTER", "Data Infrastructure"))) + .dataSchema( + Map.of( + "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), + "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), + "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING))) + .parseDataTypes(true); + + final var response = RptClient.forModel(RptModel.SAP_RPT_1_SMALL).tabCompletion(request); + + assertThat(response).isNotNull(); + } + + @Test + void testTabCompletionWithColumnsFormat() { + var request = + TabCompletionPostRequest.create() + .predictionConfig( + PredictionConfig.create() + .targetColumns( + List.of( + TargetColumn.create() + .predictionPlaceholder("[PREDICT]") + .name("COSTCENTER") + .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)))) + .indexColumn("ID") + .columns( + Map.of( + "PRODUCT", List.of("Couch", "Office Chair", "Server Rack"), + "PRICE", List.of(999.99, 150.8, 2200.00), + "ORDERDATE", List.of("28-11-2025", "02-11-2025", "01-11-2025"), + "ID", List.of("35", "44", "104"), + "COSTCENTER", List.of("[PREDICT]", "Office Furniture", "Data Infrastructure"))) + .dataSchema( + Map.of( + "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), + "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), + "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING))) + .parseDataTypes(true); + + RptClient.forModel(RptModel.SAP_RPT_1_SMALL).tabCompletion(request); + } +} From 1931444ea6242951b0a7946dbcc073600be69f2f Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Wed, 21 Jan 2026 18:14:36 +0100 Subject: [PATCH 07/17] Unit test coverage --- foundation-models/sap-rpt/pom.xml | 9 + .../sdk/foundationmodels/rpt/RptClient.java | 11 + .../{Prediction.java => PredictionItem.java} | 58 +++--- ...ion.java => PredictionItemPrediction.java} | 12 +- .../model/PredictionResultsValue.java | 15 +- .../src/main/resources/spec/sap-rpt.yaml | 6 +- .../foundationmodels/rpt/RptClientTest.java | 195 +++++++++++------- .../resources/mappings/predictColumnWise.json | 98 +++++++++ .../resources/mappings/predictRowWise.json | 94 +++++++++ 9 files changed, 384 insertions(+), 114 deletions(-) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{Prediction.java => PredictionItem.java} (71%) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{PredictionPrediction.java => PredictionItemPrediction.java} (84%) create mode 100644 foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json create mode 100644 foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index bfa856e11..d4ee5ce8d 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -89,6 +89,15 @@ assertj-core test + + org.wiremock + wiremock + + + com.sap.cloud.sdk.cloudplatform + connectivity-apache-httpclient5 + test + diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 40e5d997e..53cdc411f 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -5,6 +5,7 @@ import com.sap.ai.sdk.foundationmodels.rpt.generated.client.PredictApi; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostRequest; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostResponse; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; import javax.annotation.Nonnull; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; @@ -25,6 +26,16 @@ public class RptClient { public static RptClient forModel(@Nonnull final RptModel foundationModel) throws DeploymentResolutionException { final var destination = new AiCoreService().getInferenceDestination().forModel(foundationModel); + return forDestination(destination); + } + + /** + * Creates a new RptClient for the specified destination. + * + * @param destination The destination to use. + * @return A new instance of RptClient. + */ + static RptClient forDestination(@Nonnull final Destination destination) { return new RptClient(new PredictApi(destination)); } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java similarity index 71% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java index 62cf6b19e..2e35934c4 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java @@ -25,11 +25,11 @@ /** Individual prediction result for a cell. */ // CHECKSTYLE:OFF -public class Prediction +public class PredictionItem // CHECKSTYLE:ON { @JsonProperty("prediction") - private PredictionPrediction prediction; + private PredictionItemPrediction prediction; @JsonProperty("confidence") private Float confidence; @@ -38,13 +38,13 @@ public class Prediction private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the prediction of this {@link Prediction} instance and return the same instance. + * Set the prediction of this {@link PredictionItem} instance and return the same instance. * - * @param prediction The prediction of this {@link Prediction} - * @return The same instance of this {@link Prediction} class + * @param prediction The prediction of this {@link PredictionItem} + * @return The same instance of this {@link PredictionItem} class */ @Nonnull - public Prediction prediction(@Nullable final PredictionPrediction prediction) { + public PredictionItem prediction(@Nullable final PredictionItemPrediction prediction) { this.prediction = prediction; return this; } @@ -52,30 +52,30 @@ public Prediction prediction(@Nullable final PredictionPrediction prediction) { /** * Get prediction * - * @return prediction The prediction of this {@link Prediction} instance. + * @return prediction The prediction of this {@link PredictionItem} instance. */ @Nonnull - public PredictionPrediction getPrediction() { + public PredictionItemPrediction getPrediction() { return prediction; } /** - * Set the prediction of this {@link Prediction} instance. + * Set the prediction of this {@link PredictionItem} instance. * - * @param prediction The prediction of this {@link Prediction} + * @param prediction The prediction of this {@link PredictionItem} */ - public void setPrediction(@Nullable final PredictionPrediction prediction) { + public void setPrediction(@Nullable final PredictionItemPrediction prediction) { this.prediction = prediction; } /** - * Set the confidence of this {@link Prediction} instance and return the same instance. + * Set the confidence of this {@link PredictionItem} instance and return the same instance. * * @param confidence The confidence score for this prediction (for classification tasks only). - * @return The same instance of this {@link Prediction} class + * @return The same instance of this {@link PredictionItem} class */ @Nonnull - public Prediction confidence(@Nullable final Float confidence) { + public PredictionItem confidence(@Nullable final Float confidence) { this.confidence = confidence; return this; } @@ -83,7 +83,7 @@ public Prediction confidence(@Nullable final Float confidence) { /** * The confidence score for this prediction (for classification tasks only). * - * @return confidence The confidence of this {@link Prediction} instance. + * @return confidence The confidence of this {@link PredictionItem} instance. */ @Nullable public Float getConfidence() { @@ -91,7 +91,7 @@ public Float getConfidence() { } /** - * Set the confidence of this {@link Prediction} instance. + * Set the confidence of this {@link PredictionItem} instance. * * @param confidence The confidence score for this prediction (for classification tasks only). */ @@ -100,7 +100,7 @@ public void setConfidence(@Nullable final Float confidence) { } /** - * Get the names of the unrecognizable properties of the {@link Prediction}. + * Get the names of the unrecognizable properties of the {@link PredictionItem}. * * @return The set of properties names */ @@ -111,7 +111,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link Prediction} instance. + * Get the value of an unrecognizable property of this {@link PredictionItem} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -122,13 +122,13 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("Prediction has no field with name '" + name + "'."); + throw new NoSuchElementException("PredictionItem has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link Prediction} instance including unrecognized + * Get the value of all properties of this {@link PredictionItem} instance including unrecognized * properties. * * @return The map of all properties @@ -143,7 +143,7 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link Prediction} instance. If the map previously + * Set an unrecognizable property of this {@link PredictionItem} 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 @@ -162,10 +162,10 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final Prediction prediction = (Prediction) o; - return Objects.equals(this.cloudSdkCustomFields, prediction.cloudSdkCustomFields) - && Objects.equals(this.prediction, prediction.prediction) - && Objects.equals(this.confidence, prediction.confidence); + final PredictionItem predictionItem = (PredictionItem) o; + return Objects.equals(this.cloudSdkCustomFields, predictionItem.cloudSdkCustomFields) + && Objects.equals(this.prediction, predictionItem.prediction) + && Objects.equals(this.confidence, predictionItem.confidence); } @Override @@ -177,7 +177,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class Prediction {\n"); + sb.append("class PredictionItem {\n"); sb.append(" prediction: ").append(toIndentedString(prediction)).append("\n"); sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); cloudSdkCustomFields.forEach( @@ -197,8 +197,8 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link Prediction} instance. No arguments are required. */ - public static Prediction create() { - return new Prediction(); + /** Create a new {@link PredictionItem} instance. No arguments are required. */ + public static PredictionItem create() { + return new PredictionItem(); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java similarity index 84% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java index d6998b9d4..807f679c8 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPrediction.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java @@ -13,11 +13,11 @@ import javax.annotation.Nonnull; -/** PredictionPrediction */ -public interface PredictionPrediction { - /** Helper class to create {@code Float } that implements {@link PredictionPrediction}. */ +/** PredictionItemPrediction */ +public interface PredictionItemPrediction { + /** Helper class to create {@code Float } that implements {@link PredictionItemPrediction}. */ record InnerFloat(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Float value) - implements PredictionPrediction {} + implements PredictionItemPrediction {} /** * Creator to enable deserialization of {@code Float }. @@ -31,9 +31,9 @@ static InnerFloat create(@Nonnull final Float val) { return new InnerFloat(val); } - /** Helper class to create {@code String } that implements {@link PredictionPrediction}. */ + /** Helper class to create {@code String } that implements {@link PredictionItemPrediction}. */ record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements PredictionPrediction {} + implements PredictionItemPrediction {} /** * Creator to enable deserialization of {@code String }. diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java index 0feb84fb4..32ce47b2e 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java @@ -17,23 +17,24 @@ /** PredictionResultsValue */ public interface PredictionResultsValue { /** - * Helper class to create {@code List } that implements {@link + * Helper class to create {@code List } that implements {@link * PredictionResultsValue}. */ - record ListOfPredictions( - @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + record ListOfPredictionItems( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements PredictionResultsValue {} /** - * Creator to enable deserialization of {@code List }. + * Creator to enable deserialization of {@code List }. * * @param val the value to use - * @return a new instance of {@link ListOfPredictions}. + * @return a new instance of {@link ListOfPredictionItems}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static ListOfPredictions createListOfPredictions(@Nonnull final List val) { - return new ListOfPredictions(val); + static ListOfPredictionItems createListOfPredictionItems( + @Nonnull final List val) { + return new ListOfPredictionItems(val); } /** Helper class to create {@code String } that implements {@link PredictionResultsValue}. */ diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml index 56a3f2e49..0565c326f 100644 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml @@ -159,7 +159,7 @@ components: $ref: '#/components/schemas/TabCompletionMetadata' PredictionResults: type: object - description: Prediction results for a query row that may contain target column predictions and optional index column. + description: PredictionResults for a query row that may contain target column predictions and optional index column. additionalProperties: oneOf: - type: string @@ -167,8 +167,8 @@ components: - type: array description: Array of predictions for a target column. items: - $ref: '#/components/schemas/Prediction' - Prediction: + $ref: '#/components/schemas/PredictionItem' + PredictionItem: type: object description: Individual prediction result for a cell. properties: diff --git a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java index 1018dcbf5..d25f51c4a 100644 --- a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java +++ b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java @@ -2,89 +2,146 @@ import static org.assertj.core.api.Assertions.assertThat; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.*; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Accessor; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Cache; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; import java.util.List; import java.util.Map; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +@WireMockTest class RptClientTest { + private static RptClient client; + + @BeforeEach + void setup(final WireMockRuntimeInfo server) { + final DefaultHttpDestination destination = + DefaultHttpDestination.builder(server.getHttpBaseUrl()).build(); + client = RptClient.forDestination(destination); + ApacheHttpClient5Accessor.setHttpClientCache(ApacheHttpClient5Cache.DISABLED); + } + + @Test + void testRptModels() { + assertThat(RptModel.SAP_RPT_1_SMALL.name()).isEqualTo("sap-rpt-1-small"); + assertThat(RptModel.SAP_RPT_1_SMALL.version()).isNull(); + + assertThat(RptModel.SAP_RPT_1_LARGE.name()).isEqualTo("sap-rpt-1-large"); + assertThat(RptModel.SAP_RPT_1_LARGE.version()).isNull(); + + final var modelWithVersion = RptModel.SAP_RPT_1_SMALL.withVersion("v1.0"); + assertThat(modelWithVersion.name()).isEqualTo("sap-rpt-1-small"); + assertThat(modelWithVersion.version()).isEqualTo("v1.0"); + } + + static TabCompletionPostRequest createBaseRequest() { + final var dataSchema = + Map.of( + "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), + "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), + "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), + "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING)); + final var targetColumns = + List.of( + TargetColumn.create() + .predictionPlaceholder("[PREDICT]") + .name("COSTCENTER") + .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)); + + return TabCompletionPostRequest.create() + .predictionConfig(PredictionConfig.create().targetColumns(targetColumns)) + .indexColumn("ID") + .dataSchema(dataSchema) + .parseDataTypes(true); + } @Test void testTabCompletionWithRowsFormat() { - final var request = - TabCompletionPostRequest.create() - .predictionConfig( - PredictionConfig.create() - .targetColumns( - List.of( - TargetColumn.create() - .predictionPlaceholder("[PREDICT]") - .name("COSTCENTER") - .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)))) - .indexColumn("ID") - .rows( - List.of( - Map.of( - "PRODUCT", "Couch", - "PRICE", 999.99, - "ORDERDATE", "28-11-2025", - "ID", "35", - "COSTCENTER", "[PREDICT]"), - Map.of( - "PRODUCT", "Office Chair", - "PRICE", 150.8, - "ORDERDATE", "02-11-2025", - "ID", "44", - "COSTCENTER", "Office Furniture"), - Map.of( - "PRODUCT", "Server Rack", - "PRICE", 2200.00, - "ORDERDATE", "01-11-2025", - "ID", "104", - "COSTCENTER", "Data Infrastructure"))) - .dataSchema( - Map.of( - "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), - "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), - "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING))) - .parseDataTypes(true); - - final var response = RptClient.forModel(RptModel.SAP_RPT_1_SMALL).tabCompletion(request); + final List> rows = + List.of( + Map.of( + "PRODUCT", "Couch", + "PRICE", 999.99, + "ORDERDATE", "28-11-2025", + "ID", "35", + "COSTCENTER", "[PREDICT]"), + Map.of( + "PRODUCT", "Office Chair", + "PRICE", 150.8, + "ORDERDATE", "02-11-2025", + "ID", "44", + "COSTCENTER", "Office Furniture"), + Map.of( + "PRODUCT", "Server Rack", + "PRICE", 2200.00, + "ORDERDATE", "01-11-2025", + "ID", "104", + "COSTCENTER", "Data Infrastructure")); + final var request = createBaseRequest().rows(rows); + + final var response = client.tabCompletion(request); assertThat(response).isNotNull(); + assertThat(response.getId()).isEqualTo("0381c575-9ee5-46f1-9223-4f9caf039e48"); + assertThat(response.getMetadata().getNumColumns()).isEqualTo(5); + assertThat(response.getMetadata().getNumPredictions()).isEqualTo(1); + assertThat(response.getMetadata().getNumQueryRows()).isEqualTo(1); + assertThat(response.getMetadata().getNumRows()).isEqualTo(2); + + assertThat(response.getStatus().getCode()).isEqualTo(TabCompletionStatus.CodeEnum.NUMBER_0); + assertThat(response.getStatus().getMessage()).isEqualTo("ok"); + assertThat(response.getPredictions()).hasSize(1); + + final Map prediction = response.getPredictions().get(0); + assertThat(prediction) + .containsEntry("ID", PredictionResultsValue.create("35")) + .containsEntry( + "COSTCENTER", + PredictionResultsValue.createListOfPredictionItems( + List.of( + PredictionItem.create() + .prediction(PredictionItemPrediction.create("Office Furniture")) + .confidence(0.97f)))); } @Test void testTabCompletionWithColumnsFormat() { - var request = - TabCompletionPostRequest.create() - .predictionConfig( - PredictionConfig.create() - .targetColumns( - List.of( - TargetColumn.create() - .predictionPlaceholder("[PREDICT]") - .name("COSTCENTER") - .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)))) - .indexColumn("ID") - .columns( - Map.of( - "PRODUCT", List.of("Couch", "Office Chair", "Server Rack"), - "PRICE", List.of(999.99, 150.8, 2200.00), - "ORDERDATE", List.of("28-11-2025", "02-11-2025", "01-11-2025"), - "ID", List.of("35", "44", "104"), - "COSTCENTER", List.of("[PREDICT]", "Office Furniture", "Data Infrastructure"))) - .dataSchema( - Map.of( - "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), - "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), - "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING))) - .parseDataTypes(true); - - RptClient.forModel(RptModel.SAP_RPT_1_SMALL).tabCompletion(request); + final Map> columns = + Map.of( + "PRODUCT", List.of("Couch", "Office Chair", "Server Rack"), + "PRICE", List.of(999.99, 150.8, 2200.00), + "ORDERDATE", List.of("28-11-2025", "02-11-2025", "01-11-2025"), + "ID", List.of("35", "44", "104"), + "COSTCENTER", List.of("[PREDICT]", "Office Furniture", "Data Infrastructure")); + final var request = createBaseRequest().columns(columns); + + final var response = client.tabCompletion(request); + + assertThat(response).isNotNull(); + assertThat(response.getId()).isEqualTo("f89fb682-8d6b-4ef5-97f4-bd3c9aab8c49"); + assertThat(response.getMetadata().getNumColumns()).isEqualTo(5); + assertThat(response.getMetadata().getNumPredictions()).isEqualTo(1); + assertThat(response.getMetadata().getNumQueryRows()).isEqualTo(1); + assertThat(response.getMetadata().getNumRows()).isEqualTo(2); + + assertThat(response.getStatus().getCode()).isEqualTo(TabCompletionStatus.CodeEnum.NUMBER_0); + assertThat(response.getStatus().getMessage()).isEqualTo("ok"); + assertThat(response.getPredictions()).hasSize(1); + + final Map prediction = response.getPredictions().get(0); + assertThat(prediction) + .containsEntry("ID", PredictionResultsValue.create("35")) + .containsEntry( + "COSTCENTER", + PredictionResultsValue.createListOfPredictionItems( + List.of( + PredictionItem.create() + .prediction(PredictionItemPrediction.create("Office Furniture")) + .confidence(0.97f)))); } } diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json new file mode 100644 index 000000000..67e55019e --- /dev/null +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json @@ -0,0 +1,98 @@ +{ + "request": { + "method": "POST", + "url": "/predict", + "bodyPatterns": [ + { + "equalToJson": { + "prediction_config": { + "target_columns": [ + { + "name": "COSTCENTER", + "prediction_placeholder": "[PREDICT]", + "task_type": "classification" + } + ] + }, + "index_column": "ID", + "rows": [], + "columns": { + "COSTCENTER": [ + "[PREDICT]", + "Office Furniture", + "Data Infrastructure" + ], + "PRODUCT": [ + "Couch", + "Office Chair", + "Server Rack" + ], + "ID": [ + "35", + "44", + "104" + ], + "PRICE": [ + 999.99, + 150.8, + 2200.0 + ], + "ORDERDATE": [ + "28-11-2025", + "02-11-2025", + "01-11-2025" + ] + }, + "data_schema": { + "COSTCENTER": { + "dtype": "string" + }, + "PRODUCT": { + "dtype": "string" + }, + "ID": { + "dtype": "string" + }, + "PRICE": { + "dtype": "numeric" + }, + "ORDERDATE": { + "dtype": "date" + } + }, + "parse_data_types": true + } + } + ] + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "f89fb682-8d6b-4ef5-97f4-bd3c9aab8c49", + "metadata": { + "num_columns": 5, + "num_predictions": 1, + "num_query_rows": 1, + "num_rows": 2 + }, + "predictions": [ + { + "COSTCENTER": [ + { + "confidence": 0.97, + "prediction": "Office Furniture" + } + ], + "ID": "35" + } + ], + "status": { + "code": 0, + "message": "ok" + } + } + } +} \ No newline at end of file diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json new file mode 100644 index 000000000..1490f9a05 --- /dev/null +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json @@ -0,0 +1,94 @@ +{ + "request": { + "method": "POST", + "url": "/predict", + "bodyPatterns": [ + { + "equalToJson": { + "prediction_config": { + "target_columns": [ + { + "name": "COSTCENTER", + "prediction_placeholder": "[PREDICT]", + "task_type": "classification" + } + ] + }, + "index_column": "ID", + "rows": [ + { + "ORDERDATE": "28-11-2025", + "COSTCENTER": "[PREDICT]", + "PRODUCT": "Couch", + "ID": "35", + "PRICE": 999.99 + }, + { + "ORDERDATE": "02-11-2025", + "COSTCENTER": "Office Furniture", + "PRODUCT": "Office Chair", + "ID": "44", + "PRICE": 150.8 + }, + { + "ORDERDATE": "01-11-2025", + "COSTCENTER": "Data Infrastructure", + "PRODUCT": "Server Rack", + "ID": "104", + "PRICE": 2200.0 + } + ], + "columns": {}, + "data_schema": { + "ORDERDATE": { + "dtype": "date" + }, + "COSTCENTER": { + "dtype": "string" + }, + "PRODUCT": { + "dtype": "string" + }, + "ID": { + "dtype": "string" + }, + "PRICE": { + "dtype": "numeric" + } + }, + "parse_data_types": true + } + } + ] + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "0381c575-9ee5-46f1-9223-4f9caf039e48", + "metadata": { + "num_columns": 5, + "num_predictions": 1, + "num_query_rows": 1, + "num_rows": 2 + }, + "predictions": [ + { + "COSTCENTER": [ + { + "confidence": 0.97, + "prediction": "Office Furniture" + } + ], + "ID": "35" + } + ], + "status": { + "code": 0, + "message": "ok" + } + } + } +} \ No newline at end of file From 65ce38c7af4e40ba36122ba5ab39f99bf2cc8c90 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 22 Jan 2026 14:49:18 +0100 Subject: [PATCH 08/17] Use office beta spec file --- foundation-models/sap-rpt/pom.xml | 8 +- .../sdk/foundationmodels/rpt/RptClient.java | 23 +- .../rpt/generated/client/DefaultApi.java | 222 +++++ .../rpt/generated/client/PredictApi.java | 104 --- .../rpt/generated/model/ColumnType.java | 66 ++ .../rpt/generated/model/ErrorDetail.java | 258 ------ .../rpt/generated/model/ErrorResponse.java | 221 ----- .../model/InternalServerErrorResponse.java | 265 ------ .../model/PredictRequestPayload.java | 448 +++++++++ .../PredictRequestPayloadRowsInnerValue.java | 75 ++ .../model/PredictResponseMetadata.java | 337 +++++++ .../model/PredictResponsePayload.java | 371 ++++++++ ...tResponsePayloadPredictionsInnerValue.java | 77 ++ ...Status.java => PredictResponseStatus.java} | 165 ++-- ...rorDetailLocInner.java => Prediction.java} | 27 +- .../rpt/generated/model/PredictionConfig.java | 54 +- ...iction.java => PredictionPlaceholder.java} | 40 +- ...dictionItem.java => PredictionResult.java} | 93 +- .../model/PredictionResultsValue.java | 55 -- ...mnDataType.java => SchemaFieldConfig.java} | 138 +-- .../model/TabCompletionMetadata.java | 284 ------ .../model/TabCompletionPostRequest.java | 429 --------- .../model/TabCompletionPostResponse.java | 303 ------- .../generated/model/TabCompletionStatus.java | 270 ------ ...getColumn.java => TargetColumnConfig.java} | 178 ++-- .../resources/spec/sap-rpt-1_openapi.json | 848 ++++++++++++++++++ .../src/main/resources/spec/sap-rpt.yaml | 260 ------ .../foundationmodels/rpt/RptClientTest.java | 115 ++- .../resources/mappings/predictColumnWise.json | 45 +- .../resources/mappings/predictRowWise.json | 39 +- logback.xml | 4 +- 31 files changed, 2939 insertions(+), 2883 deletions(-) create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnType.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseMetadata.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{ErrorResponseStatus.java => PredictResponseStatus.java} (52%) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{ErrorDetailLocInner.java => Prediction.java} (55%) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{PredictionItemPrediction.java => PredictionPlaceholder.java} (50%) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{PredictionItem.java => PredictionResult.java} (59%) delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{ColumnDataType.java => SchemaFieldConfig.java} (52%) delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java delete mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{TargetColumn.java => TargetColumnConfig.java} (55%) create mode 100644 foundation-models/sap-rpt/src/main/resources/spec/sap-rpt-1_openapi.json delete mode 100644 foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index d4ee5ce8d..8c1af081f 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -37,6 +37,11 @@ ${project.basedir}/../../ + 83% + 75% + 80% + 100% + 83% @@ -92,6 +97,7 @@ org.wiremock wiremock + test com.sap.cloud.sdk.cloudplatform @@ -127,7 +133,7 @@ generate-sources - ${project.basedir}/src/main/resources/spec/sap-rpt.yaml + ${project.basedir}/src/main/resources/spec/sap-rpt-1_openapi.json com.sap.ai.sdk.foundationmodels.rpt.generated.model com.sap.ai.sdk.foundationmodels.rpt.generated.client true diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 53cdc411f..1233920db 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -2,9 +2,9 @@ import com.sap.ai.sdk.core.AiCoreService; import com.sap.ai.sdk.core.DeploymentResolutionException; -import com.sap.ai.sdk.foundationmodels.rpt.generated.client.PredictApi; -import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostRequest; -import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostResponse; +import com.sap.ai.sdk.foundationmodels.rpt.generated.client.DefaultApi; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; import javax.annotation.Nonnull; import lombok.AccessLevel; @@ -13,7 +13,7 @@ /** Client for interacting with SAP RPT foundation models. */ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public class RptClient { - @Nonnull private final PredictApi api; + @Nonnull private final DefaultApi api; /** * Creates a new RptClient for the specified foundation model. @@ -36,7 +36,15 @@ public static RptClient forModel(@Nonnull final RptModel foundationModel) * @return A new instance of RptClient. */ static RptClient forDestination(@Nonnull final Destination destination) { - return new RptClient(new PredictApi(destination)); + // final var rt = new RestTemplate(); + // Iterables.filter(rt.getMessageConverters(), MappingJackson2HttpMessageConverter.class) + // .forEach(converter -> converter.setObjectMapper(getDefaultObjectMapper())); + // + // final var apiClient = + // new ApiClient(rt) + // .setBasePath(destination.asHttp().getUri().toString()) + // .addDefaultHeader("AI-Resource-Group", "default"); + return new RptClient(new DefaultApi(destination)); } /** @@ -56,8 +64,7 @@ static RptClient forDestination(@Nonnull final Destination destination) { * @return TabCompletionPostResponse */ @Nonnull - public TabCompletionPostResponse tabCompletion( - @Nonnull final TabCompletionPostRequest requestBody) { - return api.completionsCreate(requestBody); + public PredictResponsePayload tabCompletion(@Nonnull final PredictRequestPayload requestBody) { + return api.predict(requestBody); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java new file mode 100644 index 000000000..11a12f9b5 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java @@ -0,0 +1,222 @@ +package com.sap.ai.sdk.foundationmodels.rpt.generated.client; + +import com.google.common.annotations.Beta; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import java.io.File; +import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * SAP-RPT-1 Tabular AI in version 0.1.0. + * + *

A REST API for in-context learning with the SAP-RPT-1 model. + */ +public class DefaultApi extends AbstractOpenApiService { + /** + * Instantiates this API class to invoke operations on the SAP-RPT-1 Tabular AI. + * + * @param httpDestination The destination that API should be used with + */ + public DefaultApi(@Nonnull final Destination httpDestination) { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the SAP-RPT-1 Tabular AI based on a given + * {@link ApiClient}. + * + * @param apiClient ApiClient to invoke the API on + */ + @Beta + public DefaultApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * Make in-context predictions for specified target columns based on provided table data JSON + * (optionally gzip-compressed). + * + *

Make in-context predictions for specified target columns. Either \"rows\" or + * \"columns\" must be provided and must contain both context and query rows. You can + * optionally send gzip-compressed JSON payloads and set a \"Content-Encoding: gzip\" + * header. + * + *

200 - Successful Prediction + * + *

400 - Bad Request - Invalid input data + * + *

413 - Payload Too Large + * + *

422 - Validation Error + * + *

500 - Internal Server Error + * + * @param predictRequestPayload The value for the parameter predictRequestPayload + * @return PredictResponsePayload + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public PredictResponsePayload predict(@Nonnull final PredictRequestPayload predictRequestPayload) + throws OpenApiRequestException { + final Object localVarPostBody = predictRequestPayload; + + // verify the required parameter 'predictRequestPayload' is set + if (predictRequestPayload == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'predictRequestPayload' when calling predict"); + } + + final String localVarPath = UriComponentsBuilder.fromPath("/predict").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Make in-context predictions for specified target columns based on provided table data Parquet + * file. + * + *

Make in-context predictions for specified target columns based on provided table data + * Parquet file. + * + *

200 - Successful Prediction + * + *

400 - Bad Request - Invalid input data + * + *

413 - Payload Too Large + * + *

422 - Validation Error + * + *

500 - Internal Server Error + * + * @param _file (required) Parquet file containing the data + * @param predictionConfig (required) JSON string for prediction_config + * @param indexColumn (optional) Optional index column name + * @param parseDataTypes (optional, default to true) Whether to parse data types + * @return PredictResponsePayload + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public PredictResponsePayload predictParquet( + @Nonnull final File _file, + @Nonnull final String predictionConfig, + @Nullable final String indexColumn, + @Nullable final Boolean parseDataTypes) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter '_file' is set + if (_file == null) { + throw new OpenApiRequestException( + "Missing the required parameter '_file' when calling predictParquet"); + } + + // verify the required parameter 'predictionConfig' is set + if (predictionConfig == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'predictionConfig' when calling predictParquet"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/predict_parquet").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + if (_file != null) localVarFormParams.add("file", new FileSystemResource(_file)); + if (predictionConfig != null) localVarFormParams.add("prediction_config", predictionConfig); + if (indexColumn != null) localVarFormParams.add("index_column", indexColumn); + if (parseDataTypes != null) localVarFormParams.add("parse_data_types", parseDataTypes); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"multipart/form-data"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Make in-context predictions for specified target columns based on provided table data Parquet + * file. + * + *

Make in-context predictions for specified target columns based on provided table data + * Parquet file. + * + *

200 - Successful Prediction + * + *

400 - Bad Request - Invalid input data + * + *

413 - Payload Too Large + * + *

422 - Validation Error + * + *

500 - Internal Server Error + * + * @param _file Parquet file containing the data + * @param predictionConfig JSON string for prediction_config + * @return PredictResponsePayload + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public PredictResponsePayload predictParquet( + @Nonnull final File _file, @Nonnull final String predictionConfig) + throws OpenApiRequestException { + return predictParquet(_file, predictionConfig, null, null); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java deleted file mode 100644 index 09ee03c37..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/PredictApi.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.sap.ai.sdk.foundationmodels.rpt.generated.client; - -import com.google.common.annotations.Beta; -import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostRequest; -import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TabCompletionPostResponse; -import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; -import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; -import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; -import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; -import java.util.List; -import javax.annotation.Nonnull; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.util.UriComponentsBuilder; - -/** - * SAP RPT API in version 0.0.1-SNAPSHOT. - * - *

SAP RPT API for predictive insights using in-context learning on structured business data. - */ -public class PredictApi extends AbstractOpenApiService { - /** - * Instantiates this API class to invoke operations on the SAP RPT API. - * - * @param httpDestination The destination that API should be used with - */ - public PredictApi(@Nonnull final Destination httpDestination) { - super(httpDestination); - } - - /** - * Instantiates this API class to invoke operations on the SAP RPT API based on a given {@link - * ApiClient}. - * - * @param apiClient ApiClient to invoke the API on - */ - @Beta - public PredictApi(@Nonnull final ApiClient apiClient) { - super(apiClient); - } - - /** - * Predict targets using SAP RPT model with structured data. - * - *

- * - *

200 - Successful response with predictive insights. - * - *

400 - Bad Request - Invalid input. - * - *

422 - Unprocessable Content - Invalid input. - * - *

500 - Internal Server Error. - * - * @param tabCompletionPostRequest The value for the parameter tabCompletionPostRequest - * @return TabCompletionPostResponse - * @throws OpenApiRequestException if an error occurs while attempting to invoke the API - */ - @Nonnull - public TabCompletionPostResponse completionsCreate( - @Nonnull final TabCompletionPostRequest tabCompletionPostRequest) - throws OpenApiRequestException { - final Object localVarPostBody = tabCompletionPostRequest; - - // verify the required parameter 'tabCompletionPostRequest' is set - if (tabCompletionPostRequest == null) { - throw new OpenApiRequestException( - "Missing the required parameter 'tabCompletionPostRequest' when calling completionsCreate"); - } - - final String localVarPath = UriComponentsBuilder.fromPath("/predict").build().toUriString(); - - final MultiValueMap localVarQueryParams = - new LinkedMultiValueMap(); - final HttpHeaders localVarHeaderParams = new HttpHeaders(); - final MultiValueMap localVarFormParams = - new LinkedMultiValueMap(); - - final String[] localVarAccepts = {"application/json"}; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - final String[] localVarAuthNames = new String[] {}; - - final ParameterizedTypeReference localVarReturnType = - new ParameterizedTypeReference() {}; - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnType.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnType.java new file mode 100644 index 000000000..1afaa9b08 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnType.java @@ -0,0 +1,66 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets ColumnType */ +public enum ColumnType { + STRING("string"), + + NUMERIC("numeric"), + + DATE("date"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + ColumnType(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static ColumnType fromValue(@Nonnull final String value) { + for (final ColumnType b : ColumnType.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java deleted file mode 100644 index 0a4e07ce3..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetail.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** Validation error detail in pydantic format. */ -// CHECKSTYLE:OFF -public class ErrorDetail -// CHECKSTYLE:ON -{ - @JsonProperty("loc") - private List loc = new ArrayList<>(); - - @JsonProperty("msg") - private String msg; - - @JsonProperty("type") - private String type; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the loc of this {@link ErrorDetail} instance and return the same instance. - * - * @param loc Location of the error in the request structure. - * @return The same instance of this {@link ErrorDetail} class - */ - @Nonnull - public ErrorDetail loc(@Nullable final List loc) { - this.loc = loc; - return this; - } - - /** - * Add one loc instance to this {@link ErrorDetail}. - * - * @param locItem The loc that should be added - * @return The same instance of type {@link ErrorDetail} - */ - @Nonnull - public ErrorDetail addLocItem(@Nonnull final ErrorDetailLocInner locItem) { - if (this.loc == null) { - this.loc = new ArrayList<>(); - } - this.loc.add(locItem); - return this; - } - - /** - * Location of the error in the request structure. - * - * @return loc The loc of this {@link ErrorDetail} instance. - */ - @Nonnull - public List getLoc() { - return loc; - } - - /** - * Set the loc of this {@link ErrorDetail} instance. - * - * @param loc Location of the error in the request structure. - */ - public void setLoc(@Nullable final List loc) { - this.loc = loc; - } - - /** - * Set the msg of this {@link ErrorDetail} instance and return the same instance. - * - * @param msg Error message. - * @return The same instance of this {@link ErrorDetail} class - */ - @Nonnull - public ErrorDetail msg(@Nullable final String msg) { - this.msg = msg; - return this; - } - - /** - * Error message. - * - * @return msg The msg of this {@link ErrorDetail} instance. - */ - @Nonnull - public String getMsg() { - return msg; - } - - /** - * Set the msg of this {@link ErrorDetail} instance. - * - * @param msg Error message. - */ - public void setMsg(@Nullable final String msg) { - this.msg = msg; - } - - /** - * Set the type of this {@link ErrorDetail} instance and return the same instance. - * - * @param type Error type. - * @return The same instance of this {@link ErrorDetail} class - */ - @Nonnull - public ErrorDetail type(@Nullable final String type) { - this.type = type; - return this; - } - - /** - * Error type. - * - * @return type The type of this {@link ErrorDetail} instance. - */ - @Nonnull - public String getType() { - return type; - } - - /** - * Set the type of this {@link ErrorDetail} instance. - * - * @param type Error type. - */ - public void setType(@Nullable final String type) { - this.type = type; - } - - /** - * Get the names of the unrecognizable properties of the {@link ErrorDetail}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ErrorDetail} 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("ErrorDetail has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ErrorDetail} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (loc != null) declaredFields.put("loc", loc); - if (msg != null) declaredFields.put("msg", msg); - if (type != null) declaredFields.put("type", type); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ErrorDetail} 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 ErrorDetail errorDetail = (ErrorDetail) o; - return Objects.equals(this.cloudSdkCustomFields, errorDetail.cloudSdkCustomFields) - && Objects.equals(this.loc, errorDetail.loc) - && Objects.equals(this.msg, errorDetail.msg) - && Objects.equals(this.type, errorDetail.type); - } - - @Override - public int hashCode() { - return Objects.hash(loc, msg, type, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class ErrorDetail {\n"); - sb.append(" loc: ").append(toIndentedString(loc)).append("\n"); - sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).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 ErrorDetail} instance. No arguments are required. */ - public static ErrorDetail create() { - return new ErrorDetail(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java deleted file mode 100644 index 848709ba6..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponse.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** Error response with status and validation details. */ -// CHECKSTYLE:OFF -public class ErrorResponse -// CHECKSTYLE:ON -{ - @JsonProperty("status") - private ErrorResponseStatus status; - - @JsonProperty("detail") - private List detail = new ArrayList<>(); - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the status of this {@link ErrorResponse} instance and return the same instance. - * - * @param status The status of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse status(@Nullable final ErrorResponseStatus status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status The status of this {@link ErrorResponse} instance. - */ - @Nonnull - public ErrorResponseStatus getStatus() { - return status; - } - - /** - * Set the status of this {@link ErrorResponse} instance. - * - * @param status The status of this {@link ErrorResponse} - */ - public void setStatus(@Nullable final ErrorResponseStatus status) { - this.status = status; - } - - /** - * Set the detail of this {@link ErrorResponse} instance and return the same instance. - * - * @param detail Array of validation errors in pydantic format. - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse detail(@Nullable final List detail) { - this.detail = detail; - return this; - } - - /** - * Add one detail instance to this {@link ErrorResponse}. - * - * @param detailItem The detail that should be added - * @return The same instance of type {@link ErrorResponse} - */ - @Nonnull - public ErrorResponse addDetailItem(@Nonnull final ErrorDetail detailItem) { - if (this.detail == null) { - this.detail = new ArrayList<>(); - } - this.detail.add(detailItem); - return this; - } - - /** - * Array of validation errors in pydantic format. - * - * @return detail The detail of this {@link ErrorResponse} instance. - */ - @Nonnull - public List getDetail() { - return detail; - } - - /** - * Set the detail of this {@link ErrorResponse} instance. - * - * @param detail Array of validation errors in pydantic format. - */ - public void setDetail(@Nullable final List detail) { - this.detail = detail; - } - - /** - * 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 (status != null) declaredFields.put("status", status); - if (detail != null) declaredFields.put("detail", detail); - 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.status, errorResponse.status) - && Objects.equals(this.detail, errorResponse.detail); - } - - @Override - public int hashCode() { - return Objects.hash(status, detail, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class ErrorResponse {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" detail: ").append(toIndentedString(detail)).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 ErrorResponse} instance. No arguments are required. */ - public static ErrorResponse create() { - return new ErrorResponse(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java deleted file mode 100644 index 2a081eb7d..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/InternalServerErrorResponse.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** Internal server error response. */ -// CHECKSTYLE:OFF -public class InternalServerErrorResponse -// CHECKSTYLE:ON -{ - /** Gets or Sets status */ - public enum StatusEnum { - /** The NUMBER_3 option of this InternalServerErrorResponse */ - NUMBER_3(3), - - /** The NUMBER_unknown_default_open_api option of this InternalServerErrorResponse */ - NUMBER_unknown_default_open_api(11184809); - - private Integer value; - - StatusEnum(Integer value) { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public Integer 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 InternalServerErrorResponse - */ - @JsonCreator - @Nonnull - public static StatusEnum fromValue(@Nonnull final Integer value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return NUMBER_unknown_default_open_api; - } - } - - @JsonProperty("status") - private StatusEnum status; - - @JsonProperty("message") - private String message; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the status of this {@link InternalServerErrorResponse} instance and return the same - * instance. - * - * @param status The status of this {@link InternalServerErrorResponse} - * @return The same instance of this {@link InternalServerErrorResponse} class - */ - @Nonnull - public InternalServerErrorResponse status(@Nullable final StatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status The status of this {@link InternalServerErrorResponse} instance. - */ - @Nonnull - public StatusEnum getStatus() { - return status; - } - - /** - * Set the status of this {@link InternalServerErrorResponse} instance. - * - * @param status The status of this {@link InternalServerErrorResponse} - */ - public void setStatus(@Nullable final StatusEnum status) { - this.status = status; - } - - /** - * Set the message of this {@link InternalServerErrorResponse} instance and return the same - * instance. - * - * @param message The message of this {@link InternalServerErrorResponse} - * @return The same instance of this {@link InternalServerErrorResponse} class - */ - @Nonnull - public InternalServerErrorResponse message(@Nullable final String message) { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link InternalServerErrorResponse} instance. - */ - @Nonnull - public String getMessage() { - return message; - } - - /** - * Set the message of this {@link InternalServerErrorResponse} instance. - * - * @param message The message of this {@link InternalServerErrorResponse} - */ - public void setMessage(@Nullable final String message) { - this.message = message; - } - - /** - * Get the names of the unrecognizable properties of the {@link InternalServerErrorResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link InternalServerErrorResponse} - * 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( - "InternalServerErrorResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link InternalServerErrorResponse} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (status != null) declaredFields.put("status", status); - if (message != null) declaredFields.put("message", message); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link InternalServerErrorResponse} 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 InternalServerErrorResponse internalServerErrorResponse = (InternalServerErrorResponse) o; - return Objects.equals( - this.cloudSdkCustomFields, internalServerErrorResponse.cloudSdkCustomFields) - && Objects.equals(this.status, internalServerErrorResponse.status) - && Objects.equals(this.message, internalServerErrorResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(status, message, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class InternalServerErrorResponse {\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 InternalServerErrorResponse} instance. No arguments are required. */ - public static InternalServerErrorResponse create() { - return new InternalServerErrorResponse(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java new file mode 100644 index 000000000..c2bc2a170 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java @@ -0,0 +1,448 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.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.HashMap; +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; + +/** + * Users need to specify a list of rows, which contains both the context rows and the rows for which + * to predict a label, and a mapping of column names to placeholder values. The model will predict + * the value for any column specified in `predict_columns` for all rows that have the + * placeholder value in that column. + */ +// CHECKSTYLE:OFF +public class PredictRequestPayload +// CHECKSTYLE:ON +{ + @JsonProperty("prediction_config") + private PredictionConfig predictionConfig; + + @JsonProperty("rows") + private List> rows = new ArrayList<>(); + + @JsonProperty("columns") + private Map> columns; + + @JsonProperty("index_column") + private String indexColumn; + + @JsonProperty("parse_data_types") + private Boolean parseDataTypes = true; + + @JsonProperty("data_schema") + private Map dataSchema; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the predictionConfig of this {@link PredictRequestPayload} instance and return the same + * instance. + * + * @param predictionConfig Configuration of target columns and placeholder value. + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload predictionConfig(@Nonnull final PredictionConfig predictionConfig) { + this.predictionConfig = predictionConfig; + return this; + } + + /** + * Configuration of target columns and placeholder value. + * + * @return predictionConfig The predictionConfig of this {@link PredictRequestPayload} instance. + */ + @Nonnull + public PredictionConfig getPredictionConfig() { + return predictionConfig; + } + + /** + * Set the predictionConfig of this {@link PredictRequestPayload} instance. + * + * @param predictionConfig Configuration of target columns and placeholder value. + */ + public void setPredictionConfig(@Nonnull final PredictionConfig predictionConfig) { + this.predictionConfig = predictionConfig; + } + + /** + * Set the rows of this {@link PredictRequestPayload} instance and return the same instance. + * + * @param rows Table rows, i.e. list of objects where each object is a mapping of column names to + * values. Either \"rows\" or \"columns\" must be provided. + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload rows( + @Nullable final List> rows) { + this.rows = rows; + return this; + } + + /** + * Add one rows instance to this {@link PredictRequestPayload}. + * + * @param rowsItem The rows that should be added + * @return The same instance of type {@link PredictRequestPayload} + */ + @Nonnull + public PredictRequestPayload addRowsItem( + @Nonnull final Map rowsItem) { + if (this.rows == null) { + this.rows = new ArrayList<>(); + } + this.rows.add(rowsItem); + return this; + } + + /** + * Table rows, i.e. list of objects where each object is a mapping of column names to values. + * Either \"rows\" or \"columns\" must be provided. + * + * @return rows The rows of this {@link PredictRequestPayload} instance. + */ + @Nonnull + public List> getRows() { + return rows; + } + + /** + * Set the rows of this {@link PredictRequestPayload} instance. + * + * @param rows Table rows, i.e. list of objects where each object is a mapping of column names to + * values. Either \"rows\" or \"columns\" must be provided. + */ + public void setRows(@Nullable final List> rows) { + this.rows = rows; + } + + /** + * Set the columns of this {@link PredictRequestPayload} instance and return the same instance. + * + * @param columns The columns of this {@link PredictRequestPayload} + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload columns( + @Nullable final Map> columns) { + this.columns = columns; + return this; + } + + /** + * Put one columns instance to this {@link PredictRequestPayload} instance. + * + * @param key The String key of this columns instance + * @param columnsItem The columns that should be added under the given key + * @return The same instance of type {@link PredictRequestPayload} + */ + @Nonnull + public PredictRequestPayload putcolumnsItem( + @Nonnull final String key, + @Nonnull final List columnsItem) { + if (this.columns == null) { + this.columns = new HashMap<>(); + } + this.columns.put(key, columnsItem); + return this; + } + + /** + * Get columns + * + * @return columns The columns of this {@link PredictRequestPayload} instance. + */ + @Nullable + public Map> getColumns() { + return columns; + } + + /** + * Set the columns of this {@link PredictRequestPayload} instance. + * + * @param columns The columns of this {@link PredictRequestPayload} + */ + public void setColumns( + @Nullable final Map> columns) { + this.columns = columns; + } + + /** + * Set the indexColumn of this {@link PredictRequestPayload} instance and return the same + * instance. + * + * @param indexColumn The indexColumn of this {@link PredictRequestPayload} + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload indexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + return this; + } + + /** + * Get indexColumn + * + * @return indexColumn The indexColumn of this {@link PredictRequestPayload} instance. + */ + @Nullable + public String getIndexColumn() { + return indexColumn; + } + + /** + * Set the indexColumn of this {@link PredictRequestPayload} instance. + * + * @param indexColumn The indexColumn of this {@link PredictRequestPayload} + */ + public void setIndexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + } + + /** + * Set the parseDataTypes of this {@link PredictRequestPayload} instance and return the same + * instance. + * + * @param parseDataTypes Whether to parse the data types of the columns. If set to True, numeric + * columns will be parsed to float or integer and dates in ISO format YYYY-MM-DD will be + * parsed. + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload parseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + return this; + } + + /** + * Whether to parse the data types of the columns. If set to True, numeric columns will be parsed + * to float or integer and dates in ISO format YYYY-MM-DD will be parsed. + * + * @return parseDataTypes The parseDataTypes of this {@link PredictRequestPayload} instance. + */ + @Nonnull + public Boolean isParseDataTypes() { + return parseDataTypes; + } + + /** + * Set the parseDataTypes of this {@link PredictRequestPayload} instance. + * + * @param parseDataTypes Whether to parse the data types of the columns. If set to True, numeric + * columns will be parsed to float or integer and dates in ISO format YYYY-MM-DD will be + * parsed. + */ + public void setParseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + } + + /** + * Set the dataSchema of this {@link PredictRequestPayload} instance and return the same instance. + * + * @param dataSchema The dataSchema of this {@link PredictRequestPayload} + * @return The same instance of this {@link PredictRequestPayload} class + */ + @Nonnull + public PredictRequestPayload dataSchema( + @Nullable final Map dataSchema) { + this.dataSchema = dataSchema; + return this; + } + + /** + * Put one dataSchema instance to this {@link PredictRequestPayload} instance. + * + * @param key The String key of this dataSchema instance + * @param dataSchemaItem The dataSchema that should be added under the given key + * @return The same instance of type {@link PredictRequestPayload} + */ + @Nonnull + public PredictRequestPayload putdataSchemaItem( + @Nonnull final String key, @Nonnull final SchemaFieldConfig dataSchemaItem) { + if (this.dataSchema == null) { + this.dataSchema = new HashMap<>(); + } + this.dataSchema.put(key, dataSchemaItem); + return this; + } + + /** + * Get dataSchema + * + * @return dataSchema The dataSchema of this {@link PredictRequestPayload} instance. + */ + @Nullable + public Map getDataSchema() { + return dataSchema; + } + + /** + * Set the dataSchema of this {@link PredictRequestPayload} instance. + * + * @param dataSchema The dataSchema of this {@link PredictRequestPayload} + */ + public void setDataSchema(@Nullable final Map dataSchema) { + this.dataSchema = dataSchema; + } + + /** + * Get the names of the unrecognizable properties of the {@link PredictRequestPayload}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PredictRequestPayload} 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( + "PredictRequestPayload has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PredictRequestPayload} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (predictionConfig != null) declaredFields.put("predictionConfig", predictionConfig); + if (rows != null) declaredFields.put("rows", rows); + if (columns != null) declaredFields.put("columns", columns); + if (indexColumn != null) declaredFields.put("indexColumn", indexColumn); + if (parseDataTypes != null) declaredFields.put("parseDataTypes", parseDataTypes); + if (dataSchema != null) declaredFields.put("dataSchema", dataSchema); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PredictRequestPayload} 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 PredictRequestPayload predictRequestPayload = (PredictRequestPayload) o; + return Objects.equals(this.cloudSdkCustomFields, predictRequestPayload.cloudSdkCustomFields) + && Objects.equals(this.predictionConfig, predictRequestPayload.predictionConfig) + && Objects.equals(this.rows, predictRequestPayload.rows) + && Objects.equals(this.columns, predictRequestPayload.columns) + && Objects.equals(this.indexColumn, predictRequestPayload.indexColumn) + && Objects.equals(this.parseDataTypes, predictRequestPayload.parseDataTypes) + && Objects.equals(this.dataSchema, predictRequestPayload.dataSchema); + } + + @Override + public int hashCode() { + return Objects.hash( + predictionConfig, + rows, + columns, + indexColumn, + parseDataTypes, + dataSchema, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PredictRequestPayload {\n"); + sb.append(" predictionConfig: ").append(toIndentedString(predictionConfig)).append("\n"); + sb.append(" rows: ").append(toIndentedString(rows)).append("\n"); + sb.append(" columns: ").append(toIndentedString(columns)).append("\n"); + sb.append(" indexColumn: ").append(toIndentedString(indexColumn)).append("\n"); + sb.append(" parseDataTypes: ").append(toIndentedString(parseDataTypes)).append("\n"); + sb.append(" dataSchema: ").append(toIndentedString(dataSchema)).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 PredictRequestPayload} + * instance with all required arguments. + */ + public static Builder create() { + return (predictionConfig) -> new PredictRequestPayload().predictionConfig(predictionConfig); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the predictionConfig of this {@link PredictRequestPayload} instance. + * + * @param predictionConfig Configuration of target columns and placeholder value. + * @return The PredictRequestPayload instance. + */ + PredictRequestPayload predictionConfig(@Nonnull final PredictionConfig predictionConfig); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java new file mode 100644 index 000000000..d65f53598 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java @@ -0,0 +1,75 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import java.math.BigDecimal; +import javax.annotation.Nonnull; + +/** PredictRequestPayloadRowsInnerValue */ +public interface PredictRequestPayloadRowsInnerValue { + /** + * Helper class to create {@code String } that implements {@link + * PredictRequestPayloadRowsInnerValue}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements PredictRequestPayloadRowsInnerValue {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** + * Helper class to create {@code Integer } that implements {@link + * PredictRequestPayloadRowsInnerValue}. + */ + record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) + implements PredictRequestPayloadRowsInnerValue {} + + /** + * Creator to enable deserialization of {@code Integer }. + * + * @param val the value to use + * @return a new instance of {@link InnerInteger}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerInteger create(@Nonnull final Integer val) { + return new InnerInteger(val); + } + + /** + * Helper class to create {@code BigDecimal } that implements {@link + * PredictRequestPayloadRowsInnerValue}. + */ + record InnerBigDecimal(@com.fasterxml.jackson.annotation.JsonValue @Nonnull BigDecimal value) + implements PredictRequestPayloadRowsInnerValue {} + + /** + * Creator to enable deserialization of {@code BigDecimal }. + * + * @param val the value to use + * @return a new instance of {@link InnerBigDecimal}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerBigDecimal create(@Nonnull final BigDecimal val) { + return new InnerBigDecimal(val); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseMetadata.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseMetadata.java new file mode 100644 index 000000000..9e0c27fb2 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseMetadata.java @@ -0,0 +1,337 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.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; + +/** Metadata about the prediction request. */ +// CHECKSTYLE:OFF +public class PredictResponseMetadata +// CHECKSTYLE:ON +{ + @JsonProperty("num_columns") + private Integer numColumns; + + @JsonProperty("num_rows") + private Integer numRows; + + @JsonProperty("num_predictions") + private Integer numPredictions; + + @JsonProperty("num_query_rows") + private Integer numQueryRows; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the numColumns of this {@link PredictResponseMetadata} instance and return the same + * instance. + * + * @param numColumns Number of columns in the input data. + * @return The same instance of this {@link PredictResponseMetadata} class + */ + @Nonnull + public PredictResponseMetadata numColumns(@Nonnull final Integer numColumns) { + this.numColumns = numColumns; + return this; + } + + /** + * Number of columns in the input data. + * + * @return numColumns The numColumns of this {@link PredictResponseMetadata} instance. + */ + @Nonnull + public Integer getNumColumns() { + return numColumns; + } + + /** + * Set the numColumns of this {@link PredictResponseMetadata} instance. + * + * @param numColumns Number of columns in the input data. + */ + public void setNumColumns(@Nonnull final Integer numColumns) { + this.numColumns = numColumns; + } + + /** + * Set the numRows of this {@link PredictResponseMetadata} instance and return the same instance. + * + * @param numRows Number of rows in the input data. + * @return The same instance of this {@link PredictResponseMetadata} class + */ + @Nonnull + public PredictResponseMetadata numRows(@Nonnull final Integer numRows) { + this.numRows = numRows; + return this; + } + + /** + * Number of rows in the input data. + * + * @return numRows The numRows of this {@link PredictResponseMetadata} instance. + */ + @Nonnull + public Integer getNumRows() { + return numRows; + } + + /** + * Set the numRows of this {@link PredictResponseMetadata} instance. + * + * @param numRows Number of rows in the input data. + */ + public void setNumRows(@Nonnull final Integer numRows) { + this.numRows = numRows; + } + + /** + * Set the numPredictions of this {@link PredictResponseMetadata} instance and return the same + * instance. + * + * @param numPredictions Number of table cells containing the specified placeholder value. + * @return The same instance of this {@link PredictResponseMetadata} class + */ + @Nonnull + public PredictResponseMetadata numPredictions(@Nonnull final Integer numPredictions) { + this.numPredictions = numPredictions; + return this; + } + + /** + * Number of table cells containing the specified placeholder value. + * + * @return numPredictions The numPredictions of this {@link PredictResponseMetadata} instance. + */ + @Nonnull + public Integer getNumPredictions() { + return numPredictions; + } + + /** + * Set the numPredictions of this {@link PredictResponseMetadata} instance. + * + * @param numPredictions Number of table cells containing the specified placeholder value. + */ + public void setNumPredictions(@Nonnull final Integer numPredictions) { + this.numPredictions = numPredictions; + } + + /** + * Set the numQueryRows of this {@link PredictResponseMetadata} instance and return the same + * instance. + * + * @param numQueryRows Number of rows for which a prediction was made. + * @return The same instance of this {@link PredictResponseMetadata} class + */ + @Nonnull + public PredictResponseMetadata numQueryRows(@Nonnull final Integer numQueryRows) { + this.numQueryRows = numQueryRows; + return this; + } + + /** + * Number of rows for which a prediction was made. + * + * @return numQueryRows The numQueryRows of this {@link PredictResponseMetadata} instance. + */ + @Nonnull + public Integer getNumQueryRows() { + return numQueryRows; + } + + /** + * Set the numQueryRows of this {@link PredictResponseMetadata} instance. + * + * @param numQueryRows Number of rows for which a prediction was made. + */ + public void setNumQueryRows(@Nonnull final Integer numQueryRows) { + this.numQueryRows = numQueryRows; + } + + /** + * Get the names of the unrecognizable properties of the {@link PredictResponseMetadata}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PredictResponseMetadata} 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( + "PredictResponseMetadata has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PredictResponseMetadata} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (numColumns != null) declaredFields.put("numColumns", numColumns); + if (numRows != null) declaredFields.put("numRows", numRows); + if (numPredictions != null) declaredFields.put("numPredictions", numPredictions); + if (numQueryRows != null) declaredFields.put("numQueryRows", numQueryRows); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PredictResponseMetadata} 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 PredictResponseMetadata predictResponseMetadata = (PredictResponseMetadata) o; + return Objects.equals(this.cloudSdkCustomFields, predictResponseMetadata.cloudSdkCustomFields) + && Objects.equals(this.numColumns, predictResponseMetadata.numColumns) + && Objects.equals(this.numRows, predictResponseMetadata.numRows) + && Objects.equals(this.numPredictions, predictResponseMetadata.numPredictions) + && Objects.equals(this.numQueryRows, predictResponseMetadata.numQueryRows); + } + + @Override + public int hashCode() { + return Objects.hash(numColumns, numRows, numPredictions, numQueryRows, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PredictResponseMetadata {\n"); + sb.append(" numColumns: ").append(toIndentedString(numColumns)).append("\n"); + sb.append(" numRows: ").append(toIndentedString(numRows)).append("\n"); + sb.append(" numPredictions: ").append(toIndentedString(numPredictions)).append("\n"); + sb.append(" numQueryRows: ").append(toIndentedString(numQueryRows)).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 + * PredictResponseMetadata} instance with all required arguments. + */ + public static Builder create() { + return (numColumns) -> + (numRows) -> + (numPredictions) -> + (numQueryRows) -> + new PredictResponseMetadata() + .numColumns(numColumns) + .numRows(numRows) + .numPredictions(numPredictions) + .numQueryRows(numQueryRows); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the numColumns of this {@link PredictResponseMetadata} instance. + * + * @param numColumns Number of columns in the input data. + * @return The PredictResponseMetadata builder. + */ + Builder1 numColumns(@Nonnull final Integer numColumns); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the numRows of this {@link PredictResponseMetadata} instance. + * + * @param numRows Number of rows in the input data. + * @return The PredictResponseMetadata builder. + */ + Builder2 numRows(@Nonnull final Integer numRows); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the numPredictions of this {@link PredictResponseMetadata} instance. + * + * @param numPredictions Number of table cells containing the specified placeholder value. + * @return The PredictResponseMetadata builder. + */ + Builder3 numPredictions(@Nonnull final Integer numPredictions); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the numQueryRows of this {@link PredictResponseMetadata} instance. + * + * @param numQueryRows Number of rows for which a prediction was made. + * @return The PredictResponseMetadata instance. + */ + PredictResponseMetadata numQueryRows(@Nonnull final Integer numQueryRows); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java new file mode 100644 index 000000000..e4d4daac8 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java @@ -0,0 +1,371 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.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.Arrays; +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; + +/** Response payload for prediction requests. Contains a list of prediction results. */ +// CHECKSTYLE:OFF +public class PredictResponsePayload +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("status") + private PredictResponseStatus status; + + @JsonProperty("predictions") + private List> predictions = + new ArrayList<>(); + + @JsonProperty("metadata") + private PredictResponseMetadata metadata; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link PredictResponsePayload} instance and return the same instance. + * + * @param id Unique ID for the request. + * @return The same instance of this {@link PredictResponsePayload} class + */ + @Nonnull + public PredictResponsePayload id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Unique ID for the request. + * + * @return id The id of this {@link PredictResponsePayload} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link PredictResponsePayload} instance. + * + * @param id Unique ID for the request. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the status of this {@link PredictResponsePayload} instance and return the same instance. + * + * @param status Status message that can indicate warnings (e.g. about suboptimal data). + * @return The same instance of this {@link PredictResponsePayload} class + */ + @Nonnull + public PredictResponsePayload status(@Nonnull final PredictResponseStatus status) { + this.status = status; + return this; + } + + /** + * Status message that can indicate warnings (e.g. about suboptimal data). + * + * @return status The status of this {@link PredictResponsePayload} instance. + */ + @Nonnull + public PredictResponseStatus getStatus() { + return status; + } + + /** + * Set the status of this {@link PredictResponsePayload} instance. + * + * @param status Status message that can indicate warnings (e.g. about suboptimal data). + */ + public void setStatus(@Nonnull final PredictResponseStatus status) { + this.status = status; + } + + /** + * Set the predictions of this {@link PredictResponsePayload} instance and return the same + * instance. + * + * @param predictions Mapping of column names to their list of prediction results or index column. + * @return The same instance of this {@link PredictResponsePayload} class + */ + @Nonnull + public PredictResponsePayload predictions( + @Nonnull final List> predictions) { + this.predictions = predictions; + return this; + } + + /** + * Add one predictions instance to this {@link PredictResponsePayload}. + * + * @param predictionsItem The predictions that should be added + * @return The same instance of type {@link PredictResponsePayload} + */ + @Nonnull + public PredictResponsePayload addPredictionsItem( + @Nonnull final Map predictionsItem) { + if (this.predictions == null) { + this.predictions = new ArrayList<>(); + } + this.predictions.add(predictionsItem); + return this; + } + + /** + * Mapping of column names to their list of prediction results or index column. + * + * @return predictions The predictions of this {@link PredictResponsePayload} instance. + */ + @Nonnull + public List> getPredictions() { + return predictions; + } + + /** + * Set the predictions of this {@link PredictResponsePayload} instance. + * + * @param predictions Mapping of column names to their list of prediction results or index column. + */ + public void setPredictions( + @Nonnull final List> predictions) { + this.predictions = predictions; + } + + /** + * Set the metadata of this {@link PredictResponsePayload} instance and return the same instance. + * + * @param metadata The metadata of this {@link PredictResponsePayload} + * @return The same instance of this {@link PredictResponsePayload} class + */ + @Nonnull + public PredictResponsePayload metadata(@Nonnull final PredictResponseMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link PredictResponsePayload} instance. + */ + @Nonnull + public PredictResponseMetadata getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link PredictResponsePayload} instance. + * + * @param metadata The metadata of this {@link PredictResponsePayload} + */ + public void setMetadata(@Nonnull final PredictResponseMetadata metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link PredictResponsePayload}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PredictResponsePayload} 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( + "PredictResponsePayload has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PredictResponsePayload} 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 (status != null) declaredFields.put("status", status); + if (predictions != null) declaredFields.put("predictions", predictions); + if (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PredictResponsePayload} 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 PredictResponsePayload predictResponsePayload = (PredictResponsePayload) o; + return Objects.equals(this.cloudSdkCustomFields, predictResponsePayload.cloudSdkCustomFields) + && Objects.equals(this.id, predictResponsePayload.id) + && Objects.equals(this.status, predictResponsePayload.status) + && Objects.equals(this.predictions, predictResponsePayload.predictions) + && Objects.equals(this.metadata, predictResponsePayload.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, predictions, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PredictResponsePayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" predictions: ").append(toIndentedString(predictions)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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 PredictResponsePayload} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (status) -> + (predictions) -> + (metadata) -> + new PredictResponsePayload() + .id(id) + .status(status) + .predictions(predictions) + .metadata(metadata); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link PredictResponsePayload} instance. + * + * @param id Unique ID for the request. + * @return The PredictResponsePayload builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the status of this {@link PredictResponsePayload} instance. + * + * @param status Status message that can indicate warnings (e.g. about suboptimal data). + * @return The PredictResponsePayload builder. + */ + Builder2 status(@Nonnull final PredictResponseStatus status); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the predictions of this {@link PredictResponsePayload} instance. + * + * @param predictions Mapping of column names to their list of prediction results or index + * column. + * @return The PredictResponsePayload builder. + */ + Builder3 predictions( + @Nonnull final List> predictions); + + /** + * Set the predictions of this {@link PredictResponsePayload} instance. + * + * @param predictions Mapping of column names to their list of prediction results or index + * column. + * @return The PredictResponsePayload builder. + */ + default Builder3 predictions( + @Nonnull final Map... predictions) { + return predictions(Arrays.asList(predictions)); + } + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the metadata of this {@link PredictResponsePayload} instance. + * + * @param metadata The metadata of this {@link PredictResponsePayload} + * @return The PredictResponsePayload instance. + */ + PredictResponsePayload metadata(@Nonnull final PredictResponseMetadata metadata); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java new file mode 100644 index 000000000..15fb362e8 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java @@ -0,0 +1,77 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.generated.model; + +import java.util.List; +import javax.annotation.Nonnull; + +/** PredictResponsePayloadPredictionsInnerValue */ +public interface PredictResponsePayloadPredictionsInnerValue { + /** + * Helper class to create {@code List } that implements {@link + * PredictResponsePayloadPredictionsInnerValue}. + */ + record ListOfPredictionResults( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements PredictResponsePayloadPredictionsInnerValue {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val the value to use + * @return a new instance of {@link ListOfPredictionResults}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfPredictionResults createListOfPredictionResults( + @Nonnull final List val) { + return new ListOfPredictionResults(val); + } + + /** + * Helper class to create {@code String } that implements {@link + * PredictResponsePayloadPredictionsInnerValue}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements PredictResponsePayloadPredictionsInnerValue {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** + * Helper class to create {@code Integer } that implements {@link + * PredictResponsePayloadPredictionsInnerValue}. + */ + record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) + implements PredictResponsePayloadPredictionsInnerValue {} + + /** + * Creator to enable deserialization of {@code Integer }. + * + * @param val the value to use + * @return a new instance of {@link InnerInteger}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerInteger create(@Nonnull final Integer val) { + return new InnerInteger(val); + } +} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseStatus.java similarity index 52% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseStatus.java index 70c6ee8d3..5a0f5a46a 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorResponseStatus.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponseStatus.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -13,11 +13,8 @@ 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.math.BigDecimal; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; @@ -26,138 +23,86 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** ErrorResponseStatus */ +/** Output status for prediction requests. */ // CHECKSTYLE:OFF -public class ErrorResponseStatus +public class PredictResponseStatus // CHECKSTYLE:ON { - /** Gets or Sets code */ - public enum CodeEnum { - /** The NUMBER_2 option of this ErrorResponseStatus */ - NUMBER_2(new BigDecimal("2")), - - /** The NUMBER_unknown_default_open_api option of this ErrorResponseStatus */ - NUMBER_unknown_default_open_api(new BigDecimal("11184809")); - - private BigDecimal value; - - CodeEnum(BigDecimal value) { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public BigDecimal 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 ErrorResponseStatus - */ - @JsonCreator - @Nonnull - public static CodeEnum fromValue(@Nonnull final BigDecimal value) { - for (CodeEnum b : CodeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return NUMBER_unknown_default_open_api; - } - } - @JsonProperty("code") - private CodeEnum code; + private Integer code; @JsonProperty("message") - private Object message = null; + private String message; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the code of this {@link ErrorResponseStatus} instance and return the same instance. + * Set the code of this {@link PredictResponseStatus} instance and return the same instance. * - * @param code The code of this {@link ErrorResponseStatus} - * @return The same instance of this {@link ErrorResponseStatus} class + * @param code Status code (zero means success, other status codes indicate warnings) + * @return The same instance of this {@link PredictResponseStatus} class */ @Nonnull - public ErrorResponseStatus code(@Nullable final CodeEnum code) { + public PredictResponseStatus code(@Nonnull final Integer code) { this.code = code; return this; } /** - * Get code + * Status code (zero means success, other status codes indicate warnings) * - * @return code The code of this {@link ErrorResponseStatus} instance. + * @return code The code of this {@link PredictResponseStatus} instance. */ @Nonnull - public CodeEnum getCode() { + public Integer getCode() { return code; } /** - * Set the code of this {@link ErrorResponseStatus} instance. + * Set the code of this {@link PredictResponseStatus} instance. * - * @param code The code of this {@link ErrorResponseStatus} + * @param code Status code (zero means success, other status codes indicate warnings) */ - public void setCode(@Nullable final CodeEnum code) { + public void setCode(@Nonnull final Integer code) { this.code = code; } /** - * Set the message of this {@link ErrorResponseStatus} instance and return the same instance. + * Set the message of this {@link PredictResponseStatus} instance and return the same instance. * - * @param message The message of this {@link ErrorResponseStatus} - * @return The same instance of this {@link ErrorResponseStatus} class + * @param message Status message, either \"ok\" or contains a warning / more + * information. + * @return The same instance of this {@link PredictResponseStatus} class */ @Nonnull - public ErrorResponseStatus message(@Nullable final Object message) { + public PredictResponseStatus message(@Nonnull final String message) { this.message = message; return this; } /** - * Get message + * Status message, either \"ok\" or contains a warning / more information. * - * @return message The message of this {@link ErrorResponseStatus} instance. + * @return message The message of this {@link PredictResponseStatus} instance. */ - @Nullable - public Object getMessage() { + @Nonnull + public String getMessage() { return message; } /** - * Set the message of this {@link ErrorResponseStatus} instance. + * Set the message of this {@link PredictResponseStatus} instance. * - * @param message The message of this {@link ErrorResponseStatus} + * @param message Status message, either \"ok\" or contains a warning / more + * information. */ - public void setMessage(@Nullable final Object message) { + public void setMessage(@Nonnull final String message) { this.message = message; } /** - * Get the names of the unrecognizable properties of the {@link ErrorResponseStatus}. + * Get the names of the unrecognizable properties of the {@link PredictResponseStatus}. * * @return The set of properties names */ @@ -168,7 +113,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link ErrorResponseStatus} instance. + * Get the value of an unrecognizable property of this {@link PredictResponseStatus} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -180,13 +125,13 @@ public Set getCustomFieldNames() { public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { throw new NoSuchElementException( - "ErrorResponseStatus has no field with name '" + name + "'."); + "PredictResponseStatus has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ErrorResponseStatus} instance including + * Get the value of all properties of this {@link PredictResponseStatus} instance including * unrecognized properties. * * @return The map of all properties @@ -201,7 +146,7 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link ErrorResponseStatus} instance. If the map + * Set an unrecognizable property of this {@link PredictResponseStatus} 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 @@ -220,10 +165,10 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final ErrorResponseStatus errorResponseStatus = (ErrorResponseStatus) o; - return Objects.equals(this.cloudSdkCustomFields, errorResponseStatus.cloudSdkCustomFields) - && Objects.equals(this.code, errorResponseStatus.code) - && Objects.equals(this.message, errorResponseStatus.message); + final PredictResponseStatus predictResponseStatus = (PredictResponseStatus) o; + return Objects.equals(this.cloudSdkCustomFields, predictResponseStatus.cloudSdkCustomFields) + && Objects.equals(this.code, predictResponseStatus.code) + && Objects.equals(this.message, predictResponseStatus.message); } @Override @@ -235,7 +180,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ErrorResponseStatus {\n"); + sb.append("class PredictResponseStatus {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); cloudSdkCustomFields.forEach( @@ -255,8 +200,34 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link ErrorResponseStatus} instance. No arguments are required. */ - public static ErrorResponseStatus create() { - return new ErrorResponseStatus(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link PredictResponseStatus} + * instance with all required arguments. + */ + public static Builder create() { + return (code) -> (message) -> new PredictResponseStatus().code(code).message(message); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the code of this {@link PredictResponseStatus} instance. + * + * @param code Status code (zero means success, other status codes indicate warnings) + * @return The PredictResponseStatus builder. + */ + Builder1 code(@Nonnull final Integer code); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the message of this {@link PredictResponseStatus} instance. + * + * @param message Status message, either \"ok\" or contains a warning / more + * information. + * @return The PredictResponseStatus instance. + */ + PredictResponseStatus message(@Nonnull final String message); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java similarity index 55% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java index f1f778d48..17a13e67d 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ErrorDetailLocInner.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/Prediction.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -11,13 +11,14 @@ package com.sap.ai.sdk.foundationmodels.rpt.generated.model; +import java.math.BigDecimal; import javax.annotation.Nonnull; -/** ErrorDetailLocInner */ -public interface ErrorDetailLocInner { - /** Helper class to create {@code String } that implements {@link ErrorDetailLocInner}. */ +/** The predicted value for the column. */ +public interface Prediction { + /** Helper class to create {@code String } that implements {@link Prediction}. */ record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements ErrorDetailLocInner {} + implements Prediction {} /** * Creator to enable deserialization of {@code String }. @@ -31,19 +32,19 @@ static InnerString create(@Nonnull final String val) { return new InnerString(val); } - /** Helper class to create {@code Integer } that implements {@link ErrorDetailLocInner}. */ - record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) - implements ErrorDetailLocInner {} + /** Helper class to create {@code BigDecimal } that implements {@link Prediction}. */ + record InnerBigDecimal(@com.fasterxml.jackson.annotation.JsonValue @Nonnull BigDecimal value) + implements Prediction {} /** - * Creator to enable deserialization of {@code Integer }. + * Creator to enable deserialization of {@code BigDecimal }. * * @param val the value to use - * @return a new instance of {@link InnerInteger}. + * @return a new instance of {@link InnerBigDecimal}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static InnerInteger create(@Nonnull final Integer val) { - return new InnerInteger(val); + static InnerBigDecimal create(@Nonnull final BigDecimal val) { + return new InnerBigDecimal(val); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java index 2d2bb77d7..dba99d910 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionConfig.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -25,13 +26,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Configuration specifying which columns to predict. */ +/** Configuration of the prediction model. */ // CHECKSTYLE:OFF public class PredictionConfig // CHECKSTYLE:ON { @JsonProperty("target_columns") - private List targetColumns = new ArrayList<>(); + private List targetColumns = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -39,11 +40,11 @@ public class PredictionConfig /** * Set the targetColumns of this {@link PredictionConfig} instance and return the same instance. * - * @param targetColumns Array of target column configurations for prediction. + * @param targetColumns The targetColumns of this {@link PredictionConfig} * @return The same instance of this {@link PredictionConfig} class */ @Nonnull - public PredictionConfig targetColumns(@Nullable final List targetColumns) { + public PredictionConfig targetColumns(@Nonnull final List targetColumns) { this.targetColumns = targetColumns; return this; } @@ -55,7 +56,8 @@ public PredictionConfig targetColumns(@Nullable final List targetC * @return The same instance of type {@link PredictionConfig} */ @Nonnull - public PredictionConfig addTargetColumnsItem(@Nonnull final TargetColumn targetColumnsItem) { + public PredictionConfig addTargetColumnsItem( + @Nonnull final TargetColumnConfig targetColumnsItem) { if (this.targetColumns == null) { this.targetColumns = new ArrayList<>(); } @@ -64,21 +66,21 @@ public PredictionConfig addTargetColumnsItem(@Nonnull final TargetColumn targetC } /** - * Array of target column configurations for prediction. + * Get targetColumns * * @return targetColumns The targetColumns of this {@link PredictionConfig} instance. */ @Nonnull - public List getTargetColumns() { + public List getTargetColumns() { return targetColumns; } /** * Set the targetColumns of this {@link PredictionConfig} instance. * - * @param targetColumns Array of target column configurations for prediction. + * @param targetColumns The targetColumns of this {@link PredictionConfig} */ - public void setTargetColumns(@Nullable final List targetColumns) { + public void setTargetColumns(@Nonnull final List targetColumns) { this.targetColumns = targetColumns; } @@ -177,8 +179,32 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link PredictionConfig} instance. No arguments are required. */ - public static PredictionConfig create() { - return new PredictionConfig(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link PredictionConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (targetColumns) -> new PredictionConfig().targetColumns(targetColumns); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the targetColumns of this {@link PredictionConfig} instance. + * + * @param targetColumns The targetColumns of this {@link PredictionConfig} + * @return The PredictionConfig instance. + */ + PredictionConfig targetColumns(@Nonnull final List targetColumns); + + /** + * Set the targetColumns of this {@link PredictionConfig} instance. + * + * @param targetColumns The targetColumns of this {@link PredictionConfig} + * @return The PredictionConfig instance. + */ + default PredictionConfig targetColumns(@Nonnull final TargetColumnConfig... targetColumns) { + return targetColumns(Arrays.asList(targetColumns)); + } } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPlaceholder.java similarity index 50% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPlaceholder.java index 807f679c8..a454b170a 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItemPrediction.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionPlaceholder.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -11,39 +11,43 @@ package com.sap.ai.sdk.foundationmodels.rpt.generated.model; +import java.math.BigDecimal; import javax.annotation.Nonnull; -/** PredictionItemPrediction */ -public interface PredictionItemPrediction { - /** Helper class to create {@code Float } that implements {@link PredictionItemPrediction}. */ - record InnerFloat(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Float value) - implements PredictionItemPrediction {} +/** + * The placeholder value in any column for which to predict a value. The model will predict a value + * for all table cells containing this value. + */ +public interface PredictionPlaceholder { + /** Helper class to create {@code String } that implements {@link PredictionPlaceholder}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements PredictionPlaceholder {} /** - * Creator to enable deserialization of {@code Float }. + * Creator to enable deserialization of {@code String }. * * @param val the value to use - * @return a new instance of {@link InnerFloat}. + * @return a new instance of {@link InnerString}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static InnerFloat create(@Nonnull final Float val) { - return new InnerFloat(val); + static InnerString create(@Nonnull final String val) { + return new InnerString(val); } - /** Helper class to create {@code String } that implements {@link PredictionItemPrediction}. */ - record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements PredictionItemPrediction {} + /** Helper class to create {@code BigDecimal } that implements {@link PredictionPlaceholder}. */ + record InnerBigDecimal(@com.fasterxml.jackson.annotation.JsonValue @Nonnull BigDecimal value) + implements PredictionPlaceholder {} /** - * Creator to enable deserialization of {@code String }. + * Creator to enable deserialization of {@code BigDecimal }. * * @param val the value to use - * @return a new instance of {@link InnerString}. + * @return a new instance of {@link InnerBigDecimal}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static InnerString create(@Nonnull final String val) { - return new InnerString(val); + static InnerBigDecimal create(@Nonnull final BigDecimal val) { + return new InnerBigDecimal(val); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResult.java similarity index 59% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResult.java index 2e35934c4..c768c4bb3 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionItem.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResult.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; @@ -23,28 +24,28 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Individual prediction result for a cell. */ +/** A single prediction result for a single column in a single row. */ // CHECKSTYLE:OFF -public class PredictionItem +public class PredictionResult // CHECKSTYLE:ON { @JsonProperty("prediction") - private PredictionItemPrediction prediction; + private Prediction prediction; @JsonProperty("confidence") - private Float confidence; + private BigDecimal confidence; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the prediction of this {@link PredictionItem} instance and return the same instance. + * Set the prediction of this {@link PredictionResult} instance and return the same instance. * - * @param prediction The prediction of this {@link PredictionItem} - * @return The same instance of this {@link PredictionItem} class + * @param prediction The prediction of this {@link PredictionResult} + * @return The same instance of this {@link PredictionResult} class */ @Nonnull - public PredictionItem prediction(@Nullable final PredictionItemPrediction prediction) { + public PredictionResult prediction(@Nonnull final Prediction prediction) { this.prediction = prediction; return this; } @@ -52,55 +53,55 @@ public PredictionItem prediction(@Nullable final PredictionItemPrediction predic /** * Get prediction * - * @return prediction The prediction of this {@link PredictionItem} instance. + * @return prediction The prediction of this {@link PredictionResult} instance. */ @Nonnull - public PredictionItemPrediction getPrediction() { + public Prediction getPrediction() { return prediction; } /** - * Set the prediction of this {@link PredictionItem} instance. + * Set the prediction of this {@link PredictionResult} instance. * - * @param prediction The prediction of this {@link PredictionItem} + * @param prediction The prediction of this {@link PredictionResult} */ - public void setPrediction(@Nullable final PredictionItemPrediction prediction) { + public void setPrediction(@Nonnull final Prediction prediction) { this.prediction = prediction; } /** - * Set the confidence of this {@link PredictionItem} instance and return the same instance. + * Set the confidence of this {@link PredictionResult} instance and return the same instance. * - * @param confidence The confidence score for this prediction (for classification tasks only). - * @return The same instance of this {@link PredictionItem} class + * @param confidence The confidence of this {@link PredictionResult} + * @return The same instance of this {@link PredictionResult} class */ @Nonnull - public PredictionItem confidence(@Nullable final Float confidence) { + public PredictionResult confidence(@Nullable final BigDecimal confidence) { this.confidence = confidence; return this; } /** - * The confidence score for this prediction (for classification tasks only). + * Get confidence * - * @return confidence The confidence of this {@link PredictionItem} instance. + * @return confidence The confidence of this {@link PredictionResult} instance. */ @Nullable - public Float getConfidence() { + public BigDecimal getConfidence() { return confidence; } /** - * Set the confidence of this {@link PredictionItem} instance. + * Set the confidence of this {@link PredictionResult} instance. * - * @param confidence The confidence score for this prediction (for classification tasks only). + * @param confidence The confidence of this {@link PredictionResult} */ - public void setConfidence(@Nullable final Float confidence) { + public void setConfidence(@Nullable final BigDecimal confidence) { this.confidence = confidence; } /** - * Get the names of the unrecognizable properties of the {@link PredictionItem}. + * Get the names of the unrecognizable properties of the {@link PredictionResult}. * * @return The set of properties names */ @@ -111,7 +112,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link PredictionItem} instance. + * Get the value of an unrecognizable property of this {@link PredictionResult} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -122,14 +123,14 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("PredictionItem has no field with name '" + name + "'."); + throw new NoSuchElementException("PredictionResult has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link PredictionItem} instance including unrecognized - * properties. + * Get the value of all properties of this {@link PredictionResult} instance including + * unrecognized properties. * * @return The map of all properties */ @@ -143,7 +144,7 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link PredictionItem} instance. If the map previously + * Set an unrecognizable property of this {@link PredictionResult} 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 @@ -162,10 +163,10 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final PredictionItem predictionItem = (PredictionItem) o; - return Objects.equals(this.cloudSdkCustomFields, predictionItem.cloudSdkCustomFields) - && Objects.equals(this.prediction, predictionItem.prediction) - && Objects.equals(this.confidence, predictionItem.confidence); + final PredictionResult predictionResult = (PredictionResult) o; + return Objects.equals(this.cloudSdkCustomFields, predictionResult.cloudSdkCustomFields) + && Objects.equals(this.prediction, predictionResult.prediction) + && Objects.equals(this.confidence, predictionResult.confidence); } @Override @@ -177,7 +178,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class PredictionItem {\n"); + sb.append("class PredictionResult {\n"); sb.append(" prediction: ").append(toIndentedString(prediction)).append("\n"); sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); cloudSdkCustomFields.forEach( @@ -197,8 +198,22 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link PredictionItem} instance. No arguments are required. */ - public static PredictionItem create() { - return new PredictionItem(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link PredictionResult} + * instance with all required arguments. + */ + public static Builder create() { + return (prediction) -> new PredictionResult().prediction(prediction); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the prediction of this {@link PredictionResult} instance. + * + * @param prediction The prediction of this {@link PredictionResult} + * @return The PredictionResult instance. + */ + PredictionResult prediction(@Nonnull final Prediction prediction); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java deleted file mode 100644 index 32ce47b2e..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionResultsValue.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.generated.model; - -import java.util.List; -import javax.annotation.Nonnull; - -/** PredictionResultsValue */ -public interface PredictionResultsValue { - /** - * Helper class to create {@code List } that implements {@link - * PredictionResultsValue}. - */ - record ListOfPredictionItems( - @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) - implements PredictionResultsValue {} - - /** - * Creator to enable deserialization of {@code List }. - * - * @param val the value to use - * @return a new instance of {@link ListOfPredictionItems}. - */ - @com.fasterxml.jackson.annotation.JsonCreator - @Nonnull - static ListOfPredictionItems createListOfPredictionItems( - @Nonnull final List val) { - return new ListOfPredictionItems(val); - } - - /** Helper class to create {@code String } that implements {@link PredictionResultsValue}. */ - record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements PredictionResultsValue {} - - /** - * Creator to enable deserialization of {@code String }. - * - * @param val the value to use - * @return a new instance of {@link InnerString}. - */ - @com.fasterxml.jackson.annotation.JsonCreator - @Nonnull - static InnerString create(@Nonnull final String val) { - return new InnerString(val); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/SchemaFieldConfig.java similarity index 52% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/SchemaFieldConfig.java index 1b80dfa35..9ca69ea61 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/ColumnDataType.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/SchemaFieldConfig.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -13,10 +13,8 @@ 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; @@ -25,110 +23,53 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Data type specification for a column. */ +/** Configuration for a single field in the input data schema. */ // CHECKSTYLE:OFF -public class ColumnDataType +public class SchemaFieldConfig // CHECKSTYLE:ON { - /** Data type for the column. */ - public enum DtypeEnum { - /** The STRING option of this ColumnDataType */ - STRING("string"), - - /** The NUMERIC option of this ColumnDataType */ - NUMERIC("numeric"), - - /** The DATE option of this ColumnDataType */ - DATE("date"), - - /** The UNKNOWN_DEFAULT_OPEN_API option of this ColumnDataType */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - DtypeEnum(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 ColumnDataType - */ - @JsonCreator - @Nonnull - public static DtypeEnum fromValue(@Nonnull final String value) { - for (DtypeEnum b : DtypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - @JsonProperty("dtype") - private DtypeEnum dtype; + private ColumnType dtype; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the dtype of this {@link ColumnDataType} instance and return the same instance. + * Set the dtype of this {@link SchemaFieldConfig} instance and return the same instance. * - * @param dtype Data type for the column. - * @return The same instance of this {@link ColumnDataType} class + * @param dtype The data type of the target column. Supported types are ['string', + * 'numeric', 'date']. + * @return The same instance of this {@link SchemaFieldConfig} class */ @Nonnull - public ColumnDataType dtype(@Nullable final DtypeEnum dtype) { + public SchemaFieldConfig dtype(@Nonnull final ColumnType dtype) { this.dtype = dtype; return this; } /** - * Data type for the column. + * The data type of the target column. Supported types are ['string', 'numeric', + * 'date']. * - * @return dtype The dtype of this {@link ColumnDataType} instance. + * @return dtype The dtype of this {@link SchemaFieldConfig} instance. */ @Nonnull - public DtypeEnum getDtype() { + public ColumnType getDtype() { return dtype; } /** - * Set the dtype of this {@link ColumnDataType} instance. + * Set the dtype of this {@link SchemaFieldConfig} instance. * - * @param dtype Data type for the column. + * @param dtype The data type of the target column. Supported types are ['string', + * 'numeric', 'date']. */ - public void setDtype(@Nullable final DtypeEnum dtype) { + public void setDtype(@Nonnull final ColumnType dtype) { this.dtype = dtype; } /** - * Get the names of the unrecognizable properties of the {@link ColumnDataType}. + * Get the names of the unrecognizable properties of the {@link SchemaFieldConfig}. * * @return The set of properties names */ @@ -139,7 +80,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link ColumnDataType} instance. + * Get the value of an unrecognizable property of this {@link SchemaFieldConfig} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -150,14 +91,14 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("ColumnDataType has no field with name '" + name + "'."); + throw new NoSuchElementException("SchemaFieldConfig has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ColumnDataType} instance including unrecognized - * properties. + * Get the value of all properties of this {@link SchemaFieldConfig} instance including + * unrecognized properties. * * @return The map of all properties */ @@ -170,8 +111,8 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link ColumnDataType} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link SchemaFieldConfig} 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 @@ -189,9 +130,9 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final ColumnDataType columnDataType = (ColumnDataType) o; - return Objects.equals(this.cloudSdkCustomFields, columnDataType.cloudSdkCustomFields) - && Objects.equals(this.dtype, columnDataType.dtype); + final SchemaFieldConfig schemaFieldConfig = (SchemaFieldConfig) o; + return Objects.equals(this.cloudSdkCustomFields, schemaFieldConfig.cloudSdkCustomFields) + && Objects.equals(this.dtype, schemaFieldConfig.dtype); } @Override @@ -203,7 +144,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ColumnDataType {\n"); + sb.append("class SchemaFieldConfig {\n"); sb.append(" dtype: ").append(toIndentedString(dtype)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> @@ -222,8 +163,23 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link ColumnDataType} instance. No arguments are required. */ - public static ColumnDataType create() { - return new ColumnDataType(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SchemaFieldConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (dtype) -> new SchemaFieldConfig().dtype(dtype); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the dtype of this {@link SchemaFieldConfig} instance. + * + * @param dtype The data type of the target column. Supported types are ['string', + * 'numeric', 'date']. + * @return The SchemaFieldConfig instance. + */ + SchemaFieldConfig dtype(@Nonnull final ColumnType dtype); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java deleted file mode 100644 index fac9536f3..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionMetadata.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** TabCompletionMetadata about the prediction request. */ -// CHECKSTYLE:OFF -public class TabCompletionMetadata -// CHECKSTYLE:ON -{ - @JsonProperty("num_rows") - private Integer numRows; - - @JsonProperty("num_columns") - private Integer numColumns; - - @JsonProperty("num_predictions") - private Integer numPredictions; - - @JsonProperty("num_query_rows") - private Integer numQueryRows; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the numRows of this {@link TabCompletionMetadata} instance and return the same instance. - * - * @param numRows The total number of input rows. - * @return The same instance of this {@link TabCompletionMetadata} class - */ - @Nonnull - public TabCompletionMetadata numRows(@Nullable final Integer numRows) { - this.numRows = numRows; - return this; - } - - /** - * The total number of input rows. - * - * @return numRows The numRows of this {@link TabCompletionMetadata} instance. - */ - @Nonnull - public Integer getNumRows() { - return numRows; - } - - /** - * Set the numRows of this {@link TabCompletionMetadata} instance. - * - * @param numRows The total number of input rows. - */ - public void setNumRows(@Nullable final Integer numRows) { - this.numRows = numRows; - } - - /** - * Set the numColumns of this {@link TabCompletionMetadata} instance and return the same instance. - * - * @param numColumns The total number of input columns. - * @return The same instance of this {@link TabCompletionMetadata} class - */ - @Nonnull - public TabCompletionMetadata numColumns(@Nullable final Integer numColumns) { - this.numColumns = numColumns; - return this; - } - - /** - * The total number of input columns. - * - * @return numColumns The numColumns of this {@link TabCompletionMetadata} instance. - */ - @Nonnull - public Integer getNumColumns() { - return numColumns; - } - - /** - * Set the numColumns of this {@link TabCompletionMetadata} instance. - * - * @param numColumns The total number of input columns. - */ - public void setNumColumns(@Nullable final Integer numColumns) { - this.numColumns = numColumns; - } - - /** - * Set the numPredictions of this {@link TabCompletionMetadata} instance and return the same - * instance. - * - * @param numPredictions The number of table cells containing the specified placeholder values - * summed over all target columns. - * @return The same instance of this {@link TabCompletionMetadata} class - */ - @Nonnull - public TabCompletionMetadata numPredictions(@Nullable final Integer numPredictions) { - this.numPredictions = numPredictions; - return this; - } - - /** - * The number of table cells containing the specified placeholder values summed over all target - * columns. - * - * @return numPredictions The numPredictions of this {@link TabCompletionMetadata} instance. - */ - @Nonnull - public Integer getNumPredictions() { - return numPredictions; - } - - /** - * Set the numPredictions of this {@link TabCompletionMetadata} instance. - * - * @param numPredictions The number of table cells containing the specified placeholder values - * summed over all target columns. - */ - public void setNumPredictions(@Nullable final Integer numPredictions) { - this.numPredictions = numPredictions; - } - - /** - * Set the numQueryRows of this {@link TabCompletionMetadata} instance and return the same - * instance. - * - * @param numQueryRows The number of query rows for which a prediction was made. - * @return The same instance of this {@link TabCompletionMetadata} class - */ - @Nonnull - public TabCompletionMetadata numQueryRows(@Nullable final Integer numQueryRows) { - this.numQueryRows = numQueryRows; - return this; - } - - /** - * The number of query rows for which a prediction was made. - * - * @return numQueryRows The numQueryRows of this {@link TabCompletionMetadata} instance. - */ - @Nonnull - public Integer getNumQueryRows() { - return numQueryRows; - } - - /** - * Set the numQueryRows of this {@link TabCompletionMetadata} instance. - * - * @param numQueryRows The number of query rows for which a prediction was made. - */ - public void setNumQueryRows(@Nullable final Integer numQueryRows) { - this.numQueryRows = numQueryRows; - } - - /** - * Get the names of the unrecognizable properties of the {@link TabCompletionMetadata}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TabCompletionMetadata} 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( - "TabCompletionMetadata has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TabCompletionMetadata} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (numRows != null) declaredFields.put("numRows", numRows); - if (numColumns != null) declaredFields.put("numColumns", numColumns); - if (numPredictions != null) declaredFields.put("numPredictions", numPredictions); - if (numQueryRows != null) declaredFields.put("numQueryRows", numQueryRows); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TabCompletionMetadata} 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 TabCompletionMetadata tabCompletionMetadata = (TabCompletionMetadata) o; - return Objects.equals(this.cloudSdkCustomFields, tabCompletionMetadata.cloudSdkCustomFields) - && Objects.equals(this.numRows, tabCompletionMetadata.numRows) - && Objects.equals(this.numColumns, tabCompletionMetadata.numColumns) - && Objects.equals(this.numPredictions, tabCompletionMetadata.numPredictions) - && Objects.equals(this.numQueryRows, tabCompletionMetadata.numQueryRows); - } - - @Override - public int hashCode() { - return Objects.hash(numRows, numColumns, numPredictions, numQueryRows, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class TabCompletionMetadata {\n"); - sb.append(" numRows: ").append(toIndentedString(numRows)).append("\n"); - sb.append(" numColumns: ").append(toIndentedString(numColumns)).append("\n"); - sb.append(" numPredictions: ").append(toIndentedString(numPredictions)).append("\n"); - sb.append(" numQueryRows: ").append(toIndentedString(numQueryRows)).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 TabCompletionMetadata} instance. No arguments are required. */ - public static TabCompletionMetadata create() { - return new TabCompletionMetadata(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java deleted file mode 100644 index 7c176e645..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostRequest.java +++ /dev/null @@ -1,429 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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.HashMap; -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; - -/** - * Request for tabular prediction. Must provide data as either rows or columns (mutually exclusive). - */ -// CHECKSTYLE:OFF -public class TabCompletionPostRequest -// CHECKSTYLE:ON -{ - @JsonProperty("prediction_config") - private PredictionConfig predictionConfig; - - @JsonProperty("index_column") - private String indexColumn; - - @JsonProperty("rows") - private List> rows = new ArrayList<>(); - - @JsonProperty("columns") - private Map> columns = new HashMap<>(); - - @JsonProperty("data_schema") - private Map dataSchema = new HashMap<>(); - - @JsonProperty("parse_data_types") - private Boolean parseDataTypes = true; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the predictionConfig of this {@link TabCompletionPostRequest} instance and return the same - * instance. - * - * @param predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest predictionConfig( - @Nullable final PredictionConfig predictionConfig) { - this.predictionConfig = predictionConfig; - return this; - } - - /** - * Get predictionConfig - * - * @return predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} - * instance. - */ - @Nonnull - public PredictionConfig getPredictionConfig() { - return predictionConfig; - } - - /** - * Set the predictionConfig of this {@link TabCompletionPostRequest} instance. - * - * @param predictionConfig The predictionConfig of this {@link TabCompletionPostRequest} - */ - public void setPredictionConfig(@Nullable final PredictionConfig predictionConfig) { - this.predictionConfig = predictionConfig; - } - - /** - * Set the indexColumn of this {@link TabCompletionPostRequest} instance and return the same - * instance. - * - * @param indexColumn Optional column name used to identify rows. Not used as input feature, but - * returned in response. - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest indexColumn(@Nullable final String indexColumn) { - this.indexColumn = indexColumn; - return this; - } - - /** - * Optional column name used to identify rows. Not used as input feature, but returned in - * response. - * - * @return indexColumn The indexColumn of this {@link TabCompletionPostRequest} instance. - */ - @Nonnull - public String getIndexColumn() { - return indexColumn; - } - - /** - * Set the indexColumn of this {@link TabCompletionPostRequest} instance. - * - * @param indexColumn Optional column name used to identify rows. Not used as input feature, but - * returned in response. - */ - public void setIndexColumn(@Nullable final String indexColumn) { - this.indexColumn = indexColumn; - } - - /** - * Set the rows of this {@link TabCompletionPostRequest} instance and return the same instance. - * - * @param rows Table data organized by rows (mutually exclusive with columns). - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest rows(@Nullable final List> rows) { - this.rows = rows; - return this; - } - - /** - * Add one rows instance to this {@link TabCompletionPostRequest}. - * - * @param rowsItem The rows that should be added - * @return The same instance of type {@link TabCompletionPostRequest} - */ - @Nonnull - public TabCompletionPostRequest addRowsItem(@Nonnull final Map rowsItem) { - if (this.rows == null) { - this.rows = new ArrayList<>(); - } - this.rows.add(rowsItem); - return this; - } - - /** - * Table data organized by rows (mutually exclusive with columns). - * - * @return rows The rows of this {@link TabCompletionPostRequest} instance. - */ - @Nonnull - public List> getRows() { - return rows; - } - - /** - * Set the rows of this {@link TabCompletionPostRequest} instance. - * - * @param rows Table data organized by rows (mutually exclusive with columns). - */ - public void setRows(@Nullable final List> rows) { - this.rows = rows; - } - - /** - * Set the columns of this {@link TabCompletionPostRequest} instance and return the same instance. - * - * @param columns Table data organized by columns (mutually exclusive with rows). - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest columns(@Nullable final Map> columns) { - this.columns = columns; - return this; - } - - /** - * Put one columns instance to this {@link TabCompletionPostRequest} instance. - * - * @param key The String key of this columns instance - * @param columnsItem The columns that should be added under the given key - * @return The same instance of type {@link TabCompletionPostRequest} - */ - @Nonnull - public TabCompletionPostRequest putcolumnsItem( - @Nonnull final String key, @Nonnull final List columnsItem) { - if (this.columns == null) { - this.columns = new HashMap<>(); - } - this.columns.put(key, columnsItem); - return this; - } - - /** - * Table data organized by columns (mutually exclusive with rows). - * - * @return columns The columns of this {@link TabCompletionPostRequest} instance. - */ - @Nonnull - public Map> getColumns() { - return columns; - } - - /** - * Set the columns of this {@link TabCompletionPostRequest} instance. - * - * @param columns Table data organized by columns (mutually exclusive with rows). - */ - public void setColumns(@Nullable final Map> columns) { - this.columns = columns; - } - - /** - * Set the dataSchema of this {@link TabCompletionPostRequest} instance and return the same - * instance. - * - * @param dataSchema (Optional) Schema definition for column data types. If omitted and - * parse_data_types is true, data types will be inferred. - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest dataSchema( - @Nullable final Map dataSchema) { - this.dataSchema = dataSchema; - return this; - } - - /** - * Put one dataSchema instance to this {@link TabCompletionPostRequest} instance. - * - * @param key The String key of this dataSchema instance - * @param dataSchemaItem The dataSchema that should be added under the given key - * @return The same instance of type {@link TabCompletionPostRequest} - */ - @Nonnull - public TabCompletionPostRequest putdataSchemaItem( - @Nonnull final String key, @Nonnull final ColumnDataType dataSchemaItem) { - if (this.dataSchema == null) { - this.dataSchema = new HashMap<>(); - } - this.dataSchema.put(key, dataSchemaItem); - return this; - } - - /** - * (Optional) Schema definition for column data types. If omitted and parse_data_types is true, - * data types will be inferred. - * - * @return dataSchema The dataSchema of this {@link TabCompletionPostRequest} instance. - */ - @Nonnull - public Map getDataSchema() { - return dataSchema; - } - - /** - * Set the dataSchema of this {@link TabCompletionPostRequest} instance. - * - * @param dataSchema (Optional) Schema definition for column data types. If omitted and - * parse_data_types is true, data types will be inferred. - */ - public void setDataSchema(@Nullable final Map dataSchema) { - this.dataSchema = dataSchema; - } - - /** - * Set the parseDataTypes of this {@link TabCompletionPostRequest} instance and return the same - * instance. - * - * @param parseDataTypes Whether to parse data types when data_schema is not provided eg. - * interpret date, numeric - * @return The same instance of this {@link TabCompletionPostRequest} class - */ - @Nonnull - public TabCompletionPostRequest parseDataTypes(@Nullable final Boolean parseDataTypes) { - this.parseDataTypes = parseDataTypes; - return this; - } - - /** - * Whether to parse data types when data_schema is not provided eg. interpret date, numeric - * - * @return parseDataTypes The parseDataTypes of this {@link TabCompletionPostRequest} instance. - */ - @Nonnull - public Boolean isParseDataTypes() { - return parseDataTypes; - } - - /** - * Set the parseDataTypes of this {@link TabCompletionPostRequest} instance. - * - * @param parseDataTypes Whether to parse data types when data_schema is not provided eg. - * interpret date, numeric - */ - public void setParseDataTypes(@Nullable final Boolean parseDataTypes) { - this.parseDataTypes = parseDataTypes; - } - - /** - * Get the names of the unrecognizable properties of the {@link TabCompletionPostRequest}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TabCompletionPostRequest} 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( - "TabCompletionPostRequest has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TabCompletionPostRequest} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (predictionConfig != null) declaredFields.put("predictionConfig", predictionConfig); - if (indexColumn != null) declaredFields.put("indexColumn", indexColumn); - if (rows != null) declaredFields.put("rows", rows); - if (columns != null) declaredFields.put("columns", columns); - if (dataSchema != null) declaredFields.put("dataSchema", dataSchema); - if (parseDataTypes != null) declaredFields.put("parseDataTypes", parseDataTypes); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TabCompletionPostRequest} 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 TabCompletionPostRequest tabCompletionPostRequest = (TabCompletionPostRequest) o; - return Objects.equals(this.cloudSdkCustomFields, tabCompletionPostRequest.cloudSdkCustomFields) - && Objects.equals(this.predictionConfig, tabCompletionPostRequest.predictionConfig) - && Objects.equals(this.indexColumn, tabCompletionPostRequest.indexColumn) - && Objects.equals(this.rows, tabCompletionPostRequest.rows) - && Objects.equals(this.columns, tabCompletionPostRequest.columns) - && Objects.equals(this.dataSchema, tabCompletionPostRequest.dataSchema) - && Objects.equals(this.parseDataTypes, tabCompletionPostRequest.parseDataTypes); - } - - @Override - public int hashCode() { - return Objects.hash( - predictionConfig, - indexColumn, - rows, - columns, - dataSchema, - parseDataTypes, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class TabCompletionPostRequest {\n"); - sb.append(" predictionConfig: ").append(toIndentedString(predictionConfig)).append("\n"); - sb.append(" indexColumn: ").append(toIndentedString(indexColumn)).append("\n"); - sb.append(" rows: ").append(toIndentedString(rows)).append("\n"); - sb.append(" columns: ").append(toIndentedString(columns)).append("\n"); - sb.append(" dataSchema: ").append(toIndentedString(dataSchema)).append("\n"); - sb.append(" parseDataTypes: ").append(toIndentedString(parseDataTypes)).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 TabCompletionPostRequest} instance. No arguments are required. */ - public static TabCompletionPostRequest create() { - return new TabCompletionPostRequest(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java deleted file mode 100644 index a6b527ef0..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionPostResponse.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** Successful tabular prediction response. */ -// CHECKSTYLE:OFF -public class TabCompletionPostResponse -// CHECKSTYLE:ON -{ - @JsonProperty("id") - private String id; - - @JsonProperty("status") - private TabCompletionStatus status; - - @JsonProperty("predictions") - private List> predictions = new ArrayList<>(); - - @JsonProperty("metadata") - private TabCompletionMetadata metadata; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the id of this {@link TabCompletionPostResponse} instance and return the same instance. - * - * @param id The generated UUID4 for this request (useful for logging). - * @return The same instance of this {@link TabCompletionPostResponse} class - */ - @Nonnull - public TabCompletionPostResponse id(@Nullable final String id) { - this.id = id; - return this; - } - - /** - * The generated UUID4 for this request (useful for logging). - * - * @return id The id of this {@link TabCompletionPostResponse} instance. - */ - @Nonnull - public String getId() { - return id; - } - - /** - * Set the id of this {@link TabCompletionPostResponse} instance. - * - * @param id The generated UUID4 for this request (useful for logging). - */ - public void setId(@Nullable final String id) { - this.id = id; - } - - /** - * Set the status of this {@link TabCompletionPostResponse} instance and return the same instance. - * - * @param status The status of this {@link TabCompletionPostResponse} - * @return The same instance of this {@link TabCompletionPostResponse} class - */ - @Nonnull - public TabCompletionPostResponse status(@Nullable final TabCompletionStatus status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status The status of this {@link TabCompletionPostResponse} instance. - */ - @Nonnull - public TabCompletionStatus getStatus() { - return status; - } - - /** - * Set the status of this {@link TabCompletionPostResponse} instance. - * - * @param status The status of this {@link TabCompletionPostResponse} - */ - public void setStatus(@Nullable final TabCompletionStatus status) { - this.status = status; - } - - /** - * Set the predictions of this {@link TabCompletionPostResponse} instance and return the same - * instance. - * - * @param predictions Array of prediction results sequence-aligned with the order of the query - * rows in the request. - * @return The same instance of this {@link TabCompletionPostResponse} class - */ - @Nonnull - public TabCompletionPostResponse predictions( - @Nullable final List> predictions) { - this.predictions = predictions; - return this; - } - - /** - * Add one predictions instance to this {@link TabCompletionPostResponse}. - * - * @param predictionsItem The predictions that should be added - * @return The same instance of type {@link TabCompletionPostResponse} - */ - @Nonnull - public TabCompletionPostResponse addPredictionsItem( - @Nonnull final Map predictionsItem) { - if (this.predictions == null) { - this.predictions = new ArrayList<>(); - } - this.predictions.add(predictionsItem); - return this; - } - - /** - * Array of prediction results sequence-aligned with the order of the query rows in the request. - * - * @return predictions The predictions of this {@link TabCompletionPostResponse} instance. - */ - @Nonnull - public List> getPredictions() { - return predictions; - } - - /** - * Set the predictions of this {@link TabCompletionPostResponse} instance. - * - * @param predictions Array of prediction results sequence-aligned with the order of the query - * rows in the request. - */ - public void setPredictions( - @Nullable final List> predictions) { - this.predictions = predictions; - } - - /** - * Set the metadata of this {@link TabCompletionPostResponse} instance and return the same - * instance. - * - * @param metadata The metadata of this {@link TabCompletionPostResponse} - * @return The same instance of this {@link TabCompletionPostResponse} class - */ - @Nonnull - public TabCompletionPostResponse metadata(@Nullable final TabCompletionMetadata metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * - * @return metadata The metadata of this {@link TabCompletionPostResponse} instance. - */ - @Nonnull - public TabCompletionMetadata getMetadata() { - return metadata; - } - - /** - * Set the metadata of this {@link TabCompletionPostResponse} instance. - * - * @param metadata The metadata of this {@link TabCompletionPostResponse} - */ - public void setMetadata(@Nullable final TabCompletionMetadata metadata) { - this.metadata = metadata; - } - - /** - * Get the names of the unrecognizable properties of the {@link TabCompletionPostResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TabCompletionPostResponse} 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( - "TabCompletionPostResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TabCompletionPostResponse} 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 (status != null) declaredFields.put("status", status); - if (predictions != null) declaredFields.put("predictions", predictions); - if (metadata != null) declaredFields.put("metadata", metadata); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TabCompletionPostResponse} 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 TabCompletionPostResponse tabCompletionPostResponse = (TabCompletionPostResponse) o; - return Objects.equals(this.cloudSdkCustomFields, tabCompletionPostResponse.cloudSdkCustomFields) - && Objects.equals(this.id, tabCompletionPostResponse.id) - && Objects.equals(this.status, tabCompletionPostResponse.status) - && Objects.equals(this.predictions, tabCompletionPostResponse.predictions) - && Objects.equals(this.metadata, tabCompletionPostResponse.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(id, status, predictions, metadata, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class TabCompletionPostResponse {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" predictions: ").append(toIndentedString(predictions)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).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 TabCompletionPostResponse} instance. No arguments are required. */ - public static TabCompletionPostResponse create() { - return new TabCompletionPostResponse(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java deleted file mode 100644 index 7f198caec..000000000 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TabCompletionStatus.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. - * - * - * - * 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.foundationmodels.rpt.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; - -/** TabCompletionStatus object indicating the result of the request. */ -// CHECKSTYLE:OFF -public class TabCompletionStatus -// CHECKSTYLE:ON -{ - /** The numeric status code. */ - public enum CodeEnum { - /** The NUMBER_0 option of this TabCompletionStatus */ - NUMBER_0(0), - - /** The NUMBER_1 option of this TabCompletionStatus */ - NUMBER_1(1), - - /** The NUMBER_2 option of this TabCompletionStatus */ - NUMBER_2(2), - - /** The NUMBER_3 option of this TabCompletionStatus */ - NUMBER_3(3), - - /** The NUMBER_unknown_default_open_api option of this TabCompletionStatus */ - NUMBER_unknown_default_open_api(11184809); - - private Integer value; - - CodeEnum(Integer value) { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public Integer 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 TabCompletionStatus - */ - @JsonCreator - @Nonnull - public static CodeEnum fromValue(@Nonnull final Integer value) { - for (CodeEnum b : CodeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return NUMBER_unknown_default_open_api; - } - } - - @JsonProperty("code") - private CodeEnum code; - - @JsonProperty("message") - private String message; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Set the code of this {@link TabCompletionStatus} instance and return the same instance. - * - * @param code The numeric status code. - * @return The same instance of this {@link TabCompletionStatus} class - */ - @Nonnull - public TabCompletionStatus code(@Nullable final CodeEnum code) { - this.code = code; - return this; - } - - /** - * The numeric status code. - * - * @return code The code of this {@link TabCompletionStatus} instance. - */ - @Nonnull - public CodeEnum getCode() { - return code; - } - - /** - * Set the code of this {@link TabCompletionStatus} instance. - * - * @param code The numeric status code. - */ - public void setCode(@Nullable final CodeEnum code) { - this.code = code; - } - - /** - * Set the message of this {@link TabCompletionStatus} instance and return the same instance. - * - * @param message The status message text. - * @return The same instance of this {@link TabCompletionStatus} class - */ - @Nonnull - public TabCompletionStatus message(@Nullable final String message) { - this.message = message; - return this; - } - - /** - * The status message text. - * - * @return message The message of this {@link TabCompletionStatus} instance. - */ - @Nonnull - public String getMessage() { - return message; - } - - /** - * Set the message of this {@link TabCompletionStatus} instance. - * - * @param message The status message text. - */ - public void setMessage(@Nullable final String message) { - this.message = message; - } - - /** - * Get the names of the unrecognizable properties of the {@link TabCompletionStatus}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TabCompletionStatus} 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( - "TabCompletionStatus has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TabCompletionStatus} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (code != null) declaredFields.put("code", code); - if (message != null) declaredFields.put("message", message); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TabCompletionStatus} 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 TabCompletionStatus tabCompletionStatus = (TabCompletionStatus) o; - return Objects.equals(this.cloudSdkCustomFields, tabCompletionStatus.cloudSdkCustomFields) - && Objects.equals(this.code, tabCompletionStatus.code) - && Objects.equals(this.message, tabCompletionStatus.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class TabCompletionStatus {\n"); - sb.append(" code: ").append(toIndentedString(code)).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 TabCompletionStatus} instance. No arguments are required. */ - public static TabCompletionStatus create() { - return new TabCompletionStatus(); - } -} diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumnConfig.java similarity index 55% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumnConfig.java index 1bee31586..ec0324c3f 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumn.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/TargetColumnConfig.java @@ -1,6 +1,6 @@ /* - * SAP RPT API - * SAP RPT API for predictive insights using in-context learning on structured business data. + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. * * * @@ -25,26 +25,26 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Configuration for a target column to predict. */ +/** Configuration for a target column in the prediction model. */ // CHECKSTYLE:OFF -public class TargetColumn +public class TargetColumnConfig // CHECKSTYLE:ON { @JsonProperty("name") private String name; @JsonProperty("prediction_placeholder") - private String predictionPlaceholder; + private PredictionPlaceholder predictionPlaceholder; - /** (Optional) Type of prediction task. If omitted, model attempts to infer task type. */ + /** Gets or Sets taskType */ public enum TaskTypeEnum { - /** The CLASSIFICATION option of this TargetColumn */ + /** The CLASSIFICATION option of this TargetColumnConfig */ CLASSIFICATION("classification"), - /** The REGRESSION option of this TargetColumn */ + /** The REGRESSION option of this TargetColumnConfig */ REGRESSION("regression"), - /** The UNKNOWN_DEFAULT_OPEN_API option of this TargetColumn */ + /** The UNKNOWN_DEFAULT_OPEN_API option of this TargetColumnConfig */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; @@ -79,42 +79,45 @@ public String toString() { * Get the enum value from a String value * * @param value The String value - * @return The enum value of type TargetColumn + * @return The enum value of type TargetColumnConfig */ @JsonCreator - @Nonnull + @Nullable public static TaskTypeEnum fromValue(@Nonnull final String value) { for (TaskTypeEnum b : TaskTypeEnum.values()) { if (b.value.equals(value)) { return b; } } - return UNKNOWN_DEFAULT_OPEN_API; + return null; } } @JsonProperty("task_type") private TaskTypeEnum taskType; + @JsonProperty("top_k") + private Integer topK; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Set the name of this {@link TargetColumn} instance and return the same instance. + * Set the name of this {@link TargetColumnConfig} instance and return the same instance. * - * @param name Name of the column to predict. - * @return The same instance of this {@link TargetColumn} class + * @param name The name of the target column. + * @return The same instance of this {@link TargetColumnConfig} class */ @Nonnull - public TargetColumn name(@Nullable final String name) { + public TargetColumnConfig name(@Nonnull final String name) { this.name = name; return this; } /** - * Name of the column to predict. + * The name of the target column. * - * @return name The name of this {@link TargetColumn} instance. + * @return name The name of this {@link TargetColumnConfig} instance. */ @Nonnull public String getName() { @@ -122,81 +125,112 @@ public String getName() { } /** - * Set the name of this {@link TargetColumn} instance. + * Set the name of this {@link TargetColumnConfig} instance. * - * @param name Name of the column to predict. + * @param name The name of the target column. */ - public void setName(@Nullable final String name) { + public void setName(@Nonnull final String name) { this.name = name; } /** - * Set the predictionPlaceholder of this {@link TargetColumn} instance and return the same + * Set the predictionPlaceholder of this {@link TargetColumnConfig} instance and return the same * instance. * - * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. - * @return The same instance of this {@link TargetColumn} class + * @param predictionPlaceholder The predictionPlaceholder of this {@link TargetColumnConfig} + * @return The same instance of this {@link TargetColumnConfig} class */ @Nonnull - public TargetColumn predictionPlaceholder(@Nonnull final String predictionPlaceholder) { + public TargetColumnConfig predictionPlaceholder( + @Nonnull final PredictionPlaceholder predictionPlaceholder) { this.predictionPlaceholder = predictionPlaceholder; return this; } /** - * Value used as placeholder in cells where prediction is needed. + * Get predictionPlaceholder * - * @return predictionPlaceholder The predictionPlaceholder of this {@link TargetColumn} instance. + * @return predictionPlaceholder The predictionPlaceholder of this {@link TargetColumnConfig} + * instance. */ @Nonnull - public String getPredictionPlaceholder() { + public PredictionPlaceholder getPredictionPlaceholder() { return predictionPlaceholder; } /** - * Set the predictionPlaceholder of this {@link TargetColumn} instance. + * Set the predictionPlaceholder of this {@link TargetColumnConfig} instance. * - * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. + * @param predictionPlaceholder The predictionPlaceholder of this {@link TargetColumnConfig} */ - public void setPredictionPlaceholder(@Nonnull final String predictionPlaceholder) { + public void setPredictionPlaceholder(@Nonnull final PredictionPlaceholder predictionPlaceholder) { this.predictionPlaceholder = predictionPlaceholder; } /** - * Set the taskType of this {@link TargetColumn} instance and return the same instance. + * Set the taskType of this {@link TargetColumnConfig} instance and return the same instance. * - * @param taskType (Optional) Type of prediction task. If omitted, model attempts to infer task - * type. - * @return The same instance of this {@link TargetColumn} class + * @param taskType The taskType of this {@link TargetColumnConfig} + * @return The same instance of this {@link TargetColumnConfig} class */ @Nonnull - public TargetColumn taskType(@Nullable final TaskTypeEnum taskType) { + public TargetColumnConfig taskType(@Nullable final TaskTypeEnum taskType) { this.taskType = taskType; return this; } /** - * (Optional) Type of prediction task. If omitted, model attempts to infer task type. + * Get taskType * - * @return taskType The taskType of this {@link TargetColumn} instance. + * @return taskType The taskType of this {@link TargetColumnConfig} instance. */ - @Nonnull + @Nullable public TaskTypeEnum getTaskType() { return taskType; } /** - * Set the taskType of this {@link TargetColumn} instance. + * Set the taskType of this {@link TargetColumnConfig} instance. * - * @param taskType (Optional) Type of prediction task. If omitted, model attempts to infer task - * type. + * @param taskType The taskType of this {@link TargetColumnConfig} */ public void setTaskType(@Nullable final TaskTypeEnum taskType) { this.taskType = taskType; } /** - * Get the names of the unrecognizable properties of the {@link TargetColumn}. + * Set the topK of this {@link TargetColumnConfig} instance and return the same instance. + * + * @param topK The topK of this {@link TargetColumnConfig} + * @return The same instance of this {@link TargetColumnConfig} class + */ + @Nonnull + public TargetColumnConfig topK(@Nullable final Integer topK) { + this.topK = topK; + return this; + } + + /** + * Get topK + * + * @return topK The topK of this {@link TargetColumnConfig} instance. + */ + @Nullable + public Integer getTopK() { + return topK; + } + + /** + * Set the topK of this {@link TargetColumnConfig} instance. + * + * @param topK The topK of this {@link TargetColumnConfig} + */ + public void setTopK(@Nullable final Integer topK) { + this.topK = topK; + } + + /** + * Get the names of the unrecognizable properties of the {@link TargetColumnConfig}. * * @return The set of properties names */ @@ -207,7 +241,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link TargetColumn} instance. + * Get the value of an unrecognizable property of this {@link TargetColumnConfig} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -218,14 +252,14 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("TargetColumn has no field with name '" + name + "'."); + throw new NoSuchElementException("TargetColumnConfig has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link TargetColumn} instance including unrecognized - * properties. + * Get the value of all properties of this {@link TargetColumnConfig} instance including + * unrecognized properties. * * @return The map of all properties */ @@ -237,12 +271,13 @@ public Map toMap() { if (predictionPlaceholder != null) declaredFields.put("predictionPlaceholder", predictionPlaceholder); if (taskType != null) declaredFields.put("taskType", taskType); + if (topK != null) declaredFields.put("topK", topK); return declaredFields; } /** - * Set an unrecognizable property of this {@link TargetColumn} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link TargetColumnConfig} 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 @@ -260,28 +295,30 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final TargetColumn targetColumn = (TargetColumn) o; - return Objects.equals(this.cloudSdkCustomFields, targetColumn.cloudSdkCustomFields) - && Objects.equals(this.name, targetColumn.name) - && Objects.equals(this.predictionPlaceholder, targetColumn.predictionPlaceholder) - && Objects.equals(this.taskType, targetColumn.taskType); + final TargetColumnConfig targetColumnConfig = (TargetColumnConfig) o; + return Objects.equals(this.cloudSdkCustomFields, targetColumnConfig.cloudSdkCustomFields) + && Objects.equals(this.name, targetColumnConfig.name) + && Objects.equals(this.predictionPlaceholder, targetColumnConfig.predictionPlaceholder) + && Objects.equals(this.taskType, targetColumnConfig.taskType) + && Objects.equals(this.topK, targetColumnConfig.topK); } @Override public int hashCode() { - return Objects.hash(name, predictionPlaceholder, taskType, cloudSdkCustomFields); + return Objects.hash(name, predictionPlaceholder, taskType, topK, cloudSdkCustomFields); } @Override @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class TargetColumn {\n"); + sb.append("class TargetColumnConfig {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" predictionPlaceholder: ") .append(toIndentedString(predictionPlaceholder)) .append("\n"); sb.append(" taskType: ").append(toIndentedString(taskType)).append("\n"); + sb.append(" topK: ").append(toIndentedString(topK)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -300,22 +337,35 @@ private String toIndentedString(final java.lang.Object o) { } /** - * Create a type-safe, fluent-api builder object to construct a new {@link TargetColumn} instance - * with all required arguments. + * Create a type-safe, fluent-api builder object to construct a new {@link TargetColumnConfig} + * instance with all required arguments. */ public static Builder create() { - return (predictionPlaceholder) -> - new TargetColumn().predictionPlaceholder(predictionPlaceholder); + return (name) -> + (predictionPlaceholder) -> + new TargetColumnConfig().name(name).predictionPlaceholder(predictionPlaceholder); } /** Builder helper class. */ public interface Builder { /** - * Set the predictionPlaceholder of this {@link TargetColumn} instance. + * Set the name of this {@link TargetColumnConfig} instance. + * + * @param name The name of the target column. + * @return The TargetColumnConfig builder. + */ + Builder1 name(@Nonnull final String name); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the predictionPlaceholder of this {@link TargetColumnConfig} instance. * - * @param predictionPlaceholder Value used as placeholder in cells where prediction is needed. - * @return The TargetColumn instance. + * @param predictionPlaceholder The predictionPlaceholder of this {@link TargetColumnConfig} + * @return The TargetColumnConfig instance. */ - TargetColumn predictionPlaceholder(@Nonnull final String predictionPlaceholder); + TargetColumnConfig predictionPlaceholder( + @Nonnull final PredictionPlaceholder predictionPlaceholder); } } diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt-1_openapi.json b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt-1_openapi.json new file mode 100644 index 000000000..40a9e2846 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt-1_openapi.json @@ -0,0 +1,848 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "SAP-RPT-1 Tabular AI", + "description": "A REST API for in-context learning with the SAP-RPT-1 model.", + "version": "0.1.0", + "x-logo": { + "url": "https://www.sap.com/favicon.ico" + } + }, + "servers": [ + { + "url": "/v1" + } + ], + "paths": { + "/predict": { + "post": { + "summary": "Make in-context predictions for specified target columns based on provided table data JSON (optionally gzip-compressed).", + "description": "Make in-context predictions for specified target columns.\nEither \"rows\" or \"columns\" must be provided and must contain both context and query rows.\nYou can optionally send gzip-compressed JSON payloads and set a \"Content-Encoding: gzip\" header.", + "operationId": "predict", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PredictRequestPayload" + }, + "examples": { + "classification_example": { + "summary": "Classification Example", + "description": "Predict product category using in-context learning", + "value": { + "index_column": "id", + "prediction_config": { + "target_columns": [ + { + "name": "category", + "prediction_placeholder": "?", + "task_type": "classification" + } + ] + }, + "columns": { + "id": [ + 1, + 2, + 3, + 4 + ], + "product": [ + "Laptop", + "Mouse", + "Keyboard", + "Monitor" + ], + "price": [ + 899, + 25, + 75, + 350 + ], + "category": [ + "Electronics", + "Accessories", + "Accessories", + "?" + ], + "stock": [ + "150", + "500", + "320", + "200" + ] + }, + "data_schema": { + "id": { + "dtype": "numeric" + }, + "product": { + "dtype": "string" + }, + "price": { + "dtype": "numeric" + }, + "category": { + "dtype": "string" + }, + "stock": { + "dtype": "numeric" + } + } + } + }, + "regression_example": { + "summary": "Regression Example", + "description": "Predict multiple columns including regression using in-context learning", + "value": { + "index_column": "ID", + "prediction_config": { + "target_columns": [ + { + "name": "PRICE", + "prediction_placeholder": "[?]", + "task_type": "regression" + }, + { + "name": "COSTCENTER", + "prediction_placeholder": "[PREDICT]", + "task_type": "classification" + } + ] + }, + "columns": { + "PRODUCT": [ + "Couch", + "Office Chair", + "Server Rack", + "Server Rack" + ], + "PRICE": [ + "[?]", + 150.8, + "210.0", + "[?]" + ], + "ORDERDATE": [ + "2025-11-28", + "2025-11-02", + "2025-11-01", + "2025-11-01" + ], + "ID": [ + "35", + "44", + "108", + "104" + ], + "COSTCENTER": [ + "[PREDICT]", + "Office Furniture", + "Data Infrastructure", + "[PREDICT]" + ] + }, + "data_schema": { + "PRODUCT": { + "dtype": "string" + }, + "PRICE": { + "dtype": "numeric" + }, + "ORDERDATE": { + "dtype": "date" + }, + "ID": { + "dtype": "string" + }, + "COSTCENTER": { + "dtype": "string" + } + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Prediction", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PredictResponsePayload" + }, + "example": { + "id": "781bf15e-602a-4503-a8ff-dc32b20f804a", + "status": { + "code": 0, + "message": "ok" + }, + "predictions": [ + { + "COSTCENTER": [ + { + "prediction": "Office Furniture", + "confidence": 0.52 + } + ], + "PRICE": [ + { + "prediction": 195.090179443359 + } + ], + "ID": "35" + }, + { + "COSTCENTER": [ + { + "prediction": "Data Infrastructure", + "confidence": 1 + } + ], + "PRICE": [ + { + "prediction": 209.380523681641 + } + ], + "ID": "104" + } + ], + "metadata": { + "num_columns": 5, + "num_rows": 2, + "num_predictions": 4, + "num_query_rows": 2 + } + } + } + } + }, + "400": { + "description": "Bad Request - Invalid input data", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [ + "body", + "prediction_config" + ], + "msg": "Field required", + "type": "missing" + } + ] + } + } + } + }, + "413": { + "description": "Payload Too Large", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [], + "msg": "Request body too large (\u003E10485760 bytes)", + "type": "value_error" + } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [ + "body", + "prediction_config" + ], + "msg": "Field required", + "type": "value_error" + } + ] + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 3, + "message": "Internal server error" + }, + "detail": [] + } + } + } + } + } + } + }, + "/predict_parquet": { + "post": { + "summary": "Make in-context predictions for specified target columns based on provided table data Parquet file.", + "description": "Make in-context predictions for specified target columns based on provided table data Parquet file.", + "operationId": "predict_parquet", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_predict_parquet" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Prediction", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PredictResponsePayload" + }, + "example": { + "id": "781bf15e-602a-4503-a8ff-dc32b20f804a", + "status": { + "code": 0, + "message": "ok" + }, + "predictions": [ + { + "COSTCENTER": [ + { + "prediction": "Office Furniture", + "confidence": 0.52 + } + ], + "PRICE": [ + { + "prediction": 195.090179443359 + } + ], + "ID": "35" + }, + { + "COSTCENTER": [ + { + "prediction": "Data Infrastructure", + "confidence": 1 + } + ], + "PRICE": [ + { + "prediction": 209.380523681641 + } + ], + "ID": "104" + } + ], + "metadata": { + "num_columns": 5, + "num_rows": 2, + "num_predictions": 4, + "num_query_rows": 2 + } + } + } + } + }, + "400": { + "description": "Bad Request - Invalid input data", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [ + "body", + "prediction_config" + ], + "msg": "Field required", + "type": "missing" + } + ] + } + } + } + }, + "413": { + "description": "Payload Too Large", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [], + "msg": "Request body too large (\u003E10485760 bytes)", + "type": "value_error" + } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 2, + "message": "Invalid input" + }, + "detail": [ + { + "loc": [ + "body", + "prediction_config" + ], + "msg": "Field required", + "type": "value_error" + } + ] + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "status": { + "code": 3, + "message": "Internal server error" + }, + "detail": [] + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Body_predict_parquet": { + "properties": { + "file": { + "type": "string", + "format": "binary", + "title": "File", + "description": "Parquet file containing the data" + }, + "prediction_config": { + "type": "string", + "title": "Prediction Config", + "description": "JSON string for prediction_config" + }, + "index_column": { + "type": "string", + "title": "Index Column", + "description": "Optional index column name" + }, + "parse_data_types": { + "type": "boolean", + "title": "Parse Data Types", + "description": "Whether to parse data types", + "default": true + } + }, + "type": "object", + "required": [ + "file", + "prediction_config" + ], + "title": "Body_predict_parquet" + }, + "PredictResponseMetadata": { + "properties": { + "num_columns": { + "type": "integer", + "title": "Num Columns", + "description": "Number of columns in the input data." + }, + "num_rows": { + "type": "integer", + "title": "Num Rows", + "description": "Number of rows in the input data." + }, + "num_predictions": { + "type": "integer", + "title": "Num Predictions", + "description": "Number of table cells containing the specified placeholder value." + }, + "num_query_rows": { + "type": "integer", + "title": "Num Query Rows", + "description": "Number of rows for which a prediction was made." + } + }, + "type": "object", + "required": [ + "num_columns", + "num_rows", + "num_predictions", + "num_query_rows" + ], + "title": "PredictResponseMetadata", + "description": "Metadata about the prediction request." + }, + "PredictResponsePayload": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "Unique ID for the request." + }, + "status": { + "$ref": "#/components/schemas/PredictResponseStatus", + "description": "Status message that can indicate warnings (e.g. about suboptimal data)." + }, + "predictions": { + "items": { + "additionalProperties": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/PredictionResult" + }, + "type": "array" + }, + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "object" + }, + "type": "array", + "title": "Predictions", + "description": "Mapping of column names to their list of prediction results or index column." + }, + "metadata": { + "$ref": "#/components/schemas/PredictResponseMetadata" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id", + "status", + "predictions", + "metadata" + ], + "title": "PredictResponsePayload", + "description": "Response payload for prediction requests.\nContains a list of prediction results." + }, + "PredictResponseStatus": { + "properties": { + "code": { + "type": "integer", + "title": "Code", + "description": "Status code (zero means success, other status codes indicate warnings)" + }, + "message": { + "type": "string", + "title": "Message", + "description": "Status message, either \"ok\" or contains a warning / more information." + } + }, + "type": "object", + "required": [ + "code", + "message" + ], + "title": "PredictResponseStatus", + "description": "Output status for prediction requests." + }, + "PredictionResult": { + "properties": { + "prediction": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "title": "Prediction", + "description": "The predicted value for the column." + }, + "confidence": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Confidence", + "description": "The confidence of the prediction (currently not provided)." + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "prediction" + ], + "title": "PredictionResult", + "description": "A single prediction result for a single column in a single row." + }, + "ColumnType": { + "enum": [ + "string", + "numeric", + "date" + ], + "title": "ColumnType", + "type": "string" + }, + "PredictionConfig": { + "additionalProperties": false, + "description": "Configuration of the prediction model.", + "properties": { + "target_columns": { + "items": { + "$ref": "#/components/schemas/TargetColumnConfig" + }, + "title": "Target Columns", + "type": "array" + } + }, + "required": [ + "target_columns" + ], + "title": "PredictionConfig", + "type": "object" + }, + "SchemaFieldConfig": { + "description": "Configuration for a single field in the input data schema.", + "properties": { + "dtype": { + "$ref": "#/components/schemas/ColumnType", + "description": "The data type of the target column. Supported types are ['string', 'numeric', 'date']." + } + }, + "required": [ + "dtype" + ], + "title": "SchemaFieldConfig", + "type": "object" + }, + "TargetColumnConfig": { + "description": "Configuration for a target column in the prediction model.", + "properties": { + "name": { + "description": "The name of the target column.", + "title": "Name", + "type": "string" + }, + "prediction_placeholder": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "description": "The placeholder value in any column for which to predict a value. The model will predict a value for all table cells containing this value.", + "title": "Prediction Placeholder" + }, + "task_type": { + "anyOf": [ + { + "enum": [ + "classification", + "regression" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The type of prediction task for this column. If not provided, the model will infer the task type from the data.", + "title": "Task Type" + }, + "top_k": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "How many predictions to output per classification column.If not provided, only a single prediction is returned. Only relevant for classification.", + "title": "Top K" + } + }, + "required": [ + "name", + "prediction_placeholder" + ], + "title": "TargetColumnConfig", + "type": "object" + }, + "PredictRequestPayload": { + "additionalProperties": false, + "description": "Users need to specify a list of rows, which contains both the context rows\nand the rows for which to predict a label, and a mapping of column names\nto placeholder values. The model will predict the value for any column\nspecified in `predict_columns` for all rows that have the placeholder\nvalue in that column.", + "properties": { + "prediction_config": { + "$ref": "#/components/schemas/PredictionConfig", + "description": "Configuration of target columns and placeholder value." + }, + "rows": { + "default": null, + "description": "Table rows, i.e. list of objects where each object is a mapping of column names to values. Either \"rows\" or \"columns\" must be provided.", + "items": { + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "type": "object" + }, + "title": "Rows", + "type": "array" + }, + "columns": { + "anyOf": [ + { + "additionalProperties": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "type": "array" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Alternative to rows: columns of data where each key is a column name and the value is a list of all column values. Either \"rows\" or \"columns\" must be provided.", + "title": "Columns" + }, + "index_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The name of the index column. If provided, the service will return this column's value in each prediction object to facilitate aligning the output predictions with the input rows on the client side. If not provided, the column will not be included in the output.", + "title": "Index Column" + }, + "parse_data_types": { + "default": true, + "description": "Whether to parse the data types of the columns. If set to True, numeric columns will be parsed to float or integer and dates in ISO format YYYY-MM-DD will be parsed.", + "title": "Parse Data Types", + "type": "boolean" + }, + "data_schema": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/components/schemas/SchemaFieldConfig" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional schema defining the data types of each column. If provided, this will override automatic data type parsing.", + "title": "Data Schema" + } + }, + "required": [ + "prediction_config" + ], + "title": "PredictRequestPayload", + "type": "object" + } + } + } +} \ No newline at end of file diff --git a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml b/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml deleted file mode 100644 index 0565c326f..000000000 --- a/foundation-models/sap-rpt/src/main/resources/spec/sap-rpt.yaml +++ /dev/null @@ -1,260 +0,0 @@ -# Unofficial OpenAPI specification for SAP RPT API. -openapi: 3.0.0 - -info: - title: SAP RPT API - description: SAP RPT API for predictive insights using in-context learning on structured business data. - version: 0.0.1-SNAPSHOT - -paths: - /predict: - post: - tags: - - Predict - summary: Predict targets using SAP RPT model with structured data. - operationId: Completions_Create - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TabCompletionPostRequest' - responses: - '200': - description: Successful response with predictive insights. - content: - application/json: - schema: - $ref: '#/components/schemas/TabCompletionPostResponse' - '400': - description: Bad Request - Invalid input. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '422': - description: Unprocessable Content - Invalid input. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '500': - description: Internal Server Error. - content: - application/json: - schema: - $ref: '#/components/schemas/InternalServerErrorResponse' - -components: - schemas: - TabCompletionPostRequest: - type: object - description: Request for tabular prediction. Must provide data as either rows or columns (mutually exclusive). - properties: - prediction_config: - $ref: '#/components/schemas/PredictionConfig' - index_column: - type: string - description: Optional column name used to identify rows. Not used as input feature, but returned in response. - example: "ID" - rows: - type: array - description: Table data organized by rows (mutually exclusive with columns). - items: - type: object - additionalProperties: true - example: - - PRODUCT: "Couch" - PRICE: 999.99 - ORDERDATE: "28-11-2025" - ID: "35" - COSTCENTER: "[PREDICT]" - columns: - type: object - description: Table data organized by columns (mutually exclusive with rows). - additionalProperties: - type: array - items: { } - example: - PRODUCT: [ "Couch", "Office Chair", "Server Rack" ] - PRICE: [ 999.99, 150.8, 2200.00 ] - ORDERDATE: [ "28-11-2025", "02-11-2025", "01-11-2025" ] - ID: [ "35", "44", "104" ] - COSTCENTER: [ "[PREDICT]", "Office Furniture", "Data Infrastructure" ] - data_schema: - $ref: '#/components/schemas/DataSchema' - parse_data_types: - type: boolean - description: Whether to parse data types when data_schema is not provided eg. interpret date, numeric - default: true - oneOf: - - required: [ prediction_config, rows ] - - required: [ prediction_config, columns ] - PredictionConfig: - type: object - description: Configuration specifying which columns to predict. - properties: - target_columns: - type: array - description: Array of target column configurations for prediction. - minItems: 1 - items: - $ref: '#/components/schemas/TargetColumn' - TargetColumn: - type: object - description: Configuration for a target column to predict. - required: - - prediction_placeholder - properties: - name: - type: string - description: Name of the column to predict. - example: "COSTCENTER" - prediction_placeholder: - type: string - description: Value used as placeholder in cells where prediction is needed. - example: "[PREDICT]" - task_type: - type: string - enum: [ classification, regression ] - description: (Optional) Type of prediction task. If omitted, model attempts to infer task type. - DataSchema: - type: object - description: (Optional) Schema definition for column data types. If omitted and parse_data_types is true, data types will be inferred. - additionalProperties: - $ref: '#/components/schemas/ColumnDataType' - example: - PRODUCT: - dtype: "string" - PRICE: - dtype: "numeric" - ORDERDATE: - dtype: "date" - ColumnDataType: - type: object - description: Data type specification for a column. - properties: - dtype: - type: string - enum: [ string, numeric, date ] - description: Data type for the column. - example: "string" - - TabCompletionPostResponse: - type: object - description: Successful tabular prediction response. - properties: - id: - type: string - description: The generated UUID4 for this request (useful for logging). - example: "c334f854-0d70-4c79-bd73-9ac581fd8cda" - status: - $ref: '#/components/schemas/TabCompletionStatus' - predictions: - type: array - description: Array of prediction results sequence-aligned with the order of the query rows in the request. - items: - $ref: '#/components/schemas/PredictionResults' - metadata: - $ref: '#/components/schemas/TabCompletionMetadata' - PredictionResults: - type: object - description: PredictionResults for a query row that may contain target column predictions and optional index column. - additionalProperties: - oneOf: - - type: string - description: Index column value (when index_column parameter is specified). - - type: array - description: Array of predictions for a target column. - items: - $ref: '#/components/schemas/PredictionItem' - PredictionItem: - type: object - description: Individual prediction result for a cell. - properties: - prediction: - oneOf: - - type: string - description: Predicted value for classification tasks. - - type: number - format: float - description: Predicted value for regression tasks. - confidence: - type: number - format: float - nullable: true - description: The confidence score for this prediction (for classification tasks only). - TabCompletionMetadata: - type: object - description: TabCompletionMetadata about the prediction request. - properties: - num_rows: - type: integer - description: The total number of input rows. - num_columns: - type: integer - description: The total number of input columns. - num_predictions: - type: integer - description: The number of table cells containing the specified placeholder values summed over all target columns. - num_query_rows: - type: integer - description: The number of query rows for which a prediction was made. - - ErrorResponse: - type: object - description: Error response with status and validation details. - properties: - status: - allOf: - - $ref: '#/components/schemas/TabCompletionStatus' - - properties: - code: - enum: [ 2 ] - example: 2 - message: - example: "Invalid input" - detail: - type: array - description: Array of validation errors in pydantic format. - items: - $ref: '#/components/schemas/ErrorDetail' - InternalServerErrorResponse: - type: object - description: Internal server error response. - properties: - status: - type: integer - enum: [ 3 ] - example: 3 - message: - type: string - example: "Internal server error" - ErrorDetail: - type: object - description: Validation error detail in pydantic format. - properties: - loc: - type: array - description: Location of the error in the request structure. - items: - oneOf: - - type: string - - type: integer - msg: - type: string - description: Error message. - type: - type: string - description: Error type. - TabCompletionStatus: - type: object - description: TabCompletionStatus object indicating the result of the request. - properties: - code: - type: integer - description: The numeric status code. - enum: [ 0, 1, 2, 3 ] - message: - type: string - description: The status message text. \ No newline at end of file diff --git a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java index d25f51c4a..744c5679d 100644 --- a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java +++ b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java @@ -8,6 +8,7 @@ import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Accessor; import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Cache; import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -38,22 +39,22 @@ void testRptModels() { assertThat(modelWithVersion.version()).isEqualTo("v1.0"); } - static TabCompletionPostRequest createBaseRequest() { + static PredictRequestPayload createBaseRequest() { final var dataSchema = Map.of( - "PRODUCT", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "PRICE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.NUMERIC), - "ORDERDATE", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.DATE), - "ID", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING), - "COSTCENTER", ColumnDataType.create().dtype(ColumnDataType.DtypeEnum.STRING)); + "PRODUCT", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "PRICE", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "ORDERDATE", SchemaFieldConfig.create().dtype(ColumnType.DATE), + "ID", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "COSTCENTER", SchemaFieldConfig.create().dtype(ColumnType.STRING)); final var targetColumns = List.of( - TargetColumn.create() - .predictionPlaceholder("[PREDICT]") + TargetColumnConfig.create() .name("COSTCENTER") - .taskType(TargetColumn.TaskTypeEnum.CLASSIFICATION)); + .predictionPlaceholder(PredictionPlaceholder.create("[PREDICT]")) + .taskType(TargetColumnConfig.TaskTypeEnum.CLASSIFICATION)); - return TabCompletionPostRequest.create() + return PredictRequestPayload.create() .predictionConfig(PredictionConfig.create().targetColumns(targetColumns)) .indexColumn("ID") .dataSchema(dataSchema) @@ -63,26 +64,26 @@ static TabCompletionPostRequest createBaseRequest() { @Test void testTabCompletionWithRowsFormat() { - final List> rows = + final List> rows = List.of( Map.of( - "PRODUCT", "Couch", - "PRICE", 999.99, - "ORDERDATE", "28-11-2025", - "ID", "35", - "COSTCENTER", "[PREDICT]"), + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Couch"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("28-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("35"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("[PREDICT]")), Map.of( - "PRODUCT", "Office Chair", - "PRICE", 150.8, - "ORDERDATE", "02-11-2025", - "ID", "44", - "COSTCENTER", "Office Furniture"), + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Office Chair"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("02-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("44"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Office Furniture")), Map.of( - "PRODUCT", "Server Rack", - "PRICE", 2200.00, - "ORDERDATE", "01-11-2025", - "ID", "104", - "COSTCENTER", "Data Infrastructure")); + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Server Rack"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("01-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("104"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); final var request = createBaseRequest().rows(rows); final var response = client.tabCompletion(request); @@ -93,31 +94,52 @@ void testTabCompletionWithRowsFormat() { assertThat(response.getMetadata().getNumQueryRows()).isEqualTo(1); assertThat(response.getMetadata().getNumRows()).isEqualTo(2); - assertThat(response.getStatus().getCode()).isEqualTo(TabCompletionStatus.CodeEnum.NUMBER_0); + assertThat(response.getStatus().getCode()).isEqualTo(0); assertThat(response.getStatus().getMessage()).isEqualTo("ok"); assertThat(response.getPredictions()).hasSize(1); - final Map prediction = response.getPredictions().get(0); + final Map prediction = + response.getPredictions().get(0); assertThat(prediction) - .containsEntry("ID", PredictionResultsValue.create("35")) + .containsEntry("ID", PredictResponsePayloadPredictionsInnerValue.create("35")) .containsEntry( "COSTCENTER", - PredictionResultsValue.createListOfPredictionItems( + PredictResponsePayloadPredictionsInnerValue.createListOfPredictionResults( List.of( - PredictionItem.create() - .prediction(PredictionItemPrediction.create("Office Furniture")) - .confidence(0.97f)))); + PredictionResult.create() + .prediction(Prediction.create("Office Furniture")) + .confidence(BigDecimal.valueOf(0.97))))); } @Test void testTabCompletionWithColumnsFormat() { - final Map> columns = + final Map> columns = Map.of( - "PRODUCT", List.of("Couch", "Office Chair", "Server Rack"), - "PRICE", List.of(999.99, 150.8, 2200.00), - "ORDERDATE", List.of("28-11-2025", "02-11-2025", "01-11-2025"), - "ID", List.of("35", "44", "104"), - "COSTCENTER", List.of("[PREDICT]", "Office Furniture", "Data Infrastructure")); + "PRODUCT", + List.of( + PredictRequestPayloadRowsInnerValue.create("Couch"), + PredictRequestPayloadRowsInnerValue.create("Office Chair"), + PredictRequestPayloadRowsInnerValue.create("Server Rack")), + "PRICE", + List.of( + PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), + PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), + PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00))), + "ORDERDATE", + List.of( + PredictRequestPayloadRowsInnerValue.create("28-11-2025"), + PredictRequestPayloadRowsInnerValue.create("02-11-2025"), + PredictRequestPayloadRowsInnerValue.create("01-11-2025")), + "ID", + List.of( + PredictRequestPayloadRowsInnerValue.create("35"), + PredictRequestPayloadRowsInnerValue.create("44"), + PredictRequestPayloadRowsInnerValue.create("104")), + "COSTCENTER", + List.of( + PredictRequestPayloadRowsInnerValue.create("[PREDICT]"), + PredictRequestPayloadRowsInnerValue.create("Office Furniture"), + PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); final var request = createBaseRequest().columns(columns); final var response = client.tabCompletion(request); @@ -129,19 +151,20 @@ void testTabCompletionWithColumnsFormat() { assertThat(response.getMetadata().getNumQueryRows()).isEqualTo(1); assertThat(response.getMetadata().getNumRows()).isEqualTo(2); - assertThat(response.getStatus().getCode()).isEqualTo(TabCompletionStatus.CodeEnum.NUMBER_0); + assertThat(response.getStatus().getCode()).isEqualTo(0); assertThat(response.getStatus().getMessage()).isEqualTo("ok"); assertThat(response.getPredictions()).hasSize(1); - final Map prediction = response.getPredictions().get(0); + final Map prediction = + response.getPredictions().get(0); assertThat(prediction) - .containsEntry("ID", PredictionResultsValue.create("35")) + .containsEntry("ID", PredictResponsePayloadPredictionsInnerValue.create("35")) .containsEntry( "COSTCENTER", - PredictionResultsValue.createListOfPredictionItems( + PredictResponsePayloadPredictionsInnerValue.createListOfPredictionResults( List.of( - PredictionItem.create() - .prediction(PredictionItemPrediction.create("Office Furniture")) - .confidence(0.97f)))); + PredictionResult.create() + .prediction(Prediction.create("Office Furniture")) + .confidence(BigDecimal.valueOf(0.97))))); } } diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json index 67e55019e..4ada79f18 100644 --- a/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json @@ -10,32 +10,32 @@ { "name": "COSTCENTER", "prediction_placeholder": "[PREDICT]", - "task_type": "classification" + "task_type": "classification", + "top_k": null } ] }, - "index_column": "ID", "rows": [], "columns": { - "COSTCENTER": [ - "[PREDICT]", - "Office Furniture", - "Data Infrastructure" - ], - "PRODUCT": [ - "Couch", - "Office Chair", - "Server Rack" + "PRICE": [ + 999.99, + 150.8, + 2200.0 ], "ID": [ "35", "44", "104" ], - "PRICE": [ - 999.99, - 150.8, - 2200.0 + "PRODUCT": [ + "Couch", + "Office Chair", + "Server Rack" + ], + "COSTCENTER": [ + "[PREDICT]", + "Office Furniture", + "Data Infrastructure" ], "ORDERDATE": [ "28-11-2025", @@ -43,24 +43,25 @@ "01-11-2025" ] }, + "index_column": "ID", + "parse_data_types": true, "data_schema": { - "COSTCENTER": { + "PRICE": { "dtype": "string" }, - "PRODUCT": { + "ID": { "dtype": "string" }, - "ID": { + "PRODUCT": { "dtype": "string" }, - "PRICE": { - "dtype": "numeric" + "COSTCENTER": { + "dtype": "string" }, "ORDERDATE": { "dtype": "date" } - }, - "parse_data_types": true + } } } ] diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json index 1490f9a05..9043690e4 100644 --- a/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json @@ -10,53 +10,54 @@ { "name": "COSTCENTER", "prediction_placeholder": "[PREDICT]", - "task_type": "classification" + "task_type": "classification", + "top_k": null } ] }, - "index_column": "ID", "rows": [ { "ORDERDATE": "28-11-2025", - "COSTCENTER": "[PREDICT]", - "PRODUCT": "Couch", + "PRICE": 999.99, "ID": "35", - "PRICE": 999.99 + "PRODUCT": "Couch", + "COSTCENTER": "[PREDICT]" }, { "ORDERDATE": "02-11-2025", - "COSTCENTER": "Office Furniture", - "PRODUCT": "Office Chair", + "PRICE": 150.8, "ID": "44", - "PRICE": 150.8 + "PRODUCT": "Office Chair", + "COSTCENTER": "Office Furniture" }, { "ORDERDATE": "01-11-2025", - "COSTCENTER": "Data Infrastructure", - "PRODUCT": "Server Rack", + "PRICE": 2200.0, "ID": "104", - "PRICE": 2200.0 + "PRODUCT": "Server Rack", + "COSTCENTER": "Data Infrastructure" } ], - "columns": {}, + "columns": null, + "index_column": "ID", + "parse_data_types": true, "data_schema": { "ORDERDATE": { "dtype": "date" }, - "COSTCENTER": { + "PRICE": { "dtype": "string" }, - "PRODUCT": { + "ID": { "dtype": "string" }, - "ID": { + "PRODUCT": { "dtype": "string" }, - "PRICE": { - "dtype": "numeric" + "COSTCENTER": { + "dtype": "string" } - }, - "parse_data_types": true + } } } ] diff --git a/logback.xml b/logback.xml index 2bbaaa365..5fe30b5bf 100644 --- a/logback.xml +++ b/logback.xml @@ -12,8 +12,8 @@ - - + + From 47b981c3cc09b5c67ffdeb67fba6625f298d7465 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 22 Jan 2026 17:32:01 +0100 Subject: [PATCH 09/17] disable wire logs --- logback.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logback.xml b/logback.xml index 5fe30b5bf..2bbaaa365 100644 --- a/logback.xml +++ b/logback.xml @@ -12,8 +12,8 @@ - - + + From 70d0234c739431ae464ff9af4c54ca9defc00ed9 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 22 Jan 2026 18:40:42 +0100 Subject: [PATCH 10/17] Prevent serialization of null --- foundation-models/sap-rpt/pom.xml | 9 ++- .../sdk/foundationmodels/rpt/RptClient.java | 29 ++++++--- .../foundationmodels/rpt/RptClientTest.java | 1 - .../resources/mappings/predictColumnWise.json | 3 +- .../resources/mappings/predictRowWise.json | 4 +- sample-code/spring-app/pom.xml | 6 ++ .../sap/ai/sdk/app/services/RptService.java | 65 +++++++++++++++++++ .../sap/ai/sdk/app/controllers/RptTest.java | 21 ++++++ 8 files changed, 122 insertions(+), 16 deletions(-) create mode 100644 sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java create mode 100644 sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/RptTest.java diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index 8c1af081f..dbe994506 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -77,6 +77,10 @@ com.google.guava guava + + com.fasterxml.jackson.core + jackson-databind + org.projectlombok @@ -102,7 +106,10 @@ com.sap.cloud.sdk.cloudplatform connectivity-apache-httpclient5 - test + + + org.apache.httpcomponents.client5 + httpclient5 diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 1233920db..55f2fc0ed 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -1,14 +1,24 @@ package com.sap.ai.sdk.foundationmodels.rpt; +import static com.sap.ai.sdk.core.JacksonConfiguration.getDefaultObjectMapper; + +import com.google.common.collect.Iterables; import com.sap.ai.sdk.core.AiCoreService; import com.sap.ai.sdk.core.DeploymentResolutionException; import com.sap.ai.sdk.foundationmodels.rpt.generated.client.DefaultApi; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Accessor; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; import javax.annotation.Nonnull; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; +import lombok.val; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.client.RestTemplate; /** Client for interacting with SAP RPT foundation models. */ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) @@ -36,15 +46,16 @@ public static RptClient forModel(@Nonnull final RptModel foundationModel) * @return A new instance of RptClient. */ static RptClient forDestination(@Nonnull final Destination destination) { - // final var rt = new RestTemplate(); - // Iterables.filter(rt.getMessageConverters(), MappingJackson2HttpMessageConverter.class) - // .forEach(converter -> converter.setObjectMapper(getDefaultObjectMapper())); - // - // final var apiClient = - // new ApiClient(rt) - // .setBasePath(destination.asHttp().getUri().toString()) - // .addDefaultHeader("AI-Resource-Group", "default"); - return new RptClient(new DefaultApi(destination)); + // This is a workaround to override the object mapper to ignore null on serialization + val httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); + httpRequestFactory.setHttpClient(ApacheHttpClient5Accessor.getHttpClient(destination)); + final var rt = new RestTemplate(); + Iterables.filter(rt.getMessageConverters(), MappingJackson2HttpMessageConverter.class) + .forEach(converter -> converter.setObjectMapper(getDefaultObjectMapper())); + rt.setRequestFactory(new BufferingClientHttpRequestFactory(httpRequestFactory)); + + final var apiClient = new ApiClient(rt).setBasePath(destination.asHttp().getUri().toString()); + return new RptClient(new DefaultApi(apiClient)); } /** diff --git a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java index 744c5679d..d1f31a1a0 100644 --- a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java +++ b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java @@ -63,7 +63,6 @@ static PredictRequestPayload createBaseRequest() { @Test void testTabCompletionWithRowsFormat() { - final List> rows = List.of( Map.of( diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json index 4ada79f18..b04f39fb9 100644 --- a/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictColumnWise.json @@ -10,8 +10,7 @@ { "name": "COSTCENTER", "prediction_placeholder": "[PREDICT]", - "task_type": "classification", - "top_k": null + "task_type": "classification" } ] }, diff --git a/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json index 9043690e4..9d97f1f84 100644 --- a/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json +++ b/foundation-models/sap-rpt/src/test/resources/mappings/predictRowWise.json @@ -10,8 +10,7 @@ { "name": "COSTCENTER", "prediction_placeholder": "[PREDICT]", - "task_type": "classification", - "top_k": null + "task_type": "classification" } ] }, @@ -38,7 +37,6 @@ "COSTCENTER": "Data Infrastructure" } ], - "columns": null, "index_column": "ID", "parse_data_types": true, "data_schema": { diff --git a/sample-code/spring-app/pom.xml b/sample-code/spring-app/pom.xml index 7a23b70d1..f026298f9 100644 --- a/sample-code/spring-app/pom.xml +++ b/sample-code/spring-app/pom.xml @@ -238,6 +238,12 @@ jackson-dataformat-yaml test + + com.sap.ai.sdk.foundationmodels + sap-rpt + 1.15.0-SNAPSHOT + compile + diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java new file mode 100644 index 000000000..de13b8542 --- /dev/null +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java @@ -0,0 +1,65 @@ +package com.sap.ai.sdk.app.services; + +import com.sap.ai.sdk.foundationmodels.rpt.RptClient; +import com.sap.ai.sdk.foundationmodels.rpt.RptModel; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.ColumnType; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayloadRowsInnerValue; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionConfig; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionPlaceholder; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.SchemaFieldConfig; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TargetColumnConfig; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +public class RptService { + + static final RptClient rptClient = RptClient.forModel(RptModel.SAP_RPT_1_SMALL); + + public PredictResponsePayload predict() { + final var dataSchema = + Map.of( + "PRODUCT", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "PRICE", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "ORDERDATE", SchemaFieldConfig.create().dtype(ColumnType.DATE), + "ID", SchemaFieldConfig.create().dtype(ColumnType.STRING), + "COSTCENTER", SchemaFieldConfig.create().dtype(ColumnType.STRING)); + final var targetColumns = + List.of( + TargetColumnConfig.create() + .name("COSTCENTER") + .predictionPlaceholder(PredictionPlaceholder.create("[PREDICT]")) + .taskType(TargetColumnConfig.TaskTypeEnum.CLASSIFICATION)); + final List> rows = + List.of( + Map.of( + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Couch"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("28-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("35"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("[PREDICT]")), + Map.of( + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Office Chair"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("02-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("44"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Office Furniture")), + Map.of( + "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Server Rack"), + "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00)), + "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("01-11-2025"), + "ID", PredictRequestPayloadRowsInnerValue.create("104"), + "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); + + final var request = + PredictRequestPayload.create() + .predictionConfig(PredictionConfig.create().targetColumns(targetColumns)) + .indexColumn("ID") + .dataSchema(dataSchema) + .parseDataTypes(true) + .rows(rows); + return rptClient.tabCompletion(request); + } +} diff --git a/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/RptTest.java b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/RptTest.java new file mode 100644 index 000000000..b70b7c406 --- /dev/null +++ b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/RptTest.java @@ -0,0 +1,21 @@ +package com.sap.ai.sdk.app.controllers; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.sap.ai.sdk.app.services.RptService; +import org.junit.jupiter.api.Test; + +class RptTest { + @Test + void testRpt() { + final var service = new RptService(); + final var response = service.predict(); + + assertThat(response).isNotNull(); + assertThat(response.getMetadata().getNumRows()).isEqualTo(2); + assertThat(response.getMetadata().getNumColumns()).isEqualTo(5); + assertThat(response.getMetadata().getNumQueryRows()).isEqualTo(1); + assertThat(response.getMetadata().getNumPredictions()).isEqualTo(1); + assertThat(response.getPredictions().get(0)).containsKey("COSTCENTER"); + } +} From b580486907373ca72380478676ae1933d5fc1436 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Fri, 23 Jan 2026 12:49:40 +0100 Subject: [PATCH 11/17] Disable /predict_parquet --- foundation-models/sap-rpt/pom.xml | 1 + .../rpt/generated/client/DefaultApi.java | 113 ------- .../generated/model/BodyPredictParquet.java | 308 ++++++++++++++++++ 3 files changed, 309 insertions(+), 113 deletions(-) create mode 100644 foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/BodyPredictParquet.java diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index dbe994506..bcb338fcd 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -150,6 +150,7 @@ true true true + /predict_parquet diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java index 11a12f9b5..39d8025d0 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java @@ -7,12 +7,9 @@ import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; -import java.io.File; import java.util.List; import javax.annotation.Nonnull; -import javax.annotation.Nullable; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; @@ -109,114 +106,4 @@ public PredictResponsePayload predict(@Nonnull final PredictRequestPayload predi localVarAuthNames, localVarReturnType); } - - /** - * Make in-context predictions for specified target columns based on provided table data Parquet - * file. - * - *

Make in-context predictions for specified target columns based on provided table data - * Parquet file. - * - *

200 - Successful Prediction - * - *

400 - Bad Request - Invalid input data - * - *

413 - Payload Too Large - * - *

422 - Validation Error - * - *

500 - Internal Server Error - * - * @param _file (required) Parquet file containing the data - * @param predictionConfig (required) JSON string for prediction_config - * @param indexColumn (optional) Optional index column name - * @param parseDataTypes (optional, default to true) Whether to parse data types - * @return PredictResponsePayload - * @throws OpenApiRequestException if an error occurs while attempting to invoke the API - */ - @Nonnull - public PredictResponsePayload predictParquet( - @Nonnull final File _file, - @Nonnull final String predictionConfig, - @Nullable final String indexColumn, - @Nullable final Boolean parseDataTypes) - throws OpenApiRequestException { - final Object localVarPostBody = null; - - // verify the required parameter '_file' is set - if (_file == null) { - throw new OpenApiRequestException( - "Missing the required parameter '_file' when calling predictParquet"); - } - - // verify the required parameter 'predictionConfig' is set - if (predictionConfig == null) { - throw new OpenApiRequestException( - "Missing the required parameter 'predictionConfig' when calling predictParquet"); - } - - final String localVarPath = - UriComponentsBuilder.fromPath("/predict_parquet").build().toUriString(); - - final MultiValueMap localVarQueryParams = - new LinkedMultiValueMap(); - final HttpHeaders localVarHeaderParams = new HttpHeaders(); - final MultiValueMap localVarFormParams = - new LinkedMultiValueMap(); - - if (_file != null) localVarFormParams.add("file", new FileSystemResource(_file)); - if (predictionConfig != null) localVarFormParams.add("prediction_config", predictionConfig); - if (indexColumn != null) localVarFormParams.add("index_column", indexColumn); - if (parseDataTypes != null) localVarFormParams.add("parse_data_types", parseDataTypes); - - final String[] localVarAccepts = {"application/json"}; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"multipart/form-data"}; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - final String[] localVarAuthNames = new String[] {}; - - final ParameterizedTypeReference localVarReturnType = - new ParameterizedTypeReference() {}; - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * Make in-context predictions for specified target columns based on provided table data Parquet - * file. - * - *

Make in-context predictions for specified target columns based on provided table data - * Parquet file. - * - *

200 - Successful Prediction - * - *

400 - Bad Request - Invalid input data - * - *

413 - Payload Too Large - * - *

422 - Validation Error - * - *

500 - Internal Server Error - * - * @param _file Parquet file containing the data - * @param predictionConfig JSON string for prediction_config - * @return PredictResponsePayload - * @throws OpenApiRequestException if an error occurs while attempting to invoke the API - */ - @Nonnull - public PredictResponsePayload predictParquet( - @Nonnull final File _file, @Nonnull final String predictionConfig) - throws OpenApiRequestException { - return predictParquet(_file, predictionConfig, null, null); - } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/BodyPredictParquet.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/BodyPredictParquet.java new file mode 100644 index 000000000..c3dd7b890 --- /dev/null +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/BodyPredictParquet.java @@ -0,0 +1,308 @@ +/* + * SAP-RPT-1 Tabular AI + * A REST API for in-context learning with the SAP-RPT-1 model. + * + * + * + * 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.foundationmodels.rpt.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.io.File; +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; + +/** BodyPredictParquet */ +// CHECKSTYLE:OFF +public class BodyPredictParquet +// CHECKSTYLE:ON +{ + @JsonProperty("file") + private File _file; + + @JsonProperty("prediction_config") + private String predictionConfig; + + @JsonProperty("index_column") + private String indexColumn; + + @JsonProperty("parse_data_types") + private Boolean parseDataTypes = true; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the _file of this {@link BodyPredictParquet} instance and return the same instance. + * + * @param _file Parquet file containing the data + * @return The same instance of this {@link BodyPredictParquet} class + */ + @Nonnull + public BodyPredictParquet _file(@Nonnull final File _file) { + this._file = _file; + return this; + } + + /** + * Parquet file containing the data + * + * @return _file The _file of this {@link BodyPredictParquet} instance. + */ + @Nonnull + public File getFile() { + return _file; + } + + /** + * Set the _file of this {@link BodyPredictParquet} instance. + * + * @param _file Parquet file containing the data + */ + public void setFile(@Nonnull final File _file) { + this._file = _file; + } + + /** + * Set the predictionConfig of this {@link BodyPredictParquet} instance and return the same + * instance. + * + * @param predictionConfig JSON string for prediction_config + * @return The same instance of this {@link BodyPredictParquet} class + */ + @Nonnull + public BodyPredictParquet predictionConfig(@Nonnull final String predictionConfig) { + this.predictionConfig = predictionConfig; + return this; + } + + /** + * JSON string for prediction_config + * + * @return predictionConfig The predictionConfig of this {@link BodyPredictParquet} instance. + */ + @Nonnull + public String getPredictionConfig() { + return predictionConfig; + } + + /** + * Set the predictionConfig of this {@link BodyPredictParquet} instance. + * + * @param predictionConfig JSON string for prediction_config + */ + public void setPredictionConfig(@Nonnull final String predictionConfig) { + this.predictionConfig = predictionConfig; + } + + /** + * Set the indexColumn of this {@link BodyPredictParquet} instance and return the same instance. + * + * @param indexColumn Optional index column name + * @return The same instance of this {@link BodyPredictParquet} class + */ + @Nonnull + public BodyPredictParquet indexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + return this; + } + + /** + * Optional index column name + * + * @return indexColumn The indexColumn of this {@link BodyPredictParquet} instance. + */ + @Nonnull + public String getIndexColumn() { + return indexColumn; + } + + /** + * Set the indexColumn of this {@link BodyPredictParquet} instance. + * + * @param indexColumn Optional index column name + */ + public void setIndexColumn(@Nullable final String indexColumn) { + this.indexColumn = indexColumn; + } + + /** + * Set the parseDataTypes of this {@link BodyPredictParquet} instance and return the same + * instance. + * + * @param parseDataTypes Whether to parse data types + * @return The same instance of this {@link BodyPredictParquet} class + */ + @Nonnull + public BodyPredictParquet parseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + return this; + } + + /** + * Whether to parse data types + * + * @return parseDataTypes The parseDataTypes of this {@link BodyPredictParquet} instance. + */ + @Nonnull + public Boolean isParseDataTypes() { + return parseDataTypes; + } + + /** + * Set the parseDataTypes of this {@link BodyPredictParquet} instance. + * + * @param parseDataTypes Whether to parse data types + */ + public void setParseDataTypes(@Nullable final Boolean parseDataTypes) { + this.parseDataTypes = parseDataTypes; + } + + /** + * Get the names of the unrecognizable properties of the {@link BodyPredictParquet}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BodyPredictParquet} 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("BodyPredictParquet has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BodyPredictParquet} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (_file != null) declaredFields.put("_file", _file); + if (predictionConfig != null) declaredFields.put("predictionConfig", predictionConfig); + if (indexColumn != null) declaredFields.put("indexColumn", indexColumn); + if (parseDataTypes != null) declaredFields.put("parseDataTypes", parseDataTypes); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BodyPredictParquet} 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 BodyPredictParquet bodyPredictParquet = (BodyPredictParquet) o; + return Objects.equals(this.cloudSdkCustomFields, bodyPredictParquet.cloudSdkCustomFields) + && Objects.equals(this._file, bodyPredictParquet._file) + && Objects.equals(this.predictionConfig, bodyPredictParquet.predictionConfig) + && Objects.equals(this.indexColumn, bodyPredictParquet.indexColumn) + && Objects.equals(this.parseDataTypes, bodyPredictParquet.parseDataTypes); + } + + @Override + public int hashCode() { + return Objects.hash(_file, predictionConfig, indexColumn, parseDataTypes, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BodyPredictParquet {\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" predictionConfig: ").append(toIndentedString(predictionConfig)).append("\n"); + sb.append(" indexColumn: ").append(toIndentedString(indexColumn)).append("\n"); + sb.append(" parseDataTypes: ").append(toIndentedString(parseDataTypes)).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 BodyPredictParquet} + * instance with all required arguments. + */ + public static Builder create() { + return (_file) -> + (predictionConfig) -> + new BodyPredictParquet()._file(_file).predictionConfig(predictionConfig); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the _file of this {@link BodyPredictParquet} instance. + * + * @param _file Parquet file containing the data + * @return The BodyPredictParquet builder. + */ + Builder1 _file(@Nonnull final File _file); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the predictionConfig of this {@link BodyPredictParquet} instance. + * + * @param predictionConfig JSON string for prediction_config + * @return The BodyPredictParquet instance. + */ + BodyPredictParquet predictionConfig(@Nonnull final String predictionConfig); + } +} From 640a57ab6a514781ab4d4109421026d9ea1014d1 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Fri, 23 Jan 2026 12:56:57 +0100 Subject: [PATCH 12/17] pmd and checkstyle --- .../main/java/com/sap/ai/sdk/app/services/RptService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java index de13b8542..a7f7b4cdf 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java @@ -13,11 +13,19 @@ import java.math.BigDecimal; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; +/** Service to interact with the RPT model for predictions. */ public class RptService { static final RptClient rptClient = RptClient.forModel(RptModel.SAP_RPT_1_SMALL); + /** + * Makes a prediction request to the RPT model. * + * + * @return the prediction response payload from the RPT model + */ + @Nonnull public PredictResponsePayload predict() { final var dataSchema = Map.of( From 1d1e85110d9db7b9babc019b1f0a2a88ce267276 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Fri, 23 Jan 2026 13:03:54 +0100 Subject: [PATCH 13/17] Update version --- foundation-models/sap-rpt/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index bcb338fcd..a7274035f 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -4,7 +4,7 @@ com.sap.ai.sdk sdk-parent - 1.15.0-SNAPSHOT + 1.16.0-SNAPSHOT ../../pom.xml com.sap.ai.sdk.foundationmodels From d8d56f61c16cebd9e8fcf29b39b631c6b522818d Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Fri, 23 Jan 2026 13:12:32 +0100 Subject: [PATCH 14/17] Update dependency management --- pom.xml | 5 +++++ sample-code/spring-app/pom.xml | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7d3d59cfe..332d08e70 100644 --- a/pom.xml +++ b/pom.xml @@ -251,6 +251,11 @@ openai ${project.version} + + com.sap.ai.sdk.foundationmodels + sap-rpt + ${project.version} + com.sap.ai.sdk.app spring-app diff --git a/sample-code/spring-app/pom.xml b/sample-code/spring-app/pom.xml index b0598865c..7f3e76141 100644 --- a/sample-code/spring-app/pom.xml +++ b/sample-code/spring-app/pom.xml @@ -83,6 +83,10 @@ com.sap.ai.sdk prompt-registry + + com.sap.ai.sdk.foundationmodels + sap-rpt + com.sap.cloud.sdk.cloudplatform cloudplatform-core @@ -237,12 +241,6 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml - - com.sap.ai.sdk.foundationmodels - sap-rpt - 1.15.0-SNAPSHOT - compile - From ee539a0f7f2420e609ad68ad26775a8894e2a66f Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 26 Jan 2026 13:14:01 +0100 Subject: [PATCH 15/17] Mark the new module non-release --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 332d08e70..12a81f998 100644 --- a/pom.xml +++ b/pom.xml @@ -811,6 +811,7 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma sample-code/spring-app + foundation-models/sap-rpt From 58a8bfb60ff943fecb74ea0aea4a8b3940155fb9 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 26 Jan 2026 17:12:43 +0100 Subject: [PATCH 16/17] Fix coverage nums and javadoc --- foundation-models/sap-rpt/pom.xml | 8 ++++---- .../sap/ai/sdk/foundationmodels/rpt/RptClient.java | 14 ++++++++------ .../sap/ai/sdk/foundationmodels/rpt/RptModel.java | 3 +-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index a7274035f..bbdaa8d2a 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -37,11 +37,11 @@ ${project.basedir}/../../ - 83% - 75% - 80% + 85% + 86% + 88% 100% - 83% + 85% diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 55f2fc0ed..49a870f68 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -20,7 +20,11 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; -/** Client for interacting with SAP RPT foundation models. */ +/** + * Client for interacting with SAP RPT foundation models. + * + * @since 1.16.0 + */ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public class RptClient { @Nonnull private final DefaultApi api; @@ -59,9 +63,7 @@ static RptClient forDestination(@Nonnull final Destination destination) { } /** - * Predict targets using SAP RPT model with structured data. - * - *

+ * Predict targets using SAP RPT model with structured data. * * *

200 - Successful response with predictive insights. * @@ -71,8 +73,8 @@ static RptClient forDestination(@Nonnull final Destination destination) { * *

500 - Internal Server Error. * - * @param requestBody The value for the parameter tabCompletionPostRequest - * @return TabCompletionPostResponse + * @param requestBody The prediction request + * @return prediction response from the RPT model */ @Nonnull public PredictResponsePayload tabCompletion(@Nonnull final PredictRequestPayload requestBody) { diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java index ab906b1e6..1afead85c 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java @@ -7,10 +7,9 @@ /** * Represents an SAP RPT foundation model. * - *

Example models: - * * @param name The name of the model. * @param version The version of the model (optional). + * @since 1.16.0 */ public record RptModel(@Nonnull String name, @Nullable String version) implements AiModel { From b2f5255391e6622b0a8f902bd7d22bfba0dfe165 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 27 Jan 2026 12:46:52 +0100 Subject: [PATCH 17/17] Regenerate with Apache HttpClient --- foundation-models/sap-rpt/pom.xml | 32 +++----- .../sdk/foundationmodels/rpt/RptClient.java | 19 +---- .../rpt/generated/client/DefaultApi.java | 58 +++++++------- .../model/PredictRequestPayload.java | 25 +++--- .../model/PredictResponsePayload.java | 18 ++--- ...rValue.java => PredictionsInnerValue.java} | 22 ++---- ...owsInnerValue.java => RowsInnerValue.java} | 25 ++---- .../foundationmodels/rpt/RptClientTest.java | 78 +++++++++---------- pom.xml | 2 +- .../sap/ai/sdk/app/services/RptService.java | 34 ++++---- 10 files changed, 132 insertions(+), 181 deletions(-) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{PredictResponsePayloadPredictionsInnerValue.java => PredictionsInnerValue.java} (74%) rename foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/{PredictRequestPayloadRowsInnerValue.java => RowsInnerValue.java} (72%) diff --git a/foundation-models/sap-rpt/pom.xml b/foundation-models/sap-rpt/pom.xml index bbdaa8d2a..38f1c8ccd 100644 --- a/foundation-models/sap-rpt/pom.xml +++ b/foundation-models/sap-rpt/pom.xml @@ -37,11 +37,11 @@ ${project.basedir}/../../ - 85% - 86% - 88% + 83% + 77% + 82% 100% - 85% + 83% @@ -58,29 +58,21 @@ openapi-core - org.springframework - spring-core + com.fasterxml.jackson.core + jackson-core - org.springframework - spring-web + com.fasterxml.jackson.core + jackson-annotations com.fasterxml.jackson.core - jackson-annotations + jackson-databind com.google.code.findbugs jsr305 - - com.google.guava - guava - - - com.fasterxml.jackson.core - jackson-databind - org.projectlombok @@ -106,10 +98,7 @@ com.sap.cloud.sdk.cloudplatform connectivity-apache-httpclient5 - - - org.apache.httpcomponents.client5 - httpclient5 + test @@ -145,6 +134,7 @@ com.sap.ai.sdk.foundationmodels.rpt.generated.client true + apache-httpclient create true true diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 49a870f68..51e8aa66b 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -2,23 +2,16 @@ import static com.sap.ai.sdk.core.JacksonConfiguration.getDefaultObjectMapper; -import com.google.common.collect.Iterables; import com.sap.ai.sdk.core.AiCoreService; import com.sap.ai.sdk.core.DeploymentResolutionException; import com.sap.ai.sdk.foundationmodels.rpt.generated.client.DefaultApi; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; -import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Accessor; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; -import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; import javax.annotation.Nonnull; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; -import lombok.val; -import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.client.RestTemplate; /** * Client for interacting with SAP RPT foundation models. @@ -50,15 +43,7 @@ public static RptClient forModel(@Nonnull final RptModel foundationModel) * @return A new instance of RptClient. */ static RptClient forDestination(@Nonnull final Destination destination) { - // This is a workaround to override the object mapper to ignore null on serialization - val httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); - httpRequestFactory.setHttpClient(ApacheHttpClient5Accessor.getHttpClient(destination)); - final var rt = new RestTemplate(); - Iterables.filter(rt.getMessageConverters(), MappingJackson2HttpMessageConverter.class) - .forEach(converter -> converter.setObjectMapper(getDefaultObjectMapper())); - rt.setRequestFactory(new BufferingClientHttpRequestFactory(httpRequestFactory)); - - final var apiClient = new ApiClient(rt).setBasePath(destination.asHttp().getUri().toString()); + final var apiClient = ApiClient.create(destination).withObjectMapper(getDefaultObjectMapper()); return new RptClient(new DefaultApi(apiClient)); } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java index 39d8025d0..d6878b280 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/client/DefaultApi.java @@ -1,28 +1,30 @@ package com.sap.ai.sdk.foundationmodels.rpt.generated.client; -import com.google.common.annotations.Beta; +import com.fasterxml.jackson.core.type.TypeReference; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; -import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; -import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.StringJoiner; import javax.annotation.Nonnull; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.util.UriComponentsBuilder; /** * SAP-RPT-1 Tabular AI in version 0.1.0. * *

A REST API for in-context learning with the SAP-RPT-1 model. */ -public class DefaultApi extends AbstractOpenApiService { +public class DefaultApi extends BaseApi { + + /** Instantiates this API class to invoke operations on the SAP-RPT-1 Tabular AI */ + public DefaultApi() {} + /** * Instantiates this API class to invoke operations on the SAP-RPT-1 Tabular AI. * @@ -38,7 +40,6 @@ public DefaultApi(@Nonnull final Destination httpDestination) { * * @param apiClient ApiClient to invoke the API on */ - @Beta public DefaultApi(@Nonnull final ApiClient apiClient) { super(apiClient); } @@ -69,41 +70,42 @@ public DefaultApi(@Nonnull final ApiClient apiClient) { @Nonnull public PredictResponsePayload predict(@Nonnull final PredictRequestPayload predictRequestPayload) throws OpenApiRequestException { - final Object localVarPostBody = predictRequestPayload; // verify the required parameter 'predictRequestPayload' is set if (predictRequestPayload == null) { throw new OpenApiRequestException( - "Missing the required parameter 'predictRequestPayload' when calling predict"); + "Missing the required parameter 'predictRequestPayload' when calling predict") + .statusCode(400); } - final String localVarPath = UriComponentsBuilder.fromPath("/predict").build().toUriString(); + // create path and map variables + final String localVarPath = "/predict"; - final MultiValueMap localVarQueryParams = - new LinkedMultiValueMap(); - final HttpHeaders localVarHeaderParams = new HttpHeaders(); - final MultiValueMap localVarFormParams = - new LinkedMultiValueMap(); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = {"application/json"}; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = {"application/json"}; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - final String[] localVarAuthNames = new String[] {}; + final TypeReference localVarReturnType = + new TypeReference() {}; - final ParameterizedTypeReference localVarReturnType = - new ParameterizedTypeReference() {}; return apiClient.invokeAPI( localVarPath, - HttpMethod.POST, + "POST", localVarQueryParams, - localVarPostBody, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + predictRequestPayload, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java index c2bc2a170..65ca2bc75 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayload.java @@ -40,10 +40,10 @@ public class PredictRequestPayload private PredictionConfig predictionConfig; @JsonProperty("rows") - private List> rows = new ArrayList<>(); + private List> rows = new ArrayList<>(); @JsonProperty("columns") - private Map> columns; + private Map> columns; @JsonProperty("index_column") private String indexColumn; @@ -97,8 +97,7 @@ public void setPredictionConfig(@Nonnull final PredictionConfig predictionConfig * @return The same instance of this {@link PredictRequestPayload} class */ @Nonnull - public PredictRequestPayload rows( - @Nullable final List> rows) { + public PredictRequestPayload rows(@Nullable final List> rows) { this.rows = rows; return this; } @@ -110,8 +109,7 @@ public PredictRequestPayload rows( * @return The same instance of type {@link PredictRequestPayload} */ @Nonnull - public PredictRequestPayload addRowsItem( - @Nonnull final Map rowsItem) { + public PredictRequestPayload addRowsItem(@Nonnull final Map rowsItem) { if (this.rows == null) { this.rows = new ArrayList<>(); } @@ -126,7 +124,7 @@ public PredictRequestPayload addRowsItem( * @return rows The rows of this {@link PredictRequestPayload} instance. */ @Nonnull - public List> getRows() { + public List> getRows() { return rows; } @@ -136,7 +134,7 @@ public List> getRows() { * @param rows Table rows, i.e. list of objects where each object is a mapping of column names to * values. Either \"rows\" or \"columns\" must be provided. */ - public void setRows(@Nullable final List> rows) { + public void setRows(@Nullable final List> rows) { this.rows = rows; } @@ -147,8 +145,7 @@ public void setRows(@Nullable final List> columns) { + public PredictRequestPayload columns(@Nullable final Map> columns) { this.columns = columns; return this; } @@ -162,8 +159,7 @@ public PredictRequestPayload columns( */ @Nonnull public PredictRequestPayload putcolumnsItem( - @Nonnull final String key, - @Nonnull final List columnsItem) { + @Nonnull final String key, @Nonnull final List columnsItem) { if (this.columns == null) { this.columns = new HashMap<>(); } @@ -177,7 +173,7 @@ public PredictRequestPayload putcolumnsItem( * @return columns The columns of this {@link PredictRequestPayload} instance. */ @Nullable - public Map> getColumns() { + public Map> getColumns() { return columns; } @@ -186,8 +182,7 @@ public Map> getColumns() { * * @param columns The columns of this {@link PredictRequestPayload} */ - public void setColumns( - @Nullable final Map> columns) { + public void setColumns(@Nullable final Map> columns) { this.columns = columns; } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java index e4d4daac8..631e53f9e 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayload.java @@ -38,8 +38,7 @@ public class PredictResponsePayload private PredictResponseStatus status; @JsonProperty("predictions") - private List> predictions = - new ArrayList<>(); + private List> predictions = new ArrayList<>(); @JsonProperty("metadata") private PredictResponseMetadata metadata; @@ -118,7 +117,7 @@ public void setStatus(@Nonnull final PredictResponseStatus status) { */ @Nonnull public PredictResponsePayload predictions( - @Nonnull final List> predictions) { + @Nonnull final List> predictions) { this.predictions = predictions; return this; } @@ -131,7 +130,7 @@ public PredictResponsePayload predictions( */ @Nonnull public PredictResponsePayload addPredictionsItem( - @Nonnull final Map predictionsItem) { + @Nonnull final Map predictionsItem) { if (this.predictions == null) { this.predictions = new ArrayList<>(); } @@ -145,7 +144,7 @@ public PredictResponsePayload addPredictionsItem( * @return predictions The predictions of this {@link PredictResponsePayload} instance. */ @Nonnull - public List> getPredictions() { + public List> getPredictions() { return predictions; } @@ -154,8 +153,7 @@ public List> getPredict * * @param predictions Mapping of column names to their list of prediction results or index column. */ - public void setPredictions( - @Nonnull final List> predictions) { + public void setPredictions(@Nonnull final List> predictions) { this.predictions = predictions; } @@ -342,8 +340,7 @@ public interface Builder2 { * column. * @return The PredictResponsePayload builder. */ - Builder3 predictions( - @Nonnull final List> predictions); + Builder3 predictions(@Nonnull final List> predictions); /** * Set the predictions of this {@link PredictResponsePayload} instance. @@ -352,8 +349,7 @@ Builder3 predictions( * column. * @return The PredictResponsePayload builder. */ - default Builder3 predictions( - @Nonnull final Map... predictions) { + default Builder3 predictions(@Nonnull final Map... predictions) { return predictions(Arrays.asList(predictions)); } } diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionsInnerValue.java similarity index 74% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionsInnerValue.java index 15fb362e8..d817ff9fb 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictResponsePayloadPredictionsInnerValue.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictionsInnerValue.java @@ -14,15 +14,15 @@ import java.util.List; import javax.annotation.Nonnull; -/** PredictResponsePayloadPredictionsInnerValue */ -public interface PredictResponsePayloadPredictionsInnerValue { +/** PredictionsInnerValue */ +public interface PredictionsInnerValue { /** * Helper class to create {@code List } that implements {@link - * PredictResponsePayloadPredictionsInnerValue}. + * PredictionsInnerValue}. */ record ListOfPredictionResults( @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) - implements PredictResponsePayloadPredictionsInnerValue {} + implements PredictionsInnerValue {} /** * Creator to enable deserialization of {@code List }. @@ -37,12 +37,9 @@ static ListOfPredictionResults createListOfPredictionResults( return new ListOfPredictionResults(val); } - /** - * Helper class to create {@code String } that implements {@link - * PredictResponsePayloadPredictionsInnerValue}. - */ + /** Helper class to create {@code String } that implements {@link PredictionsInnerValue}. */ record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements PredictResponsePayloadPredictionsInnerValue {} + implements PredictionsInnerValue {} /** * Creator to enable deserialization of {@code String }. @@ -56,12 +53,9 @@ static InnerString create(@Nonnull final String val) { return new InnerString(val); } - /** - * Helper class to create {@code Integer } that implements {@link - * PredictResponsePayloadPredictionsInnerValue}. - */ + /** Helper class to create {@code Integer } that implements {@link PredictionsInnerValue}. */ record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) - implements PredictResponsePayloadPredictionsInnerValue {} + implements PredictionsInnerValue {} /** * Creator to enable deserialization of {@code Integer }. diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/RowsInnerValue.java similarity index 72% rename from foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java rename to foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/RowsInnerValue.java index d65f53598..286c7006c 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/PredictRequestPayloadRowsInnerValue.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/generated/model/RowsInnerValue.java @@ -14,14 +14,11 @@ import java.math.BigDecimal; import javax.annotation.Nonnull; -/** PredictRequestPayloadRowsInnerValue */ -public interface PredictRequestPayloadRowsInnerValue { - /** - * Helper class to create {@code String } that implements {@link - * PredictRequestPayloadRowsInnerValue}. - */ +/** RowsInnerValue */ +public interface RowsInnerValue { + /** Helper class to create {@code String } that implements {@link RowsInnerValue}. */ record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) - implements PredictRequestPayloadRowsInnerValue {} + implements RowsInnerValue {} /** * Creator to enable deserialization of {@code String }. @@ -35,12 +32,9 @@ static InnerString create(@Nonnull final String val) { return new InnerString(val); } - /** - * Helper class to create {@code Integer } that implements {@link - * PredictRequestPayloadRowsInnerValue}. - */ + /** Helper class to create {@code Integer } that implements {@link RowsInnerValue}. */ record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) - implements PredictRequestPayloadRowsInnerValue {} + implements RowsInnerValue {} /** * Creator to enable deserialization of {@code Integer }. @@ -54,12 +48,9 @@ static InnerInteger create(@Nonnull final Integer val) { return new InnerInteger(val); } - /** - * Helper class to create {@code BigDecimal } that implements {@link - * PredictRequestPayloadRowsInnerValue}. - */ + /** Helper class to create {@code BigDecimal } that implements {@link RowsInnerValue}. */ record InnerBigDecimal(@com.fasterxml.jackson.annotation.JsonValue @Nonnull BigDecimal value) - implements PredictRequestPayloadRowsInnerValue {} + implements RowsInnerValue {} /** * Creator to enable deserialization of {@code BigDecimal }. diff --git a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java index d1f31a1a0..a183d7f77 100644 --- a/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java +++ b/foundation-models/sap-rpt/src/test/java/com/sap/ai/sdk/foundationmodels/rpt/RptClientTest.java @@ -63,26 +63,26 @@ static PredictRequestPayload createBaseRequest() { @Test void testTabCompletionWithRowsFormat() { - final List> rows = + final List> rows = List.of( Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Couch"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("28-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("35"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("[PREDICT]")), + "PRODUCT", RowsInnerValue.create("Couch"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(999.99)), + "ORDERDATE", RowsInnerValue.create("28-11-2025"), + "ID", RowsInnerValue.create("35"), + "COSTCENTER", RowsInnerValue.create("[PREDICT]")), Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Office Chair"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("02-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("44"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Office Furniture")), + "PRODUCT", RowsInnerValue.create("Office Chair"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(150.8)), + "ORDERDATE", RowsInnerValue.create("02-11-2025"), + "ID", RowsInnerValue.create("44"), + "COSTCENTER", RowsInnerValue.create("Office Furniture")), Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Server Rack"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("01-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("104"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); + "PRODUCT", RowsInnerValue.create("Server Rack"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(2200.00)), + "ORDERDATE", RowsInnerValue.create("01-11-2025"), + "ID", RowsInnerValue.create("104"), + "COSTCENTER", RowsInnerValue.create("Data Infrastructure"))); final var request = createBaseRequest().rows(rows); final var response = client.tabCompletion(request); @@ -97,13 +97,12 @@ void testTabCompletionWithRowsFormat() { assertThat(response.getStatus().getMessage()).isEqualTo("ok"); assertThat(response.getPredictions()).hasSize(1); - final Map prediction = - response.getPredictions().get(0); + final Map prediction = response.getPredictions().get(0); assertThat(prediction) - .containsEntry("ID", PredictResponsePayloadPredictionsInnerValue.create("35")) + .containsEntry("ID", PredictionsInnerValue.create("35")) .containsEntry( "COSTCENTER", - PredictResponsePayloadPredictionsInnerValue.createListOfPredictionResults( + PredictionsInnerValue.createListOfPredictionResults( List.of( PredictionResult.create() .prediction(Prediction.create("Office Furniture")) @@ -112,33 +111,33 @@ void testTabCompletionWithRowsFormat() { @Test void testTabCompletionWithColumnsFormat() { - final Map> columns = + final Map> columns = Map.of( "PRODUCT", List.of( - PredictRequestPayloadRowsInnerValue.create("Couch"), - PredictRequestPayloadRowsInnerValue.create("Office Chair"), - PredictRequestPayloadRowsInnerValue.create("Server Rack")), + RowsInnerValue.create("Couch"), + RowsInnerValue.create("Office Chair"), + RowsInnerValue.create("Server Rack")), "PRICE", List.of( - PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), - PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), - PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00))), + RowsInnerValue.create(BigDecimal.valueOf(999.99)), + RowsInnerValue.create(BigDecimal.valueOf(150.8)), + RowsInnerValue.create(BigDecimal.valueOf(2200.00))), "ORDERDATE", List.of( - PredictRequestPayloadRowsInnerValue.create("28-11-2025"), - PredictRequestPayloadRowsInnerValue.create("02-11-2025"), - PredictRequestPayloadRowsInnerValue.create("01-11-2025")), + RowsInnerValue.create("28-11-2025"), + RowsInnerValue.create("02-11-2025"), + RowsInnerValue.create("01-11-2025")), "ID", List.of( - PredictRequestPayloadRowsInnerValue.create("35"), - PredictRequestPayloadRowsInnerValue.create("44"), - PredictRequestPayloadRowsInnerValue.create("104")), + RowsInnerValue.create("35"), + RowsInnerValue.create("44"), + RowsInnerValue.create("104")), "COSTCENTER", List.of( - PredictRequestPayloadRowsInnerValue.create("[PREDICT]"), - PredictRequestPayloadRowsInnerValue.create("Office Furniture"), - PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); + RowsInnerValue.create("[PREDICT]"), + RowsInnerValue.create("Office Furniture"), + RowsInnerValue.create("Data Infrastructure"))); final var request = createBaseRequest().columns(columns); final var response = client.tabCompletion(request); @@ -154,13 +153,12 @@ void testTabCompletionWithColumnsFormat() { assertThat(response.getStatus().getMessage()).isEqualTo("ok"); assertThat(response.getPredictions()).hasSize(1); - final Map prediction = - response.getPredictions().get(0); + final Map prediction = response.getPredictions().get(0); assertThat(prediction) - .containsEntry("ID", PredictResponsePayloadPredictionsInnerValue.create("35")) + .containsEntry("ID", PredictionsInnerValue.create("35")) .containsEntry( "COSTCENTER", - PredictResponsePayloadPredictionsInnerValue.createListOfPredictionResults( + PredictionsInnerValue.createListOfPredictionResults( List.of( PredictionResult.create() .prediction(Prediction.create("Office Furniture")) diff --git a/pom.xml b/pom.xml index c734923f5..446c615d3 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ full UTF-8 2025-04-03T13:23:00Z - 5.25.0 + 5.26.0 6.0.2 3.13.2 3.27.6 diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java index a7f7b4cdf..38e2931bb 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java @@ -4,10 +4,10 @@ import com.sap.ai.sdk.foundationmodels.rpt.RptModel; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.ColumnType; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayload; -import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictRequestPayloadRowsInnerValue; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictResponsePayload; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionConfig; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionPlaceholder; +import com.sap.ai.sdk.foundationmodels.rpt.generated.model.RowsInnerValue; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.SchemaFieldConfig; import com.sap.ai.sdk.foundationmodels.rpt.generated.model.TargetColumnConfig; import java.math.BigDecimal; @@ -40,26 +40,26 @@ public PredictResponsePayload predict() { .name("COSTCENTER") .predictionPlaceholder(PredictionPlaceholder.create("[PREDICT]")) .taskType(TargetColumnConfig.TaskTypeEnum.CLASSIFICATION)); - final List> rows = + final List> rows = List.of( Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Couch"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(999.99)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("28-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("35"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("[PREDICT]")), + "PRODUCT", RowsInnerValue.create("Couch"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(999.99)), + "ORDERDATE", RowsInnerValue.create("28-11-2025"), + "ID", RowsInnerValue.create("35"), + "COSTCENTER", RowsInnerValue.create("[PREDICT]")), Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Office Chair"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(150.8)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("02-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("44"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Office Furniture")), + "PRODUCT", RowsInnerValue.create("Office Chair"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(150.8)), + "ORDERDATE", RowsInnerValue.create("02-11-2025"), + "ID", RowsInnerValue.create("44"), + "COSTCENTER", RowsInnerValue.create("Office Furniture")), Map.of( - "PRODUCT", PredictRequestPayloadRowsInnerValue.create("Server Rack"), - "PRICE", PredictRequestPayloadRowsInnerValue.create(BigDecimal.valueOf(2200.00)), - "ORDERDATE", PredictRequestPayloadRowsInnerValue.create("01-11-2025"), - "ID", PredictRequestPayloadRowsInnerValue.create("104"), - "COSTCENTER", PredictRequestPayloadRowsInnerValue.create("Data Infrastructure"))); + "PRODUCT", RowsInnerValue.create("Server Rack"), + "PRICE", RowsInnerValue.create(BigDecimal.valueOf(2200.00)), + "ORDERDATE", RowsInnerValue.create("01-11-2025"), + "ID", RowsInnerValue.create("104"), + "COSTCENTER", RowsInnerValue.create("Data Infrastructure"))); final var request = PredictRequestPayload.create()