diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java index 0fca60664..a9038d68f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java @@ -6,6 +6,7 @@ import com.sap.ai.sdk.orchestration.model.InputFilteringConfig; import com.sap.ai.sdk.orchestration.model.LLMModelDetails; import com.sap.ai.sdk.orchestration.model.MaskingModuleConfig; +import com.sap.ai.sdk.orchestration.model.MaskingModuleConfigProviders; import com.sap.ai.sdk.orchestration.model.OutputFilteringConfig; import com.sap.ai.sdk.orchestration.model.PromptTemplatingModuleConfigPrompt; import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslation; @@ -130,9 +131,9 @@ public OrchestrationModuleConfig withMaskingConfig( @Nonnull final MaskingProvider maskingProvider, @Nonnull final MaskingProvider... maskingProviders) { val newMaskingConfig = - MaskingModuleConfig.create().maskingProviders(maskingProvider.createConfig()); + MaskingModuleConfigProviders.create().providers(maskingProvider.createConfig()); Arrays.stream(maskingProviders) - .forEach(it -> newMaskingConfig.addMaskingProvidersItem(it.createConfig())); + .forEach(it -> newMaskingConfig.addProvidersItem(it.createConfig())); return withMaskingConfig(newMaskingConfig); } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java index 7a932eef0..af21d50f9 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java @@ -24,7 +24,10 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** LLMModelDetails */ +/** + * The model and parameters to be used for the prompt templating. This is the model that will be + * used to generate the response. + */ // CHECKSTYLE:OFF public class LLMModelDetails // CHECKSTYLE:ON diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfig.java index ccdfee3b8..dd5866b3f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfig.java @@ -11,205 +11,13 @@ package com.sap.ai.sdk.orchestration.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; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; /** MaskingModuleConfig */ -// CHECKSTYLE:OFF -public class MaskingModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty("masking_providers") - private List maskingProviders = new ArrayList<>(); - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** Default constructor for MaskingModuleConfig. */ - protected MaskingModuleConfig() {} - - /** - * Set the maskingProviders of this {@link MaskingModuleConfig} instance and return the same - * instance. - * - * @param maskingProviders List of masking service providers - * @return The same instance of this {@link MaskingModuleConfig} class - */ - @Nonnull - public MaskingModuleConfig maskingProviders(@Nonnull final List maskingProviders) { - this.maskingProviders = maskingProviders; - return this; - } - - /** - * Add one maskingProviders instance to this {@link MaskingModuleConfig}. - * - * @param maskingProvidersItem The maskingProviders that should be added - * @return The same instance of type {@link MaskingModuleConfig} - */ - @Nonnull - public MaskingModuleConfig addMaskingProvidersItem( - @Nonnull final DPIConfig maskingProvidersItem) { - if (this.maskingProviders == null) { - this.maskingProviders = new ArrayList<>(); - } - this.maskingProviders.add(maskingProvidersItem); - return this; - } - - /** - * List of masking service providers - * - * @return maskingProviders The maskingProviders of this {@link MaskingModuleConfig} instance. - */ - @Nonnull - public List getMaskingProviders() { - return maskingProviders; - } - - /** - * Set the maskingProviders of this {@link MaskingModuleConfig} instance. - * - * @param maskingProviders List of masking service providers - */ - public void setMaskingProviders(@Nonnull final List maskingProviders) { - this.maskingProviders = maskingProviders; - } - - /** - * Get the names of the unrecognizable properties of the {@link MaskingModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MaskingModuleConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name The name of the property - * @return The value of the property - * @throws NoSuchElementException If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { - if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException( - "MaskingModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MaskingModuleConfig} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (maskingProviders != null) declaredFields.put("maskingProviders", maskingProviders); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MaskingModuleConfig} 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 MaskingModuleConfig maskingModuleConfig = (MaskingModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.maskingProviders, maskingModuleConfig.maskingProviders); - } - - @Override - public int hashCode() { - return Objects.hash(maskingProviders, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class MaskingModuleConfig {\n"); - sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).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 MaskingModuleConfig} - * instance with all required arguments. - */ - public static Builder create() { - return (maskingProviders) -> new MaskingModuleConfig().maskingProviders(maskingProviders); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the maskingProviders of this {@link MaskingModuleConfig} instance. - * - * @param maskingProviders List of masking service providers - * @return The MaskingModuleConfig instance. - */ - MaskingModuleConfig maskingProviders(@Nonnull final List maskingProviders); - - /** - * Set the maskingProviders of this {@link MaskingModuleConfig} instance. - * - * @param maskingProviders List of masking service providers - * @return The MaskingModuleConfig instance. - */ - default MaskingModuleConfig maskingProviders(@Nonnull final DPIConfig... maskingProviders) { - return maskingProviders(Arrays.asList(maskingProviders)); - } - } -} +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = MaskingModuleConfigMaskingProviders.class), + @JsonSubTypes.Type(value = MaskingModuleConfigProviders.class), +}) +public interface MaskingModuleConfig {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java new file mode 100644 index 000000000..59b5af5b7 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java @@ -0,0 +1,233 @@ +/* + * Internal Orchestration Service API + * Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services. + * + * + * + * 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.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; + +/** MaskingModuleConfigMaskingProviders */ +// CHECKSTYLE:OFF +public class MaskingModuleConfigMaskingProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("masking_providers") + private List maskingProviders = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MaskingModuleConfigMaskingProviders. */ + protected MaskingModuleConfigMaskingProviders() {} + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and + * return the same instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class + */ + @Nonnull + public MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; + return this; + } + + /** + * Add one maskingProviders instance to this {@link MaskingModuleConfigMaskingProviders}. + * + * @param maskingProvidersItem The maskingProviders that should be added + * @return The same instance of type {@link MaskingModuleConfigMaskingProviders} + */ + @Nonnull + public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( + @Nonnull final DPIConfig maskingProvidersItem) { + if (this.maskingProviders == null) { + this.maskingProviders = new ArrayList<>(); + } + this.maskingProviders.add(maskingProvidersItem); + return this; + } + + /** + * This field is **DEPRECATED** and will be removed on August 05, 2026. Use `providers` + * property instead. List of masking service providers. + * + * @return maskingProviders The maskingProviders of this {@link + * MaskingModuleConfigMaskingProviders} instance. + * @deprecated + */ + @Deprecated + @Nonnull + public List getMaskingProviders() { + return maskingProviders; + } + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + */ + public void setMaskingProviders(@Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * MaskingModuleConfigMaskingProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MaskingModuleConfigMaskingProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigMaskingProviders} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (maskingProviders != null) declaredFields.put("maskingProviders", maskingProviders); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} 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 MaskingModuleConfigMaskingProviders maskingModuleConfigMaskingProviders = + (MaskingModuleConfigMaskingProviders) o; + return Objects.equals( + this.cloudSdkCustomFields, maskingModuleConfigMaskingProviders.cloudSdkCustomFields) + && Objects.equals( + this.maskingProviders, maskingModuleConfigMaskingProviders.maskingProviders); + } + + @Override + public int hashCode() { + return Objects.hash(maskingProviders, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigMaskingProviders {\n"); + sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).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 + * MaskingModuleConfigMaskingProviders} instance with all required arguments. + */ + public static Builder create() { + return (maskingProviders) -> + new MaskingModuleConfigMaskingProviders().maskingProviders(maskingProviders); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The MaskingModuleConfigMaskingProviders instance. + */ + MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final List maskingProviders); + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The MaskingModuleConfigMaskingProviders instance. + */ + default MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final DPIConfig... maskingProviders) { + return maskingProviders(Arrays.asList(maskingProviders)); + } + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigProviders.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigProviders.java new file mode 100644 index 000000000..989c3c3d7 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigProviders.java @@ -0,0 +1,218 @@ +/* + * Internal Orchestration Service API + * Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services. + * + * + * + * 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.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; + +/** MaskingModuleConfigProviders */ +// CHECKSTYLE:OFF +public class MaskingModuleConfigProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("providers") + private List providers = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MaskingModuleConfigProviders. */ + protected MaskingModuleConfigProviders() {} + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance and return the same + * instance. + * + * @param providers List of masking service providers + * @return The same instance of this {@link MaskingModuleConfigProviders} class + */ + @Nonnull + public MaskingModuleConfigProviders providers(@Nonnull final List providers) { + this.providers = providers; + return this; + } + + /** + * Add one providers instance to this {@link MaskingModuleConfigProviders}. + * + * @param providersItem The providers that should be added + * @return The same instance of type {@link MaskingModuleConfigProviders} + */ + @Nonnull + public MaskingModuleConfigProviders addProvidersItem(@Nonnull final DPIConfig providersItem) { + if (this.providers == null) { + this.providers = new ArrayList<>(); + } + this.providers.add(providersItem); + return this; + } + + /** + * List of masking service providers + * + * @return providers The providers of this {@link MaskingModuleConfigProviders} instance. + */ + @Nonnull + public List getProviders() { + return providers; + } + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + */ + public void setProviders(@Nonnull final List providers) { + this.providers = providers; + } + + /** + * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigProviders} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MaskingModuleConfigProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigProviders} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (providers != null) declaredFields.put("providers", providers); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigProviders} 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 MaskingModuleConfigProviders maskingModuleConfigProviders = + (MaskingModuleConfigProviders) o; + return Objects.equals( + this.cloudSdkCustomFields, maskingModuleConfigProviders.cloudSdkCustomFields) + && Objects.equals(this.providers, maskingModuleConfigProviders.providers); + } + + @Override + public int hashCode() { + return Objects.hash(providers, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigProviders {\n"); + sb.append(" providers: ").append(toIndentedString(providers)).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 + * MaskingModuleConfigProviders} instance with all required arguments. + */ + public static Builder create() { + return (providers) -> new MaskingModuleConfigProviders().providers(providers); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + * @return The MaskingModuleConfigProviders instance. + */ + MaskingModuleConfigProviders providers(@Nonnull final List providers); + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + * @return The MaskingModuleConfigProviders instance. + */ + default MaskingModuleConfigProviders providers(@Nonnull final DPIConfig... providers) { + return providers(Arrays.asList(providers)); + } + } +} diff --git a/orchestration/src/main/resources/spec/orchestration.yaml b/orchestration/src/main/resources/spec/orchestration.yaml index 865fe50ff..def4964b1 100644 --- a/orchestration/src/main/resources/spec/orchestration.yaml +++ b/orchestration/src/main/resources/spec/orchestration.yaml @@ -97,7 +97,7 @@ components: allOf: - $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 - + # Embedings Schemas EmbeddingsPostRequest: type: object @@ -173,7 +173,7 @@ components: type: string default: "latest" params: - $ref: "#/components/schemas/EmbeddingsModelParams" + $ref: "#/components/schemas/EmbeddingsModelParams" EmbeddingsModelParams: type: object description: Additional parameters for generating input's embeddings. Default values are used for mandatory parameters. @@ -182,7 +182,7 @@ components: dimensions: type: integer description: > - The number of dimensions the resulting output embeddings should have. + The number of dimensions the resulting output embeddings should have. encoding_format: type: string enum: [float, base64, binary] @@ -270,7 +270,7 @@ components: description: "An array of numbers representing the embedding." - type: string description: "A single base64 string representing the embedding." - + # Chat Completion Schemas ChatMessages: type: array @@ -401,7 +401,7 @@ components: - role - content # Below, OpenAI's spec marks 'content' as required but nullable: https://github.com/Azure/azure-rest-api-specs/blob/8279d4aee23a3fef5aac9c76333b0895c83e44c3/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-10-21/inference.yaml#L2121 - # We've made it optional instead to maintain SDK compatibility and avoid breaking changes. + # We've made it optional instead to maintain SDK compatibility and avoid breaking changes. # Functionally achieves the same result as both patterns permit responses without textual content # OpenAI via null values, ours via field omission. ResponseChatMessage: @@ -799,11 +799,11 @@ components: - $ref: "#/components/schemas/Template" - $ref: "#/components/schemas/TemplateRef" model: - description: > - The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. $ref: "#/components/schemas/LLMModelDetails" LLMModelDetails: type: object + description: > + The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. required: - name additionalProperties: false @@ -1230,19 +1230,33 @@ components: type: boolean # --- Masking module --- - MaskingModuleConfig: - type: object - required: - - masking_providers - additionalProperties: false - properties: - masking_providers: - type: array - minItems: 1 - items: - $ref: "#/components/schemas/MaskingProviderConfig" - description: List of masking service providers + oneOf: + - type: object + title: MaskingModuleConfigProviders + properties: + providers: + description: List of masking service providers + type: array + minItems: 1 + items: + $ref: "#/components/schemas/MaskingProviderConfig" + required: + - providers + additionalProperties: false + - type: object + title: MaskingModuleConfigMaskingProviders + properties: + masking_providers: + deprecated: true + description: "This field is **DEPRECATED** and will be removed on August 05, 2026. Use `providers` property instead. List of masking service providers." + type: array + minItems: 1 + items: + $ref: "#/components/schemas/MaskingProviderConfig" + required: + - masking_providers + additionalProperties: false MaskingProviderConfig: oneOf: @@ -1718,7 +1732,7 @@ components: items: $ref: '#/components/schemas/ChatCompletionTokenLogprob' description: A list of message refusal tokens with log probability information. - + responses: BadRequest: description: Bad Request diff --git a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java index 21191c198..b7d942752 100644 --- a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java +++ b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java @@ -15,6 +15,7 @@ import com.sap.ai.sdk.orchestration.model.DocumentGroundingFilter; import com.sap.ai.sdk.orchestration.model.GroundingModuleConfigConfig; import com.sap.ai.sdk.orchestration.model.GroundingModuleConfigConfigFiltersInner; +import com.sap.ai.sdk.orchestration.model.MaskingModuleConfigProviders; import com.sap.ai.sdk.orchestration.model.ResponseFormatJsonObject; import com.sap.ai.sdk.orchestration.model.ResponseFormatJsonSchema; import com.sap.ai.sdk.orchestration.model.Template; @@ -87,8 +88,10 @@ void testDpiMaskingConfig() { new OrchestrationModuleConfig().withLlmConfig(GPT_4O).withMaskingConfig(maskingConfig); assertThat(config.getMaskingConfig()).isNotNull(); - assertThat(config.getMaskingConfig().getMaskingProviders()).hasSize(1); - DPIConfig dpiConfig = config.getMaskingConfig().getMaskingProviders().get(0); + assertThat(((MaskingModuleConfigProviders) config.getMaskingConfig()).getProviders()) + .hasSize(1); + DPIConfig dpiConfig = + ((MaskingModuleConfigProviders) config.getMaskingConfig()).getProviders().get(0); assertThat(dpiConfig.getMethod()).isEqualTo(DPIConfig.MethodEnum.ANONYMIZATION); assertThat(dpiConfig.getEntities()).hasSize(1); assertThat(((DPIStandardEntity) dpiConfig.getEntities().get(0)).getType()) @@ -98,7 +101,7 @@ void testDpiMaskingConfig() { var configModified = config.withMaskingConfig(maskingConfig); assertThat(configModified.getMaskingConfig()).isNotNull(); - assertThat(configModified.getMaskingConfig().getMaskingProviders()) + assertThat(((MaskingModuleConfigProviders) configModified.getMaskingConfig()).getProviders()) .withFailMessage("withMaskingConfig() should overwrite the existing config and not append") .hasSize(1); } diff --git a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java index 060ca8430..df9be4417 100644 --- a/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java +++ b/orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java @@ -66,7 +66,7 @@ import com.sap.ai.sdk.orchestration.model.GroundingModuleConfigConfigPlaceholders; import com.sap.ai.sdk.orchestration.model.KeyValueListPair; import com.sap.ai.sdk.orchestration.model.LlamaGuard38b; -import com.sap.ai.sdk.orchestration.model.MaskingModuleConfig; +import com.sap.ai.sdk.orchestration.model.MaskingModuleConfigProviders; import com.sap.ai.sdk.orchestration.model.ModuleResultsStreaming; import com.sap.ai.sdk.orchestration.model.ResponseFormatText; import com.sap.ai.sdk.orchestration.model.SearchDocumentKeyValueListPair; @@ -1329,7 +1329,7 @@ void testEmbeddingCallWithMasking() { .type(DPIConfig.TypeEnum.SAP_DATA_PRIVACY_INTEGRATION) .method(DPIConfig.MethodEnum.ANONYMIZATION) .entities(List.of(DPIStandardEntity.create().type(DPIEntities.PERSON))); - val maskingConfig = MaskingModuleConfig.create().maskingProviders(List.of(dpiConfig)); + val maskingConfig = MaskingModuleConfigProviders.create().providers(List.of(dpiConfig)); val modelParams = EmbeddingsModelParams.create() @@ -1408,7 +1408,7 @@ void testEmbeddingCallWithMasking() { } }, "masking": { - "masking_providers": [ + "providers": [ { "type": "sap_data_privacy_integration", "method": "anonymization", diff --git a/orchestration/src/test/resources/groundingRequest.json b/orchestration/src/test/resources/groundingRequest.json index f89fdea20..be967e5de 100644 --- a/orchestration/src/test/resources/groundingRequest.json +++ b/orchestration/src/test/resources/groundingRequest.json @@ -26,7 +26,7 @@ } }, "masking": { - "masking_providers": [ + "providers": [ { "type": "sap_data_privacy_integration", "method": "anonymization", diff --git a/orchestration/src/test/resources/maskingRequest.json b/orchestration/src/test/resources/maskingRequest.json index 418eb4961..3e949d06d 100644 --- a/orchestration/src/test/resources/maskingRequest.json +++ b/orchestration/src/test/resources/maskingRequest.json @@ -26,7 +26,7 @@ } }, "masking": { - "masking_providers": [ + "providers": [ { "type": "sap_data_privacy_integration", "method": "pseudonymization",