diff --git a/README.md b/README.md index 9197c791..09dba116 100644 --- a/README.md +++ b/README.md @@ -336,20 +336,21 @@ final var template = "Create a rental posting for subletting my apartment in the downtown area. Keep it short. Make sure to add the following disclaimer to the end. Do not change it! {{?disclaimer}}"); final var templatingConfig = TemplatingModuleConfig.create().template(template); -final var filterStrict = - Filter.create() - .type(ProviderType.AZURE_CONTENT_SAFETY) +final var filterStrict = + FilterConfig.create() + .type(FilterConfig.TypeEnum.AZURE_CONTENT_SAFETY) .config( - FilterConfig.create() + AzureContentSafety.create() .hate(NUMBER_0) .selfHarm(NUMBER_0) .sexual(NUMBER_0) .violence(NUMBER_0)); + final var filterLoose = - Filter.create() - .type(ProviderType.AZURE_CONTENT_SAFETY) + FilterConfig.create() + .type(FilterConfig.TypeEnum.AZURE_CONTENT_SAFETY) .config( - FilterConfig.create() + AzureContentSafety.create() .hate(NUMBER_4) .selfHarm(NUMBER_4) .sexual(NUMBER_4) diff --git a/e2e-test-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java b/e2e-test-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java index 6f829f23..77f47531 100644 --- a/e2e-test-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java +++ b/e2e-test-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java @@ -3,18 +3,17 @@ import static com.sap.ai.sdk.core.Core.getOrchestrationClient; import com.sap.ai.sdk.orchestration.client.OrchestrationCompletionApi; +import com.sap.ai.sdk.orchestration.client.model.AzureContentSafety; import com.sap.ai.sdk.orchestration.client.model.AzureThreshold; import com.sap.ai.sdk.orchestration.client.model.ChatMessage; import com.sap.ai.sdk.orchestration.client.model.CompletionPostRequest; import com.sap.ai.sdk.orchestration.client.model.CompletionPostResponse; -import com.sap.ai.sdk.orchestration.client.model.Filter; import com.sap.ai.sdk.orchestration.client.model.FilterConfig; import com.sap.ai.sdk.orchestration.client.model.FilteringConfig; import com.sap.ai.sdk.orchestration.client.model.FilteringModuleConfig; import com.sap.ai.sdk.orchestration.client.model.LLMModuleConfig; import com.sap.ai.sdk.orchestration.client.model.ModuleConfigs; import com.sap.ai.sdk.orchestration.client.model.OrchestrationConfig; -import com.sap.ai.sdk.orchestration.client.model.ProviderType; import com.sap.ai.sdk.orchestration.client.model.TemplatingModuleConfig; import java.util.List; import java.util.Map; @@ -68,10 +67,10 @@ class OrchestrationController { final var templatingConfig = TemplatingModuleConfig.create().template(template); final var filter = - Filter.create() - .type(ProviderType.AZURE_CONTENT_SAFETY) + FilterConfig.create() + .type(FilterConfig.TypeEnum.AZURE_CONTENT_SAFETY) .config( - FilterConfig.create() + AzureContentSafety.create() .hate(filterThreshold) .selfHarm(filterThreshold) .sexual(filterThreshold) diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafety.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafety.java index ad50bbff..dbb63e12 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafety.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafety.java @@ -24,7 +24,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** AzureContentSafety */ +/** Filter configuration for Azure Content Safety */ // CHECKSTYLE:OFF public class AzureContentSafety // CHECKSTYLE:ON diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafetyFilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafetyFilterConfig.java new file mode 100644 index 00000000..40b996a5 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafetyFilterConfig.java @@ -0,0 +1,264 @@ +/* + * Internal Orchestration Service API + * SAP AI Core - Orchestration Service API + * + * The version of the OpenAPI document: 0.0.1 + * + * + * 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.orchestration.client.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; + +/** AzureContentSafetyFilterConfig */ +// CHECKSTYLE:OFF +public class AzureContentSafetyFilterConfig +// CHECKSTYLE:ON +{ + /** String represents name of the filter provider */ + public enum TypeEnum { + /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyFilterConfig */ + AZURE_CONTENT_SAFETY("azure_content_safety"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type AzureContentSafetyFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private AzureContentSafety config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + protected AzureContentSafetyFilterConfig() {} + + /** + * Set the type of this {@link AzureContentSafetyFilterConfig} instance and return the same + * instance. + * + * @param type String represents name of the filter provider + * @return The same instance of this {@link AzureContentSafetyFilterConfig} class + */ + @Nonnull + public AzureContentSafetyFilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * String represents name of the filter provider + * + * @return type The type of this {@link AzureContentSafetyFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyFilterConfig} instance. + * + * @param type String represents name of the filter provider + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyFilterConfig} instance and return the same + * instance. + * + * @param config The config of this {@link AzureContentSafetyFilterConfig} + * @return The same instance of this {@link AzureContentSafetyFilterConfig} class + */ + @Nonnull + public AzureContentSafetyFilterConfig config(@Nonnull final AzureContentSafety config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyFilterConfig} instance. + */ + @Nonnull + public AzureContentSafety getConfig() { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyFilterConfig} instance. + * + * @param config The config of this {@link AzureContentSafetyFilterConfig} + */ + public void setConfig(@Nonnull final AzureContentSafety config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyFilterConfig} + * instance. + * + * @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 + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AzureContentSafetyFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyFilterConfig} 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 AzureContentSafetyFilterConfig azureContentSafetyFilterConfig = + (AzureContentSafetyFilterConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, azureContentSafetyFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyFilterConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).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 + * AzureContentSafetyFilterConfig} instance with all required arguments. + */ + public static Builder create() { + return (type) -> new AzureContentSafetyFilterConfig().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link AzureContentSafetyFilterConfig} instance. + * + * @param type String represents name of the filter provider + * @return The AzureContentSafetyFilterConfig instance. + */ + AzureContentSafetyFilterConfig type(@Nonnull final TypeEnum type); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/CompletionPostRequest.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/CompletionPostRequest.java index f99de4e8..230c63dc 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/CompletionPostRequest.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/CompletionPostRequest.java @@ -270,10 +270,7 @@ private String toIndentedString(final java.lang.Object o) { */ public static Builder create() { return (orchestrationConfig) -> - (inputParams) -> - new CompletionPostRequest() - .orchestrationConfig(orchestrationConfig) - .inputParams(inputParams); + new CompletionPostRequest().orchestrationConfig(orchestrationConfig); } /** Builder helper class. */ @@ -282,19 +279,9 @@ public interface Builder { * Set the orchestrationConfig of this {@link CompletionPostRequest} instance. * * @param orchestrationConfig The orchestrationConfig of this {@link CompletionPostRequest} - * @return The CompletionPostRequest builder. - */ - Builder1 orchestrationConfig(@Nonnull final OrchestrationConfig orchestrationConfig); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the inputParams of this {@link CompletionPostRequest} instance. - * - * @param inputParams The inputParams of this {@link CompletionPostRequest} * @return The CompletionPostRequest instance. */ - CompletionPostRequest inputParams(@Nonnull final Map inputParams); + CompletionPostRequest orchestrationConfig( + @Nonnull final OrchestrationConfig orchestrationConfig); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIConfig.java new file mode 100644 index 00000000..9ff2338a --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIConfig.java @@ -0,0 +1,398 @@ +/* + * Internal Orchestration Service API + * SAP AI Core - Orchestration Service API + * + * The version of the OpenAPI document: 0.0.1 + * + * + * 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.orchestration.client.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.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; + +/** DPIConfig */ +// CHECKSTYLE:OFF +public class DPIConfig +// CHECKSTYLE:ON +{ + /** Type of masking service provider */ + public enum TypeEnum { + /** The SAP_DATA_PRIVACY_INTEGRATION option of this DPIConfig */ + SAP_DATA_PRIVACY_INTEGRATION("sap_data_privacy_integration"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("type") + private TypeEnum type; + + /** Type of masking method to be used */ + public enum MethodEnum { + /** The ANONYMIZATION option of this DPIConfig */ + ANONYMIZATION("anonymization"), + + /** The PSEUDONYMIZATION option of this DPIConfig */ + PSEUDONYMIZATION("pseudonymization"); + + private String value; + + MethodEnum(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 DPIConfig + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonProperty("entities") + private List entities = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + protected DPIConfig() {} + + /** + * Set the type of this {@link DPIConfig} instance and return the same instance. + * + * @param type Type of masking service provider + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of masking service provider + * + * @return type The type of this {@link DPIConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link DPIConfig} instance. + * + * @param type Type of masking service provider + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the method of this {@link DPIConfig} instance and return the same instance. + * + * @param method Type of masking method to be used + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Type of masking method to be used + * + * @return method The method of this {@link DPIConfig} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIConfig} instance. + * + * @param method Type of masking method to be used + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Set the entities of this {@link DPIConfig} instance and return the same instance. + * + * @param entities List of entities to be masked + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig entities(@Nonnull final List entities) { + this.entities = entities; + return this; + } + + /** + * Add one entities instance to this {@link DPIConfig}. + * + * @param entitiesItem The entities that should be added + * @return The same instance of type {@link DPIConfig} + */ + @Nonnull + public DPIConfig addEntitiesItem(@Nonnull final DPIEntityConfig entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * List of entities to be masked + * + * @return entities The entities of this {@link DPIConfig} instance. + */ + @Nonnull + public List getEntities() { + return entities; + } + + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + */ + public void setEntities(@Nonnull final List entities) { + this.entities = entities; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIConfig} instance. + * + * @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 + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("DPIConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Set an unrecognizable property of this {@link DPIConfig} 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 DPIConfig dpIConfig = (DPIConfig) o; + return Objects.equals(this.cloudSdkCustomFields, dpIConfig.cloudSdkCustomFields) + && Objects.equals(this.type, dpIConfig.type) + && Objects.equals(this.method, dpIConfig.method) + && Objects.equals(this.entities, dpIConfig.entities); + } + + @Override + public int hashCode() { + return Objects.hash(type, method, entities, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).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 DPIConfig} instance + * with all required arguments. + */ + public static Builder create() { + return (type) -> + (method) -> (entities) -> new DPIConfig().type(type).method(method).entities(entities); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link DPIConfig} instance. + * + * @param type Type of masking service provider + * @return The DPIConfig builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the method of this {@link DPIConfig} instance. + * + * @param method Type of masking method to be used + * @return The DPIConfig builder. + */ + Builder2 method(@Nonnull final MethodEnum method); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + * @return The DPIConfig instance. + */ + DPIConfig entities(@Nonnull final List entities); + + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + * @return The DPIConfig instance. + */ + default DPIConfig entities(@Nonnull final DPIEntityConfig... entities) { + return entities(Arrays.asList(entities)); + } + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntities.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntities.java index 5c52e045..228ff2d9 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntities.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntities.java @@ -22,6 +22,10 @@ public enum DPIEntities { ORG("profile-org"), + UNIVERSITY("profile-university"), + + LOCATION("profile-location"), + EMAIL("profile-email"), PHONE("profile-phone"), @@ -34,8 +38,14 @@ public enum DPIEntities { URL("profile-url"), + USERNAME_PASSWORD("profile-username-password"), + + NATIONALID("profile-nationalid"), + IBAN("profile-iban"), + SSN("profile-ssn"), + CREDIT_CARD_NUMBER("profile-credit-card-number"), PASSPORT("profile-passport"), @@ -44,9 +54,19 @@ public enum DPIEntities { NATIONALITY("profile-nationality"), + RELIGIOUS_GROUP("profile-religious-group"), + POLITICAL_GROUP("profile-political-group"), - ETHNICITY("profile-ethnicity"); + PRONOUNS_GENDER("profile-pronouns-gender"), + + GENDER("profile-gender"), + + SEXUAL_ORIENTATION("profile-sexual-orientation"), + + TRADE_UNION("profile-trade-union"), + + SENSITIVE_DATA("profile-sensitive-data"); private final String value; diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Filter.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntityConfig.java similarity index 57% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Filter.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntityConfig.java index aed1af6a..fcb67436 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Filter.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/DPIEntityConfig.java @@ -24,86 +24,52 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Filter */ +/** DPIEntityConfig */ // CHECKSTYLE:OFF -public class Filter +public class DPIEntityConfig // CHECKSTYLE:ON { @JsonProperty("type") - private ProviderType type; - - @JsonProperty("config") - private FilterConfig config; + private DPIEntities type; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - protected Filter() {} + protected DPIEntityConfig() {} /** - * Set the type of this {@link Filter} instance and return the same instance. + * Set the type of this {@link DPIEntityConfig} instance and return the same instance. * - * @param type The type of this {@link Filter} - * @return The same instance of this {@link Filter} class + * @param type Type of entity to be masked + * @return The same instance of this {@link DPIEntityConfig} class */ @Nonnull - public Filter type(@Nonnull final ProviderType type) { + public DPIEntityConfig type(@Nonnull final DPIEntities type) { this.type = type; return this; } /** - * Get type + * Type of entity to be masked * - * @return type The type of this {@link Filter} instance. + * @return type The type of this {@link DPIEntityConfig} instance. */ @Nonnull - public ProviderType getType() { + public DPIEntities getType() { return type; } /** - * Set the type of this {@link Filter} instance. + * Set the type of this {@link DPIEntityConfig} instance. * - * @param type The type of this {@link Filter} + * @param type Type of entity to be masked */ - public void setType(@Nonnull final ProviderType type) { + public void setType(@Nonnull final DPIEntities type) { this.type = type; } /** - * Set the config of this {@link Filter} instance and return the same instance. - * - * @param config The config of this {@link Filter} - * @return The same instance of this {@link Filter} class - */ - @Nonnull - public Filter config(@Nonnull final FilterConfig config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link Filter} instance. - */ - @Nonnull - public FilterConfig getConfig() { - return config; - } - - /** - * Set the config of this {@link Filter} instance. - * - * @param config The config of this {@link Filter} - */ - public void setConfig(@Nonnull final FilterConfig config) { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link Filter}. + * Get the names of the unrecognizable properties of the {@link DPIEntityConfig}. * * @return The set of properties names */ @@ -114,7 +80,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link Filter} instance. + * Get the value of an unrecognizable property of this {@link DPIEntityConfig} instance. * * @param name The name of the property * @return The value of the property @@ -123,14 +89,14 @@ public Set getCustomFieldNames() { @Nullable public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("Filter has no field with name '" + name + "'."); + throw new NoSuchElementException("DPIEntityConfig has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Set an unrecognizable property of this {@link Filter} 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 DPIEntityConfig} 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 @@ -148,24 +114,22 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final Filter filter = (Filter) o; - return Objects.equals(this.cloudSdkCustomFields, filter.cloudSdkCustomFields) - && Objects.equals(this.type, filter.type) - && Objects.equals(this.config, filter.config); + final DPIEntityConfig dpIEntityConfig = (DPIEntityConfig) o; + return Objects.equals(this.cloudSdkCustomFields, dpIEntityConfig.cloudSdkCustomFields) + && Objects.equals(this.type, dpIEntityConfig.type); } @Override public int hashCode() { - return Objects.hash(type, config, cloudSdkCustomFields); + return Objects.hash(type, cloudSdkCustomFields); } @Override @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class Filter {\n"); + sb.append("class DPIEntityConfig {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -184,21 +148,21 @@ private String toIndentedString(final java.lang.Object o) { } /** - * Create a type-safe, fluent-api builder object to construct a new {@link Filter} instance with - * all required arguments. + * Create a type-safe, fluent-api builder object to construct a new {@link DPIEntityConfig} + * instance with all required arguments. */ public static Builder create() { - return (type) -> new Filter().type(type); + return (type) -> new DPIEntityConfig().type(type); } /** Builder helper class. */ public interface Builder { /** - * Set the type of this {@link Filter} instance. + * Set the type of this {@link DPIEntityConfig} instance. * - * @param type The type of this {@link Filter} - * @return The Filter instance. + * @param type Type of entity to be masked + * @return The DPIEntityConfig instance. */ - Filter type(@Nonnull final ProviderType type); + DPIEntityConfig type(@Nonnull final DPIEntities type); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilterConfig.java index 2517018c..a0e1f957 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilterConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilterConfig.java @@ -14,8 +14,10 @@ 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; @@ -24,150 +26,133 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Filters classifiers to be used */ +/** FilterConfig */ // CHECKSTYLE:OFF public class FilterConfig // CHECKSTYLE:ON { - @JsonProperty("Hate") - private AzureThreshold hate; + /** String represents name of the filter provider */ + public enum TypeEnum { + /** The AZURE_CONTENT_SAFETY option of this FilterConfig */ + AZURE_CONTENT_SAFETY("azure_content_safety"); - @JsonProperty("SelfHarm") - private AzureThreshold selfHarm; + private String value; - @JsonProperty("Sexual") - private AzureThreshold sexual; - - @JsonProperty("Violence") - private AzureThreshold violence; + TypeEnum(String value) { + this.value = value; + } - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } - protected FilterConfig() {} + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } - /** - * Set the hate of this {@link FilterConfig} instance and return the same instance. - * - * @param hate The hate of this {@link FilterConfig} - * @return The same instance of this {@link FilterConfig} class - */ - @Nonnull - public FilterConfig hate(@Nonnull final AzureThreshold hate) { - this.hate = hate; - return this; + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type FilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } } - /** - * Get hate - * - * @return hate The hate of this {@link FilterConfig} instance. - */ - @Nonnull - public AzureThreshold getHate() { - return hate; - } + @JsonProperty("type") + private TypeEnum type; - /** - * Set the hate of this {@link FilterConfig} instance. - * - * @param hate The hate of this {@link FilterConfig} - */ - public void setHate(@Nonnull final AzureThreshold hate) { - this.hate = hate; - } + @JsonProperty("config") + private AzureContentSafety config; - /** - * Set the selfHarm of this {@link FilterConfig} instance and return the same instance. - * - * @param selfHarm The selfHarm of this {@link FilterConfig} - * @return The same instance of this {@link FilterConfig} class - */ - @Nonnull - public FilterConfig selfHarm(@Nonnull final AzureThreshold selfHarm) { - this.selfHarm = selfHarm; - return this; - } - - /** - * Get selfHarm - * - * @return selfHarm The selfHarm of this {@link FilterConfig} instance. - */ - @Nonnull - public AzureThreshold getSelfHarm() { - return selfHarm; - } + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - /** - * Set the selfHarm of this {@link FilterConfig} instance. - * - * @param selfHarm The selfHarm of this {@link FilterConfig} - */ - public void setSelfHarm(@Nonnull final AzureThreshold selfHarm) { - this.selfHarm = selfHarm; - } + protected FilterConfig() {} /** - * Set the sexual of this {@link FilterConfig} instance and return the same instance. + * Set the type of this {@link FilterConfig} instance and return the same instance. * - * @param sexual The sexual of this {@link FilterConfig} + * @param type String represents name of the filter provider * @return The same instance of this {@link FilterConfig} class */ @Nonnull - public FilterConfig sexual(@Nonnull final AzureThreshold sexual) { - this.sexual = sexual; + public FilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; return this; } /** - * Get sexual + * String represents name of the filter provider * - * @return sexual The sexual of this {@link FilterConfig} instance. + * @return type The type of this {@link FilterConfig} instance. */ @Nonnull - public AzureThreshold getSexual() { - return sexual; + public TypeEnum getType() { + return type; } /** - * Set the sexual of this {@link FilterConfig} instance. + * Set the type of this {@link FilterConfig} instance. * - * @param sexual The sexual of this {@link FilterConfig} + * @param type String represents name of the filter provider */ - public void setSexual(@Nonnull final AzureThreshold sexual) { - this.sexual = sexual; + public void setType(@Nonnull final TypeEnum type) { + this.type = type; } /** - * Set the violence of this {@link FilterConfig} instance and return the same instance. + * Set the config of this {@link FilterConfig} instance and return the same instance. * - * @param violence The violence of this {@link FilterConfig} + * @param config The config of this {@link FilterConfig} * @return The same instance of this {@link FilterConfig} class */ @Nonnull - public FilterConfig violence(@Nonnull final AzureThreshold violence) { - this.violence = violence; + public FilterConfig config(@Nonnull final AzureContentSafety config) { + this.config = config; return this; } /** - * Get violence + * Get config * - * @return violence The violence of this {@link FilterConfig} instance. + * @return config The config of this {@link FilterConfig} instance. */ @Nonnull - public AzureThreshold getViolence() { - return violence; + public AzureContentSafety getConfig() { + return config; } /** - * Set the violence of this {@link FilterConfig} instance. + * Set the config of this {@link FilterConfig} instance. * - * @param violence The violence of this {@link FilterConfig} + * @param config The config of this {@link FilterConfig} */ - public void setViolence(@Nonnull final AzureThreshold violence) { - this.violence = violence; + public void setConfig(@Nonnull final AzureContentSafety config) { + this.config = config; } /** @@ -218,15 +203,13 @@ public boolean equals(@Nullable final java.lang.Object o) { } final FilterConfig filterConfig = (FilterConfig) o; return Objects.equals(this.cloudSdkCustomFields, filterConfig.cloudSdkCustomFields) - && Objects.equals(this.hate, filterConfig.hate) - && Objects.equals(this.selfHarm, filterConfig.selfHarm) - && Objects.equals(this.sexual, filterConfig.sexual) - && Objects.equals(this.violence, filterConfig.violence); + && Objects.equals(this.type, filterConfig.type) + && Objects.equals(this.config, filterConfig.config); } @Override public int hashCode() { - return Objects.hash(hate, selfHarm, sexual, violence, cloudSdkCustomFields); + return Objects.hash(type, config, cloudSdkCustomFields); } @Override @@ -234,10 +217,8 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class FilterConfig {\n"); - sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); - sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); - sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); - sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -255,8 +236,22 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link FilterConfig} instance. No arguments are required. */ - public static FilterConfig create() { - return new FilterConfig(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link FilterConfig} instance + * with all required arguments. + */ + public static Builder create() { + return (type) -> new FilterConfig().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link FilterConfig} instance. + * + * @param type String represents name of the filter provider + * @return The FilterConfig instance. + */ + FilterConfig type(@Nonnull final TypeEnum type); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringConfig.java index a41ebe05..501ad1bb 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringConfig.java @@ -33,7 +33,7 @@ public class FilteringConfig // CHECKSTYLE:ON { @JsonProperty("filters") - private List filters = new ArrayList<>(); + private List filters = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -43,11 +43,12 @@ protected FilteringConfig() {} /** * Set the filters of this {@link FilteringConfig} instance and return the same instance. * - * @param filters Filters to be used + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering or output filtering). * @return The same instance of this {@link FilteringConfig} class */ @Nonnull - public FilteringConfig filters(@Nonnull final List filters) { + public FilteringConfig filters(@Nonnull final List filters) { this.filters = filters; return this; } @@ -59,7 +60,7 @@ public FilteringConfig filters(@Nonnull final List filters) { * @return The same instance of type {@link FilteringConfig} */ @Nonnull - public FilteringConfig addFiltersItem(@Nonnull final Filter filtersItem) { + public FilteringConfig addFiltersItem(@Nonnull final FilterConfig filtersItem) { if (this.filters == null) { this.filters = new ArrayList<>(); } @@ -68,21 +69,23 @@ public FilteringConfig addFiltersItem(@Nonnull final Filter filtersItem) { } /** - * Filters to be used + * Configuration for content filtering services that should be used for the given filtering step + * (input filtering or output filtering). * * @return filters The filters of this {@link FilteringConfig} instance. */ @Nonnull - public List getFilters() { + public List getFilters() { return filters; } /** * Set the filters of this {@link FilteringConfig} instance. * - * @param filters Filters to be used + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering or output filtering). */ - public void setFilters(@Nonnull final List filters) { + public void setFilters(@Nonnull final List filters) { this.filters = filters; } @@ -178,18 +181,20 @@ public interface Builder { /** * Set the filters of this {@link FilteringConfig} instance. * - * @param filters Filters to be used + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering or output filtering). * @return The FilteringConfig instance. */ - FilteringConfig filters(@Nonnull final List filters); + FilteringConfig filters(@Nonnull final List filters); /** * Set the filters of this {@link FilteringConfig} instance. * - * @param filters Filters to be used + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering or output filtering). * @return The FilteringConfig instance. */ - default FilteringConfig filters(@Nonnull final Filter... filters) { + default FilteringConfig filters(@Nonnull final FilterConfig... filters) { return filters(Arrays.asList(filters)); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringModuleConfig.java index 30b2d584..40bd50b5 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/FilteringModuleConfig.java @@ -43,7 +43,7 @@ protected FilteringModuleConfig() {} /** * Set the input of this {@link FilteringModuleConfig} instance and return the same instance. * - * @param input The input of this {@link FilteringModuleConfig} + * @param input List of provider type and filters * @return The same instance of this {@link FilteringModuleConfig} class */ @Nonnull @@ -53,7 +53,7 @@ public FilteringModuleConfig input(@Nonnull final FilteringConfig input) { } /** - * Get input + * List of provider type and filters * * @return input The input of this {@link FilteringModuleConfig} instance. */ @@ -65,7 +65,7 @@ public FilteringConfig getInput() { /** * Set the input of this {@link FilteringModuleConfig} instance. * - * @param input The input of this {@link FilteringModuleConfig} + * @param input List of provider type and filters */ public void setInput(@Nonnull final FilteringConfig input) { this.input = input; @@ -74,7 +74,7 @@ public void setInput(@Nonnull final FilteringConfig input) { /** * Set the output of this {@link FilteringModuleConfig} instance and return the same instance. * - * @param output The output of this {@link FilteringModuleConfig} + * @param output List of provider type and filters * @return The same instance of this {@link FilteringModuleConfig} class */ @Nonnull @@ -84,7 +84,7 @@ public FilteringModuleConfig output(@Nonnull final FilteringConfig output) { } /** - * Get output + * List of provider type and filters * * @return output The output of this {@link FilteringModuleConfig} instance. */ @@ -96,7 +96,7 @@ public FilteringConfig getOutput() { /** * Set the output of this {@link FilteringModuleConfig} instance. * - * @param output The output of this {@link FilteringModuleConfig} + * @param output List of provider type and filters */ public void setOutput(@Nonnull final FilteringConfig output) { this.output = output; diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/GroundingModuleConfigGroundingServiceConfiguration.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/GroundingModuleConfigGroundingServiceConfiguration.java index 7573c36c..379561b0 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/GroundingModuleConfigGroundingServiceConfiguration.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/GroundingModuleConfigGroundingServiceConfiguration.java @@ -32,9 +32,6 @@ public class GroundingModuleConfigGroundingServiceConfiguration // CHECKSTYLE:ON { - @JsonProperty("secret_name") - private String secretName; - @JsonProperty("filters") private List filters = new ArrayList<>(); @@ -49,44 +46,6 @@ public class GroundingModuleConfigGroundingServiceConfiguration protected GroundingModuleConfigGroundingServiceConfiguration() {} - /** - * Set the secretName of this {@link GroundingModuleConfigGroundingServiceConfiguration} instance - * and return the same instance. - * - * @param secretName Secret name of the generic secret within Gen AI Hub containing document - * grounding service credentials - * @return The same instance of this {@link GroundingModuleConfigGroundingServiceConfiguration} - * class - */ - @Nonnull - public GroundingModuleConfigGroundingServiceConfiguration secretName( - @Nonnull final String secretName) { - this.secretName = secretName; - return this; - } - - /** - * Secret name of the generic secret within Gen AI Hub containing document grounding service - * credentials - * - * @return secretName The secretName of this {@link - * GroundingModuleConfigGroundingServiceConfiguration} instance. - */ - @Nonnull - public String getSecretName() { - return secretName; - } - - /** - * Set the secretName of this {@link GroundingModuleConfigGroundingServiceConfiguration} instance. - * - * @param secretName Secret name of the generic secret within Gen AI Hub containing document - * grounding service credentials - */ - public void setSecretName(@Nonnull final String secretName) { - this.secretName = secretName; - } - /** * Set the filters of this {@link GroundingModuleConfigGroundingServiceConfiguration} instance and * return the same instance. @@ -287,8 +246,6 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals( this.cloudSdkCustomFields, groundingModuleConfigGroundingServiceConfiguration.cloudSdkCustomFields) - && Objects.equals( - this.secretName, groundingModuleConfigGroundingServiceConfiguration.secretName) && Objects.equals(this.filters, groundingModuleConfigGroundingServiceConfiguration.filters) && Objects.equals( this.groundingInputParameters, @@ -301,11 +258,7 @@ public boolean equals(@Nullable final java.lang.Object o) { @Override public int hashCode() { return Objects.hash( - secretName, - filters, - groundingInputParameters, - groundingOutputParameter, - cloudSdkCustomFields); + filters, groundingInputParameters, groundingOutputParameter, cloudSdkCustomFields); } @Override @@ -313,7 +266,6 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class GroundingModuleConfigGroundingServiceConfiguration {\n"); - sb.append(" secretName: ").append(toIndentedString(secretName)).append("\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); sb.append(" groundingInputParameters: ") .append(toIndentedString(groundingInputParameters)) @@ -343,30 +295,15 @@ private String toIndentedString(final java.lang.Object o) { * GroundingModuleConfigGroundingServiceConfiguration} instance with all required arguments. */ public static Builder create() { - return (secretName) -> - (groundingInputParameters) -> - (groundingOutputParameter) -> - new GroundingModuleConfigGroundingServiceConfiguration() - .secretName(secretName) - .groundingInputParameters(groundingInputParameters) - .groundingOutputParameter(groundingOutputParameter); + return (groundingInputParameters) -> + (groundingOutputParameter) -> + new GroundingModuleConfigGroundingServiceConfiguration() + .groundingInputParameters(groundingInputParameters) + .groundingOutputParameter(groundingOutputParameter); } /** Builder helper class. */ public interface Builder { - /** - * Set the secretName of this {@link GroundingModuleConfigGroundingServiceConfiguration} - * instance. - * - * @param secretName Secret name of the generic secret within Gen AI Hub containing document - * grounding service credentials - * @return The GroundingModuleConfigGroundingServiceConfiguration builder. - */ - Builder1 secretName(@Nonnull final String secretName); - } - - /** Builder helper class. */ - public interface Builder1 { /** * Set the groundingInputParameters of this {@link * GroundingModuleConfigGroundingServiceConfiguration} instance. @@ -375,7 +312,7 @@ public interface Builder1 { * questions * @return The GroundingModuleConfigGroundingServiceConfiguration builder. */ - Builder2 groundingInputParameters(@Nonnull final List groundingInputParameters); + Builder1 groundingInputParameters(@Nonnull final List groundingInputParameters); /** * Set the groundingInputParameters of this {@link @@ -385,13 +322,13 @@ public interface Builder1 { * questions * @return The GroundingModuleConfigGroundingServiceConfiguration builder. */ - default Builder2 groundingInputParameters(@Nonnull final String... groundingInputParameters) { + default Builder1 groundingInputParameters(@Nonnull final String... groundingInputParameters) { return groundingInputParameters(Arrays.asList(groundingInputParameters)); } } /** Builder helper class. */ - public interface Builder2 { + public interface Builder1 { /** * Set the groundingOutputParameter of this {@link * GroundingModuleConfigGroundingServiceConfiguration} instance. diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/LLMChoice.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/LLMChoice.java index 0ea077d4..50b8755c 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/LLMChoice.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/LLMChoice.java @@ -160,7 +160,10 @@ public void setLogprobs(@Nonnull final Map> logprobs) { /** * Set the finishReason of this {@link LLMChoice} instance and return the same instance. * - * @param finishReason Reason for stopping the model + * @param finishReason Reason the model stopped generating tokens. 'stop' if the model hit + * a natural stop point or a provided stop sequence, 'length' if the maximum token + * number was reached, 'content_filter' if content was omitted due to a filter + * enforced by the LLM model provider or the content filtering module * @return The same instance of this {@link LLMChoice} class */ @Nonnull @@ -170,7 +173,10 @@ public LLMChoice finishReason(@Nonnull final String finishReason) { } /** - * Reason for stopping the model + * Reason the model stopped generating tokens. 'stop' if the model hit a natural stop + * point or a provided stop sequence, 'length' if the maximum token number was reached, + * 'content_filter' if content was omitted due to a filter enforced by the LLM model + * provider or the content filtering module * * @return finishReason The finishReason of this {@link LLMChoice} instance. */ @@ -182,7 +188,10 @@ public String getFinishReason() { /** * Set the finishReason of this {@link LLMChoice} instance. * - * @param finishReason Reason for stopping the model + * @param finishReason Reason the model stopped generating tokens. 'stop' if the model hit + * a natural stop point or a provided stop sequence, 'length' if the maximum token + * number was reached, 'content_filter' if content was omitted due to a filter + * enforced by the LLM model provider or the content filtering module */ public void setFinishReason(@Nonnull final String finishReason) { this.finishReason = finishReason; @@ -311,7 +320,10 @@ public interface Builder2 { /** * Set the finishReason of this {@link LLMChoice} instance. * - * @param finishReason Reason for stopping the model + * @param finishReason Reason the model stopped generating tokens. 'stop' if the model + * hit a natural stop point or a provided stop sequence, 'length' if the maximum + * token number was reached, 'content_filter' if content was omitted due to a filter + * enforced by the LLM model provider or the content filtering module * @return The LLMChoice instance. */ LLMChoice finishReason(@Nonnull final String finishReason); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Masking.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Masking.java deleted file mode 100644 index 03d213a4..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/Masking.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.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; - -/** Masking */ -// CHECKSTYLE:OFF -public class Masking -// CHECKSTYLE:ON -{ - @JsonProperty("type") - private MaskingProviderType type; - - @JsonProperty("entities") - private List entities = new ArrayList<>(); - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - protected Masking() {} - - /** - * Set the type of this {@link Masking} instance and return the same instance. - * - * @param type The type of this {@link Masking} - * @return The same instance of this {@link Masking} class - */ - @Nonnull - public Masking type(@Nonnull final MaskingProviderType type) { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link Masking} instance. - */ - @Nonnull - public MaskingProviderType getType() { - return type; - } - - /** - * Set the type of this {@link Masking} instance. - * - * @param type The type of this {@link Masking} - */ - public void setType(@Nonnull final MaskingProviderType type) { - this.type = type; - } - - /** - * Set the entities of this {@link Masking} instance and return the same instance. - * - * @param entities List of entities to be masked - * @return The same instance of this {@link Masking} class - */ - @Nonnull - public Masking entities(@Nonnull final List entities) { - this.entities = entities; - return this; - } - - /** - * Add one entities instance to this {@link Masking}. - * - * @param entitiesItem The entities that should be added - * @return The same instance of type {@link Masking} - */ - @Nonnull - public Masking addEntitiesItem(@Nonnull final MaskingEntitiesInner entitiesItem) { - if (this.entities == null) { - this.entities = new ArrayList<>(); - } - this.entities.add(entitiesItem); - return this; - } - - /** - * List of entities to be masked - * - * @return entities The entities of this {@link Masking} instance. - */ - @Nonnull - public List getEntities() { - return entities; - } - - /** - * Set the entities of this {@link Masking} instance. - * - * @param entities List of entities to be masked - */ - public void setEntities(@Nonnull final List entities) { - this.entities = entities; - } - - /** - * Get the names of the unrecognizable properties of the {@link Masking}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link Masking} instance. - * - * @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 - public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { - if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("Masking has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Set an unrecognizable property of this {@link Masking} 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 Masking masking = (Masking) o; - return Objects.equals(this.cloudSdkCustomFields, masking.cloudSdkCustomFields) - && Objects.equals(this.type, masking.type) - && Objects.equals(this.entities, masking.entities); - } - - @Override - public int hashCode() { - return Objects.hash(type, entities, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class Masking {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" entities: ").append(toIndentedString(entities)).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 Masking} instance with - * all required arguments. - */ - public static Builder create() { - return (type) -> (entities) -> new Masking().type(type).entities(entities); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the type of this {@link Masking} instance. - * - * @param type The type of this {@link Masking} - * @return The Masking builder. - */ - Builder1 type(@Nonnull final MaskingProviderType type); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the entities of this {@link Masking} instance. - * - * @param entities List of entities to be masked - * @return The Masking instance. - */ - Masking entities(@Nonnull final List entities); - - /** - * Set the entities of this {@link Masking} instance. - * - * @param entities List of entities to be masked - * @return The Masking instance. - */ - default Masking entities(@Nonnull final MaskingEntitiesInner... entities) { - return entities(Arrays.asList(entities)); - } - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingEntitiesInner.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingEntitiesInner.java deleted file mode 100644 index cf64cac2..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingEntitiesInner.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.model; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -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; - -/** MaskingEntitiesInner */ -// CHECKSTYLE:OFF -public class MaskingEntitiesInner -// CHECKSTYLE:ON -{ - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - protected MaskingEntitiesInner() {} - - /** - * Get the names of the unrecognizable properties of the {@link MaskingEntitiesInner}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MaskingEntitiesInner} instance. - * - * @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 - public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { - if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException( - "MaskingEntitiesInner has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Set an unrecognizable property of this {@link MaskingEntitiesInner} 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 MaskingEntitiesInner maskingEntitiesInner = (MaskingEntitiesInner) o; - return Objects.equals(this.cloudSdkCustomFields, maskingEntitiesInner.cloudSdkCustomFields); - } - - @Override - public int hashCode() { - return Objects.hash(cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class MaskingEntitiesInner {\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 MaskingEntitiesInner} instance. No arguments are required. */ - public static MaskingEntitiesInner create() { - return new MaskingEntitiesInner(); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingModuleConfig.java index 08b024a4..01f2fd64 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingModuleConfig.java @@ -32,11 +32,8 @@ public class MaskingModuleConfig // CHECKSTYLE:ON { - @JsonProperty("masking") - private List masking = new ArrayList<>(); - - @JsonProperty("unmasking") - private UnmaskingConfig unmasking; + @JsonProperty("masking_providers") + private List maskingProviders = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -44,80 +41,52 @@ public class MaskingModuleConfig protected MaskingModuleConfig() {} /** - * Set the masking of this {@link MaskingModuleConfig} instance and return the same instance. + * Set the maskingProviders of this {@link MaskingModuleConfig} instance and return the same + * instance. * - * @param masking Masking services to be used + * @param maskingProviders List of masking service providers * @return The same instance of this {@link MaskingModuleConfig} class */ @Nonnull - public MaskingModuleConfig masking(@Nonnull final List masking) { - this.masking = masking; + public MaskingModuleConfig maskingProviders( + @Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; return this; } /** - * Add one masking instance to this {@link MaskingModuleConfig}. + * Add one maskingProviders instance to this {@link MaskingModuleConfig}. * - * @param maskingItem The masking that should be added + * @param maskingProvidersItem The maskingProviders that should be added * @return The same instance of type {@link MaskingModuleConfig} */ @Nonnull - public MaskingModuleConfig addMaskingItem(@Nonnull final Masking maskingItem) { - if (this.masking == null) { - this.masking = new ArrayList<>(); + public MaskingModuleConfig addMaskingProvidersItem( + @Nonnull final MaskingProviderConfig maskingProvidersItem) { + if (this.maskingProviders == null) { + this.maskingProviders = new ArrayList<>(); } - this.masking.add(maskingItem); - return this; - } - - /** - * Masking services to be used - * - * @return masking The masking of this {@link MaskingModuleConfig} instance. - */ - @Nonnull - public List getMasking() { - return masking; - } - - /** - * Set the masking of this {@link MaskingModuleConfig} instance. - * - * @param masking Masking services to be used - */ - public void setMasking(@Nonnull final List masking) { - this.masking = masking; - } - - /** - * Set the unmasking of this {@link MaskingModuleConfig} instance and return the same instance. - * - * @param unmasking The unmasking of this {@link MaskingModuleConfig} - * @return The same instance of this {@link MaskingModuleConfig} class - */ - @Nonnull - public MaskingModuleConfig unmasking(@Nonnull final UnmaskingConfig unmasking) { - this.unmasking = unmasking; + this.maskingProviders.add(maskingProvidersItem); return this; } /** - * Get unmasking + * List of masking service providers * - * @return unmasking The unmasking of this {@link MaskingModuleConfig} instance. + * @return maskingProviders The maskingProviders of this {@link MaskingModuleConfig} instance. */ @Nonnull - public UnmaskingConfig getUnmasking() { - return unmasking; + public List getMaskingProviders() { + return maskingProviders; } /** - * Set the unmasking of this {@link MaskingModuleConfig} instance. + * Set the maskingProviders of this {@link MaskingModuleConfig} instance. * - * @param unmasking The unmasking of this {@link MaskingModuleConfig} + * @param maskingProviders List of masking service providers */ - public void setUnmasking(@Nonnull final UnmaskingConfig unmasking) { - this.unmasking = unmasking; + public void setMaskingProviders(@Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; } /** @@ -169,13 +138,12 @@ public boolean equals(@Nullable final java.lang.Object o) { } final MaskingModuleConfig maskingModuleConfig = (MaskingModuleConfig) o; return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.masking, maskingModuleConfig.masking) - && Objects.equals(this.unmasking, maskingModuleConfig.unmasking); + && Objects.equals(this.maskingProviders, maskingModuleConfig.maskingProviders); } @Override public int hashCode() { - return Objects.hash(masking, unmasking, cloudSdkCustomFields); + return Objects.hash(maskingProviders, cloudSdkCustomFields); } @Override @@ -183,8 +151,7 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class MaskingModuleConfig {\n"); - sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); - sb.append(" unmasking: ").append(toIndentedString(unmasking)).append("\n"); + sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -207,27 +174,29 @@ private String toIndentedString(final java.lang.Object o) { * instance with all required arguments. */ public static Builder create() { - return (masking) -> new MaskingModuleConfig().masking(masking); + return (maskingProviders) -> new MaskingModuleConfig().maskingProviders(maskingProviders); } /** Builder helper class. */ public interface Builder { /** - * Set the masking of this {@link MaskingModuleConfig} instance. + * Set the maskingProviders of this {@link MaskingModuleConfig} instance. * - * @param masking Masking services to be used + * @param maskingProviders List of masking service providers * @return The MaskingModuleConfig instance. */ - MaskingModuleConfig masking(@Nonnull final List masking); + MaskingModuleConfig maskingProviders( + @Nonnull final List maskingProviders); /** - * Set the masking of this {@link MaskingModuleConfig} instance. + * Set the maskingProviders of this {@link MaskingModuleConfig} instance. * - * @param masking Masking services to be used + * @param maskingProviders List of masking service providers * @return The MaskingModuleConfig instance. */ - default MaskingModuleConfig masking(@Nonnull final Masking... masking) { - return masking(Arrays.asList(masking)); + default MaskingModuleConfig maskingProviders( + @Nonnull final MaskingProviderConfig... maskingProviders) { + return maskingProviders(Arrays.asList(maskingProviders)); } } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderConfig.java new file mode 100644 index 00000000..cbfc8b7b --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderConfig.java @@ -0,0 +1,400 @@ +/* + * Internal Orchestration Service API + * SAP AI Core - Orchestration Service API + * + * The version of the OpenAPI document: 0.0.1 + * + * + * 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.orchestration.client.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.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; + +/** MaskingProviderConfig */ +// CHECKSTYLE:OFF +public class MaskingProviderConfig +// CHECKSTYLE:ON +{ + /** Type of masking service provider */ + public enum TypeEnum { + /** The SAP_DATA_PRIVACY_INTEGRATION option of this MaskingProviderConfig */ + SAP_DATA_PRIVACY_INTEGRATION("sap_data_privacy_integration"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type MaskingProviderConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("type") + private TypeEnum type; + + /** Type of masking method to be used */ + public enum MethodEnum { + /** The ANONYMIZATION option of this MaskingProviderConfig */ + ANONYMIZATION("anonymization"), + + /** The PSEUDONYMIZATION option of this MaskingProviderConfig */ + PSEUDONYMIZATION("pseudonymization"); + + private String value; + + MethodEnum(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 MaskingProviderConfig + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonProperty("entities") + private List entities = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + protected MaskingProviderConfig() {} + + /** + * Set the type of this {@link MaskingProviderConfig} instance and return the same instance. + * + * @param type Type of masking service provider + * @return The same instance of this {@link MaskingProviderConfig} class + */ + @Nonnull + public MaskingProviderConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of masking service provider + * + * @return type The type of this {@link MaskingProviderConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link MaskingProviderConfig} instance. + * + * @param type Type of masking service provider + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the method of this {@link MaskingProviderConfig} instance and return the same instance. + * + * @param method Type of masking method to be used + * @return The same instance of this {@link MaskingProviderConfig} class + */ + @Nonnull + public MaskingProviderConfig method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Type of masking method to be used + * + * @return method The method of this {@link MaskingProviderConfig} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link MaskingProviderConfig} instance. + * + * @param method Type of masking method to be used + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Set the entities of this {@link MaskingProviderConfig} instance and return the same instance. + * + * @param entities List of entities to be masked + * @return The same instance of this {@link MaskingProviderConfig} class + */ + @Nonnull + public MaskingProviderConfig entities(@Nonnull final List entities) { + this.entities = entities; + return this; + } + + /** + * Add one entities instance to this {@link MaskingProviderConfig}. + * + * @param entitiesItem The entities that should be added + * @return The same instance of type {@link MaskingProviderConfig} + */ + @Nonnull + public MaskingProviderConfig addEntitiesItem(@Nonnull final DPIEntityConfig entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * List of entities to be masked + * + * @return entities The entities of this {@link MaskingProviderConfig} instance. + */ + @Nonnull + public List getEntities() { + return entities; + } + + /** + * Set the entities of this {@link MaskingProviderConfig} instance. + * + * @param entities List of entities to be masked + */ + public void setEntities(@Nonnull final List entities) { + this.entities = entities; + } + + /** + * Get the names of the unrecognizable properties of the {@link MaskingProviderConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingProviderConfig} instance. + * + * @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 + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MaskingProviderConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Set an unrecognizable property of this {@link MaskingProviderConfig} 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 MaskingProviderConfig maskingProviderConfig = (MaskingProviderConfig) o; + return Objects.equals(this.cloudSdkCustomFields, maskingProviderConfig.cloudSdkCustomFields) + && Objects.equals(this.type, maskingProviderConfig.type) + && Objects.equals(this.method, maskingProviderConfig.method) + && Objects.equals(this.entities, maskingProviderConfig.entities); + } + + @Override + public int hashCode() { + return Objects.hash(type, method, entities, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingProviderConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).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 MaskingProviderConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> + (method) -> + (entities) -> new MaskingProviderConfig().type(type).method(method).entities(entities); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link MaskingProviderConfig} instance. + * + * @param type Type of masking service provider + * @return The MaskingProviderConfig builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the method of this {@link MaskingProviderConfig} instance. + * + * @param method Type of masking method to be used + * @return The MaskingProviderConfig builder. + */ + Builder2 method(@Nonnull final MethodEnum method); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the entities of this {@link MaskingProviderConfig} instance. + * + * @param entities List of entities to be masked + * @return The MaskingProviderConfig instance. + */ + MaskingProviderConfig entities(@Nonnull final List entities); + + /** + * Set the entities of this {@link MaskingProviderConfig} instance. + * + * @param entities List of entities to be masked + * @return The MaskingProviderConfig instance. + */ + default MaskingProviderConfig entities(@Nonnull final DPIEntityConfig... entities) { + return entities(Arrays.asList(entities)); + } + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderType.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderType.java deleted file mode 100644 index 34333873..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/MaskingProviderType.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import javax.annotation.Nonnull; - -/** Gets or Sets MaskingProviderType */ -public enum MaskingProviderType { - DATA_PRIVACY_INTEGRATION("data_privacy_integration"), - - MS_PRESIDIO("ms_presidio"); - - private final String value; - - MaskingProviderType(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 MaskingProviderType fromValue(@Nonnull final String value) { - for (final MaskingProviderType b : MaskingProviderType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ModuleResults.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ModuleResults.java index 447e2d03..13ffd6bf 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ModuleResults.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ModuleResults.java @@ -50,7 +50,7 @@ public class ModuleResults private GenericModuleResult outputFiltering; @JsonProperty("output_unmasking") - private GenericModuleResult outputUnmasking; + private List outputUnmasking = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -265,18 +265,33 @@ public void setOutputFiltering(@Nonnull final GenericModuleResult outputFilterin * @return The same instance of this {@link ModuleResults} class */ @Nonnull - public ModuleResults outputUnmasking(@Nonnull final GenericModuleResult outputUnmasking) { + public ModuleResults outputUnmasking(@Nonnull final List outputUnmasking) { this.outputUnmasking = outputUnmasking; return this; } + /** + * Add one outputUnmasking instance to this {@link ModuleResults}. + * + * @param outputUnmaskingItem The outputUnmasking that should be added + * @return The same instance of type {@link ModuleResults} + */ + @Nonnull + public ModuleResults addOutputUnmaskingItem(@Nonnull final LLMChoice outputUnmaskingItem) { + if (this.outputUnmasking == null) { + this.outputUnmasking = new ArrayList<>(); + } + this.outputUnmasking.add(outputUnmaskingItem); + return this; + } + /** * Get outputUnmasking * * @return outputUnmasking The outputUnmasking of this {@link ModuleResults} instance. */ @Nonnull - public GenericModuleResult getOutputUnmasking() { + public List getOutputUnmasking() { return outputUnmasking; } @@ -285,7 +300,7 @@ public GenericModuleResult getOutputUnmasking() { * * @param outputUnmasking The outputUnmasking of this {@link ModuleResults} */ - public void setOutputUnmasking(@Nonnull final GenericModuleResult outputUnmasking) { + public void setOutputUnmasking(@Nonnull final List outputUnmasking) { this.outputUnmasking = outputUnmasking; } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/PresidioEntities.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/PresidioEntities.java deleted file mode 100644 index c474ac4d..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/PresidioEntities.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import javax.annotation.Nonnull; - -/** Gets or Sets PresidioEntities */ -public enum PresidioEntities { - URL("URL"); - - private final String value; - - PresidioEntities(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 PresidioEntities fromValue(@Nonnull final String value) { - for (final PresidioEntities b : PresidioEntities.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ProviderType.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ProviderType.java deleted file mode 100644 index 9961b52e..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ProviderType.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import javax.annotation.Nonnull; - -/** Gets or Sets ProviderType */ -public enum ProviderType { - AZURE_CONTENT_SAFETY("azure_content_safety"); - - private final String value; - - ProviderType(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 ProviderType fromValue(@Nonnull final String value) { - for (final ProviderType b : ProviderType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfig.java deleted file mode 100644 index e1472f5f..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfig.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.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; - -/** UnmaskingConfig */ -// CHECKSTYLE:OFF -public class UnmaskingConfig -// CHECKSTYLE:ON -{ - @JsonProperty("entities") - private List entities = new ArrayList<>(); - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - protected UnmaskingConfig() {} - - /** - * Set the entities of this {@link UnmaskingConfig} instance and return the same instance. - * - * @param entities List of entities to be unmasked - * @return The same instance of this {@link UnmaskingConfig} class - */ - @Nonnull - public UnmaskingConfig entities(@Nonnull final List entities) { - this.entities = entities; - return this; - } - - /** - * Add one entities instance to this {@link UnmaskingConfig}. - * - * @param entitiesItem The entities that should be added - * @return The same instance of type {@link UnmaskingConfig} - */ - @Nonnull - public UnmaskingConfig addEntitiesItem(@Nonnull final UnmaskingConfigEntitiesInner entitiesItem) { - if (this.entities == null) { - this.entities = new ArrayList<>(); - } - this.entities.add(entitiesItem); - return this; - } - - /** - * List of entities to be unmasked - * - * @return entities The entities of this {@link UnmaskingConfig} instance. - */ - @Nonnull - public List getEntities() { - return entities; - } - - /** - * Set the entities of this {@link UnmaskingConfig} instance. - * - * @param entities List of entities to be unmasked - */ - public void setEntities(@Nonnull final List entities) { - this.entities = entities; - } - - /** - * Get the names of the unrecognizable properties of the {@link UnmaskingConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link UnmaskingConfig} instance. - * - * @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 - public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { - if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("UnmaskingConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Set an unrecognizable property of this {@link UnmaskingConfig} 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 UnmaskingConfig unmaskingConfig = (UnmaskingConfig) o; - return Objects.equals(this.cloudSdkCustomFields, unmaskingConfig.cloudSdkCustomFields) - && Objects.equals(this.entities, unmaskingConfig.entities); - } - - @Override - public int hashCode() { - return Objects.hash(entities, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class UnmaskingConfig {\n"); - sb.append(" entities: ").append(toIndentedString(entities)).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 UnmaskingConfig} - * instance with all required arguments. - */ - public static Builder create() { - return (entities) -> new UnmaskingConfig().entities(entities); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the entities of this {@link UnmaskingConfig} instance. - * - * @param entities List of entities to be unmasked - * @return The UnmaskingConfig instance. - */ - UnmaskingConfig entities(@Nonnull final List entities); - - /** - * Set the entities of this {@link UnmaskingConfig} instance. - * - * @param entities List of entities to be unmasked - * @return The UnmaskingConfig instance. - */ - default UnmaskingConfig entities(@Nonnull final UnmaskingConfigEntitiesInner... entities) { - return entities(Arrays.asList(entities)); - } - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfigEntitiesInner.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfigEntitiesInner.java deleted file mode 100644 index c9f4249a..00000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/UnmaskingConfigEntitiesInner.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Internal Orchestration Service API - * SAP AI Core - Orchestration Service API - * - * The version of the OpenAPI document: 0.0.1 - * - * - * 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.orchestration.client.model; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -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; - -/** UnmaskingConfigEntitiesInner */ -// CHECKSTYLE:OFF -public class UnmaskingConfigEntitiesInner -// CHECKSTYLE:ON -{ - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - protected UnmaskingConfigEntitiesInner() {} - - /** - * Get the names of the unrecognizable properties of the {@link UnmaskingConfigEntitiesInner}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link UnmaskingConfigEntitiesInner} - * instance. - * - * @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 - public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { - if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException( - "UnmaskingConfigEntitiesInner has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Set an unrecognizable property of this {@link UnmaskingConfigEntitiesInner} 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 UnmaskingConfigEntitiesInner unmaskingConfigEntitiesInner = - (UnmaskingConfigEntitiesInner) o; - return Objects.equals( - this.cloudSdkCustomFields, unmaskingConfigEntitiesInner.cloudSdkCustomFields); - } - - @Override - public int hashCode() { - return Objects.hash(cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class UnmaskingConfigEntitiesInner {\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 UnmaskingConfigEntitiesInner} instance. No arguments are required. */ - public static UnmaskingConfigEntitiesInner create() { - return new UnmaskingConfigEntitiesInner(); - } -} diff --git a/orchestration/src/main/resources/spec/orchestration.yaml b/orchestration/src/main/resources/spec/orchestration.yaml index 39c90b77..f19aee51 100644 --- a/orchestration/src/main/resources/spec/orchestration.yaml +++ b/orchestration/src/main/resources/spec/orchestration.yaml @@ -8,7 +8,7 @@ info: version: 0.0.1 servers: - - url: "/v1" + - url: '/v1' tags: - name: Orchestrated Completion @@ -25,18 +25,18 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/CompletionPostRequest" + $ref: '#/components/schemas/CompletionPostRequest' responses: 200: - description: "Successful response" + description: 'Successful response' content: application/json: schema: - $ref: "#/components/schemas/CompletionPostResponse" + $ref: '#/components/schemas/CompletionPostResponse' 400: - $ref: "#/components/responses/BadRequest" + $ref: '#/components/responses/BadRequest' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /healthz: get: @@ -44,15 +44,15 @@ paths: - OrchestrationHealthz operationId: orchestration.v1.endpoints.healthz responses: - "200": - description: "Service is up and running." + '200': + description: 'Service is up and running.' content: text/plain: schema: type: string - example: "OK" - "503": - description: "Service is unavailable." + example: 'OK' + '503': + description: 'Service is unavailable.' content: application/json: schema: @@ -60,7 +60,7 @@ paths: properties: status: type: string - example: "Service Unavailable" + example: 'Service Unavailable' components: schemas: @@ -68,23 +68,25 @@ components: type: object required: - orchestration_config - - input_params properties: orchestration_config: - $ref: "#/components/schemas/OrchestrationConfig" + $ref: '#/components/schemas/OrchestrationConfig' input_params: type: object + example: + groundingInput: 'What is SAP Joule?' + inputContext: 'optimizing supply chain management' additionalProperties: type: string messages_history: allOf: - - $ref: "#/components/schemas/ChatMessages" + - $ref: '#/components/schemas/ChatMessages' description: History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message ChatMessages: type: array items: - $ref: "#/components/schemas/ChatMessage" + $ref: '#/components/schemas/ChatMessage' ChatMessage: type: object @@ -94,8 +96,10 @@ components: properties: role: type: string + example: user content: type: string + example: 'What is SAP S/4HANA?' CompletionPostResponse: type: object @@ -107,10 +111,11 @@ components: request_id: description: ID of the request type: string + example: 'd4a67ea1-2bf9-4df7-8105-d48203ccff76' module_results: - $ref: "#/components/schemas/ModuleResults" + $ref: '#/components/schemas/ModuleResults' orchestration_result: - $ref: "#/components/schemas/LLMModuleResult" + $ref: '#/components/schemas/LLMModuleResult' OrchestrationConfig: type: object @@ -118,7 +123,7 @@ components: - module_configurations properties: module_configurations: - $ref: "#/components/schemas/ModuleConfigs" + $ref: '#/components/schemas/ModuleConfigs' ModuleConfigs: type: object @@ -127,15 +132,15 @@ components: - templating_module_config properties: llm_module_config: - $ref: "#/components/schemas/LLMModuleConfig" + $ref: '#/components/schemas/LLMModuleConfig' templating_module_config: - $ref: "#/components/schemas/TemplatingModuleConfig" + $ref: '#/components/schemas/TemplatingModuleConfig' filtering_module_config: - $ref: "#/components/schemas/FilteringModuleConfig" + $ref: '#/components/schemas/FilteringModuleConfig' masking_module_config: - $ref: "#/components/schemas/MaskingModuleConfig" + $ref: '#/components/schemas/MaskingModuleConfig' grounding_module_config: - $ref: "#/components/schemas/GroundingModuleConfig" + $ref: '#/components/schemas/GroundingModuleConfig' ModuleResults: description: Results of each module. @@ -143,19 +148,21 @@ components: additionalProperties: false properties: grounding: - $ref: "#/components/schemas/GenericModuleResult" + $ref: '#/components/schemas/GenericModuleResult' templating: - $ref: "#/components/schemas/ChatMessages" + $ref: '#/components/schemas/ChatMessages' input_masking: - $ref: "#/components/schemas/GenericModuleResult" + $ref: '#/components/schemas/GenericModuleResult' input_filtering: - $ref: "#/components/schemas/GenericModuleResult" + $ref: '#/components/schemas/GenericModuleResult' llm: - $ref: "#/components/schemas/LLMModuleResult" + $ref: '#/components/schemas/LLMModuleResult' output_filtering: - $ref: "#/components/schemas/GenericModuleResult" + $ref: '#/components/schemas/GenericModuleResult' output_unmasking: - $ref: "#/components/schemas/GenericModuleResult" + type: array + items: + $ref: '#/components/schemas/LLMChoice' # --- LLM MODULE --- LLMModuleConfig: @@ -166,16 +173,21 @@ components: properties: model_name: description: Model name as in LLM Access configuration - example: gpt-4 + example: 'gpt-4' type: string model_params: description: Model parameters type: object + example: + max_tokens: 300 + temperature: 0.1 + frequency_penalty: 0 + presence_penalty: 0 + n: 2 model_version: description: Version of the model to use - example: 2023-05-15 type: string - default: "latest" + default: 'latest' GenericModuleResult: type: object @@ -186,6 +198,7 @@ components: message: type: string description: Some message created from the module + example: Input to LLM is masked successfully. data: type: object description: Additional data object from the module @@ -204,25 +217,30 @@ components: id: type: string description: ID of the response + example: 'chatcmpl-9rO0aLoPKY7RtqkWi1317bazHEVFr' object: type: string description: Object type + example: chat.completion created: type: integer description: Unix timestamp + example: 1722510700 model: type: string description: Model name + example: 'gpt-4' system_fingerprint: type: string description: System fingerprint + example: 'fp_44709d6fcb' choices: type: array description: Choices items: - $ref: "#/components/schemas/LLMChoice" + $ref: '#/components/schemas/LLMChoice' usage: - $ref: "#/components/schemas/TokenUsage" + $ref: '#/components/schemas/TokenUsage' LLMChoice: type: object @@ -234,8 +252,9 @@ components: index: type: integer description: Index of the choice + example: 0 message: - $ref: "#/components/schemas/ChatMessage" + $ref: '#/components/schemas/ChatMessage' logprobs: type: object description: Log probabilities @@ -245,7 +264,8 @@ components: type: number finish_reason: type: string - description: Reason for stopping the model + description: "Reason the model stopped generating tokens. 'stop' if the model hit a natural stop point or a provided stop sequence, 'length' if the maximum token number was reached, 'content_filter' if content was omitted due to a filter enforced by the LLM model provider or the content filtering module" + example: stop TokenUsage: type: object @@ -258,12 +278,15 @@ components: completion_tokens: type: integer description: Number of tokens used in the input + example: 20 prompt_tokens: type: integer description: Number of tokens used in the output + example: 30 total_tokens: type: integer description: Total number of tokens used + example: 50 # --- Templating Module --- @@ -274,23 +297,29 @@ components: properties: template: allOf: - - $ref: "#/components/schemas/ChatMessages" + - $ref: '#/components/schemas/ChatMessages' description: A chat message array to be formatted with values from input_params. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. - example: "{\n \"role\": \"user\",\n \"content\": \"input text: {​{ ?inputExample }}\"\n }" defaults: description: Optional default values for the template. If a parameter has no default it is required. - example: '{"context": "I am a default context"}' type: object + example: + template: + - role: user + content: 'How can the features of AI in SAP BTP specifially {{?groundingOutput}}, be applied to {{?inputContext}}' + defaults: + inputContext: The default text that will be used in the template if inputContext is not set # --- Filtering Module --- FilteringModuleConfig: type: object properties: input: - $ref: "#/components/schemas/FilteringConfig" + allOf: + - $ref: '#/components/schemas/FilteringConfig' description: List of provider type and filters output: - $ref: "#/components/schemas/FilteringConfig" + allOf: + - $ref: '#/components/schemas/FilteringConfig' description: List of provider type and filters additionalProperties: false @@ -300,40 +329,43 @@ components: - filters properties: filters: + description: Configuration for content filtering services that should be used for the given filtering step (input filtering or output filtering). type: array + minItems: 1 items: - $ref: "#/components/schemas/Filter" - description: Filters to be used + $ref: '#/components/schemas/FilterConfig' - Filter: + FilterConfig: + oneOf: + - $ref: '#/components/schemas/AzureContentSafetyFilterConfig' + + AzureContentSafetyFilterConfig: + type: object required: - type properties: type: - description: Type of filtering service provider - $ref: "#/components/schemas/ProviderType" + description: String represents name of the filter provider + type: string + enum: + - azure_content_safety + example: azure_content_safety config: - description: Filters classifiers to be used - type: object - oneOf: - - $ref: "#/components/schemas/AzureContentSafety" + $ref: '#/components/schemas/AzureContentSafety' AzureContentSafety: + description: Filter configuration for Azure Content Safety type: object + additionalProperties: false properties: - "Hate": - $ref: "#/components/schemas/AzureThreshold" - "SelfHarm": - $ref: "#/components/schemas/AzureThreshold" - "Sexual": - $ref: "#/components/schemas/AzureThreshold" - "Violence": - $ref: "#/components/schemas/AzureThreshold" - - ProviderType: - type: string - enum: - - azure_content_safety + 'Hate': + $ref: '#/components/schemas/AzureThreshold' + 'SelfHarm': + $ref: '#/components/schemas/AzureThreshold' + 'Sexual': + $ref: '#/components/schemas/AzureThreshold' + 'Violence': + $ref: '#/components/schemas/AzureThreshold' AzureThreshold: type: integer @@ -342,50 +374,61 @@ components: - 2 - 4 - 6 + example: 0 # --- Masking module --- MaskingModuleConfig: type: object required: - - masking + - masking_providers properties: - masking: - $ref: "#/components/schemas/MaskingConfig" - description: List of masking providers and entities - unmasking: - $ref: "#/components/schemas/UnmaskingConfig" - description: List of entities to unmask + masking_providers: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + description: List of masking service providers additionalProperties: false - MaskingConfig: - type: array - items: - $ref: "#/components/schemas/Masking" - description: Masking services to be used + MaskingProviderConfig: + oneOf: + - $ref: '#/components/schemas/DPIConfig' - Masking: + DPIConfig: type: object required: - type + - method - entities properties: type: - description: "Type of masking service provider" - $ref: "#/components/schemas/MaskingProviderType" + description: Type of masking service provider + type: string + enum: + - sap_data_privacy_integration + method: + description: Type of masking method to be used + type: string + enum: + - anonymization + - pseudonymization entities: description: List of entities to be masked type: array + minItems: 1 items: - oneOf: - - $ref: "#/components/schemas/DPIEntities" - - $ref: "#/components/schemas/PresidioEntities" + $ref: '#/components/schemas/DPIEntityConfig' - MaskingProviderType: - type: string - enum: - - data_privacy_integration - - ms_presidio + DPIEntityConfig: + type: object + required: + - type + properties: + type: + description: Type of entity to be masked + allOf: + - $ref: '#/components/schemas/DPIEntities' DPIEntities: description: Default entities supported by data privacy and integration service @@ -393,37 +436,29 @@ components: enum: - profile-person - profile-org + - profile-university + - profile-location - profile-email - profile-phone - profile-address - profile-sapids-internal - profile-sapids-public - profile-url + - profile-username-password + - profile-nationalid - profile-iban + - profile-ssn - profile-credit-card-number - profile-passport - profile-driverlicense - profile-nationality + - profile-religious-group - profile-political-group - - profile-ethnicity - - PresidioEntities: - type: string - enum: - - URL - - UnmaskingConfig: - required: - - entities - properties: - entities: - type: array - description: List of entities to be unmasked - items: - anyOf: - - $ref: "#/components/schemas/DPIEntities" - - $ref: "#/components/schemas/PresidioEntities" - + - profile-pronouns-gender + - profile-gender + - profile-sexual-orientation + - profile-trade-union + - profile-sensitive-data # --- Grounding Module --- @@ -436,57 +471,63 @@ components: type: string enum: - document_grounding_service + example: document_grounding_service grounding_service_configuration: type: object required: - - secret_name - grounding_input_parameters - grounding_output_parameter properties: - secret_name: - type: string - description: Secret name of the generic secret within Gen AI Hub containing document grounding service credentials filters: type: array items: - $ref: "#/components/schemas/GroundingFilter" + $ref: '#/components/schemas/GroundingFilter' description: Document grounding service filters to be used grounding_input_parameters: type: array items: type: string + example: groundingInput description: Contains the input parameters used for grounding input questions grounding_output_parameter: type: string description: Parameter name used for grounding output + example: groundingOutput GroundingFilter: type: object properties: id: type: string + example: 'string' search_configuration: type: object + example: {} data_repositories: type: array items: type: string + example: ['*'] data_repository_type: type: string enum: - vector - help.sap.com + example: help.sap.com data_repository_metadata: type: array items: type: object + example: [] document_metadata: type: array items: type: object + example: [] chunk_metadata: type: array items: type: object + example: [] ErrorResponse: type: object @@ -498,16 +539,19 @@ components: properties: request_id: type: string + example: 'd4a67ea1-2bf9-4df7-8105-d48203ccff76' code: type: integer + example: 400 message: type: string + example: "Model name must be one of ['gpt-4', ...]" location: type: string description: Where the error occurred - example: "LLM Module" + example: 'LLM Module' module_results: - $ref: "#/components/schemas/ModuleResults" + $ref: '#/components/schemas/ModuleResults' responses: BadRequest: @@ -515,10 +559,10 @@ components: content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' CommonError: description: Common Error content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' diff --git a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/client/OrchestrationUnitTest.java b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/client/OrchestrationUnitTest.java index 12436ed1..e9a2f79b 100644 --- a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/client/OrchestrationUnitTest.java +++ b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/client/OrchestrationUnitTest.java @@ -17,17 +17,16 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.sap.ai.sdk.orchestration.client.model.AzureContentSafety; import com.sap.ai.sdk.orchestration.client.model.AzureThreshold; import com.sap.ai.sdk.orchestration.client.model.ChatMessage; import com.sap.ai.sdk.orchestration.client.model.CompletionPostRequest; -import com.sap.ai.sdk.orchestration.client.model.Filter; import com.sap.ai.sdk.orchestration.client.model.FilterConfig; import com.sap.ai.sdk.orchestration.client.model.FilteringConfig; import com.sap.ai.sdk.orchestration.client.model.FilteringModuleConfig; import com.sap.ai.sdk.orchestration.client.model.LLMModuleConfig; import com.sap.ai.sdk.orchestration.client.model.ModuleConfigs; import com.sap.ai.sdk.orchestration.client.model.OrchestrationConfig; -import com.sap.ai.sdk.orchestration.client.model.ProviderType; import com.sap.ai.sdk.orchestration.client.model.TemplatingModuleConfig; import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; import java.io.IOException; @@ -85,15 +84,14 @@ public class OrchestrationUnitTest { final var templatingConfig = TemplatingModuleConfig.create().template(template); final var filter = - Filter.create() - .type(ProviderType.AZURE_CONTENT_SAFETY) + FilterConfig.create() + .type(FilterConfig.TypeEnum.AZURE_CONTENT_SAFETY) .config( - FilterConfig.create() + AzureContentSafety.create() .hate(filterThreshold) .selfHarm(filterThreshold) .sexual(filterThreshold) .violence(filterThreshold)); - final var filteringConfig = FilteringModuleConfig.create() .input(FilteringConfig.create().filters(filter))