diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInput.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInput.java new file mode 100644 index 000000000..209d91377 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInput.java @@ -0,0 +1,320 @@ +/* + * 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.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; + +/** Filter configuration for Azure Content Safety */ +// CHECKSTYLE:OFF +public class AzureContentSafetyInput +// CHECKSTYLE:ON +{ + @JsonProperty("hate") + private AzureThreshold hate; + + @JsonProperty("self_harm") + private AzureThreshold selfHarm; + + @JsonProperty("sexual") + private AzureThreshold sexual; + + @JsonProperty("violence") + private AzureThreshold violence; + + @JsonProperty("prompt_shield") + private Boolean promptShield = false; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyInput. */ + protected AzureContentSafetyInput() {} + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param hate The hate of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput hate(@Nullable final AzureThreshold hate) { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getHate() { + return hate; + } + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance. + * + * @param hate The hate of this {@link AzureContentSafetyInput} + */ + public void setHate(@Nullable final AzureThreshold hate) { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput selfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSelfHarm() { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyInput} + */ + public void setSelfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput sexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + return this; + } + + /** + * Get sexual + * + * @return sexual The sexual of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSexual() { + return sexual; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyInput} + */ + public void setSexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param violence The violence of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput violence(@Nullable final AzureThreshold violence) { + this.violence = violence; + return this; + } + + /** + * Get violence + * + * @return violence The violence of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getViolence() { + return violence; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance. + * + * @param violence The violence of this {@link AzureContentSafetyInput} + */ + public void setViolence(@Nullable final AzureThreshold violence) { + this.violence = violence; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance and return the same + * instance. + * + * @param promptShield A flag to use prompt shield + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput promptShield(@Nullable final Boolean promptShield) { + this.promptShield = promptShield; + return this; + } + + /** + * A flag to use prompt shield + * + * @return promptShield The promptShield of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public Boolean isPromptShield() { + return promptShield; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance. + * + * @param promptShield A flag to use prompt shield + */ + public void setPromptShield(@Nullable final Boolean promptShield) { + this.promptShield = promptShield; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInput} 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( + "AzureContentSafetyInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (hate != null) declaredFields.put("hate", hate); + if (selfHarm != null) declaredFields.put("selfHarm", selfHarm); + if (sexual != null) declaredFields.put("sexual", sexual); + if (violence != null) declaredFields.put("violence", violence); + if (promptShield != null) declaredFields.put("promptShield", promptShield); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyInput} 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 AzureContentSafetyInput azureContentSafetyInput = (AzureContentSafetyInput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyInput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyInput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyInput.sexual) + && Objects.equals(this.violence, azureContentSafetyInput.violence) + && Objects.equals(this.promptShield, azureContentSafetyInput.promptShield); + } + + @Override + public int hashCode() { + return Objects.hash(hate, selfHarm, sexual, violence, promptShield, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyInput {\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(" promptShield: ").append(toIndentedString(promptShield)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link AzureContentSafetyInput} instance. No arguments are required. */ + public static AzureContentSafetyInput create() { + return new AzureContentSafetyInput(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyFilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInputFilterConfig.java similarity index 71% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyFilterConfig.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInputFilterConfig.java index 1ee8e13fd..3de44c4d5 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyFilterConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyInputFilterConfig.java @@ -25,17 +25,17 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** AzureContentSafetyFilterConfig */ +/** AzureContentSafetyInputFilterConfig */ // CHECKSTYLE:OFF -public class AzureContentSafetyFilterConfig implements FilterConfig +public class AzureContentSafetyInputFilterConfig implements InputFilterConfig // CHECKSTYLE:ON { /** Name of the filter provider type */ public enum TypeEnum { - /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyFilterConfig */ + /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyInputFilterConfig */ AZURE_CONTENT_SAFETY("azure_content_safety"), - /** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyFilterConfig */ + /** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyInputFilterConfig */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; @@ -70,7 +70,7 @@ public String toString() { * Get the enum value from a String value * * @param value The String value - * @return The enum value of type AzureContentSafetyFilterConfig + * @return The enum value of type AzureContentSafetyInputFilterConfig */ @JsonCreator @Nonnull @@ -88,23 +88,23 @@ public static TypeEnum fromValue(@Nonnull final String value) { private TypeEnum type; @JsonProperty("config") - private AzureContentSafety config; + private AzureContentSafetyInput config; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - /** Default constructor for AzureContentSafetyFilterConfig. */ - protected AzureContentSafetyFilterConfig() {} + /** Default constructor for AzureContentSafetyInputFilterConfig. */ + protected AzureContentSafetyInputFilterConfig() {} /** - * Set the type of this {@link AzureContentSafetyFilterConfig} instance and return the same + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance and return the same * instance. * * @param type Name of the filter provider type - * @return The same instance of this {@link AzureContentSafetyFilterConfig} class + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class */ @Nonnull - public AzureContentSafetyFilterConfig type(@Nonnull final TypeEnum type) { + public AzureContentSafetyInputFilterConfig type(@Nonnull final TypeEnum type) { this.type = type; return this; } @@ -112,7 +112,7 @@ public AzureContentSafetyFilterConfig type(@Nonnull final TypeEnum type) { /** * Name of the filter provider type * - * @return type The type of this {@link AzureContentSafetyFilterConfig} instance. + * @return type The type of this {@link AzureContentSafetyInputFilterConfig} instance. */ @Nonnull public TypeEnum getType() { @@ -120,7 +120,7 @@ public TypeEnum getType() { } /** - * Set the type of this {@link AzureContentSafetyFilterConfig} instance. + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. * * @param type Name of the filter provider type */ @@ -129,14 +129,15 @@ public void setType(@Nonnull final TypeEnum type) { } /** - * Set the config of this {@link AzureContentSafetyFilterConfig} instance and return the same + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance and return the same * instance. * - * @param config The config of this {@link AzureContentSafetyFilterConfig} - * @return The same instance of this {@link AzureContentSafetyFilterConfig} class + * @param config The config of this {@link AzureContentSafetyInputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class */ @Nonnull - public AzureContentSafetyFilterConfig config(@Nullable final AzureContentSafety config) { + public AzureContentSafetyInputFilterConfig config( + @Nullable final AzureContentSafetyInput config) { this.config = config; return this; } @@ -144,24 +145,25 @@ public AzureContentSafetyFilterConfig config(@Nullable final AzureContentSafety /** * Get config * - * @return config The config of this {@link AzureContentSafetyFilterConfig} instance. + * @return config The config of this {@link AzureContentSafetyInputFilterConfig} instance. */ @Nonnull - public AzureContentSafety getConfig() { + public AzureContentSafetyInput getConfig() { return config; } /** - * Set the config of this {@link AzureContentSafetyFilterConfig} instance. + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance. * - * @param config The config of this {@link AzureContentSafetyFilterConfig} + * @param config The config of this {@link AzureContentSafetyInputFilterConfig} */ - public void setConfig(@Nullable final AzureContentSafety config) { + public void setConfig(@Nullable final AzureContentSafetyInput config) { this.config = config; } /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafetyFilterConfig}. + * Get the names of the unrecognizable properties of the {@link + * AzureContentSafetyInputFilterConfig}. * * @return The set of properties names */ @@ -172,7 +174,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link AzureContentSafetyFilterConfig} + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} * instance. * * @deprecated Use {@link #toMap()} instead. @@ -185,13 +187,13 @@ public Set getCustomFieldNames() { public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { throw new NoSuchElementException( - "AzureContentSafetyFilterConfig has no field with name '" + name + "'."); + "AzureContentSafetyInputFilterConfig has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link AzureContentSafetyFilterConfig} instance + * Get the value of all properties of this {@link AzureContentSafetyInputFilterConfig} instance * including unrecognized properties. * * @return The map of all properties @@ -206,8 +208,8 @@ public Map toMap() { } /** - * 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 + * Set an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} 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 @@ -226,12 +228,12 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final AzureContentSafetyFilterConfig azureContentSafetyFilterConfig = - (AzureContentSafetyFilterConfig) o; + final AzureContentSafetyInputFilterConfig azureContentSafetyInputFilterConfig = + (AzureContentSafetyInputFilterConfig) o; return Objects.equals( - this.cloudSdkCustomFields, azureContentSafetyFilterConfig.cloudSdkCustomFields) - && Objects.equals(this.type, azureContentSafetyFilterConfig.type) - && Objects.equals(this.config, azureContentSafetyFilterConfig.config); + this.cloudSdkCustomFields, azureContentSafetyInputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyInputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyInputFilterConfig.config); } @Override @@ -243,7 +245,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafetyFilterConfig {\n"); + sb.append("class AzureContentSafetyInputFilterConfig {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" config: ").append(toIndentedString(config)).append("\n"); cloudSdkCustomFields.forEach( @@ -265,20 +267,20 @@ private String toIndentedString(final java.lang.Object o) { /** * Create a type-safe, fluent-api builder object to construct a new {@link - * AzureContentSafetyFilterConfig} instance with all required arguments. + * AzureContentSafetyInputFilterConfig} instance with all required arguments. */ public static Builder create() { - return (type) -> new AzureContentSafetyFilterConfig().type(type); + return (type) -> new AzureContentSafetyInputFilterConfig().type(type); } /** Builder helper class. */ public interface Builder { /** - * Set the type of this {@link AzureContentSafetyFilterConfig} instance. + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. * * @param type Name of the filter provider type - * @return The AzureContentSafetyFilterConfig instance. + * @return The AzureContentSafetyInputFilterConfig instance. */ - AzureContentSafetyFilterConfig type(@Nonnull final TypeEnum type); + AzureContentSafetyInputFilterConfig type(@Nonnull final TypeEnum type); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafety.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutput.java similarity index 70% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafety.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutput.java index dcece0626..b8d9db163 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafety.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutput.java @@ -25,35 +25,35 @@ /** Filter configuration for Azure Content Safety */ // CHECKSTYLE:OFF -public class AzureContentSafety +public class AzureContentSafetyOutput // CHECKSTYLE:ON { - @JsonProperty("Hate") + @JsonProperty("hate") private AzureThreshold hate; - @JsonProperty("SelfHarm") + @JsonProperty("self_harm") private AzureThreshold selfHarm; - @JsonProperty("Sexual") + @JsonProperty("sexual") private AzureThreshold sexual; - @JsonProperty("Violence") + @JsonProperty("violence") private AzureThreshold violence; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - /** Default constructor for AzureContentSafety. */ - protected AzureContentSafety() {} + /** Default constructor for AzureContentSafetyOutput. */ + protected AzureContentSafetyOutput() {} /** - * Set the hate of this {@link AzureContentSafety} instance and return the same instance. + * Set the hate of this {@link AzureContentSafetyOutput} instance and return the same instance. * - * @param hate The hate of this {@link AzureContentSafety} - * @return The same instance of this {@link AzureContentSafety} class + * @param hate The hate of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class */ @Nonnull - public AzureContentSafety hate(@Nullable final AzureThreshold hate) { + public AzureContentSafetyOutput hate(@Nullable final AzureThreshold hate) { this.hate = hate; return this; } @@ -61,7 +61,7 @@ public AzureContentSafety hate(@Nullable final AzureThreshold hate) { /** * Get hate * - * @return hate The hate of this {@link AzureContentSafety} instance. + * @return hate The hate of this {@link AzureContentSafetyOutput} instance. */ @Nonnull public AzureThreshold getHate() { @@ -69,22 +69,23 @@ public AzureThreshold getHate() { } /** - * Set the hate of this {@link AzureContentSafety} instance. + * Set the hate of this {@link AzureContentSafetyOutput} instance. * - * @param hate The hate of this {@link AzureContentSafety} + * @param hate The hate of this {@link AzureContentSafetyOutput} */ public void setHate(@Nullable final AzureThreshold hate) { this.hate = hate; } /** - * Set the selfHarm of this {@link AzureContentSafety} instance and return the same instance. + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance and return the same + * instance. * - * @param selfHarm The selfHarm of this {@link AzureContentSafety} - * @return The same instance of this {@link AzureContentSafety} class + * @param selfHarm The selfHarm of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class */ @Nonnull - public AzureContentSafety selfHarm(@Nullable final AzureThreshold selfHarm) { + public AzureContentSafetyOutput selfHarm(@Nullable final AzureThreshold selfHarm) { this.selfHarm = selfHarm; return this; } @@ -92,7 +93,7 @@ public AzureContentSafety selfHarm(@Nullable final AzureThreshold selfHarm) { /** * Get selfHarm * - * @return selfHarm The selfHarm of this {@link AzureContentSafety} instance. + * @return selfHarm The selfHarm of this {@link AzureContentSafetyOutput} instance. */ @Nonnull public AzureThreshold getSelfHarm() { @@ -100,22 +101,22 @@ public AzureThreshold getSelfHarm() { } /** - * Set the selfHarm of this {@link AzureContentSafety} instance. + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance. * - * @param selfHarm The selfHarm of this {@link AzureContentSafety} + * @param selfHarm The selfHarm of this {@link AzureContentSafetyOutput} */ public void setSelfHarm(@Nullable final AzureThreshold selfHarm) { this.selfHarm = selfHarm; } /** - * Set the sexual of this {@link AzureContentSafety} instance and return the same instance. + * Set the sexual of this {@link AzureContentSafetyOutput} instance and return the same instance. * - * @param sexual The sexual of this {@link AzureContentSafety} - * @return The same instance of this {@link AzureContentSafety} class + * @param sexual The sexual of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class */ @Nonnull - public AzureContentSafety sexual(@Nullable final AzureThreshold sexual) { + public AzureContentSafetyOutput sexual(@Nullable final AzureThreshold sexual) { this.sexual = sexual; return this; } @@ -123,7 +124,7 @@ public AzureContentSafety sexual(@Nullable final AzureThreshold sexual) { /** * Get sexual * - * @return sexual The sexual of this {@link AzureContentSafety} instance. + * @return sexual The sexual of this {@link AzureContentSafetyOutput} instance. */ @Nonnull public AzureThreshold getSexual() { @@ -131,22 +132,23 @@ public AzureThreshold getSexual() { } /** - * Set the sexual of this {@link AzureContentSafety} instance. + * Set the sexual of this {@link AzureContentSafetyOutput} instance. * - * @param sexual The sexual of this {@link AzureContentSafety} + * @param sexual The sexual of this {@link AzureContentSafetyOutput} */ public void setSexual(@Nullable final AzureThreshold sexual) { this.sexual = sexual; } /** - * Set the violence of this {@link AzureContentSafety} instance and return the same instance. + * Set the violence of this {@link AzureContentSafetyOutput} instance and return the same + * instance. * - * @param violence The violence of this {@link AzureContentSafety} - * @return The same instance of this {@link AzureContentSafety} class + * @param violence The violence of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class */ @Nonnull - public AzureContentSafety violence(@Nullable final AzureThreshold violence) { + public AzureContentSafetyOutput violence(@Nullable final AzureThreshold violence) { this.violence = violence; return this; } @@ -154,7 +156,7 @@ public AzureContentSafety violence(@Nullable final AzureThreshold violence) { /** * Get violence * - * @return violence The violence of this {@link AzureContentSafety} instance. + * @return violence The violence of this {@link AzureContentSafetyOutput} instance. */ @Nonnull public AzureThreshold getViolence() { @@ -162,16 +164,16 @@ public AzureThreshold getViolence() { } /** - * Set the violence of this {@link AzureContentSafety} instance. + * Set the violence of this {@link AzureContentSafetyOutput} instance. * - * @param violence The violence of this {@link AzureContentSafety} + * @param violence The violence of this {@link AzureContentSafetyOutput} */ public void setViolence(@Nullable final AzureThreshold violence) { this.violence = violence; } /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafety}. + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutput}. * * @return The set of properties names */ @@ -182,7 +184,7 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link AzureContentSafety} instance. + * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutput} instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -193,13 +195,14 @@ public Set getCustomFieldNames() { @Deprecated public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { - throw new NoSuchElementException("AzureContentSafety has no field with name '" + name + "'."); + throw new NoSuchElementException( + "AzureContentSafetyOutput has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link AzureContentSafety} instance including + * Get the value of all properties of this {@link AzureContentSafetyOutput} instance including * unrecognized properties. * * @return The map of all properties @@ -216,7 +219,7 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link AzureContentSafety} instance. If the map + * Set an unrecognizable property of this {@link AzureContentSafetyOutput} 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 @@ -235,12 +238,12 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final AzureContentSafety azureContentSafety = (AzureContentSafety) o; - return Objects.equals(this.cloudSdkCustomFields, azureContentSafety.cloudSdkCustomFields) - && Objects.equals(this.hate, azureContentSafety.hate) - && Objects.equals(this.selfHarm, azureContentSafety.selfHarm) - && Objects.equals(this.sexual, azureContentSafety.sexual) - && Objects.equals(this.violence, azureContentSafety.violence); + final AzureContentSafetyOutput azureContentSafetyOutput = (AzureContentSafetyOutput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyOutput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyOutput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyOutput.sexual) + && Objects.equals(this.violence, azureContentSafetyOutput.violence); } @Override @@ -252,7 +255,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafety {\n"); + sb.append("class AzureContentSafetyOutput {\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"); @@ -274,8 +277,8 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link AzureContentSafety} instance. No arguments are required. */ - public static AzureContentSafety create() { - return new AzureContentSafety(); + /** Create a new {@link AzureContentSafetyOutput} instance. No arguments are required. */ + public static AzureContentSafetyOutput create() { + return new AzureContentSafetyOutput(); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutputFilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutputFilterConfig.java new file mode 100644 index 000000000..c083b6c20 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyOutputFilterConfig.java @@ -0,0 +1,286 @@ +/* + * 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.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; + +/** AzureContentSafetyOutputFilterConfig */ +// CHECKSTYLE:OFF +public class AzureContentSafetyOutputFilterConfig implements OutputFilterConfig +// CHECKSTYLE:ON +{ + /** Name of the filter provider type */ + public enum TypeEnum { + /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyOutputFilterConfig */ + AZURE_CONTENT_SAFETY("azure_content_safety"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyOutputFilterConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type AzureContentSafetyOutputFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private AzureContentSafetyOutput config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyOutputFilterConfig. */ + protected AzureContentSafetyOutputFilterConfig() {} + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same + * instance. + * + * @param type Name of the filter provider type + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param type Name of the filter provider type + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance and return the + * same instance. + * + * @param config The config of this {@link AzureContentSafetyOutputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig config( + @Nullable final AzureContentSafetyOutput config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public AzureContentSafetyOutput getConfig() { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param config The config of this {@link AzureContentSafetyOutputFilterConfig} + */ + public void setConfig(@Nullable final AzureContentSafetyOutput config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * AzureContentSafetyOutputFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * AzureContentSafetyOutputFilterConfig} 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( + "AzureContentSafetyOutputFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyOutputFilterConfig} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} 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 AzureContentSafetyOutputFilterConfig azureContentSafetyOutputFilterConfig = + (AzureContentSafetyOutputFilterConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, azureContentSafetyOutputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyOutputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyOutputFilterConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyOutputFilterConfig {\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 + * AzureContentSafetyOutputFilterConfig} instance with all required arguments. + */ + public static Builder create() { + return (type) -> new AzureContentSafetyOutputFilterConfig().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param type Name of the filter provider type + * @return The AzureContentSafetyOutputFilterConfig instance. + */ + AzureContentSafetyOutputFilterConfig type(@Nonnull final TypeEnum type); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprob.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprob.java new file mode 100644 index 000000000..61dc8142d --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprob.java @@ -0,0 +1,354 @@ +/* + * 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.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; + +/** ChatCompletionTokenLogprob */ +// CHECKSTYLE:OFF +public class ChatCompletionTokenLogprob +// CHECKSTYLE:ON +{ + @JsonProperty("token") + private String token; + + @JsonProperty("logprob") + private Float logprob; + + @JsonProperty("bytes") + private List bytes = new ArrayList<>(); + + @JsonProperty("top_logprobs") + private List topLogprobs = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ChatCompletionTokenLogprob. */ + protected ChatCompletionTokenLogprob() {} + + /** + * Set the token of this {@link ChatCompletionTokenLogprob} instance and return the same instance. + * + * @param token The token. + * @return The same instance of this {@link ChatCompletionTokenLogprob} class + */ + @Nonnull + public ChatCompletionTokenLogprob token(@Nonnull final String token) { + this.token = token; + return this; + } + + /** + * The token. + * + * @return token The token of this {@link ChatCompletionTokenLogprob} instance. + */ + @Nonnull + public String getToken() { + return token; + } + + /** + * Set the token of this {@link ChatCompletionTokenLogprob} instance. + * + * @param token The token. + */ + public void setToken(@Nonnull final String token) { + this.token = token; + } + + /** + * Set the logprob of this {@link ChatCompletionTokenLogprob} instance and return the same + * instance. + * + * @param logprob The log probability of this token. + * @return The same instance of this {@link ChatCompletionTokenLogprob} class + */ + @Nonnull + public ChatCompletionTokenLogprob logprob(@Nonnull final Float logprob) { + this.logprob = logprob; + return this; + } + + /** + * The log probability of this token. + * + * @return logprob The logprob of this {@link ChatCompletionTokenLogprob} instance. + */ + @Nonnull + public Float getLogprob() { + return logprob; + } + + /** + * Set the logprob of this {@link ChatCompletionTokenLogprob} instance. + * + * @param logprob The log probability of this token. + */ + public void setLogprob(@Nonnull final Float logprob) { + this.logprob = logprob; + } + + /** + * Set the bytes of this {@link ChatCompletionTokenLogprob} instance and return the same instance. + * + * @param bytes A list of integers representing the UTF-8 bytes representation of the token. + * Useful in instances where characters are multi-byte. + * @return The same instance of this {@link ChatCompletionTokenLogprob} class + */ + @Nonnull + public ChatCompletionTokenLogprob bytes(@Nullable final List bytes) { + this.bytes = bytes; + return this; + } + + /** + * Add one bytes instance to this {@link ChatCompletionTokenLogprob}. + * + * @param bytesItem The bytes that should be added + * @return The same instance of type {@link ChatCompletionTokenLogprob} + */ + @Nonnull + public ChatCompletionTokenLogprob addBytesItem(@Nonnull final Integer bytesItem) { + if (this.bytes == null) { + this.bytes = new ArrayList<>(); + } + this.bytes.add(bytesItem); + return this; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in + * instances where characters are multi-byte. + * + * @return bytes The bytes of this {@link ChatCompletionTokenLogprob} instance. + */ + @Nonnull + public List getBytes() { + return bytes; + } + + /** + * Set the bytes of this {@link ChatCompletionTokenLogprob} instance. + * + * @param bytes A list of integers representing the UTF-8 bytes representation of the token. + * Useful in instances where characters are multi-byte. + */ + public void setBytes(@Nullable final List bytes) { + this.bytes = bytes; + } + + /** + * Set the topLogprobs of this {@link ChatCompletionTokenLogprob} instance and return the same + * instance. + * + * @param topLogprobs List of the most likely tokens and their log probability, at this token + * position. In rare cases, there may be fewer than the number of requested + * `top_logprobs`. + * @return The same instance of this {@link ChatCompletionTokenLogprob} class + */ + @Nonnull + public ChatCompletionTokenLogprob topLogprobs( + @Nullable final List topLogprobs) { + this.topLogprobs = topLogprobs; + return this; + } + + /** + * Add one topLogprobs instance to this {@link ChatCompletionTokenLogprob}. + * + * @param topLogprobsItem The topLogprobs that should be added + * @return The same instance of type {@link ChatCompletionTokenLogprob} + */ + @Nonnull + public ChatCompletionTokenLogprob addTopLogprobsItem( + @Nonnull final ChatCompletionTokenLogprobTopLogprobsInner topLogprobsItem) { + if (this.topLogprobs == null) { + this.topLogprobs = new ArrayList<>(); + } + this.topLogprobs.add(topLogprobsItem); + return this; + } + + /** + * List of the most likely tokens and their log probability, at this token position. In rare + * cases, there may be fewer than the number of requested `top_logprobs`. + * + * @return topLogprobs The topLogprobs of this {@link ChatCompletionTokenLogprob} instance. + */ + @Nonnull + public List getTopLogprobs() { + return topLogprobs; + } + + /** + * Set the topLogprobs of this {@link ChatCompletionTokenLogprob} instance. + * + * @param topLogprobs List of the most likely tokens and their log probability, at this token + * position. In rare cases, there may be fewer than the number of requested + * `top_logprobs`. + */ + public void setTopLogprobs( + @Nullable final List topLogprobs) { + this.topLogprobs = topLogprobs; + } + + /** + * Get the names of the unrecognizable properties of the {@link ChatCompletionTokenLogprob}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ChatCompletionTokenLogprob} + * 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( + "ChatCompletionTokenLogprob has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ChatCompletionTokenLogprob} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (token != null) declaredFields.put("token", token); + if (logprob != null) declaredFields.put("logprob", logprob); + if (bytes != null) declaredFields.put("bytes", bytes); + if (topLogprobs != null) declaredFields.put("topLogprobs", topLogprobs); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ChatCompletionTokenLogprob} 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 ChatCompletionTokenLogprob chatCompletionTokenLogprob = (ChatCompletionTokenLogprob) o; + return Objects.equals( + this.cloudSdkCustomFields, chatCompletionTokenLogprob.cloudSdkCustomFields) + && Objects.equals(this.token, chatCompletionTokenLogprob.token) + && Objects.equals(this.logprob, chatCompletionTokenLogprob.logprob) + && Objects.equals(this.bytes, chatCompletionTokenLogprob.bytes) + && Objects.equals(this.topLogprobs, chatCompletionTokenLogprob.topLogprobs); + } + + @Override + public int hashCode() { + return Objects.hash(token, logprob, bytes, topLogprobs, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ChatCompletionTokenLogprob {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" logprob: ").append(toIndentedString(logprob)).append("\n"); + sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n"); + sb.append(" topLogprobs: ").append(toIndentedString(topLogprobs)).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 + * ChatCompletionTokenLogprob} instance with all required arguments. + */ + public static Builder create() { + return (token) -> (logprob) -> new ChatCompletionTokenLogprob().token(token).logprob(logprob); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the token of this {@link ChatCompletionTokenLogprob} instance. + * + * @param token The token. + * @return The ChatCompletionTokenLogprob builder. + */ + Builder1 token(@Nonnull final String token); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the logprob of this {@link ChatCompletionTokenLogprob} instance. + * + * @param logprob The log probability of this token. + * @return The ChatCompletionTokenLogprob instance. + */ + ChatCompletionTokenLogprob logprob(@Nonnull final Float logprob); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprobTopLogprobsInner.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprobTopLogprobsInner.java new file mode 100644 index 000000000..ad7c7bf0a --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTokenLogprobTopLogprobsInner.java @@ -0,0 +1,301 @@ +/* + * 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.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; + +/** ChatCompletionTokenLogprobTopLogprobsInner */ +// CHECKSTYLE:OFF +public class ChatCompletionTokenLogprobTopLogprobsInner +// CHECKSTYLE:ON +{ + @JsonProperty("token") + private String token; + + @JsonProperty("logprob") + private Float logprob; + + @JsonProperty("bytes") + private List bytes = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ChatCompletionTokenLogprobTopLogprobsInner. */ + protected ChatCompletionTokenLogprobTopLogprobsInner() {} + + /** + * Set the token of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance and return + * the same instance. + * + * @param token The token. + * @return The same instance of this {@link ChatCompletionTokenLogprobTopLogprobsInner} class + */ + @Nonnull + public ChatCompletionTokenLogprobTopLogprobsInner token(@Nonnull final String token) { + this.token = token; + return this; + } + + /** + * The token. + * + * @return token The token of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + */ + @Nonnull + public String getToken() { + return token; + } + + /** + * Set the token of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + * + * @param token The token. + */ + public void setToken(@Nonnull final String token) { + this.token = token; + } + + /** + * Set the logprob of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance and return + * the same instance. + * + * @param logprob The log probability of this token. + * @return The same instance of this {@link ChatCompletionTokenLogprobTopLogprobsInner} class + */ + @Nonnull + public ChatCompletionTokenLogprobTopLogprobsInner logprob(@Nonnull final Float logprob) { + this.logprob = logprob; + return this; + } + + /** + * The log probability of this token. + * + * @return logprob The logprob of this {@link ChatCompletionTokenLogprobTopLogprobsInner} + * instance. + */ + @Nonnull + public Float getLogprob() { + return logprob; + } + + /** + * Set the logprob of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + * + * @param logprob The log probability of this token. + */ + public void setLogprob(@Nonnull final Float logprob) { + this.logprob = logprob; + } + + /** + * Set the bytes of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance and return + * the same instance. + * + * @param bytes A list of integers representing the UTF-8 bytes representation of the token. + * Useful in instances where characters are multi-byte. + * @return The same instance of this {@link ChatCompletionTokenLogprobTopLogprobsInner} class + */ + @Nonnull + public ChatCompletionTokenLogprobTopLogprobsInner bytes(@Nullable final List bytes) { + this.bytes = bytes; + return this; + } + + /** + * Add one bytes instance to this {@link ChatCompletionTokenLogprobTopLogprobsInner}. + * + * @param bytesItem The bytes that should be added + * @return The same instance of type {@link ChatCompletionTokenLogprobTopLogprobsInner} + */ + @Nonnull + public ChatCompletionTokenLogprobTopLogprobsInner addBytesItem(@Nonnull final Integer bytesItem) { + if (this.bytes == null) { + this.bytes = new ArrayList<>(); + } + this.bytes.add(bytesItem); + return this; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in + * instances where characters are multi-byte. + * + * @return bytes The bytes of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + */ + @Nonnull + public List getBytes() { + return bytes; + } + + /** + * Set the bytes of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + * + * @param bytes A list of integers representing the UTF-8 bytes representation of the token. + * Useful in instances where characters are multi-byte. + */ + public void setBytes(@Nullable final List bytes) { + this.bytes = bytes; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * ChatCompletionTokenLogprobTopLogprobsInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * ChatCompletionTokenLogprobTopLogprobsInner} 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( + "ChatCompletionTokenLogprobTopLogprobsInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ChatCompletionTokenLogprobTopLogprobsInner} + * instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (token != null) declaredFields.put("token", token); + if (logprob != null) declaredFields.put("logprob", logprob); + if (bytes != null) declaredFields.put("bytes", bytes); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ChatCompletionTokenLogprobTopLogprobsInner} + * 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 ChatCompletionTokenLogprobTopLogprobsInner chatCompletionTokenLogprobTopLogprobsInner = + (ChatCompletionTokenLogprobTopLogprobsInner) o; + return Objects.equals( + this.cloudSdkCustomFields, + chatCompletionTokenLogprobTopLogprobsInner.cloudSdkCustomFields) + && Objects.equals(this.token, chatCompletionTokenLogprobTopLogprobsInner.token) + && Objects.equals(this.logprob, chatCompletionTokenLogprobTopLogprobsInner.logprob) + && Objects.equals(this.bytes, chatCompletionTokenLogprobTopLogprobsInner.bytes); + } + + @Override + public int hashCode() { + return Objects.hash(token, logprob, bytes, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ChatCompletionTokenLogprobTopLogprobsInner {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" logprob: ").append(toIndentedString(logprob)).append("\n"); + sb.append(" bytes: ").append(toIndentedString(bytes)).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 + * ChatCompletionTokenLogprobTopLogprobsInner} instance with all required arguments. + */ + public static Builder create() { + return (token) -> + (logprob) -> new ChatCompletionTokenLogprobTopLogprobsInner().token(token).logprob(logprob); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the token of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + * + * @param token The token. + * @return The ChatCompletionTokenLogprobTopLogprobsInner builder. + */ + Builder1 token(@Nonnull final String token); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the logprob of this {@link ChatCompletionTokenLogprobTopLogprobsInner} instance. + * + * @param logprob The log probability of this token. + * @return The ChatCompletionTokenLogprobTopLogprobsInner instance. + */ + ChatCompletionTokenLogprobTopLogprobsInner logprob(@Nonnull final Float logprob); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChoiceLogprobs.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChoiceLogprobs.java new file mode 100644 index 000000000..363d74e53 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChoiceLogprobs.java @@ -0,0 +1,239 @@ +/* + * 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.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; + +/** Log probabilities for the choice. */ +// CHECKSTYLE:OFF +public class ChoiceLogprobs +// CHECKSTYLE:ON +{ + @JsonProperty("content") + private List content = new ArrayList<>(); + + @JsonProperty("refusal") + private List refusal = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ChoiceLogprobs. */ + protected ChoiceLogprobs() {} + + /** + * Set the content of this {@link ChoiceLogprobs} instance and return the same instance. + * + * @param content A list of message content tokens with log probability information. + * @return The same instance of this {@link ChoiceLogprobs} class + */ + @Nonnull + public ChoiceLogprobs content(@Nullable final List content) { + this.content = content; + return this; + } + + /** + * Add one content instance to this {@link ChoiceLogprobs}. + * + * @param contentItem The content that should be added + * @return The same instance of type {@link ChoiceLogprobs} + */ + @Nonnull + public ChoiceLogprobs addContentItem(@Nonnull final ChatCompletionTokenLogprob contentItem) { + if (this.content == null) { + this.content = new ArrayList<>(); + } + this.content.add(contentItem); + return this; + } + + /** + * A list of message content tokens with log probability information. + * + * @return content The content of this {@link ChoiceLogprobs} instance. + */ + @Nonnull + public List getContent() { + return content; + } + + /** + * Set the content of this {@link ChoiceLogprobs} instance. + * + * @param content A list of message content tokens with log probability information. + */ + public void setContent(@Nullable final List content) { + this.content = content; + } + + /** + * Set the refusal of this {@link ChoiceLogprobs} instance and return the same instance. + * + * @param refusal A list of message refusal tokens with log probability information. + * @return The same instance of this {@link ChoiceLogprobs} class + */ + @Nonnull + public ChoiceLogprobs refusal(@Nullable final List refusal) { + this.refusal = refusal; + return this; + } + + /** + * Add one refusal instance to this {@link ChoiceLogprobs}. + * + * @param refusalItem The refusal that should be added + * @return The same instance of type {@link ChoiceLogprobs} + */ + @Nonnull + public ChoiceLogprobs addRefusalItem(@Nonnull final ChatCompletionTokenLogprob refusalItem) { + if (this.refusal == null) { + this.refusal = new ArrayList<>(); + } + this.refusal.add(refusalItem); + return this; + } + + /** + * A list of message refusal tokens with log probability information. + * + * @return refusal The refusal of this {@link ChoiceLogprobs} instance. + */ + @Nonnull + public List getRefusal() { + return refusal; + } + + /** + * Set the refusal of this {@link ChoiceLogprobs} instance. + * + * @param refusal A list of message refusal tokens with log probability information. + */ + public void setRefusal(@Nullable final List refusal) { + this.refusal = refusal; + } + + /** + * Get the names of the unrecognizable properties of the {@link ChoiceLogprobs}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ChoiceLogprobs} 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("ChoiceLogprobs has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ChoiceLogprobs} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (content != null) declaredFields.put("content", content); + if (refusal != null) declaredFields.put("refusal", refusal); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ChoiceLogprobs} 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 ChoiceLogprobs choiceLogprobs = (ChoiceLogprobs) o; + return Objects.equals(this.cloudSdkCustomFields, choiceLogprobs.cloudSdkCustomFields) + && Objects.equals(this.content, choiceLogprobs.content) + && Objects.equals(this.refusal, choiceLogprobs.refusal); + } + + @Override + public int hashCode() { + return Objects.hash(content, refusal, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ChoiceLogprobs {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link ChoiceLogprobs} instance. No arguments are required. */ + public static ChoiceLogprobs create() { + return new ChoiceLogprobs(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostRequest.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostRequest.java index bb81b40ab..08290ff96 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostRequest.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostRequest.java @@ -31,11 +31,11 @@ public class CompletionPostRequest // CHECKSTYLE:ON { - @JsonProperty("orchestration_config") - private OrchestrationConfig orchestrationConfig; + @JsonProperty("config") + private OrchestrationConfig config; - @JsonProperty("input_params") - private Map inputParams = new HashMap<>(); + @JsonProperty("placeholder_values") + private Map placeholderValues = new HashMap<>(); @JsonProperty("messages_history") private List messagesHistory; @@ -47,86 +47,84 @@ public class CompletionPostRequest protected CompletionPostRequest() {} /** - * Set the orchestrationConfig of this {@link CompletionPostRequest} instance and return the same - * instance. + * Set the config of this {@link CompletionPostRequest} instance and return the same instance. * - * @param orchestrationConfig The orchestrationConfig of this {@link CompletionPostRequest} + * @param config The config of this {@link CompletionPostRequest} * @return The same instance of this {@link CompletionPostRequest} class */ @Nonnull - public CompletionPostRequest orchestrationConfig( - @Nonnull final OrchestrationConfig orchestrationConfig) { - this.orchestrationConfig = orchestrationConfig; + public CompletionPostRequest config(@Nonnull final OrchestrationConfig config) { + this.config = config; return this; } /** - * Get orchestrationConfig + * Get config * - * @return orchestrationConfig The orchestrationConfig of this {@link CompletionPostRequest} - * instance. + * @return config The config of this {@link CompletionPostRequest} instance. */ @Nonnull - public OrchestrationConfig getOrchestrationConfig() { - return orchestrationConfig; + public OrchestrationConfig getConfig() { + return config; } /** - * Set the orchestrationConfig of this {@link CompletionPostRequest} instance. + * Set the config of this {@link CompletionPostRequest} instance. * - * @param orchestrationConfig The orchestrationConfig of this {@link CompletionPostRequest} + * @param config The config of this {@link CompletionPostRequest} */ - public void setOrchestrationConfig(@Nonnull final OrchestrationConfig orchestrationConfig) { - this.orchestrationConfig = orchestrationConfig; + public void setConfig(@Nonnull final OrchestrationConfig config) { + this.config = config; } /** - * Set the inputParams of this {@link CompletionPostRequest} instance and return the same + * Set the placeholderValues of this {@link CompletionPostRequest} instance and return the same * instance. * - * @param inputParams The inputParams of this {@link CompletionPostRequest} + * @param placeholderValues The placeholderValues of this {@link CompletionPostRequest} * @return The same instance of this {@link CompletionPostRequest} class */ @Nonnull - public CompletionPostRequest inputParams(@Nullable final Map inputParams) { - this.inputParams = inputParams; + public CompletionPostRequest placeholderValues( + @Nullable final Map placeholderValues) { + this.placeholderValues = placeholderValues; return this; } /** - * Put one inputParams instance to this {@link CompletionPostRequest} instance. + * Put one placeholderValues instance to this {@link CompletionPostRequest} instance. * - * @param key The String key of this inputParams instance - * @param inputParamsItem The inputParams that should be added under the given key + * @param key The String key of this placeholderValues instance + * @param placeholderValuesItem The placeholderValues that should be added under the given key * @return The same instance of type {@link CompletionPostRequest} */ @Nonnull - public CompletionPostRequest putinputParamsItem( - @Nonnull final String key, @Nonnull final String inputParamsItem) { - if (this.inputParams == null) { - this.inputParams = new HashMap<>(); + public CompletionPostRequest putplaceholderValuesItem( + @Nonnull final String key, @Nonnull final String placeholderValuesItem) { + if (this.placeholderValues == null) { + this.placeholderValues = new HashMap<>(); } - this.inputParams.put(key, inputParamsItem); + this.placeholderValues.put(key, placeholderValuesItem); return this; } /** - * Get inputParams + * Get placeholderValues * - * @return inputParams The inputParams of this {@link CompletionPostRequest} instance. + * @return placeholderValues The placeholderValues of this {@link CompletionPostRequest} instance. */ @Nonnull - public Map getInputParams() { - return inputParams; + public Map getPlaceholderValues() { + return placeholderValues; } /** - * Set the inputParams of this {@link CompletionPostRequest} instance. + * Set the placeholderValues of this {@link CompletionPostRequest} instance. * - * @param inputParams The inputParams of this {@link CompletionPostRequest} + * @param placeholderValues The placeholderValues of this {@link CompletionPostRequest} */ - public void setInputParams(@Nullable final Map inputParams) { - this.inputParams = inputParams; + public void setPlaceholderValues(@Nullable final Map placeholderValues) { + this.placeholderValues = placeholderValues; } /** @@ -219,8 +217,8 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (orchestrationConfig != null) declaredFields.put("orchestrationConfig", orchestrationConfig); - if (inputParams != null) declaredFields.put("inputParams", inputParams); + if (config != null) declaredFields.put("config", config); + if (placeholderValues != null) declaredFields.put("placeholderValues", placeholderValues); if (messagesHistory != null) declaredFields.put("messagesHistory", messagesHistory); return declaredFields; } @@ -247,14 +245,14 @@ public boolean equals(@Nullable final java.lang.Object o) { } final CompletionPostRequest completionPostRequest = (CompletionPostRequest) o; return Objects.equals(this.cloudSdkCustomFields, completionPostRequest.cloudSdkCustomFields) - && Objects.equals(this.orchestrationConfig, completionPostRequest.orchestrationConfig) - && Objects.equals(this.inputParams, completionPostRequest.inputParams) + && Objects.equals(this.config, completionPostRequest.config) + && Objects.equals(this.placeholderValues, completionPostRequest.placeholderValues) && Objects.equals(this.messagesHistory, completionPostRequest.messagesHistory); } @Override public int hashCode() { - return Objects.hash(orchestrationConfig, inputParams, messagesHistory, cloudSdkCustomFields); + return Objects.hash(config, placeholderValues, messagesHistory, cloudSdkCustomFields); } @Override @@ -262,10 +260,8 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class CompletionPostRequest {\n"); - sb.append(" orchestrationConfig: ") - .append(toIndentedString(orchestrationConfig)) - .append("\n"); - sb.append(" inputParams: ").append(toIndentedString(inputParams)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" placeholderValues: ").append(toIndentedString(placeholderValues)).append("\n"); sb.append(" messagesHistory: ").append(toIndentedString(messagesHistory)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> @@ -289,19 +285,17 @@ private String toIndentedString(final java.lang.Object o) { * instance with all required arguments. */ public static Builder create() { - return (orchestrationConfig) -> - new CompletionPostRequest().orchestrationConfig(orchestrationConfig); + return (config) -> new CompletionPostRequest().config(config); } /** Builder helper class. */ public interface Builder { /** - * Set the orchestrationConfig of this {@link CompletionPostRequest} instance. + * Set the config of this {@link CompletionPostRequest} instance. * - * @param orchestrationConfig The orchestrationConfig of this {@link CompletionPostRequest} + * @param config The config of this {@link CompletionPostRequest} * @return The CompletionPostRequest instance. */ - CompletionPostRequest orchestrationConfig( - @Nonnull final OrchestrationConfig orchestrationConfig); + CompletionPostRequest config(@Nonnull final OrchestrationConfig config); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponse.java index 245223966..c5b0f0908 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponse.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponse.java @@ -31,11 +31,11 @@ public class CompletionPostResponse @JsonProperty("request_id") private String requestId; - @JsonProperty("module_results") - private ModuleResults moduleResults; + @JsonProperty("intermediate_results") + private ModuleResults intermediateResults; - @JsonProperty("orchestration_result") - private LLMModuleResult orchestrationResult; + @JsonProperty("final_result") + private LLMModuleResult finalResult; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -75,69 +75,69 @@ public void setRequestId(@Nonnull final String requestId) { } /** - * Set the moduleResults of this {@link CompletionPostResponse} instance and return the same + * Set the intermediateResults of this {@link CompletionPostResponse} instance and return the same * instance. * - * @param moduleResults The moduleResults of this {@link CompletionPostResponse} + * @param intermediateResults The intermediateResults of this {@link CompletionPostResponse} * @return The same instance of this {@link CompletionPostResponse} class */ @Nonnull - public CompletionPostResponse moduleResults(@Nonnull final ModuleResults moduleResults) { - this.moduleResults = moduleResults; + public CompletionPostResponse intermediateResults( + @Nonnull final ModuleResults intermediateResults) { + this.intermediateResults = intermediateResults; return this; } /** - * Get moduleResults + * Get intermediateResults * - * @return moduleResults The moduleResults of this {@link CompletionPostResponse} instance. + * @return intermediateResults The intermediateResults of this {@link CompletionPostResponse} + * instance. */ @Nonnull - public ModuleResults getModuleResults() { - return moduleResults; + public ModuleResults getIntermediateResults() { + return intermediateResults; } /** - * Set the moduleResults of this {@link CompletionPostResponse} instance. + * Set the intermediateResults of this {@link CompletionPostResponse} instance. * - * @param moduleResults The moduleResults of this {@link CompletionPostResponse} + * @param intermediateResults The intermediateResults of this {@link CompletionPostResponse} */ - public void setModuleResults(@Nonnull final ModuleResults moduleResults) { - this.moduleResults = moduleResults; + public void setIntermediateResults(@Nonnull final ModuleResults intermediateResults) { + this.intermediateResults = intermediateResults; } /** - * Set the orchestrationResult of this {@link CompletionPostResponse} instance and return the same + * Set the finalResult of this {@link CompletionPostResponse} instance and return the same * instance. * - * @param orchestrationResult The orchestrationResult of this {@link CompletionPostResponse} + * @param finalResult The finalResult of this {@link CompletionPostResponse} * @return The same instance of this {@link CompletionPostResponse} class */ @Nonnull - public CompletionPostResponse orchestrationResult( - @Nonnull final LLMModuleResult orchestrationResult) { - this.orchestrationResult = orchestrationResult; + public CompletionPostResponse finalResult(@Nonnull final LLMModuleResult finalResult) { + this.finalResult = finalResult; return this; } /** - * Get orchestrationResult + * Get finalResult * - * @return orchestrationResult The orchestrationResult of this {@link CompletionPostResponse} - * instance. + * @return finalResult The finalResult of this {@link CompletionPostResponse} instance. */ @Nonnull - public LLMModuleResult getOrchestrationResult() { - return orchestrationResult; + public LLMModuleResult getFinalResult() { + return finalResult; } /** - * Set the orchestrationResult of this {@link CompletionPostResponse} instance. + * Set the finalResult of this {@link CompletionPostResponse} instance. * - * @param orchestrationResult The orchestrationResult of this {@link CompletionPostResponse} + * @param finalResult The finalResult of this {@link CompletionPostResponse} */ - public void setOrchestrationResult(@Nonnull final LLMModuleResult orchestrationResult) { - this.orchestrationResult = orchestrationResult; + public void setFinalResult(@Nonnull final LLMModuleResult finalResult) { + this.finalResult = finalResult; } /** @@ -180,8 +180,8 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (requestId != null) declaredFields.put("requestId", requestId); - if (moduleResults != null) declaredFields.put("moduleResults", moduleResults); - if (orchestrationResult != null) declaredFields.put("orchestrationResult", orchestrationResult); + if (intermediateResults != null) declaredFields.put("intermediateResults", intermediateResults); + if (finalResult != null) declaredFields.put("finalResult", finalResult); return declaredFields; } @@ -208,13 +208,13 @@ public boolean equals(@Nullable final java.lang.Object o) { final CompletionPostResponse completionPostResponse = (CompletionPostResponse) o; return Objects.equals(this.cloudSdkCustomFields, completionPostResponse.cloudSdkCustomFields) && Objects.equals(this.requestId, completionPostResponse.requestId) - && Objects.equals(this.moduleResults, completionPostResponse.moduleResults) - && Objects.equals(this.orchestrationResult, completionPostResponse.orchestrationResult); + && Objects.equals(this.intermediateResults, completionPostResponse.intermediateResults) + && Objects.equals(this.finalResult, completionPostResponse.finalResult); } @Override public int hashCode() { - return Objects.hash(requestId, moduleResults, orchestrationResult, cloudSdkCustomFields); + return Objects.hash(requestId, intermediateResults, finalResult, cloudSdkCustomFields); } @Override @@ -223,10 +223,10 @@ public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class CompletionPostResponse {\n"); sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); - sb.append(" moduleResults: ").append(toIndentedString(moduleResults)).append("\n"); - sb.append(" orchestrationResult: ") - .append(toIndentedString(orchestrationResult)) + sb.append(" intermediateResults: ") + .append(toIndentedString(intermediateResults)) .append("\n"); + sb.append(" finalResult: ").append(toIndentedString(finalResult)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -250,12 +250,12 @@ private String toIndentedString(final java.lang.Object o) { */ public static Builder create() { return (requestId) -> - (moduleResults) -> - (orchestrationResult) -> + (intermediateResults) -> + (finalResult) -> new CompletionPostResponse() .requestId(requestId) - .moduleResults(moduleResults) - .orchestrationResult(orchestrationResult); + .intermediateResults(intermediateResults) + .finalResult(finalResult); } /** Builder helper class. */ @@ -272,22 +272,22 @@ public interface Builder { /** Builder helper class. */ public interface Builder1 { /** - * Set the moduleResults of this {@link CompletionPostResponse} instance. + * Set the intermediateResults of this {@link CompletionPostResponse} instance. * - * @param moduleResults The moduleResults of this {@link CompletionPostResponse} + * @param intermediateResults The intermediateResults of this {@link CompletionPostResponse} * @return The CompletionPostResponse builder. */ - Builder2 moduleResults(@Nonnull final ModuleResults moduleResults); + Builder2 intermediateResults(@Nonnull final ModuleResults intermediateResults); } /** Builder helper class. */ public interface Builder2 { /** - * Set the orchestrationResult of this {@link CompletionPostResponse} instance. + * Set the finalResult of this {@link CompletionPostResponse} instance. * - * @param orchestrationResult The orchestrationResult of this {@link CompletionPostResponse} + * @param finalResult The finalResult of this {@link CompletionPostResponse} * @return The CompletionPostResponse instance. */ - CompletionPostResponse orchestrationResult(@Nonnull final LLMModuleResult orchestrationResult); + CompletionPostResponse finalResult(@Nonnull final LLMModuleResult finalResult); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponseStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponseStreaming.java index 4c0b23d24..7f4f759ff 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponseStreaming.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CompletionPostResponseStreaming.java @@ -31,11 +31,11 @@ public class CompletionPostResponseStreaming @JsonProperty("request_id") private String requestId; - @JsonProperty("module_results") - private ModuleResults moduleResults; + @JsonProperty("intermediate_results") + private ModuleResultsStreaming intermediateResults; - @JsonProperty("orchestration_result") - private LLMModuleResultStreaming orchestrationResult; + @JsonProperty("final_result") + private LLMModuleResultStreaming finalResult; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -76,73 +76,72 @@ public void setRequestId(@Nonnull final String requestId) { } /** - * Set the moduleResults of this {@link CompletionPostResponseStreaming} instance and return the - * same instance. + * Set the intermediateResults of this {@link CompletionPostResponseStreaming} instance and return + * the same instance. * - * @param moduleResults The moduleResults of this {@link CompletionPostResponseStreaming} + * @param intermediateResults The intermediateResults of this {@link + * CompletionPostResponseStreaming} * @return The same instance of this {@link CompletionPostResponseStreaming} class */ @Nonnull - public CompletionPostResponseStreaming moduleResults( - @Nullable final ModuleResults moduleResults) { - this.moduleResults = moduleResults; + public CompletionPostResponseStreaming intermediateResults( + @Nullable final ModuleResultsStreaming intermediateResults) { + this.intermediateResults = intermediateResults; return this; } /** - * Get moduleResults + * Get intermediateResults * - * @return moduleResults The moduleResults of this {@link CompletionPostResponseStreaming} - * instance. + * @return intermediateResults The intermediateResults of this {@link + * CompletionPostResponseStreaming} instance. */ @Nonnull - public ModuleResults getModuleResults() { - return moduleResults; + public ModuleResultsStreaming getIntermediateResults() { + return intermediateResults; } /** - * Set the moduleResults of this {@link CompletionPostResponseStreaming} instance. + * Set the intermediateResults of this {@link CompletionPostResponseStreaming} instance. * - * @param moduleResults The moduleResults of this {@link CompletionPostResponseStreaming} + * @param intermediateResults The intermediateResults of this {@link + * CompletionPostResponseStreaming} */ - public void setModuleResults(@Nullable final ModuleResults moduleResults) { - this.moduleResults = moduleResults; + public void setIntermediateResults(@Nullable final ModuleResultsStreaming intermediateResults) { + this.intermediateResults = intermediateResults; } /** - * Set the orchestrationResult of this {@link CompletionPostResponseStreaming} instance and return - * the same instance. + * Set the finalResult of this {@link CompletionPostResponseStreaming} instance and return the + * same instance. * - * @param orchestrationResult The orchestrationResult of this {@link - * CompletionPostResponseStreaming} + * @param finalResult The finalResult of this {@link CompletionPostResponseStreaming} * @return The same instance of this {@link CompletionPostResponseStreaming} class */ @Nonnull - public CompletionPostResponseStreaming orchestrationResult( - @Nullable final LLMModuleResultStreaming orchestrationResult) { - this.orchestrationResult = orchestrationResult; + public CompletionPostResponseStreaming finalResult( + @Nullable final LLMModuleResultStreaming finalResult) { + this.finalResult = finalResult; return this; } /** - * Get orchestrationResult + * Get finalResult * - * @return orchestrationResult The orchestrationResult of this {@link - * CompletionPostResponseStreaming} instance. + * @return finalResult The finalResult of this {@link CompletionPostResponseStreaming} instance. */ @Nonnull - public LLMModuleResultStreaming getOrchestrationResult() { - return orchestrationResult; + public LLMModuleResultStreaming getFinalResult() { + return finalResult; } /** - * Set the orchestrationResult of this {@link CompletionPostResponseStreaming} instance. + * Set the finalResult of this {@link CompletionPostResponseStreaming} instance. * - * @param orchestrationResult The orchestrationResult of this {@link - * CompletionPostResponseStreaming} + * @param finalResult The finalResult of this {@link CompletionPostResponseStreaming} */ - public void setOrchestrationResult(@Nullable final LLMModuleResultStreaming orchestrationResult) { - this.orchestrationResult = orchestrationResult; + public void setFinalResult(@Nullable final LLMModuleResultStreaming finalResult) { + this.finalResult = finalResult; } /** @@ -186,8 +185,8 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (requestId != null) declaredFields.put("requestId", requestId); - if (moduleResults != null) declaredFields.put("moduleResults", moduleResults); - if (orchestrationResult != null) declaredFields.put("orchestrationResult", orchestrationResult); + if (intermediateResults != null) declaredFields.put("intermediateResults", intermediateResults); + if (finalResult != null) declaredFields.put("finalResult", finalResult); return declaredFields; } @@ -217,14 +216,14 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals( this.cloudSdkCustomFields, completionPostResponseStreaming.cloudSdkCustomFields) && Objects.equals(this.requestId, completionPostResponseStreaming.requestId) - && Objects.equals(this.moduleResults, completionPostResponseStreaming.moduleResults) && Objects.equals( - this.orchestrationResult, completionPostResponseStreaming.orchestrationResult); + this.intermediateResults, completionPostResponseStreaming.intermediateResults) + && Objects.equals(this.finalResult, completionPostResponseStreaming.finalResult); } @Override public int hashCode() { - return Objects.hash(requestId, moduleResults, orchestrationResult, cloudSdkCustomFields); + return Objects.hash(requestId, intermediateResults, finalResult, cloudSdkCustomFields); } @Override @@ -233,10 +232,10 @@ public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class CompletionPostResponseStreaming {\n"); sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); - sb.append(" moduleResults: ").append(toIndentedString(moduleResults)).append("\n"); - sb.append(" orchestrationResult: ") - .append(toIndentedString(orchestrationResult)) + sb.append(" intermediateResults: ") + .append(toIndentedString(intermediateResults)) .append("\n"); + sb.append(" finalResult: ").append(toIndentedString(finalResult)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPICustomEntity.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPICustomEntity.java new file mode 100644 index 000000000..a7487b6de --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPICustomEntity.java @@ -0,0 +1,237 @@ +/* + * 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.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; + +/** DPICustomEntity */ +// CHECKSTYLE:OFF +public class DPICustomEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty("regex") + private String regex; + + @JsonProperty("replacement_strategy") + private DPIMethodConstant replacementStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPICustomEntity. */ + protected DPICustomEntity() {} + + /** + * Set the regex of this {@link DPICustomEntity} instance and return the same instance. + * + * @param regex Regular expression to match the entity + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity regex(@Nonnull final String regex) { + this.regex = regex; + return this; + } + + /** + * Regular expression to match the entity + * + * @return regex The regex of this {@link DPICustomEntity} instance. + */ + @Nonnull + public String getRegex() { + return regex; + } + + /** + * Set the regex of this {@link DPICustomEntity} instance. + * + * @param regex Regular expression to match the entity + */ + public void setRegex(@Nonnull final String regex) { + this.regex = regex; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance and return the same + * instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity replacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy) { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPICustomEntity} instance. + */ + @Nonnull + public DPIMethodConstant getReplacementStrategy() { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + */ + public void setReplacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy) { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPICustomEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPICustomEntity} 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("DPICustomEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPICustomEntity} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (regex != null) declaredFields.put("regex", regex); + if (replacementStrategy != null) declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPICustomEntity} 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 DPICustomEntity dpICustomEntity = (DPICustomEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpICustomEntity.cloudSdkCustomFields) + && Objects.equals(this.regex, dpICustomEntity.regex) + && Objects.equals(this.replacementStrategy, dpICustomEntity.replacementStrategy); + } + + @Override + public int hashCode() { + return Objects.hash(regex, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPICustomEntity {\n"); + sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); + sb.append(" replacementStrategy: ") + .append(toIndentedString(replacementStrategy)) + .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 DPICustomEntity} + * instance with all required arguments. + */ + public static Builder create() { + return (regex) -> + (replacementStrategy) -> + new DPICustomEntity().regex(regex).replacementStrategy(replacementStrategy); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the regex of this {@link DPICustomEntity} instance. + * + * @param regex Regular expression to match the entity + * @return The DPICustomEntity builder. + */ + Builder1 regex(@Nonnull final String regex); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + * @return The DPICustomEntity instance. + */ + DPICustomEntity replacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntities.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntities.java index 54e5f99ce..e0d17c434 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntities.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntities.java @@ -59,6 +59,8 @@ public enum DPIEntities { PRONOUNS_GENDER("profile-pronouns-gender"), + ETHNICITY("profile-ethnicity"), + GENDER("profile-gender"), SEXUAL_ORIENTATION("profile-sexual-orientation"), diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntityConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntityConfig.java index 20dfca1f8..5448e04cb 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntityConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIEntityConfig.java @@ -11,174 +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.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; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; /** DPIEntityConfig */ -// CHECKSTYLE:OFF -public class DPIEntityConfig -// CHECKSTYLE:ON -{ - @JsonProperty("type") - private DPIEntities type; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** Default constructor for DPIEntityConfig. */ - protected DPIEntityConfig() {} - - /** - * Set the type of this {@link DPIEntityConfig} instance and return the same instance. - * - * @param type Type of entity to be masked - * @return The same instance of this {@link DPIEntityConfig} class - */ - @Nonnull - public DPIEntityConfig type(@Nonnull final DPIEntities type) { - this.type = type; - return this; - } - - /** - * Type of entity to be masked - * - * @return type The type of this {@link DPIEntityConfig} instance. - */ - @Nonnull - public DPIEntities getType() { - return type; - } - - /** - * Set the type of this {@link DPIEntityConfig} instance. - * - * @param type Type of entity to be masked - */ - public void setType(@Nonnull final DPIEntities type) { - this.type = type; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIEntityConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIEntityConfig} 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("DPIEntityConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIEntityConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (type != null) declaredFields.put("type", type); - return declaredFields; - } - - /** - * 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 - */ - @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 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, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIEntityConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - cloudSdkCustomFields.forEach( - (k, v) -> - sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(final java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - /** - * Create a type-safe, fluent-api builder object to construct a new {@link DPIEntityConfig} - * instance with all required arguments. - */ - public static Builder create() { - return (type) -> new DPIEntityConfig().type(type); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the type of this {@link DPIEntityConfig} instance. - * - * @param type Type of entity to be masked - * @return The DPIEntityConfig instance. - */ - DPIEntityConfig type(@Nonnull final DPIEntities type); - } -} +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = DPICustomEntity.class), + @JsonSubTypes.Type(value = DPIStandardEntity.class), +}) +public interface DPIEntityConfig {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodConstant.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodConstant.java new file mode 100644 index 000000000..9a1441942 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodConstant.java @@ -0,0 +1,288 @@ +/* + * 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.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; + +/** Replaces the entity with the specified value followed by an incrementing number */ +// CHECKSTYLE:OFF +public class DPIMethodConstant implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** Gets or Sets method */ + public enum MethodEnum { + /** The CONSTANT option of this DPIMethodConstant */ + CONSTANT("constant"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodConstant */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + 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 DPIMethodConstant + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonProperty("value") + private String value; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIMethodConstant. */ + protected DPIMethodConstant() {} + + /** + * Set the method of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param method The method of this {@link DPIMethodConstant} + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIMethodConstant} instance. + * + * @param method The method of this {@link DPIMethodConstant} + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param value Value to be used for replacement + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant value(@Nonnull final String value) { + this.value = value; + return this; + } + + /** + * Value to be used for replacement + * + * @return value The value of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public String getValue() { + return value; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance. + * + * @param value Value to be used for replacement + */ + public void setValue(@Nonnull final String value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodConstant}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodConstant} 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("DPIMethodConstant has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodConstant} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (method != null) declaredFields.put("method", method); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodConstant} 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 DPIMethodConstant dpIMethodConstant = (DPIMethodConstant) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodConstant.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodConstant.method) + && Objects.equals(this.value, dpIMethodConstant.value); + } + + @Override + public int hashCode() { + return Objects.hash(method, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodConstant {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 DPIMethodConstant} + * instance with all required arguments. + */ + public static Builder create() { + return (method) -> (value) -> new DPIMethodConstant().method(method).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the method of this {@link DPIMethodConstant} instance. + * + * @param method The method of this {@link DPIMethodConstant} + * @return The DPIMethodConstant builder. + */ + Builder1 method(@Nonnull final MethodEnum method); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link DPIMethodConstant} instance. + * + * @param value Value to be used for replacement + * @return The DPIMethodConstant instance. + */ + DPIMethodConstant value(@Nonnull final String value); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodFabricatedData.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodFabricatedData.java new file mode 100644 index 000000000..fd98ad3ad --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIMethodFabricatedData.java @@ -0,0 +1,241 @@ +/* + * 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.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; + +/** Replaces the entity with a randomly generated value appropriate to its type. */ +// CHECKSTYLE:OFF +public class DPIMethodFabricatedData implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** Gets or Sets method */ + public enum MethodEnum { + /** The FABRICATED_DATA option of this DPIMethodFabricatedData */ + FABRICATED_DATA("fabricated_data"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodFabricatedData */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + 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 DPIMethodFabricatedData + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIMethodFabricatedData. */ + protected DPIMethodFabricatedData() {} + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance and return the same instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + * @return The same instance of this {@link DPIMethodFabricatedData} class + */ + @Nonnull + public DPIMethodFabricatedData method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodFabricatedData} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodFabricatedData}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodFabricatedData} 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( + "DPIMethodFabricatedData has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodFabricatedData} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (method != null) declaredFields.put("method", method); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodFabricatedData} 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 DPIMethodFabricatedData dpIMethodFabricatedData = (DPIMethodFabricatedData) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodFabricatedData.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodFabricatedData.method); + } + + @Override + public int hashCode() { + return Objects.hash(method, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodFabricatedData {\n"); + sb.append(" method: ").append(toIndentedString(method)).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 + * DPIMethodFabricatedData} instance with all required arguments. + */ + public static Builder create() { + return (method) -> new DPIMethodFabricatedData().method(method); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the method of this {@link DPIMethodFabricatedData} instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + * @return The DPIMethodFabricatedData instance. + */ + DPIMethodFabricatedData method(@Nonnull final MethodEnum method); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntity.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntity.java new file mode 100644 index 000000000..2b93c0692 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntity.java @@ -0,0 +1,226 @@ +/* + * 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.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; + +/** DPIStandardEntity */ +// CHECKSTYLE:OFF +public class DPIStandardEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty("type") + private DPIEntities type; + + @JsonProperty("replacement_strategy") + private DPIStandardEntityReplacementStrategy replacementStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIStandardEntity. */ + protected DPIStandardEntity() {} + + /** + * Set the type of this {@link DPIStandardEntity} instance and return the same instance. + * + * @param type The type of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity type(@Nonnull final DPIEntities type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIEntities getType() { + return type; + } + + /** + * Set the type of this {@link DPIStandardEntity} instance. + * + * @param type The type of this {@link DPIStandardEntity} + */ + public void setType(@Nonnull final DPIEntities type) { + this.type = type; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance and return the same + * instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity replacementStrategy( + @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy) { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIStandardEntityReplacementStrategy getReplacementStrategy() { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} + */ + public void setReplacementStrategy( + @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy) { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIStandardEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIStandardEntity} 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("DPIStandardEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIStandardEntity} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (replacementStrategy != null) declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIStandardEntity} 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 DPIStandardEntity dpIStandardEntity = (DPIStandardEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpIStandardEntity.cloudSdkCustomFields) + && Objects.equals(this.type, dpIStandardEntity.type) + && Objects.equals(this.replacementStrategy, dpIStandardEntity.replacementStrategy); + } + + @Override + public int hashCode() { + return Objects.hash(type, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIStandardEntity {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" replacementStrategy: ") + .append(toIndentedString(replacementStrategy)) + .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 DPIStandardEntity} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> new DPIStandardEntity().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link DPIStandardEntity} instance. + * + * @param type The type of this {@link DPIStandardEntity} + * @return The DPIStandardEntity instance. + */ + DPIStandardEntity type(@Nonnull final DPIEntities type); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntityReplacementStrategy.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntityReplacementStrategy.java new file mode 100644 index 000000000..930aeb75a --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIStandardEntityReplacementStrategy.java @@ -0,0 +1,23 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** Replacement strategy to be used for the entity */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = DPIMethodConstant.class), + @JsonSubTypes.Type(value = DPIMethodFabricatedData.class), +}) +public interface DPIStandardEntityReplacementStrategy {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Embedding.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Embedding.java new file mode 100644 index 000000000..712a16b91 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Embedding.java @@ -0,0 +1,52 @@ +/* + * 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 java.math.BigDecimal; +import java.util.List; +import javax.annotation.Nonnull; + +/** Embedding */ +public interface Embedding { + /** Helper class to create a String that implements {@link Embedding}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements Embedding {} + + /** + * Creator to enable deserialization of a String. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** Helper class to create a list of BigDecimal that implements {@link Embedding}. */ + record InnerBigDecimals( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements Embedding {} + + /** + * Creator to enable deserialization of a list of BigDecimal. + * + * @param val the value to use + * @return a new instance of {@link InnerBigDecimals}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerBigDecimals create(@Nonnull final List val) { + return new InnerBigDecimals(val); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingResult.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingResult.java new file mode 100644 index 000000000..12dfde521 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingResult.java @@ -0,0 +1,338 @@ +/* + * 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.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; + +/** Represents an embedding vector returned by embedding endpoint. */ +// CHECKSTYLE:OFF +public class EmbeddingResult +// CHECKSTYLE:ON +{ + /** The object type, which is always \"embedding\". */ + public enum ObjectEnum { + /** The EMBEDDING option of this EmbeddingResult */ + EMBEDDING("embedding"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this EmbeddingResult */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ObjectEnum(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 EmbeddingResult + */ + @JsonCreator + @Nonnull + public static ObjectEnum fromValue(@Nonnull final String value) { + for (ObjectEnum b : ObjectEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("object") + private ObjectEnum _object; + + @JsonProperty("embedding") + private Embedding embedding; + + @JsonProperty("index") + private Integer index; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingResult. */ + protected EmbeddingResult() {} + + /** + * Set the _object of this {@link EmbeddingResult} instance and return the same instance. + * + * @param _object The object type, which is always \"embedding\". + * @return The same instance of this {@link EmbeddingResult} class + */ + @Nonnull + public EmbeddingResult _object(@Nonnull final ObjectEnum _object) { + this._object = _object; + return this; + } + + /** + * The object type, which is always \"embedding\". + * + * @return _object The _object of this {@link EmbeddingResult} instance. + */ + @Nonnull + public ObjectEnum getObject() { + return _object; + } + + /** + * Set the _object of this {@link EmbeddingResult} instance. + * + * @param _object The object type, which is always \"embedding\". + */ + public void setObject(@Nonnull final ObjectEnum _object) { + this._object = _object; + } + + /** + * Set the embedding of this {@link EmbeddingResult} instance and return the same instance. + * + * @param embedding The embedding of this {@link EmbeddingResult} + * @return The same instance of this {@link EmbeddingResult} class + */ + @Nonnull + public EmbeddingResult embedding(@Nonnull final Embedding embedding) { + this.embedding = embedding; + return this; + } + + /** + * Get embedding + * + * @return embedding The embedding of this {@link EmbeddingResult} instance. + */ + @Nonnull + public Embedding getEmbedding() { + return embedding; + } + + /** + * Set the embedding of this {@link EmbeddingResult} instance. + * + * @param embedding The embedding of this {@link EmbeddingResult} + */ + public void setEmbedding(@Nonnull final Embedding embedding) { + this.embedding = embedding; + } + + /** + * Set the index of this {@link EmbeddingResult} instance and return the same instance. + * + * @param index The index of the embedding in the list of embeddings. + * @return The same instance of this {@link EmbeddingResult} class + */ + @Nonnull + public EmbeddingResult index(@Nonnull final Integer index) { + this.index = index; + return this; + } + + /** + * The index of the embedding in the list of embeddings. + * + * @return index The index of this {@link EmbeddingResult} instance. + */ + @Nonnull + public Integer getIndex() { + return index; + } + + /** + * Set the index of this {@link EmbeddingResult} instance. + * + * @param index The index of the embedding in the list of embeddings. + */ + public void setIndex(@Nonnull final Integer index) { + this.index = index; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingResult}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingResult} 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("EmbeddingResult has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingResult} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (_object != null) declaredFields.put("_object", _object); + if (embedding != null) declaredFields.put("embedding", embedding); + if (index != null) declaredFields.put("index", index); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingResult} 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 EmbeddingResult embeddingResult = (EmbeddingResult) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingResult.cloudSdkCustomFields) + && Objects.equals(this._object, embeddingResult._object) + && Objects.equals(this.embedding, embeddingResult.embedding) + && Objects.equals(this.index, embeddingResult.index); + } + + @Override + public int hashCode() { + return Objects.hash(_object, embedding, index, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingResult {\n"); + sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); + sb.append(" embedding: ").append(toIndentedString(embedding)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).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 EmbeddingResult} + * instance with all required arguments. + */ + public static Builder create() { + return (_object) -> + (embedding) -> + (index) -> new EmbeddingResult()._object(_object).embedding(embedding).index(index); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the _object of this {@link EmbeddingResult} instance. + * + * @param _object The object type, which is always \"embedding\". + * @return The EmbeddingResult builder. + */ + Builder1 _object(@Nonnull final ObjectEnum _object); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the embedding of this {@link EmbeddingResult} instance. + * + * @param embedding The embedding of this {@link EmbeddingResult} + * @return The EmbeddingResult builder. + */ + Builder2 embedding(@Nonnull final Embedding embedding); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the index of this {@link EmbeddingResult} instance. + * + * @param index The index of the embedding in the list of embeddings. + * @return The EmbeddingResult instance. + */ + EmbeddingResult index(@Nonnull final Integer index); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInput.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInput.java new file mode 100644 index 000000000..7a8007616 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInput.java @@ -0,0 +1,283 @@ +/* + * 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.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; + +/** EmbeddingsInput */ +// CHECKSTYLE:OFF +public class EmbeddingsInput +// CHECKSTYLE:ON +{ + @JsonProperty("text") + private EmbeddingsInputText text; + + /** Gets or Sets type */ + public enum TypeEnum { + /** The TEXT option of this EmbeddingsInput */ + TEXT("text"), + + /** The DOCUMENT option of this EmbeddingsInput */ + DOCUMENT("document"), + + /** The QUERY option of this EmbeddingsInput */ + QUERY("query"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this EmbeddingsInput */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type EmbeddingsInput + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsInput. */ + protected EmbeddingsInput() {} + + /** + * Set the text of this {@link EmbeddingsInput} instance and return the same instance. + * + * @param text The text of this {@link EmbeddingsInput} + * @return The same instance of this {@link EmbeddingsInput} class + */ + @Nonnull + public EmbeddingsInput text(@Nonnull final EmbeddingsInputText text) { + this.text = text; + return this; + } + + /** + * Get text + * + * @return text The text of this {@link EmbeddingsInput} instance. + */ + @Nonnull + public EmbeddingsInputText getText() { + return text; + } + + /** + * Set the text of this {@link EmbeddingsInput} instance. + * + * @param text The text of this {@link EmbeddingsInput} + */ + public void setText(@Nonnull final EmbeddingsInputText text) { + this.text = text; + } + + /** + * Set the type of this {@link EmbeddingsInput} instance and return the same instance. + * + * @param type The type of this {@link EmbeddingsInput} + * @return The same instance of this {@link EmbeddingsInput} class + */ + @Nonnull + public EmbeddingsInput type(@Nullable final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link EmbeddingsInput} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link EmbeddingsInput} instance. + * + * @param type The type of this {@link EmbeddingsInput} + */ + public void setType(@Nullable final TypeEnum type) { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsInput} 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("EmbeddingsInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsInput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (text != null) declaredFields.put("text", text); + if (type != null) declaredFields.put("type", type); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsInput} 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 EmbeddingsInput embeddingsInput = (EmbeddingsInput) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsInput.cloudSdkCustomFields) + && Objects.equals(this.text, embeddingsInput.text) + && Objects.equals(this.type, embeddingsInput.type); + } + + @Override + public int hashCode() { + return Objects.hash(text, type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsInput {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link EmbeddingsInput} + * instance with all required arguments. + */ + public static Builder create() { + return (text) -> new EmbeddingsInput().text(text); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the text of this {@link EmbeddingsInput} instance. + * + * @param text The text of this {@link EmbeddingsInput} + * @return The EmbeddingsInput instance. + */ + EmbeddingsInput text(@Nonnull final EmbeddingsInputText text); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInputText.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInputText.java new file mode 100644 index 000000000..3e726dfbd --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsInputText.java @@ -0,0 +1,50 @@ +/* + * 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 java.util.List; +import javax.annotation.Nonnull; + +/** Text input for which embeddings need to be generated */ +public interface EmbeddingsInputText { + /** Helper class to create a String that implements {@link EmbeddingsInputText}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements EmbeddingsInputText {} + + /** + * Creator to enable deserialization of a String. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** Helper class to create a list of String that implements {@link EmbeddingsInputText}. */ + record InnerStrings(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements EmbeddingsInputText {} + + /** + * Creator to enable deserialization of a list of String. + * + * @param val the value to use + * @return a new instance of {@link InnerStrings}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerStrings create(@Nonnull final List val) { + return new InnerStrings(val); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelConfig.java new file mode 100644 index 000000000..c246b72aa --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelConfig.java @@ -0,0 +1,185 @@ +/* + * 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.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; + +/** EmbeddingsModelConfig */ +// CHECKSTYLE:OFF +public class EmbeddingsModelConfig +// CHECKSTYLE:ON +{ + @JsonProperty("model") + private EmbeddingsModelDetails model; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsModelConfig. */ + protected EmbeddingsModelConfig() {} + + /** + * Set the model of this {@link EmbeddingsModelConfig} instance and return the same instance. + * + * @param model The model of this {@link EmbeddingsModelConfig} + * @return The same instance of this {@link EmbeddingsModelConfig} class + */ + @Nonnull + public EmbeddingsModelConfig model(@Nonnull final EmbeddingsModelDetails model) { + this.model = model; + return this; + } + + /** + * Get model + * + * @return model The model of this {@link EmbeddingsModelConfig} instance. + */ + @Nonnull + public EmbeddingsModelDetails getModel() { + return model; + } + + /** + * Set the model of this {@link EmbeddingsModelConfig} instance. + * + * @param model The model of this {@link EmbeddingsModelConfig} + */ + public void setModel(@Nonnull final EmbeddingsModelDetails model) { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsModelConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsModelConfig} 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( + "EmbeddingsModelConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsModelConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (model != null) declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsModelConfig} 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 EmbeddingsModelConfig embeddingsModelConfig = (EmbeddingsModelConfig) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsModelConfig.cloudSdkCustomFields) + && Objects.equals(this.model, embeddingsModelConfig.model); + } + + @Override + public int hashCode() { + return Objects.hash(model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsModelConfig {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link EmbeddingsModelConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (model) -> new EmbeddingsModelConfig().model(model); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the model of this {@link EmbeddingsModelConfig} instance. + * + * @param model The model of this {@link EmbeddingsModelConfig} + * @return The EmbeddingsModelConfig instance. + */ + EmbeddingsModelConfig model(@Nonnull final EmbeddingsModelDetails model); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelDetails.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelDetails.java new file mode 100644 index 000000000..1907156c8 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelDetails.java @@ -0,0 +1,259 @@ +/* + * 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.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; + +/** EmbeddingsModelDetails */ +// CHECKSTYLE:OFF +public class EmbeddingsModelDetails +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("version") + private String version = "latest"; + + @JsonProperty("params") + private EmbeddingsModelParams params; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsModelDetails. */ + protected EmbeddingsModelDetails() {} + + /** + * Set the name of this {@link EmbeddingsModelDetails} instance and return the same instance. + * + * @param name The name of this {@link EmbeddingsModelDetails} + * @return The same instance of this {@link EmbeddingsModelDetails} class + */ + @Nonnull + public EmbeddingsModelDetails name(@Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link EmbeddingsModelDetails} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link EmbeddingsModelDetails} instance. + * + * @param name The name of this {@link EmbeddingsModelDetails} + */ + public void setName(@Nonnull final String name) { + this.name = name; + } + + /** + * Set the version of this {@link EmbeddingsModelDetails} instance and return the same instance. + * + * @param version The version of this {@link EmbeddingsModelDetails} + * @return The same instance of this {@link EmbeddingsModelDetails} class + */ + @Nonnull + public EmbeddingsModelDetails version(@Nullable final String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link EmbeddingsModelDetails} instance. + */ + @Nonnull + public String getVersion() { + return version; + } + + /** + * Set the version of this {@link EmbeddingsModelDetails} instance. + * + * @param version The version of this {@link EmbeddingsModelDetails} + */ + public void setVersion(@Nullable final String version) { + this.version = version; + } + + /** + * Set the params of this {@link EmbeddingsModelDetails} instance and return the same instance. + * + * @param params The params of this {@link EmbeddingsModelDetails} + * @return The same instance of this {@link EmbeddingsModelDetails} class + */ + @Nonnull + public EmbeddingsModelDetails params(@Nullable final EmbeddingsModelParams params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params The params of this {@link EmbeddingsModelDetails} instance. + */ + @Nonnull + public EmbeddingsModelParams getParams() { + return params; + } + + /** + * Set the params of this {@link EmbeddingsModelDetails} instance. + * + * @param params The params of this {@link EmbeddingsModelDetails} + */ + public void setParams(@Nullable final EmbeddingsModelParams params) { + this.params = params; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsModelDetails}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsModelDetails} 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( + "EmbeddingsModelDetails has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsModelDetails} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (version != null) declaredFields.put("version", version); + if (params != null) declaredFields.put("params", params); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsModelDetails} 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 EmbeddingsModelDetails embeddingsModelDetails = (EmbeddingsModelDetails) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsModelDetails.cloudSdkCustomFields) + && Objects.equals(this.name, embeddingsModelDetails.name) + && Objects.equals(this.version, embeddingsModelDetails.version) + && Objects.equals(this.params, embeddingsModelDetails.params); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, params, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsModelDetails {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).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 EmbeddingsModelDetails} + * instance with all required arguments. + */ + public static Builder create() { + return (name) -> new EmbeddingsModelDetails().name(name); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the name of this {@link EmbeddingsModelDetails} instance. + * + * @param name The name of this {@link EmbeddingsModelDetails} + * @return The EmbeddingsModelDetails instance. + */ + EmbeddingsModelDetails name(@Nonnull final String name); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParams.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParams.java new file mode 100644 index 000000000..9bc236003 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParams.java @@ -0,0 +1,313 @@ +/* + * 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.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; + +/** + * Additional parameters for generating input's embeddings. Default values are used for + * mandatory parameters. + */ +// CHECKSTYLE:OFF +public class EmbeddingsModelParams +// CHECKSTYLE:ON +{ + @JsonProperty("dimensions") + private Integer dimensions; + + /** OpenAI's spec allows for 'float' and 'base64' encoding formats. */ + public enum EncodingFormatEnum { + /** The FLOAT option of this EmbeddingsModelParams */ + FLOAT("float"), + + /** The BASE64 option of this EmbeddingsModelParams */ + BASE64("base64"), + + /** The BINARY option of this EmbeddingsModelParams */ + BINARY("binary"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this EmbeddingsModelParams */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + EncodingFormatEnum(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 EmbeddingsModelParams + */ + @JsonCreator + @Nonnull + public static EncodingFormatEnum fromValue(@Nonnull final String value) { + for (EncodingFormatEnum b : EncodingFormatEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("encoding_format") + private EncodingFormatEnum encodingFormat; + + @JsonProperty("normalize") + private Boolean normalize; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsModelParams. */ + protected EmbeddingsModelParams() {} + + /** + * Set the dimensions of this {@link EmbeddingsModelParams} instance and return the same instance. + * + * @param dimensions The number of dimensions the resulting output embeddings should have. + * @return The same instance of this {@link EmbeddingsModelParams} class + */ + @Nonnull + public EmbeddingsModelParams dimensions(@Nullable final Integer dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * The number of dimensions the resulting output embeddings should have. + * + * @return dimensions The dimensions of this {@link EmbeddingsModelParams} instance. + */ + @Nonnull + public Integer getDimensions() { + return dimensions; + } + + /** + * Set the dimensions of this {@link EmbeddingsModelParams} instance. + * + * @param dimensions The number of dimensions the resulting output embeddings should have. + */ + public void setDimensions(@Nullable final Integer dimensions) { + this.dimensions = dimensions; + } + + /** + * Set the encodingFormat of this {@link EmbeddingsModelParams} instance and return the same + * instance. + * + * @param encodingFormat OpenAI's spec allows for 'float' and 'base64' + * encoding formats. + * @return The same instance of this {@link EmbeddingsModelParams} class + */ + @Nonnull + public EmbeddingsModelParams encodingFormat(@Nullable final EncodingFormatEnum encodingFormat) { + this.encodingFormat = encodingFormat; + return this; + } + + /** + * OpenAI's spec allows for 'float' and 'base64' encoding formats. + * + * @return encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} instance. + */ + @Nonnull + public EncodingFormatEnum getEncodingFormat() { + return encodingFormat; + } + + /** + * Set the encodingFormat of this {@link EmbeddingsModelParams} instance. + * + * @param encodingFormat OpenAI's spec allows for 'float' and 'base64' + * encoding formats. + */ + public void setEncodingFormat(@Nullable final EncodingFormatEnum encodingFormat) { + this.encodingFormat = encodingFormat; + } + + /** + * Set the normalize of this {@link EmbeddingsModelParams} instance and return the same instance. + * + * @param normalize The normalize of this {@link EmbeddingsModelParams} + * @return The same instance of this {@link EmbeddingsModelParams} class + */ + @Nonnull + public EmbeddingsModelParams normalize(@Nullable final Boolean normalize) { + this.normalize = normalize; + return this; + } + + /** + * Get normalize + * + * @return normalize The normalize of this {@link EmbeddingsModelParams} instance. + */ + @Nonnull + public Boolean isNormalize() { + return normalize; + } + + /** + * Set the normalize of this {@link EmbeddingsModelParams} instance. + * + * @param normalize The normalize of this {@link EmbeddingsModelParams} + */ + public void setNormalize(@Nullable final Boolean normalize) { + this.normalize = normalize; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsModelParams}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsModelParams} 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( + "EmbeddingsModelParams has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsModelParams} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (dimensions != null) declaredFields.put("dimensions", dimensions); + if (encodingFormat != null) declaredFields.put("encodingFormat", encodingFormat); + if (normalize != null) declaredFields.put("normalize", normalize); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsModelParams} 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 EmbeddingsModelParams embeddingsModelParams = (EmbeddingsModelParams) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsModelParams.cloudSdkCustomFields) + && Objects.equals(this.dimensions, embeddingsModelParams.dimensions) + && Objects.equals(this.encodingFormat, embeddingsModelParams.encodingFormat) + && Objects.equals(this.normalize, embeddingsModelParams.normalize); + } + + @Override + public int hashCode() { + return Objects.hash(dimensions, encodingFormat, normalize, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsModelParams {\n"); + sb.append(" dimensions: ").append(toIndentedString(dimensions)).append("\n"); + sb.append(" encodingFormat: ").append(toIndentedString(encodingFormat)).append("\n"); + sb.append(" normalize: ").append(toIndentedString(normalize)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link EmbeddingsModelParams} instance. No arguments are required. */ + public static EmbeddingsModelParams create() { + return new EmbeddingsModelParams(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModuleConfigs.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModuleConfigs.java new file mode 100644 index 000000000..2de5063ab --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModuleConfigs.java @@ -0,0 +1,223 @@ +/* + * 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.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; + +/** EmbeddingsModuleConfigs */ +// CHECKSTYLE:OFF +public class EmbeddingsModuleConfigs +// CHECKSTYLE:ON +{ + @JsonProperty("embeddings") + private EmbeddingsModelConfig embeddings; + + @JsonProperty("masking") + private MaskingModuleConfig masking; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsModuleConfigs. */ + protected EmbeddingsModuleConfigs() {} + + /** + * Set the embeddings of this {@link EmbeddingsModuleConfigs} instance and return the same + * instance. + * + * @param embeddings The embeddings of this {@link EmbeddingsModuleConfigs} + * @return The same instance of this {@link EmbeddingsModuleConfigs} class + */ + @Nonnull + public EmbeddingsModuleConfigs embeddings(@Nonnull final EmbeddingsModelConfig embeddings) { + this.embeddings = embeddings; + return this; + } + + /** + * Get embeddings + * + * @return embeddings The embeddings of this {@link EmbeddingsModuleConfigs} instance. + */ + @Nonnull + public EmbeddingsModelConfig getEmbeddings() { + return embeddings; + } + + /** + * Set the embeddings of this {@link EmbeddingsModuleConfigs} instance. + * + * @param embeddings The embeddings of this {@link EmbeddingsModuleConfigs} + */ + public void setEmbeddings(@Nonnull final EmbeddingsModelConfig embeddings) { + this.embeddings = embeddings; + } + + /** + * Set the masking of this {@link EmbeddingsModuleConfigs} instance and return the same instance. + * + * @param masking The masking of this {@link EmbeddingsModuleConfigs} + * @return The same instance of this {@link EmbeddingsModuleConfigs} class + */ + @Nonnull + public EmbeddingsModuleConfigs masking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + return this; + } + + /** + * Get masking + * + * @return masking The masking of this {@link EmbeddingsModuleConfigs} instance. + */ + @Nonnull + public MaskingModuleConfig getMasking() { + return masking; + } + + /** + * Set the masking of this {@link EmbeddingsModuleConfigs} instance. + * + * @param masking The masking of this {@link EmbeddingsModuleConfigs} + */ + public void setMasking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsModuleConfigs}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsModuleConfigs} 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( + "EmbeddingsModuleConfigs has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsModuleConfigs} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (embeddings != null) declaredFields.put("embeddings", embeddings); + if (masking != null) declaredFields.put("masking", masking); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsModuleConfigs} 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 EmbeddingsModuleConfigs embeddingsModuleConfigs = (EmbeddingsModuleConfigs) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsModuleConfigs.cloudSdkCustomFields) + && Objects.equals(this.embeddings, embeddingsModuleConfigs.embeddings) + && Objects.equals(this.masking, embeddingsModuleConfigs.masking); + } + + @Override + public int hashCode() { + return Objects.hash(embeddings, masking, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsModuleConfigs {\n"); + sb.append(" embeddings: ").append(toIndentedString(embeddings)).append("\n"); + sb.append(" masking: ").append(toIndentedString(masking)).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 + * EmbeddingsModuleConfigs} instance with all required arguments. + */ + public static Builder create() { + return (embeddings) -> new EmbeddingsModuleConfigs().embeddings(embeddings); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the embeddings of this {@link EmbeddingsModuleConfigs} instance. + * + * @param embeddings The embeddings of this {@link EmbeddingsModuleConfigs} + * @return The EmbeddingsModuleConfigs instance. + */ + EmbeddingsModuleConfigs embeddings(@Nonnull final EmbeddingsModelConfig embeddings); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsOrchestrationConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsOrchestrationConfig.java new file mode 100644 index 000000000..ca2d26b1d --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsOrchestrationConfig.java @@ -0,0 +1,190 @@ +/* + * 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.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; + +/** EmbeddingsOrchestrationConfig */ +// CHECKSTYLE:OFF +public class EmbeddingsOrchestrationConfig +// CHECKSTYLE:ON +{ + @JsonProperty("modules") + private EmbeddingsModuleConfigs modules; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsOrchestrationConfig. */ + protected EmbeddingsOrchestrationConfig() {} + + /** + * Set the modules of this {@link EmbeddingsOrchestrationConfig} instance and return the same + * instance. + * + * @param modules The modules of this {@link EmbeddingsOrchestrationConfig} + * @return The same instance of this {@link EmbeddingsOrchestrationConfig} class + */ + @Nonnull + public EmbeddingsOrchestrationConfig modules(@Nonnull final EmbeddingsModuleConfigs modules) { + this.modules = modules; + return this; + } + + /** + * Get modules + * + * @return modules The modules of this {@link EmbeddingsOrchestrationConfig} instance. + */ + @Nonnull + public EmbeddingsModuleConfigs getModules() { + return modules; + } + + /** + * Set the modules of this {@link EmbeddingsOrchestrationConfig} instance. + * + * @param modules The modules of this {@link EmbeddingsOrchestrationConfig} + */ + public void setModules(@Nonnull final EmbeddingsModuleConfigs modules) { + this.modules = modules; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsOrchestrationConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsOrchestrationConfig} + * 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( + "EmbeddingsOrchestrationConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsOrchestrationConfig} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (modules != null) declaredFields.put("modules", modules); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsOrchestrationConfig} 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 EmbeddingsOrchestrationConfig embeddingsOrchestrationConfig = + (EmbeddingsOrchestrationConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, embeddingsOrchestrationConfig.cloudSdkCustomFields) + && Objects.equals(this.modules, embeddingsOrchestrationConfig.modules); + } + + @Override + public int hashCode() { + return Objects.hash(modules, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsOrchestrationConfig {\n"); + sb.append(" modules: ").append(toIndentedString(modules)).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 + * EmbeddingsOrchestrationConfig} instance with all required arguments. + */ + public static Builder create() { + return (modules) -> new EmbeddingsOrchestrationConfig().modules(modules); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the modules of this {@link EmbeddingsOrchestrationConfig} instance. + * + * @param modules The modules of this {@link EmbeddingsOrchestrationConfig} + * @return The EmbeddingsOrchestrationConfig instance. + */ + EmbeddingsOrchestrationConfig modules(@Nonnull final EmbeddingsModuleConfigs modules); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostRequest.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostRequest.java new file mode 100644 index 000000000..b8e4c9480 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostRequest.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.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; + +/** EmbeddingsPostRequest */ +// CHECKSTYLE:OFF +public class EmbeddingsPostRequest +// CHECKSTYLE:ON +{ + @JsonProperty("config") + private EmbeddingsOrchestrationConfig config; + + @JsonProperty("input") + private EmbeddingsInput input; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsPostRequest. */ + protected EmbeddingsPostRequest() {} + + /** + * Set the config of this {@link EmbeddingsPostRequest} instance and return the same instance. + * + * @param config The config of this {@link EmbeddingsPostRequest} + * @return The same instance of this {@link EmbeddingsPostRequest} class + */ + @Nonnull + public EmbeddingsPostRequest config(@Nonnull final EmbeddingsOrchestrationConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link EmbeddingsPostRequest} instance. + */ + @Nonnull + public EmbeddingsOrchestrationConfig getConfig() { + return config; + } + + /** + * Set the config of this {@link EmbeddingsPostRequest} instance. + * + * @param config The config of this {@link EmbeddingsPostRequest} + */ + public void setConfig(@Nonnull final EmbeddingsOrchestrationConfig config) { + this.config = config; + } + + /** + * Set the input of this {@link EmbeddingsPostRequest} instance and return the same instance. + * + * @param input The input of this {@link EmbeddingsPostRequest} + * @return The same instance of this {@link EmbeddingsPostRequest} class + */ + @Nonnull + public EmbeddingsPostRequest input(@Nonnull final EmbeddingsInput input) { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link EmbeddingsPostRequest} instance. + */ + @Nonnull + public EmbeddingsInput getInput() { + return input; + } + + /** + * Set the input of this {@link EmbeddingsPostRequest} instance. + * + * @param input The input of this {@link EmbeddingsPostRequest} + */ + public void setInput(@Nonnull final EmbeddingsInput input) { + this.input = input; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsPostRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsPostRequest} 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( + "EmbeddingsPostRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsPostRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (config != null) declaredFields.put("config", config); + if (input != null) declaredFields.put("input", input); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsPostRequest} 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 EmbeddingsPostRequest embeddingsPostRequest = (EmbeddingsPostRequest) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsPostRequest.cloudSdkCustomFields) + && Objects.equals(this.config, embeddingsPostRequest.config) + && Objects.equals(this.input, embeddingsPostRequest.input); + } + + @Override + public int hashCode() { + return Objects.hash(config, input, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsPostRequest {\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).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 EmbeddingsPostRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (config) -> (input) -> new EmbeddingsPostRequest().config(config).input(input); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the config of this {@link EmbeddingsPostRequest} instance. + * + * @param config The config of this {@link EmbeddingsPostRequest} + * @return The EmbeddingsPostRequest builder. + */ + Builder1 config(@Nonnull final EmbeddingsOrchestrationConfig config); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the input of this {@link EmbeddingsPostRequest} instance. + * + * @param input The input of this {@link EmbeddingsPostRequest} + * @return The EmbeddingsPostRequest instance. + */ + EmbeddingsPostRequest input(@Nonnull final EmbeddingsInput input); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostResponse.java new file mode 100644 index 000000000..16dba27d2 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsPostResponse.java @@ -0,0 +1,265 @@ +/* + * 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.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; + +/** EmbeddingsPostResponse */ +// CHECKSTYLE:OFF +public class EmbeddingsPostResponse +// CHECKSTYLE:ON +{ + @JsonProperty("request_id") + private String requestId; + + @JsonProperty("intermediate_results") + private ModuleResultsBase intermediateResults; + + @JsonProperty("final_result") + private EmbeddingsResponse finalResult; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsPostResponse. */ + protected EmbeddingsPostResponse() {} + + /** + * Set the requestId of this {@link EmbeddingsPostResponse} instance and return the same instance. + * + * @param requestId The requestId of this {@link EmbeddingsPostResponse} + * @return The same instance of this {@link EmbeddingsPostResponse} class + */ + @Nonnull + public EmbeddingsPostResponse requestId(@Nonnull final String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get requestId + * + * @return requestId The requestId of this {@link EmbeddingsPostResponse} instance. + */ + @Nonnull + public String getRequestId() { + return requestId; + } + + /** + * Set the requestId of this {@link EmbeddingsPostResponse} instance. + * + * @param requestId The requestId of this {@link EmbeddingsPostResponse} + */ + public void setRequestId(@Nonnull final String requestId) { + this.requestId = requestId; + } + + /** + * Set the intermediateResults of this {@link EmbeddingsPostResponse} instance and return the same + * instance. + * + * @param intermediateResults The intermediateResults of this {@link EmbeddingsPostResponse} + * @return The same instance of this {@link EmbeddingsPostResponse} class + */ + @Nonnull + public EmbeddingsPostResponse intermediateResults( + @Nullable final ModuleResultsBase intermediateResults) { + this.intermediateResults = intermediateResults; + return this; + } + + /** + * Get intermediateResults + * + * @return intermediateResults The intermediateResults of this {@link EmbeddingsPostResponse} + * instance. + */ + @Nonnull + public ModuleResultsBase getIntermediateResults() { + return intermediateResults; + } + + /** + * Set the intermediateResults of this {@link EmbeddingsPostResponse} instance. + * + * @param intermediateResults The intermediateResults of this {@link EmbeddingsPostResponse} + */ + public void setIntermediateResults(@Nullable final ModuleResultsBase intermediateResults) { + this.intermediateResults = intermediateResults; + } + + /** + * Set the finalResult of this {@link EmbeddingsPostResponse} instance and return the same + * instance. + * + * @param finalResult The finalResult of this {@link EmbeddingsPostResponse} + * @return The same instance of this {@link EmbeddingsPostResponse} class + */ + @Nonnull + public EmbeddingsPostResponse finalResult(@Nullable final EmbeddingsResponse finalResult) { + this.finalResult = finalResult; + return this; + } + + /** + * Get finalResult + * + * @return finalResult The finalResult of this {@link EmbeddingsPostResponse} instance. + */ + @Nonnull + public EmbeddingsResponse getFinalResult() { + return finalResult; + } + + /** + * Set the finalResult of this {@link EmbeddingsPostResponse} instance. + * + * @param finalResult The finalResult of this {@link EmbeddingsPostResponse} + */ + public void setFinalResult(@Nullable final EmbeddingsResponse finalResult) { + this.finalResult = finalResult; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsPostResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsPostResponse} 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( + "EmbeddingsPostResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsPostResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (requestId != null) declaredFields.put("requestId", requestId); + if (intermediateResults != null) declaredFields.put("intermediateResults", intermediateResults); + if (finalResult != null) declaredFields.put("finalResult", finalResult); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsPostResponse} 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 EmbeddingsPostResponse embeddingsPostResponse = (EmbeddingsPostResponse) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsPostResponse.cloudSdkCustomFields) + && Objects.equals(this.requestId, embeddingsPostResponse.requestId) + && Objects.equals(this.intermediateResults, embeddingsPostResponse.intermediateResults) + && Objects.equals(this.finalResult, embeddingsPostResponse.finalResult); + } + + @Override + public int hashCode() { + return Objects.hash(requestId, intermediateResults, finalResult, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsPostResponse {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" intermediateResults: ") + .append(toIndentedString(intermediateResults)) + .append("\n"); + sb.append(" finalResult: ").append(toIndentedString(finalResult)).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 EmbeddingsPostResponse} + * instance with all required arguments. + */ + public static Builder create() { + return (requestId) -> new EmbeddingsPostResponse().requestId(requestId); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the requestId of this {@link EmbeddingsPostResponse} instance. + * + * @param requestId The requestId of this {@link EmbeddingsPostResponse} + * @return The EmbeddingsPostResponse instance. + */ + EmbeddingsPostResponse requestId(@Nonnull final String requestId); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsResponse.java new file mode 100644 index 000000000..c247199bb --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsResponse.java @@ -0,0 +1,416 @@ +/* + * 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.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; + +/** The response from request to embedding model following OpenAI specification. */ +// CHECKSTYLE:OFF +public class EmbeddingsResponse +// CHECKSTYLE:ON +{ + /** The object type, which is always \"list\". */ + public enum ObjectEnum { + /** The LIST option of this EmbeddingsResponse */ + LIST("list"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this EmbeddingsResponse */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ObjectEnum(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 EmbeddingsResponse + */ + @JsonCreator + @Nonnull + public static ObjectEnum fromValue(@Nonnull final String value) { + for (ObjectEnum b : ObjectEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("object") + private ObjectEnum _object; + + @JsonProperty("data") + private List data = new ArrayList<>(); + + @JsonProperty("model") + private String model; + + @JsonProperty("usage") + private EmbeddingsUsage usage; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsResponse. */ + protected EmbeddingsResponse() {} + + /** + * Set the _object of this {@link EmbeddingsResponse} instance and return the same instance. + * + * @param _object The object type, which is always \"list\". + * @return The same instance of this {@link EmbeddingsResponse} class + */ + @Nonnull + public EmbeddingsResponse _object(@Nonnull final ObjectEnum _object) { + this._object = _object; + return this; + } + + /** + * The object type, which is always \"list\". + * + * @return _object The _object of this {@link EmbeddingsResponse} instance. + */ + @Nonnull + public ObjectEnum getObject() { + return _object; + } + + /** + * Set the _object of this {@link EmbeddingsResponse} instance. + * + * @param _object The object type, which is always \"list\". + */ + public void setObject(@Nonnull final ObjectEnum _object) { + this._object = _object; + } + + /** + * Set the data of this {@link EmbeddingsResponse} instance and return the same instance. + * + * @param data The list of embeddings generated by the model. + * @return The same instance of this {@link EmbeddingsResponse} class + */ + @Nonnull + public EmbeddingsResponse data(@Nonnull final List data) { + this.data = data; + return this; + } + + /** + * Add one data instance to this {@link EmbeddingsResponse}. + * + * @param dataItem The data that should be added + * @return The same instance of type {@link EmbeddingsResponse} + */ + @Nonnull + public EmbeddingsResponse addDataItem(@Nonnull final EmbeddingResult dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * The list of embeddings generated by the model. + * + * @return data The data of this {@link EmbeddingsResponse} instance. + */ + @Nonnull + public List getData() { + return data; + } + + /** + * Set the data of this {@link EmbeddingsResponse} instance. + * + * @param data The list of embeddings generated by the model. + */ + public void setData(@Nonnull final List data) { + this.data = data; + } + + /** + * Set the model of this {@link EmbeddingsResponse} instance and return the same instance. + * + * @param model The name of the model used to generate the embedding. + * @return The same instance of this {@link EmbeddingsResponse} class + */ + @Nonnull + public EmbeddingsResponse model(@Nonnull final String model) { + this.model = model; + return this; + } + + /** + * The name of the model used to generate the embedding. + * + * @return model The model of this {@link EmbeddingsResponse} instance. + */ + @Nonnull + public String getModel() { + return model; + } + + /** + * Set the model of this {@link EmbeddingsResponse} instance. + * + * @param model The name of the model used to generate the embedding. + */ + public void setModel(@Nonnull final String model) { + this.model = model; + } + + /** + * Set the usage of this {@link EmbeddingsResponse} instance and return the same instance. + * + * @param usage The usage of this {@link EmbeddingsResponse} + * @return The same instance of this {@link EmbeddingsResponse} class + */ + @Nonnull + public EmbeddingsResponse usage(@Nonnull final EmbeddingsUsage usage) { + this.usage = usage; + return this; + } + + /** + * Get usage + * + * @return usage The usage of this {@link EmbeddingsResponse} instance. + */ + @Nonnull + public EmbeddingsUsage getUsage() { + return usage; + } + + /** + * Set the usage of this {@link EmbeddingsResponse} instance. + * + * @param usage The usage of this {@link EmbeddingsResponse} + */ + public void setUsage(@Nonnull final EmbeddingsUsage usage) { + this.usage = usage; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsResponse} 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("EmbeddingsResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (_object != null) declaredFields.put("_object", _object); + if (data != null) declaredFields.put("data", data); + if (model != null) declaredFields.put("model", model); + if (usage != null) declaredFields.put("usage", usage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsResponse} 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 EmbeddingsResponse embeddingsResponse = (EmbeddingsResponse) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsResponse.cloudSdkCustomFields) + && Objects.equals(this._object, embeddingsResponse._object) + && Objects.equals(this.data, embeddingsResponse.data) + && Objects.equals(this.model, embeddingsResponse.model) + && Objects.equals(this.usage, embeddingsResponse.usage); + } + + @Override + public int hashCode() { + return Objects.hash(_object, data, model, usage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsResponse {\n"); + sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).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 EmbeddingsResponse} + * instance with all required arguments. + */ + public static Builder create() { + return (_object) -> + (data) -> + (model) -> + (usage) -> + new EmbeddingsResponse()._object(_object).data(data).model(model).usage(usage); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the _object of this {@link EmbeddingsResponse} instance. + * + * @param _object The object type, which is always \"list\". + * @return The EmbeddingsResponse builder. + */ + Builder1 _object(@Nonnull final ObjectEnum _object); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the data of this {@link EmbeddingsResponse} instance. + * + * @param data The list of embeddings generated by the model. + * @return The EmbeddingsResponse builder. + */ + Builder2 data(@Nonnull final List data); + + /** + * Set the data of this {@link EmbeddingsResponse} instance. + * + * @param data The list of embeddings generated by the model. + * @return The EmbeddingsResponse builder. + */ + default Builder2 data(@Nonnull final EmbeddingResult... data) { + return data(Arrays.asList(data)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the model of this {@link EmbeddingsResponse} instance. + * + * @param model The name of the model used to generate the embedding. + * @return The EmbeddingsResponse builder. + */ + Builder3 model(@Nonnull final String model); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the usage of this {@link EmbeddingsResponse} instance. + * + * @param usage The usage of this {@link EmbeddingsResponse} + * @return The EmbeddingsResponse instance. + */ + EmbeddingsResponse usage(@Nonnull final EmbeddingsUsage usage); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsUsage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsUsage.java new file mode 100644 index 000000000..1dee2f56b --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsUsage.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.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; + +/** The usage information for the request. */ +// CHECKSTYLE:OFF +public class EmbeddingsUsage +// CHECKSTYLE:ON +{ + @JsonProperty("prompt_tokens") + private Integer promptTokens; + + @JsonProperty("total_tokens") + private Integer totalTokens; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingsUsage. */ + protected EmbeddingsUsage() {} + + /** + * Set the promptTokens of this {@link EmbeddingsUsage} instance and return the same instance. + * + * @param promptTokens The number of tokens used by the prompt. + * @return The same instance of this {@link EmbeddingsUsage} class + */ + @Nonnull + public EmbeddingsUsage promptTokens(@Nonnull final Integer promptTokens) { + this.promptTokens = promptTokens; + return this; + } + + /** + * The number of tokens used by the prompt. + * + * @return promptTokens The promptTokens of this {@link EmbeddingsUsage} instance. + */ + @Nonnull + public Integer getPromptTokens() { + return promptTokens; + } + + /** + * Set the promptTokens of this {@link EmbeddingsUsage} instance. + * + * @param promptTokens The number of tokens used by the prompt. + */ + public void setPromptTokens(@Nonnull final Integer promptTokens) { + this.promptTokens = promptTokens; + } + + /** + * Set the totalTokens of this {@link EmbeddingsUsage} instance and return the same instance. + * + * @param totalTokens The total number of tokens used by the request. + * @return The same instance of this {@link EmbeddingsUsage} class + */ + @Nonnull + public EmbeddingsUsage totalTokens(@Nonnull final Integer totalTokens) { + this.totalTokens = totalTokens; + return this; + } + + /** + * The total number of tokens used by the request. + * + * @return totalTokens The totalTokens of this {@link EmbeddingsUsage} instance. + */ + @Nonnull + public Integer getTotalTokens() { + return totalTokens; + } + + /** + * Set the totalTokens of this {@link EmbeddingsUsage} instance. + * + * @param totalTokens The total number of tokens used by the request. + */ + public void setTotalTokens(@Nonnull final Integer totalTokens) { + this.totalTokens = totalTokens; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingsUsage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingsUsage} 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("EmbeddingsUsage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingsUsage} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (promptTokens != null) declaredFields.put("promptTokens", promptTokens); + if (totalTokens != null) declaredFields.put("totalTokens", totalTokens); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingsUsage} 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 EmbeddingsUsage embeddingsUsage = (EmbeddingsUsage) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingsUsage.cloudSdkCustomFields) + && Objects.equals(this.promptTokens, embeddingsUsage.promptTokens) + && Objects.equals(this.totalTokens, embeddingsUsage.totalTokens); + } + + @Override + public int hashCode() { + return Objects.hash(promptTokens, totalTokens, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsUsage {\n"); + sb.append(" promptTokens: ").append(toIndentedString(promptTokens)).append("\n"); + sb.append(" totalTokens: ").append(toIndentedString(totalTokens)).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 EmbeddingsUsage} + * instance with all required arguments. + */ + public static Builder create() { + return (promptTokens) -> + (totalTokens) -> new EmbeddingsUsage().promptTokens(promptTokens).totalTokens(totalTokens); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the promptTokens of this {@link EmbeddingsUsage} instance. + * + * @param promptTokens The number of tokens used by the prompt. + * @return The EmbeddingsUsage builder. + */ + Builder1 promptTokens(@Nonnull final Integer promptTokens); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the totalTokens of this {@link EmbeddingsUsage} instance. + * + * @param totalTokens The total number of tokens used by the request. + * @return The EmbeddingsUsage instance. + */ + EmbeddingsUsage totalTokens(@Nonnull final Integer totalTokens); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Error.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Error.java new file mode 100644 index 000000000..a34b16ba4 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Error.java @@ -0,0 +1,372 @@ +/* + * 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.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; + +/** Error */ +// CHECKSTYLE:OFF +public class Error +// CHECKSTYLE:ON +{ + @JsonProperty("request_id") + private String requestId; + + @JsonProperty("code") + private Integer code; + + @JsonProperty("message") + private String message; + + @JsonProperty("location") + private String location; + + @JsonProperty("intermediate_results") + private ModuleResults intermediateResults; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Error. */ + protected Error() {} + + /** + * Set the requestId of this {@link Error} instance and return the same instance. + * + * @param requestId The requestId of this {@link Error} + * @return The same instance of this {@link Error} class + */ + @Nonnull + public Error requestId(@Nonnull final String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get requestId + * + * @return requestId The requestId of this {@link Error} instance. + */ + @Nonnull + public String getRequestId() { + return requestId; + } + + /** + * Set the requestId of this {@link Error} instance. + * + * @param requestId The requestId of this {@link Error} + */ + public void setRequestId(@Nonnull final String requestId) { + this.requestId = requestId; + } + + /** + * Set the code of this {@link Error} instance and return the same instance. + * + * @param code The code of this {@link Error} + * @return The same instance of this {@link Error} class + */ + @Nonnull + public Error code(@Nonnull final Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code The code of this {@link Error} instance. + */ + @Nonnull + public Integer getCode() { + return code; + } + + /** + * Set the code of this {@link Error} instance. + * + * @param code The code of this {@link Error} + */ + public void setCode(@Nonnull final Integer code) { + this.code = code; + } + + /** + * Set the message of this {@link Error} instance and return the same instance. + * + * @param message The message of this {@link Error} + * @return The same instance of this {@link Error} class + */ + @Nonnull + public Error message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link Error} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link Error} instance. + * + * @param message The message of this {@link Error} + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Set the location of this {@link Error} instance and return the same instance. + * + * @param location Where the error occurred + * @return The same instance of this {@link Error} class + */ + @Nonnull + public Error location(@Nonnull final String location) { + this.location = location; + return this; + } + + /** + * Where the error occurred + * + * @return location The location of this {@link Error} instance. + */ + @Nonnull + public String getLocation() { + return location; + } + + /** + * Set the location of this {@link Error} instance. + * + * @param location Where the error occurred + */ + public void setLocation(@Nonnull final String location) { + this.location = location; + } + + /** + * Set the intermediateResults of this {@link Error} instance and return the same instance. + * + * @param intermediateResults The intermediateResults of this {@link Error} + * @return The same instance of this {@link Error} class + */ + @Nonnull + public Error intermediateResults(@Nullable final ModuleResults intermediateResults) { + this.intermediateResults = intermediateResults; + return this; + } + + /** + * Get intermediateResults + * + * @return intermediateResults The intermediateResults of this {@link Error} instance. + */ + @Nonnull + public ModuleResults getIntermediateResults() { + return intermediateResults; + } + + /** + * Set the intermediateResults of this {@link Error} instance. + * + * @param intermediateResults The intermediateResults of this {@link Error} + */ + public void setIntermediateResults(@Nullable final ModuleResults intermediateResults) { + this.intermediateResults = intermediateResults; + } + + /** + * Get the names of the unrecognizable properties of the {@link Error}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Error} 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("Error has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Error} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (requestId != null) declaredFields.put("requestId", requestId); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + if (location != null) declaredFields.put("location", location); + if (intermediateResults != null) declaredFields.put("intermediateResults", intermediateResults); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Error} 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 Error error = (Error) o; + return Objects.equals(this.cloudSdkCustomFields, error.cloudSdkCustomFields) + && Objects.equals(this.requestId, error.requestId) + && Objects.equals(this.code, error.code) + && Objects.equals(this.message, error.message) + && Objects.equals(this.location, error.location) + && Objects.equals(this.intermediateResults, error.intermediateResults); + } + + @Override + public int hashCode() { + return Objects.hash( + requestId, code, message, location, intermediateResults, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" intermediateResults: ") + .append(toIndentedString(intermediateResults)) + .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 Error} instance with + * all required arguments. + */ + public static Builder create() { + return (requestId) -> + (code) -> + (message) -> + (location) -> + new Error().requestId(requestId).code(code).message(message).location(location); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the requestId of this {@link Error} instance. + * + * @param requestId The requestId of this {@link Error} + * @return The Error builder. + */ + Builder1 requestId(@Nonnull final String requestId); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the code of this {@link Error} instance. + * + * @param code The code of this {@link Error} + * @return The Error builder. + */ + Builder2 code(@Nonnull final Integer code); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the message of this {@link Error} instance. + * + * @param message The message of this {@link Error} + * @return The Error builder. + */ + Builder3 message(@Nonnull final String message); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the location of this {@link Error} instance. + * + * @param location Where the error occurred + * @return The Error instance. + */ + Error location(@Nonnull final String location); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponse.java index 76fc798e1..45612f31a 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponse.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponse.java @@ -28,20 +28,8 @@ public class ErrorResponse // CHECKSTYLE:ON { - @JsonProperty("request_id") - private String requestId; - - @JsonProperty("code") - private Integer code; - - @JsonProperty("message") - private String message; - - @JsonProperty("location") - private String location; - - @JsonProperty("module_results") - private ModuleResults moduleResults; + @JsonProperty("error") + private Error error; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -50,158 +38,34 @@ public class ErrorResponse protected ErrorResponse() {} /** - * Set the requestId of this {@link ErrorResponse} instance and return the same instance. - * - * @param requestId The requestId of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse requestId(@Nonnull final String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get requestId - * - * @return requestId The requestId of this {@link ErrorResponse} instance. - */ - @Nonnull - public String getRequestId() { - return requestId; - } - - /** - * Set the requestId of this {@link ErrorResponse} instance. - * - * @param requestId The requestId of this {@link ErrorResponse} - */ - public void setRequestId(@Nonnull final String requestId) { - this.requestId = requestId; - } - - /** - * Set the code of this {@link ErrorResponse} instance and return the same instance. - * - * @param code The code of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse code(@Nonnull final Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * - * @return code The code of this {@link ErrorResponse} instance. - */ - @Nonnull - public Integer getCode() { - return code; - } - - /** - * Set the code of this {@link ErrorResponse} instance. - * - * @param code The code of this {@link ErrorResponse} - */ - public void setCode(@Nonnull final Integer code) { - this.code = code; - } - - /** - * Set the message of this {@link ErrorResponse} instance and return the same instance. - * - * @param message The message of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse message(@Nonnull final String message) { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link ErrorResponse} instance. - */ - @Nonnull - public String getMessage() { - return message; - } - - /** - * Set the message of this {@link ErrorResponse} instance. + * Set the error of this {@link ErrorResponse} instance and return the same instance. * - * @param message The message of this {@link ErrorResponse} - */ - public void setMessage(@Nonnull final String message) { - this.message = message; - } - - /** - * Set the location of this {@link ErrorResponse} instance and return the same instance. - * - * @param location Where the error occurred + * @param error The error of this {@link ErrorResponse} * @return The same instance of this {@link ErrorResponse} class */ @Nonnull - public ErrorResponse location(@Nonnull final String location) { - this.location = location; + public ErrorResponse error(@Nonnull final Error error) { + this.error = error; return this; } /** - * Where the error occurred + * Get error * - * @return location The location of this {@link ErrorResponse} instance. + * @return error The error of this {@link ErrorResponse} instance. */ @Nonnull - public String getLocation() { - return location; + public Error getError() { + return error; } /** - * Set the location of this {@link ErrorResponse} instance. + * Set the error of this {@link ErrorResponse} instance. * - * @param location Where the error occurred + * @param error The error of this {@link ErrorResponse} */ - public void setLocation(@Nonnull final String location) { - this.location = location; - } - - /** - * Set the moduleResults of this {@link ErrorResponse} instance and return the same instance. - * - * @param moduleResults The moduleResults of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse moduleResults(@Nullable final ModuleResults moduleResults) { - this.moduleResults = moduleResults; - return this; - } - - /** - * Get moduleResults - * - * @return moduleResults The moduleResults of this {@link ErrorResponse} instance. - */ - @Nonnull - public ModuleResults getModuleResults() { - return moduleResults; - } - - /** - * Set the moduleResults of this {@link ErrorResponse} instance. - * - * @param moduleResults The moduleResults of this {@link ErrorResponse} - */ - public void setModuleResults(@Nullable final ModuleResults moduleResults) { - this.moduleResults = moduleResults; + public void setError(@Nonnull final Error error) { + this.error = error; } /** @@ -242,11 +106,7 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (requestId != null) declaredFields.put("requestId", requestId); - if (code != null) declaredFields.put("code", code); - if (message != null) declaredFields.put("message", message); - if (location != null) declaredFields.put("location", location); - if (moduleResults != null) declaredFields.put("moduleResults", moduleResults); + if (error != null) declaredFields.put("error", error); return declaredFields; } @@ -272,16 +132,12 @@ public boolean equals(@Nullable final java.lang.Object o) { } final ErrorResponse errorResponse = (ErrorResponse) o; return Objects.equals(this.cloudSdkCustomFields, errorResponse.cloudSdkCustomFields) - && Objects.equals(this.requestId, errorResponse.requestId) - && Objects.equals(this.code, errorResponse.code) - && Objects.equals(this.message, errorResponse.message) - && Objects.equals(this.location, errorResponse.location) - && Objects.equals(this.moduleResults, errorResponse.moduleResults); + && Objects.equals(this.error, errorResponse.error); } @Override public int hashCode() { - return Objects.hash(requestId, code, message, location, moduleResults, cloudSdkCustomFields); + return Objects.hash(error, cloudSdkCustomFields); } @Override @@ -289,11 +145,7 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class ErrorResponse {\n"); - sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" location: ").append(toIndentedString(location)).append("\n"); - sb.append(" moduleResults: ").append(toIndentedString(moduleResults)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -316,58 +168,17 @@ private String toIndentedString(final java.lang.Object o) { * with all required arguments. */ public static Builder create() { - return (requestId) -> - (code) -> - (message) -> - (location) -> - new ErrorResponse() - .requestId(requestId) - .code(code) - .message(message) - .location(location); + return (error) -> new ErrorResponse().error(error); } /** Builder helper class. */ public interface Builder { /** - * Set the requestId of this {@link ErrorResponse} instance. - * - * @param requestId The requestId of this {@link ErrorResponse} - * @return The ErrorResponse builder. - */ - Builder1 requestId(@Nonnull final String requestId); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the code of this {@link ErrorResponse} instance. - * - * @param code The code of this {@link ErrorResponse} - * @return The ErrorResponse builder. - */ - Builder2 code(@Nonnull final Integer code); - } - - /** Builder helper class. */ - public interface Builder2 { - /** - * Set the message of this {@link ErrorResponse} instance. - * - * @param message The message of this {@link ErrorResponse} - * @return The ErrorResponse builder. - */ - Builder3 message(@Nonnull final String message); - } - - /** Builder helper class. */ - public interface Builder3 { - /** - * Set the location of this {@link ErrorResponse} instance. + * Set the error of this {@link ErrorResponse} instance. * - * @param location Where the error occurred + * @param error The error of this {@link ErrorResponse} * @return The ErrorResponse instance. */ - ErrorResponse location(@Nonnull final String location); + ErrorResponse error(@Nonnull final Error error); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponseStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponseStreaming.java new file mode 100644 index 000000000..1b2b947e8 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorResponseStreaming.java @@ -0,0 +1,185 @@ +/* + * 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.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; + +/** ErrorResponseStreaming */ +// CHECKSTYLE:OFF +public class ErrorResponseStreaming +// CHECKSTYLE:ON +{ + @JsonProperty("error") + private ErrorStreaming error; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ErrorResponseStreaming. */ + protected ErrorResponseStreaming() {} + + /** + * Set the error of this {@link ErrorResponseStreaming} instance and return the same instance. + * + * @param error The error of this {@link ErrorResponseStreaming} + * @return The same instance of this {@link ErrorResponseStreaming} class + */ + @Nonnull + public ErrorResponseStreaming error(@Nonnull final ErrorStreaming error) { + this.error = error; + return this; + } + + /** + * Get error + * + * @return error The error of this {@link ErrorResponseStreaming} instance. + */ + @Nonnull + public ErrorStreaming getError() { + return error; + } + + /** + * Set the error of this {@link ErrorResponseStreaming} instance. + * + * @param error The error of this {@link ErrorResponseStreaming} + */ + public void setError(@Nonnull final ErrorStreaming error) { + this.error = error; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorResponseStreaming}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorResponseStreaming} 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( + "ErrorResponseStreaming has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorResponseStreaming} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (error != null) declaredFields.put("error", error); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorResponseStreaming} 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 ErrorResponseStreaming errorResponseStreaming = (ErrorResponseStreaming) o; + return Objects.equals(this.cloudSdkCustomFields, errorResponseStreaming.cloudSdkCustomFields) + && Objects.equals(this.error, errorResponseStreaming.error); + } + + @Override + public int hashCode() { + return Objects.hash(error, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponseStreaming {\n"); + sb.append(" error: ").append(toIndentedString(error)).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 ErrorResponseStreaming} + * instance with all required arguments. + */ + public static Builder create() { + return (error) -> new ErrorResponseStreaming().error(error); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the error of this {@link ErrorResponseStreaming} instance. + * + * @param error The error of this {@link ErrorResponseStreaming} + * @return The ErrorResponseStreaming instance. + */ + ErrorResponseStreaming error(@Nonnull final ErrorStreaming error); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorStreaming.java new file mode 100644 index 000000000..db99b3f58 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ErrorStreaming.java @@ -0,0 +1,378 @@ +/* + * 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.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; + +/** ErrorStreaming */ +// CHECKSTYLE:OFF +public class ErrorStreaming +// CHECKSTYLE:ON +{ + @JsonProperty("request_id") + private String requestId; + + @JsonProperty("code") + private Integer code; + + @JsonProperty("message") + private String message; + + @JsonProperty("location") + private String location; + + @JsonProperty("intermediate_results") + private ModuleResultsStreaming intermediateResults; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ErrorStreaming. */ + protected ErrorStreaming() {} + + /** + * Set the requestId of this {@link ErrorStreaming} instance and return the same instance. + * + * @param requestId The requestId of this {@link ErrorStreaming} + * @return The same instance of this {@link ErrorStreaming} class + */ + @Nonnull + public ErrorStreaming requestId(@Nonnull final String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get requestId + * + * @return requestId The requestId of this {@link ErrorStreaming} instance. + */ + @Nonnull + public String getRequestId() { + return requestId; + } + + /** + * Set the requestId of this {@link ErrorStreaming} instance. + * + * @param requestId The requestId of this {@link ErrorStreaming} + */ + public void setRequestId(@Nonnull final String requestId) { + this.requestId = requestId; + } + + /** + * Set the code of this {@link ErrorStreaming} instance and return the same instance. + * + * @param code The code of this {@link ErrorStreaming} + * @return The same instance of this {@link ErrorStreaming} class + */ + @Nonnull + public ErrorStreaming code(@Nonnull final Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code The code of this {@link ErrorStreaming} instance. + */ + @Nonnull + public Integer getCode() { + return code; + } + + /** + * Set the code of this {@link ErrorStreaming} instance. + * + * @param code The code of this {@link ErrorStreaming} + */ + public void setCode(@Nonnull final Integer code) { + this.code = code; + } + + /** + * Set the message of this {@link ErrorStreaming} instance and return the same instance. + * + * @param message The message of this {@link ErrorStreaming} + * @return The same instance of this {@link ErrorStreaming} class + */ + @Nonnull + public ErrorStreaming message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link ErrorStreaming} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ErrorStreaming} instance. + * + * @param message The message of this {@link ErrorStreaming} + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Set the location of this {@link ErrorStreaming} instance and return the same instance. + * + * @param location Where the error occurred + * @return The same instance of this {@link ErrorStreaming} class + */ + @Nonnull + public ErrorStreaming location(@Nonnull final String location) { + this.location = location; + return this; + } + + /** + * Where the error occurred + * + * @return location The location of this {@link ErrorStreaming} instance. + */ + @Nonnull + public String getLocation() { + return location; + } + + /** + * Set the location of this {@link ErrorStreaming} instance. + * + * @param location Where the error occurred + */ + public void setLocation(@Nonnull final String location) { + this.location = location; + } + + /** + * Set the intermediateResults of this {@link ErrorStreaming} instance and return the same + * instance. + * + * @param intermediateResults The intermediateResults of this {@link ErrorStreaming} + * @return The same instance of this {@link ErrorStreaming} class + */ + @Nonnull + public ErrorStreaming intermediateResults( + @Nullable final ModuleResultsStreaming intermediateResults) { + this.intermediateResults = intermediateResults; + return this; + } + + /** + * Get intermediateResults + * + * @return intermediateResults The intermediateResults of this {@link ErrorStreaming} instance. + */ + @Nonnull + public ModuleResultsStreaming getIntermediateResults() { + return intermediateResults; + } + + /** + * Set the intermediateResults of this {@link ErrorStreaming} instance. + * + * @param intermediateResults The intermediateResults of this {@link ErrorStreaming} + */ + public void setIntermediateResults(@Nullable final ModuleResultsStreaming intermediateResults) { + this.intermediateResults = intermediateResults; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorStreaming}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorStreaming} 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("ErrorStreaming has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorStreaming} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (requestId != null) declaredFields.put("requestId", requestId); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + if (location != null) declaredFields.put("location", location); + if (intermediateResults != null) declaredFields.put("intermediateResults", intermediateResults); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorStreaming} 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 ErrorStreaming errorStreaming = (ErrorStreaming) o; + return Objects.equals(this.cloudSdkCustomFields, errorStreaming.cloudSdkCustomFields) + && Objects.equals(this.requestId, errorStreaming.requestId) + && Objects.equals(this.code, errorStreaming.code) + && Objects.equals(this.message, errorStreaming.message) + && Objects.equals(this.location, errorStreaming.location) + && Objects.equals(this.intermediateResults, errorStreaming.intermediateResults); + } + + @Override + public int hashCode() { + return Objects.hash( + requestId, code, message, location, intermediateResults, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorStreaming {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" intermediateResults: ") + .append(toIndentedString(intermediateResults)) + .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 ErrorStreaming} + * instance with all required arguments. + */ + public static Builder create() { + return (requestId) -> + (code) -> + (message) -> + (location) -> + new ErrorStreaming() + .requestId(requestId) + .code(code) + .message(message) + .location(location); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the requestId of this {@link ErrorStreaming} instance. + * + * @param requestId The requestId of this {@link ErrorStreaming} + * @return The ErrorStreaming builder. + */ + Builder1 requestId(@Nonnull final String requestId); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the code of this {@link ErrorStreaming} instance. + * + * @param code The code of this {@link ErrorStreaming} + * @return The ErrorStreaming builder. + */ + Builder2 code(@Nonnull final Integer code); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the message of this {@link ErrorStreaming} instance. + * + * @param message The message of this {@link ErrorStreaming} + * @return The ErrorStreaming builder. + */ + Builder3 message(@Nonnull final String message); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the location of this {@link ErrorStreaming} instance. + * + * @param location Where the error occurred + * @return The ErrorStreaming instance. + */ + ErrorStreaming location(@Nonnull final String location); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GlobalStreamOptions.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GlobalStreamOptions.java index 84768b995..12b89da94 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GlobalStreamOptions.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GlobalStreamOptions.java @@ -25,11 +25,14 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Options for streaming. Will be ignored if stream is false. */ +/** Options for streaming. Will be ignored if enabled is false. */ // CHECKSTYLE:OFF public class GlobalStreamOptions // CHECKSTYLE:ON { + @JsonProperty("enabled") + private Boolean enabled = false; + @JsonProperty("chunk_size") private Integer chunkSize = 100; @@ -42,6 +45,37 @@ public class GlobalStreamOptions /** Default constructor for GlobalStreamOptions. */ protected GlobalStreamOptions() {} + /** + * Set the enabled of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param enabled If true, the response will be streamed back to the client + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * If true, the response will be streamed back to the client + * + * @return enabled The enabled of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link GlobalStreamOptions} instance. + * + * @param enabled If true, the response will be streamed back to the client + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + /** * Set the chunkSize of this {@link GlobalStreamOptions} instance and return the same instance. * @@ -167,6 +201,7 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (enabled != null) declaredFields.put("enabled", enabled); if (chunkSize != null) declaredFields.put("chunkSize", chunkSize); if (delimiters != null) declaredFields.put("delimiters", delimiters); return declaredFields; @@ -194,13 +229,14 @@ public boolean equals(@Nullable final java.lang.Object o) { } final GlobalStreamOptions globalStreamOptions = (GlobalStreamOptions) o; return Objects.equals(this.cloudSdkCustomFields, globalStreamOptions.cloudSdkCustomFields) + && Objects.equals(this.enabled, globalStreamOptions.enabled) && Objects.equals(this.chunkSize, globalStreamOptions.chunkSize) && Objects.equals(this.delimiters, globalStreamOptions.delimiters); } @Override public int hashCode() { - return Objects.hash(chunkSize, delimiters, cloudSdkCustomFields); + return Objects.hash(enabled, chunkSize, delimiters, cloudSdkCustomFields); } @Override @@ -208,6 +244,7 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class GlobalStreamOptions {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" chunkSize: ").append(toIndentedString(chunkSize)).append("\n"); sb.append(" delimiters: ").append(toIndentedString(delimiters)).append("\n"); cloudSdkCustomFields.forEach( diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfig.java index d17add2c8..11ee24b43 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfig.java @@ -16,7 +16,6 @@ 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; @@ -34,11 +33,8 @@ public class GroundingModuleConfigConfig @JsonProperty("filters") private List filters = new ArrayList<>(); - @JsonProperty("input_params") - private List inputParams = new ArrayList<>(); - - @JsonProperty("output_param") - private String outputParam; + @JsonProperty("placeholders") + private GroundingModuleConfigConfigPlaceholders placeholders; @JsonProperty("metadata_params") private List metadataParams = new ArrayList<>(); @@ -99,82 +95,36 @@ public void setFilters(@Nullable final List inputParams) { - this.inputParams = inputParams; + public GroundingModuleConfigConfig placeholders( + @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders) { + this.placeholders = placeholders; return this; } /** - * Add one inputParams instance to this {@link GroundingModuleConfigConfig}. + * Get placeholders * - * @param inputParamsItem The inputParams that should be added - * @return The same instance of type {@link GroundingModuleConfigConfig} + * @return placeholders The placeholders of this {@link GroundingModuleConfigConfig} instance. */ @Nonnull - public GroundingModuleConfigConfig addInputParamsItem(@Nonnull final String inputParamsItem) { - if (this.inputParams == null) { - this.inputParams = new ArrayList<>(); - } - this.inputParams.add(inputParamsItem); - return this; + public GroundingModuleConfigConfigPlaceholders getPlaceholders() { + return placeholders; } /** - * Contains the input parameters used for grounding input questions + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. * - * @return inputParams The inputParams of this {@link GroundingModuleConfigConfig} instance. + * @param placeholders The placeholders of this {@link GroundingModuleConfigConfig} */ - @Nonnull - public List getInputParams() { - return inputParams; - } - - /** - * Set the inputParams of this {@link GroundingModuleConfigConfig} instance. - * - * @param inputParams Contains the input parameters used for grounding input questions - */ - public void setInputParams(@Nonnull final List inputParams) { - this.inputParams = inputParams; - } - - /** - * Set the outputParam of this {@link GroundingModuleConfigConfig} instance and return the same - * instance. - * - * @param outputParam Parameter name used for grounding output - * @return The same instance of this {@link GroundingModuleConfigConfig} class - */ - @Nonnull - public GroundingModuleConfigConfig outputParam(@Nonnull final String outputParam) { - this.outputParam = outputParam; - return this; - } - - /** - * Parameter name used for grounding output - * - * @return outputParam The outputParam of this {@link GroundingModuleConfigConfig} instance. - */ - @Nonnull - public String getOutputParam() { - return outputParam; - } - - /** - * Set the outputParam of this {@link GroundingModuleConfigConfig} instance. - * - * @param outputParam Parameter name used for grounding output - */ - public void setOutputParam(@Nonnull final String outputParam) { - this.outputParam = outputParam; + public void setPlaceholders(@Nonnull final GroundingModuleConfigConfigPlaceholders placeholders) { + this.placeholders = placeholders; } /** @@ -266,8 +216,7 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (filters != null) declaredFields.put("filters", filters); - if (inputParams != null) declaredFields.put("inputParams", inputParams); - if (outputParam != null) declaredFields.put("outputParam", outputParam); + if (placeholders != null) declaredFields.put("placeholders", placeholders); if (metadataParams != null) declaredFields.put("metadataParams", metadataParams); return declaredFields; } @@ -296,14 +245,13 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals( this.cloudSdkCustomFields, groundingModuleConfigConfig.cloudSdkCustomFields) && Objects.equals(this.filters, groundingModuleConfigConfig.filters) - && Objects.equals(this.inputParams, groundingModuleConfigConfig.inputParams) - && Objects.equals(this.outputParam, groundingModuleConfigConfig.outputParam) + && Objects.equals(this.placeholders, groundingModuleConfigConfig.placeholders) && Objects.equals(this.metadataParams, groundingModuleConfigConfig.metadataParams); } @Override public int hashCode() { - return Objects.hash(filters, inputParams, outputParam, metadataParams, cloudSdkCustomFields); + return Objects.hash(filters, placeholders, metadataParams, cloudSdkCustomFields); } @Override @@ -312,8 +260,7 @@ public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class GroundingModuleConfigConfig {\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" inputParams: ").append(toIndentedString(inputParams)).append("\n"); - sb.append(" outputParam: ").append(toIndentedString(outputParam)).append("\n"); + sb.append(" placeholders: ").append(toIndentedString(placeholders)).append("\n"); sb.append(" metadataParams: ").append(toIndentedString(metadataParams)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> @@ -337,40 +284,18 @@ private String toIndentedString(final java.lang.Object o) { * GroundingModuleConfigConfig} instance with all required arguments. */ public static Builder create() { - return (inputParams) -> - (outputParam) -> - new GroundingModuleConfigConfig().inputParams(inputParams).outputParam(outputParam); + return (placeholders) -> new GroundingModuleConfigConfig().placeholders(placeholders); } /** Builder helper class. */ public interface Builder { /** - * Set the inputParams of this {@link GroundingModuleConfigConfig} instance. - * - * @param inputParams Contains the input parameters used for grounding input questions - * @return The GroundingModuleConfigConfig builder. - */ - Builder1 inputParams(@Nonnull final List inputParams); - - /** - * Set the inputParams of this {@link GroundingModuleConfigConfig} instance. - * - * @param inputParams Contains the input parameters used for grounding input questions - * @return The GroundingModuleConfigConfig builder. - */ - default Builder1 inputParams(@Nonnull final String... inputParams) { - return inputParams(Arrays.asList(inputParams)); - } - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the outputParam of this {@link GroundingModuleConfigConfig} instance. + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. * - * @param outputParam Parameter name used for grounding output + * @param placeholders The placeholders of this {@link GroundingModuleConfigConfig} * @return The GroundingModuleConfigConfig instance. */ - GroundingModuleConfigConfig outputParam(@Nonnull final String outputParam); + GroundingModuleConfigConfig placeholders( + @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfigPlaceholders.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfigPlaceholders.java new file mode 100644 index 000000000..9947284fe --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfigPlaceholders.java @@ -0,0 +1,269 @@ +/* + * 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; + +/** Placeholders to be used for grounding input questions and output */ +// CHECKSTYLE:OFF +public class GroundingModuleConfigConfigPlaceholders +// CHECKSTYLE:ON +{ + @JsonProperty("input") + private List input = new ArrayList<>(); + + @JsonProperty("output") + private String output; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GroundingModuleConfigConfigPlaceholders. */ + protected GroundingModuleConfigConfigPlaceholders() {} + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the + * same instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders input(@Nonnull final List input) { + this.input = input; + return this; + } + + /** + * Add one input instance to this {@link GroundingModuleConfigConfigPlaceholders}. + * + * @param inputItem The input that should be added + * @return The same instance of type {@link GroundingModuleConfigConfigPlaceholders} + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders addInputItem(@Nonnull final String inputItem) { + if (this.input == null) { + this.input = new ArrayList<>(); + } + this.input.add(inputItem); + return this; + } + + /** + * Contains the input parameters used for grounding input questions + * + * @return input The input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public List getInput() { + return input; + } + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + */ + public void setInput(@Nonnull final List input) { + this.input = input; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the + * same instance. + * + * @param output Placeholder name for grounding output + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders output(@Nonnull final String output) { + this.output = output; + return this; + } + + /** + * Placeholder name for grounding output + * + * @return output The output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public String getOutput() { + return output; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param output Placeholder name for grounding output + */ + public void setOutput(@Nonnull final String output) { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * GroundingModuleConfigConfigPlaceholders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * GroundingModuleConfigConfigPlaceholders} 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( + "GroundingModuleConfigConfigPlaceholders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfigConfigPlaceholders} + * instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} + * 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 GroundingModuleConfigConfigPlaceholders groundingModuleConfigConfigPlaceholders = + (GroundingModuleConfigConfigPlaceholders) o; + return Objects.equals( + this.cloudSdkCustomFields, groundingModuleConfigConfigPlaceholders.cloudSdkCustomFields) + && Objects.equals(this.input, groundingModuleConfigConfigPlaceholders.input) + && Objects.equals(this.output, groundingModuleConfigConfigPlaceholders.output); + } + + @Override + public int hashCode() { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfigConfigPlaceholders {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).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 + * GroundingModuleConfigConfigPlaceholders} instance with all required arguments. + */ + public static Builder create() { + return (input) -> + (output) -> new GroundingModuleConfigConfigPlaceholders().input(input).output(output); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The GroundingModuleConfigConfigPlaceholders builder. + */ + Builder1 input(@Nonnull final List input); + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The GroundingModuleConfigConfigPlaceholders builder. + */ + default Builder1 input(@Nonnull final String... input) { + return input(Arrays.asList(input)); + } + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param output Placeholder name for grounding output + * @return The GroundingModuleConfigConfigPlaceholders instance. + */ + GroundingModuleConfigConfigPlaceholders output(@Nonnull final String output); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/FilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilterConfig.java similarity index 88% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/FilterConfig.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilterConfig.java index 8fb497341..2f2daf275 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/FilterConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilterConfig.java @@ -14,10 +14,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -/** FilterConfig */ +/** InputFilterConfig */ @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) @JsonSubTypes({ - @JsonSubTypes.Type(value = AzureContentSafetyFilterConfig.class), + @JsonSubTypes.Type(value = AzureContentSafetyInputFilterConfig.class), @JsonSubTypes.Type(value = LlamaGuard38bFilterConfig.class), }) -public interface FilterConfig {} +public interface InputFilterConfig {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilteringConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilteringConfig.java index d71c9fb49..10da7556f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilteringConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/InputFilteringConfig.java @@ -32,7 +32,7 @@ public class InputFilteringConfig // CHECKSTYLE:ON { @JsonProperty("filters") - private List filters = new ArrayList<>(); + private List filters = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -44,11 +44,11 @@ protected InputFilteringConfig() {} * Set the filters of this {@link InputFilteringConfig} instance and return the same instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (input filtering). * @return The same instance of this {@link InputFilteringConfig} class */ @Nonnull - public InputFilteringConfig filters(@Nonnull final List filters) { + public InputFilteringConfig filters(@Nonnull final List filters) { this.filters = filters; return this; } @@ -60,7 +60,7 @@ public InputFilteringConfig filters(@Nonnull final List filters) { * @return The same instance of type {@link InputFilteringConfig} */ @Nonnull - public InputFilteringConfig addFiltersItem(@Nonnull final FilterConfig filtersItem) { + public InputFilteringConfig addFiltersItem(@Nonnull final InputFilterConfig filtersItem) { if (this.filters == null) { this.filters = new ArrayList<>(); } @@ -70,12 +70,12 @@ public InputFilteringConfig addFiltersItem(@Nonnull final FilterConfig filtersIt /** * Configuration for content filtering services that should be used for the given filtering step - * (input filtering or output filtering). + * (input filtering). * * @return filters The filters of this {@link InputFilteringConfig} instance. */ @Nonnull - public List getFilters() { + public List getFilters() { return filters; } @@ -83,9 +83,9 @@ public List getFilters() { * Set the filters of this {@link InputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (input filtering). */ - public void setFilters(@Nonnull final List filters) { + public void setFilters(@Nonnull final List filters) { this.filters = filters; } @@ -199,19 +199,19 @@ public interface Builder { * Set the filters of this {@link InputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (input filtering). * @return The InputFilteringConfig instance. */ - InputFilteringConfig filters(@Nonnull final List filters); + InputFilteringConfig filters(@Nonnull final List filters); /** * Set the filters of this {@link InputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (input filtering). * @return The InputFilteringConfig instance. */ - default InputFilteringConfig filters(@Nonnull final FilterConfig... filters) { + default InputFilteringConfig filters(@Nonnull final InputFilterConfig... filters) { return filters(Arrays.asList(filters)); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoice.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoice.java index 482d0b217..42f17cdb7 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoice.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoice.java @@ -15,10 +15,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import java.math.BigDecimal; -import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -28,7 +25,7 @@ /** LLMChoice */ // CHECKSTYLE:OFF -public class LLMChoice implements ModuleResultsOutputUnmaskingInner +public class LLMChoice // CHECKSTYLE:ON { @JsonProperty("index") @@ -38,7 +35,7 @@ public class LLMChoice implements ModuleResultsOutputUnmaskingInner private ResponseChatMessage message; @JsonProperty("logprobs") - private Map> logprobs = new HashMap<>(); + private ChoiceLogprobs logprobs; @JsonProperty("finish_reason") private String finishReason; @@ -114,48 +111,31 @@ public void setMessage(@Nonnull final ResponseChatMessage message) { /** * Set the logprobs of this {@link LLMChoice} instance and return the same instance. * - * @param logprobs Log probabilities + * @param logprobs The logprobs of this {@link LLMChoice} * @return The same instance of this {@link LLMChoice} class */ @Nonnull - public LLMChoice logprobs(@Nullable final Map> logprobs) { + public LLMChoice logprobs(@Nullable final ChoiceLogprobs logprobs) { this.logprobs = logprobs; return this; } /** - * Put one logprobs instance to this {@link LLMChoice} instance. - * - * @param key The String key of this logprobs instance - * @param logprobsItem The logprobs that should be added under the given key - * @return The same instance of type {@link LLMChoice} - */ - @Nonnull - public LLMChoice putlogprobsItem( - @Nonnull final String key, @Nonnull final List logprobsItem) { - if (this.logprobs == null) { - this.logprobs = new HashMap<>(); - } - this.logprobs.put(key, logprobsItem); - return this; - } - - /** - * Log probabilities + * Get logprobs * * @return logprobs The logprobs of this {@link LLMChoice} instance. */ @Nonnull - public Map> getLogprobs() { + public ChoiceLogprobs getLogprobs() { return logprobs; } /** * Set the logprobs of this {@link LLMChoice} instance. * - * @param logprobs Log probabilities + * @param logprobs The logprobs of this {@link LLMChoice} */ - public void setLogprobs(@Nullable final Map> logprobs) { + public void setLogprobs(@Nullable final ChoiceLogprobs logprobs) { this.logprobs = logprobs; } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoiceStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoiceStreaming.java index 4eb906ac1..070ee864d 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoiceStreaming.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMChoiceStreaming.java @@ -15,10 +15,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import java.math.BigDecimal; -import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -28,7 +25,7 @@ /** LLMChoiceStreaming */ // CHECKSTYLE:OFF -public class LLMChoiceStreaming implements ModuleResultsOutputUnmaskingInner +public class LLMChoiceStreaming // CHECKSTYLE:ON { @JsonProperty("index") @@ -38,7 +35,7 @@ public class LLMChoiceStreaming implements ModuleResultsOutputUnmaskingInner private ChatDelta delta; @JsonProperty("logprobs") - private Map> logprobs = new HashMap<>(); + private ChoiceLogprobs logprobs; @JsonProperty("finish_reason") private String finishReason; @@ -114,48 +111,31 @@ public void setDelta(@Nonnull final ChatDelta delta) { /** * Set the logprobs of this {@link LLMChoiceStreaming} instance and return the same instance. * - * @param logprobs Log probabilities + * @param logprobs The logprobs of this {@link LLMChoiceStreaming} * @return The same instance of this {@link LLMChoiceStreaming} class */ @Nonnull - public LLMChoiceStreaming logprobs(@Nullable final Map> logprobs) { + public LLMChoiceStreaming logprobs(@Nullable final ChoiceLogprobs logprobs) { this.logprobs = logprobs; return this; } /** - * Put one logprobs instance to this {@link LLMChoiceStreaming} instance. - * - * @param key The String key of this logprobs instance - * @param logprobsItem The logprobs that should be added under the given key - * @return The same instance of type {@link LLMChoiceStreaming} - */ - @Nonnull - public LLMChoiceStreaming putlogprobsItem( - @Nonnull final String key, @Nonnull final List logprobsItem) { - if (this.logprobs == null) { - this.logprobs = new HashMap<>(); - } - this.logprobs.put(key, logprobsItem); - return this; - } - - /** - * Log probabilities + * Get logprobs * * @return logprobs The logprobs of this {@link LLMChoiceStreaming} instance. */ @Nonnull - public Map> getLogprobs() { + public ChoiceLogprobs getLogprobs() { return logprobs; } /** * Set the logprobs of this {@link LLMChoiceStreaming} instance. * - * @param logprobs Log probabilities + * @param logprobs The logprobs of this {@link LLMChoiceStreaming} */ - public void setLogprobs(@Nullable final Map> logprobs) { + public void setLogprobs(@Nullable final ChoiceLogprobs logprobs) { this.logprobs = logprobs; } 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 new file mode 100644 index 000000000..7a932eef0 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java @@ -0,0 +1,278 @@ +/* + * 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.HashMap; +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; + +/** LLMModelDetails */ +// CHECKSTYLE:OFF +public class LLMModelDetails +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("version") + private String version = "latest"; + + @JsonProperty("params") + private Map params = new HashMap<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for LLMModelDetails. */ + protected LLMModelDetails() {} + + /** + * Set the name of this {@link LLMModelDetails} instance and return the same instance. + * + * @param name Name of the model as in LLM Access configuration + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails name(@Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Name of the model as in LLM Access configuration + * + * @return name The name of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link LLMModelDetails} instance. + * + * @param name Name of the model as in LLM Access configuration + */ + public void setName(@Nonnull final String name) { + this.name = name; + } + + /** + * Set the version of this {@link LLMModelDetails} instance and return the same instance. + * + * @param version Version of the model to be used + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails version(@Nullable final String version) { + this.version = version; + return this; + } + + /** + * Version of the model to be used + * + * @return version The version of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getVersion() { + return version; + } + + /** + * Set the version of this {@link LLMModelDetails} instance. + * + * @param version Version of the model to be used + */ + public void setVersion(@Nullable final String version) { + this.version = version; + } + + /** + * Set the params of this {@link LLMModelDetails} instance and return the same instance. + * + * @param params Additional parameters for the model. Default values are used for mandatory + * parameters. + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails params(@Nullable final Map params) { + this.params = params; + return this; + } + + /** + * Put one params instance to this {@link LLMModelDetails} instance. + * + * @param key The String key of this params instance + * @param paramsItem The params that should be added under the given key + * @return The same instance of type {@link LLMModelDetails} + */ + @Nonnull + public LLMModelDetails putparamsItem( + @Nonnull final String key, @Nullable final Object paramsItem) { + if (this.params == null) { + this.params = new HashMap<>(); + } + this.params.put(key, paramsItem); + return this; + } + + /** + * Additional parameters for the model. Default values are used for mandatory parameters. + * + * @return params The params of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Map getParams() { + return params; + } + + /** + * Set the params of this {@link LLMModelDetails} instance. + * + * @param params Additional parameters for the model. Default values are used for mandatory + * parameters. + */ + public void setParams(@Nullable final Map params) { + this.params = params; + } + + /** + * Get the names of the unrecognizable properties of the {@link LLMModelDetails}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LLMModelDetails} 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("LLMModelDetails has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LLMModelDetails} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (version != null) declaredFields.put("version", version); + if (params != null) declaredFields.put("params", params); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LLMModelDetails} 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 LLMModelDetails llMModelDetails = (LLMModelDetails) o; + return Objects.equals(this.cloudSdkCustomFields, llMModelDetails.cloudSdkCustomFields) + && Objects.equals(this.name, llMModelDetails.name) + && Objects.equals(this.version, llMModelDetails.version) + && Objects.equals(this.params, llMModelDetails.params); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, params, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class LLMModelDetails {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).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 LLMModelDetails} + * instance with all required arguments. + */ + public static Builder create() { + return (name) -> new LLMModelDetails().name(name); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the name of this {@link LLMModelDetails} instance. + * + * @param name Name of the model as in LLM Access configuration + * @return The LLMModelDetails instance. + */ + LLMModelDetails name(@Nonnull final String name); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleConfig.java deleted file mode 100644 index 5a2cd63d6..000000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleConfig.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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.HashMap; -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; - -/** LLMModuleConfig */ -// CHECKSTYLE:OFF -public class LLMModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty("model_name") - private String modelName; - - @JsonProperty("model_params") - private Map modelParams = new HashMap<>(); - - @JsonProperty("model_version") - private String modelVersion = "latest"; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** Default constructor for LLMModuleConfig. */ - protected LLMModuleConfig() {} - - /** - * Set the modelName of this {@link LLMModuleConfig} instance and return the same instance. - * - * @param modelName Model name as in LLM Access configuration - * @return The same instance of this {@link LLMModuleConfig} class - */ - @Nonnull - public LLMModuleConfig modelName(@Nonnull final String modelName) { - this.modelName = modelName; - return this; - } - - /** - * Model name as in LLM Access configuration - * - * @return modelName The modelName of this {@link LLMModuleConfig} instance. - */ - @Nonnull - public String getModelName() { - return modelName; - } - - /** - * Set the modelName of this {@link LLMModuleConfig} instance. - * - * @param modelName Model name as in LLM Access configuration - */ - public void setModelName(@Nonnull final String modelName) { - this.modelName = modelName; - } - - /** - * Set the modelParams of this {@link LLMModuleConfig} instance and return the same instance. - * - * @param modelParams Model parameters - * @return The same instance of this {@link LLMModuleConfig} class - */ - @Nonnull - public LLMModuleConfig modelParams(@Nullable final Map modelParams) { - this.modelParams = modelParams; - return this; - } - - /** - * Put one modelParams instance to this {@link LLMModuleConfig} instance. - * - * @param key The String key of this modelParams instance - * @param modelParamsItem The modelParams that should be added under the given key - * @return The same instance of type {@link LLMModuleConfig} - */ - @Nonnull - public LLMModuleConfig putmodelParamsItem( - @Nonnull final String key, @Nullable final Object modelParamsItem) { - if (this.modelParams == null) { - this.modelParams = new HashMap<>(); - } - this.modelParams.put(key, modelParamsItem); - return this; - } - - /** - * Model parameters - * - * @return modelParams The modelParams of this {@link LLMModuleConfig} instance. - */ - @Nonnull - public Map getModelParams() { - return modelParams; - } - - /** - * Set the modelParams of this {@link LLMModuleConfig} instance. - * - * @param modelParams Model parameters - */ - public void setModelParams(@Nullable final Map modelParams) { - this.modelParams = modelParams; - } - - /** - * Set the modelVersion of this {@link LLMModuleConfig} instance and return the same instance. - * - * @param modelVersion Version of the model to use - * @return The same instance of this {@link LLMModuleConfig} class - */ - @Nonnull - public LLMModuleConfig modelVersion(@Nullable final String modelVersion) { - this.modelVersion = modelVersion; - return this; - } - - /** - * Version of the model to use - * - * @return modelVersion The modelVersion of this {@link LLMModuleConfig} instance. - */ - @Nonnull - public String getModelVersion() { - return modelVersion; - } - - /** - * Set the modelVersion of this {@link LLMModuleConfig} instance. - * - * @param modelVersion Version of the model to use - */ - public void setModelVersion(@Nullable final String modelVersion) { - this.modelVersion = modelVersion; - } - - /** - * Get the names of the unrecognizable properties of the {@link LLMModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link LLMModuleConfig} 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("LLMModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link LLMModuleConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (modelName != null) declaredFields.put("modelName", modelName); - if (modelParams != null) declaredFields.put("modelParams", modelParams); - if (modelVersion != null) declaredFields.put("modelVersion", modelVersion); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link LLMModuleConfig} 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 LLMModuleConfig llMModuleConfig = (LLMModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, llMModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.modelName, llMModuleConfig.modelName) - && Objects.equals(this.modelParams, llMModuleConfig.modelParams) - && Objects.equals(this.modelVersion, llMModuleConfig.modelVersion); - } - - @Override - public int hashCode() { - return Objects.hash(modelName, modelParams, modelVersion, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class LLMModuleConfig {\n"); - sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); - sb.append(" modelParams: ").append(toIndentedString(modelParams)).append("\n"); - sb.append(" modelVersion: ").append(toIndentedString(modelVersion)).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 LLMModuleConfig} - * instance with all required arguments. - */ - public static Builder create() { - return (modelName) -> new LLMModuleConfig().modelName(modelName); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the modelName of this {@link LLMModuleConfig} instance. - * - * @param modelName Model name as in LLM Access configuration - * @return The LLMModuleConfig instance. - */ - LLMModuleConfig modelName(@Nonnull final String modelName); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResult.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResult.java index a07479937..957aae9ad 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResult.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResult.java @@ -11,13 +11,493 @@ package com.sap.ai.sdk.orchestration.model; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -/** Output of LLM module. Follows the OpenAI spec. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) -@JsonSubTypes({ - @JsonSubTypes.Type(value = LLMModuleResultStreaming.class), - @JsonSubTypes.Type(value = LLMModuleResultSynchronous.class), -}) -public interface LLMModuleResult {} +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; + +/** Output from LLM. Follows the OpenAI spec. */ +// CHECKSTYLE:OFF +public class LLMModuleResult +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("object") + private String _object; + + @JsonProperty("created") + private Integer created; + + @JsonProperty("model") + private String model; + + @JsonProperty("system_fingerprint") + private String systemFingerprint; + + @JsonProperty("choices") + private List choices = new ArrayList<>(); + + @JsonProperty("usage") + private TokenUsage usage; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for LLMModuleResult. */ + protected LLMModuleResult() {} + + /** + * Set the id of this {@link LLMModuleResult} instance and return the same instance. + * + * @param id ID of the response + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * ID of the response + * + * @return id The id of this {@link LLMModuleResult} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link LLMModuleResult} instance. + * + * @param id ID of the response + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the _object of this {@link LLMModuleResult} instance and return the same instance. + * + * @param _object Object type + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult _object(@Nonnull final String _object) { + this._object = _object; + return this; + } + + /** + * Object type + * + * @return _object The _object of this {@link LLMModuleResult} instance. + */ + @Nonnull + public String getObject() { + return _object; + } + + /** + * Set the _object of this {@link LLMModuleResult} instance. + * + * @param _object Object type + */ + public void setObject(@Nonnull final String _object) { + this._object = _object; + } + + /** + * Set the created of this {@link LLMModuleResult} instance and return the same instance. + * + * @param created Unix timestamp + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult created(@Nonnull final Integer created) { + this.created = created; + return this; + } + + /** + * Unix timestamp + * + * @return created The created of this {@link LLMModuleResult} instance. + */ + @Nonnull + public Integer getCreated() { + return created; + } + + /** + * Set the created of this {@link LLMModuleResult} instance. + * + * @param created Unix timestamp + */ + public void setCreated(@Nonnull final Integer created) { + this.created = created; + } + + /** + * Set the model of this {@link LLMModuleResult} instance and return the same instance. + * + * @param model Model name + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult model(@Nonnull final String model) { + this.model = model; + return this; + } + + /** + * Model name + * + * @return model The model of this {@link LLMModuleResult} instance. + */ + @Nonnull + public String getModel() { + return model; + } + + /** + * Set the model of this {@link LLMModuleResult} instance. + * + * @param model Model name + */ + public void setModel(@Nonnull final String model) { + this.model = model; + } + + /** + * Set the systemFingerprint of this {@link LLMModuleResult} instance and return the same + * instance. + * + * @param systemFingerprint System fingerprint + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult systemFingerprint(@Nullable final String systemFingerprint) { + this.systemFingerprint = systemFingerprint; + return this; + } + + /** + * System fingerprint + * + * @return systemFingerprint The systemFingerprint of this {@link LLMModuleResult} instance. + */ + @Nonnull + public String getSystemFingerprint() { + return systemFingerprint; + } + + /** + * Set the systemFingerprint of this {@link LLMModuleResult} instance. + * + * @param systemFingerprint System fingerprint + */ + public void setSystemFingerprint(@Nullable final String systemFingerprint) { + this.systemFingerprint = systemFingerprint; + } + + /** + * Set the choices of this {@link LLMModuleResult} instance and return the same instance. + * + * @param choices Choices + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult choices(@Nonnull final List choices) { + this.choices = choices; + return this; + } + + /** + * Add one choices instance to this {@link LLMModuleResult}. + * + * @param choicesItem The choices that should be added + * @return The same instance of type {@link LLMModuleResult} + */ + @Nonnull + public LLMModuleResult addChoicesItem(@Nonnull final LLMChoice choicesItem) { + if (this.choices == null) { + this.choices = new ArrayList<>(); + } + this.choices.add(choicesItem); + return this; + } + + /** + * Choices + * + * @return choices The choices of this {@link LLMModuleResult} instance. + */ + @Nonnull + public List getChoices() { + return choices; + } + + /** + * Set the choices of this {@link LLMModuleResult} instance. + * + * @param choices Choices + */ + public void setChoices(@Nonnull final List choices) { + this.choices = choices; + } + + /** + * Set the usage of this {@link LLMModuleResult} instance and return the same instance. + * + * @param usage The usage of this {@link LLMModuleResult} + * @return The same instance of this {@link LLMModuleResult} class + */ + @Nonnull + public LLMModuleResult usage(@Nonnull final TokenUsage usage) { + this.usage = usage; + return this; + } + + /** + * Get usage + * + * @return usage The usage of this {@link LLMModuleResult} instance. + */ + @Nonnull + public TokenUsage getUsage() { + return usage; + } + + /** + * Set the usage of this {@link LLMModuleResult} instance. + * + * @param usage The usage of this {@link LLMModuleResult} + */ + public void setUsage(@Nonnull final TokenUsage usage) { + this.usage = usage; + } + + /** + * Get the names of the unrecognizable properties of the {@link LLMModuleResult}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LLMModuleResult} 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("LLMModuleResult has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LLMModuleResult} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (_object != null) declaredFields.put("_object", _object); + if (created != null) declaredFields.put("created", created); + if (model != null) declaredFields.put("model", model); + if (systemFingerprint != null) declaredFields.put("systemFingerprint", systemFingerprint); + if (choices != null) declaredFields.put("choices", choices); + if (usage != null) declaredFields.put("usage", usage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LLMModuleResult} 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 LLMModuleResult llMModuleResult = (LLMModuleResult) o; + return Objects.equals(this.cloudSdkCustomFields, llMModuleResult.cloudSdkCustomFields) + && Objects.equals(this.id, llMModuleResult.id) + && Objects.equals(this._object, llMModuleResult._object) + && Objects.equals(this.created, llMModuleResult.created) + && Objects.equals(this.model, llMModuleResult.model) + && Objects.equals(this.systemFingerprint, llMModuleResult.systemFingerprint) + && Objects.equals(this.choices, llMModuleResult.choices) + && Objects.equals(this.usage, llMModuleResult.usage); + } + + @Override + public int hashCode() { + return Objects.hash( + id, _object, created, model, systemFingerprint, choices, usage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class LLMModuleResult {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" systemFingerprint: ").append(toIndentedString(systemFingerprint)).append("\n"); + sb.append(" choices: ").append(toIndentedString(choices)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).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 LLMModuleResult} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (_object) -> + (created) -> + (model) -> + (choices) -> + (usage) -> + new LLMModuleResult() + .id(id) + ._object(_object) + .created(created) + .model(model) + .choices(choices) + .usage(usage); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link LLMModuleResult} instance. + * + * @param id ID of the response + * @return The LLMModuleResult builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the _object of this {@link LLMModuleResult} instance. + * + * @param _object Object type + * @return The LLMModuleResult builder. + */ + Builder2 _object(@Nonnull final String _object); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the created of this {@link LLMModuleResult} instance. + * + * @param created Unix timestamp + * @return The LLMModuleResult builder. + */ + Builder3 created(@Nonnull final Integer created); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the model of this {@link LLMModuleResult} instance. + * + * @param model Model name + * @return The LLMModuleResult builder. + */ + Builder4 model(@Nonnull final String model); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the choices of this {@link LLMModuleResult} instance. + * + * @param choices Choices + * @return The LLMModuleResult builder. + */ + Builder5 choices(@Nonnull final List choices); + + /** + * Set the choices of this {@link LLMModuleResult} instance. + * + * @param choices Choices + * @return The LLMModuleResult builder. + */ + default Builder5 choices(@Nonnull final LLMChoice... choices) { + return choices(Arrays.asList(choices)); + } + } + + /** Builder helper class. */ + public interface Builder5 { + /** + * Set the usage of this {@link LLMModuleResult} instance. + * + * @param usage The usage of this {@link LLMModuleResult} + * @return The LLMModuleResult instance. + */ + LLMModuleResult usage(@Nonnull final TokenUsage usage); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultStreaming.java index f996ab8b0..394a8d3b1 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultStreaming.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultStreaming.java @@ -28,7 +28,7 @@ /** Output of LLM module. Follows the OpenAI spec. */ // CHECKSTYLE:OFF -public class LLMModuleResultStreaming implements LLMModuleResult +public class LLMModuleResultStreaming // CHECKSTYLE:ON { @JsonProperty("id") diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultSynchronous.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultSynchronous.java deleted file mode 100644 index 5db99a16c..000000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModuleResultSynchronous.java +++ /dev/null @@ -1,510 +0,0 @@ -/* - * 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; - -/** Output of LLM module. Follows the OpenAI spec. */ -// CHECKSTYLE:OFF -public class LLMModuleResultSynchronous implements LLMModuleResult -// CHECKSTYLE:ON -{ - @JsonProperty("id") - private String id; - - @JsonProperty("object") - private String _object; - - @JsonProperty("created") - private Integer created; - - @JsonProperty("model") - private String model; - - @JsonProperty("system_fingerprint") - private String systemFingerprint; - - @JsonProperty("choices") - private List choices = new ArrayList<>(); - - @JsonProperty("usage") - private TokenUsage usage; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** Default constructor for LLMModuleResultSynchronous. */ - protected LLMModuleResultSynchronous() {} - - /** - * Set the id of this {@link LLMModuleResultSynchronous} instance and return the same instance. - * - * @param id ID of the response - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous id(@Nonnull final String id) { - this.id = id; - return this; - } - - /** - * ID of the response - * - * @return id The id of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public String getId() { - return id; - } - - /** - * Set the id of this {@link LLMModuleResultSynchronous} instance. - * - * @param id ID of the response - */ - public void setId(@Nonnull final String id) { - this.id = id; - } - - /** - * Set the _object of this {@link LLMModuleResultSynchronous} instance and return the same - * instance. - * - * @param _object Object type - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous _object(@Nonnull final String _object) { - this._object = _object; - return this; - } - - /** - * Object type - * - * @return _object The _object of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public String getObject() { - return _object; - } - - /** - * Set the _object of this {@link LLMModuleResultSynchronous} instance. - * - * @param _object Object type - */ - public void setObject(@Nonnull final String _object) { - this._object = _object; - } - - /** - * Set the created of this {@link LLMModuleResultSynchronous} instance and return the same - * instance. - * - * @param created Unix timestamp - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous created(@Nonnull final Integer created) { - this.created = created; - return this; - } - - /** - * Unix timestamp - * - * @return created The created of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public Integer getCreated() { - return created; - } - - /** - * Set the created of this {@link LLMModuleResultSynchronous} instance. - * - * @param created Unix timestamp - */ - public void setCreated(@Nonnull final Integer created) { - this.created = created; - } - - /** - * Set the model of this {@link LLMModuleResultSynchronous} instance and return the same instance. - * - * @param model Model name - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous model(@Nonnull final String model) { - this.model = model; - return this; - } - - /** - * Model name - * - * @return model The model of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public String getModel() { - return model; - } - - /** - * Set the model of this {@link LLMModuleResultSynchronous} instance. - * - * @param model Model name - */ - public void setModel(@Nonnull final String model) { - this.model = model; - } - - /** - * Set the systemFingerprint of this {@link LLMModuleResultSynchronous} instance and return the - * same instance. - * - * @param systemFingerprint System fingerprint - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous systemFingerprint(@Nullable final String systemFingerprint) { - this.systemFingerprint = systemFingerprint; - return this; - } - - /** - * System fingerprint - * - * @return systemFingerprint The systemFingerprint of this {@link LLMModuleResultSynchronous} - * instance. - */ - @Nonnull - public String getSystemFingerprint() { - return systemFingerprint; - } - - /** - * Set the systemFingerprint of this {@link LLMModuleResultSynchronous} instance. - * - * @param systemFingerprint System fingerprint - */ - public void setSystemFingerprint(@Nullable final String systemFingerprint) { - this.systemFingerprint = systemFingerprint; - } - - /** - * Set the choices of this {@link LLMModuleResultSynchronous} instance and return the same - * instance. - * - * @param choices Choices - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous choices(@Nonnull final List choices) { - this.choices = choices; - return this; - } - - /** - * Add one choices instance to this {@link LLMModuleResultSynchronous}. - * - * @param choicesItem The choices that should be added - * @return The same instance of type {@link LLMModuleResultSynchronous} - */ - @Nonnull - public LLMModuleResultSynchronous addChoicesItem(@Nonnull final LLMChoice choicesItem) { - if (this.choices == null) { - this.choices = new ArrayList<>(); - } - this.choices.add(choicesItem); - return this; - } - - /** - * Choices - * - * @return choices The choices of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public List getChoices() { - return choices; - } - - /** - * Set the choices of this {@link LLMModuleResultSynchronous} instance. - * - * @param choices Choices - */ - public void setChoices(@Nonnull final List choices) { - this.choices = choices; - } - - /** - * Set the usage of this {@link LLMModuleResultSynchronous} instance and return the same instance. - * - * @param usage The usage of this {@link LLMModuleResultSynchronous} - * @return The same instance of this {@link LLMModuleResultSynchronous} class - */ - @Nonnull - public LLMModuleResultSynchronous usage(@Nonnull final TokenUsage usage) { - this.usage = usage; - return this; - } - - /** - * Get usage - * - * @return usage The usage of this {@link LLMModuleResultSynchronous} instance. - */ - @Nonnull - public TokenUsage getUsage() { - return usage; - } - - /** - * Set the usage of this {@link LLMModuleResultSynchronous} instance. - * - * @param usage The usage of this {@link LLMModuleResultSynchronous} - */ - public void setUsage(@Nonnull final TokenUsage usage) { - this.usage = usage; - } - - /** - * Get the names of the unrecognizable properties of the {@link LLMModuleResultSynchronous}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link LLMModuleResultSynchronous} - * 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( - "LLMModuleResultSynchronous has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link LLMModuleResultSynchronous} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (id != null) declaredFields.put("id", id); - if (_object != null) declaredFields.put("_object", _object); - if (created != null) declaredFields.put("created", created); - if (model != null) declaredFields.put("model", model); - if (systemFingerprint != null) declaredFields.put("systemFingerprint", systemFingerprint); - if (choices != null) declaredFields.put("choices", choices); - if (usage != null) declaredFields.put("usage", usage); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link LLMModuleResultSynchronous} 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 LLMModuleResultSynchronous llMModuleResultSynchronous = (LLMModuleResultSynchronous) o; - return Objects.equals( - this.cloudSdkCustomFields, llMModuleResultSynchronous.cloudSdkCustomFields) - && Objects.equals(this.id, llMModuleResultSynchronous.id) - && Objects.equals(this._object, llMModuleResultSynchronous._object) - && Objects.equals(this.created, llMModuleResultSynchronous.created) - && Objects.equals(this.model, llMModuleResultSynchronous.model) - && Objects.equals(this.systemFingerprint, llMModuleResultSynchronous.systemFingerprint) - && Objects.equals(this.choices, llMModuleResultSynchronous.choices) - && Objects.equals(this.usage, llMModuleResultSynchronous.usage); - } - - @Override - public int hashCode() { - return Objects.hash( - id, _object, created, model, systemFingerprint, choices, usage, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class LLMModuleResultSynchronous {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); - sb.append(" created: ").append(toIndentedString(created)).append("\n"); - sb.append(" model: ").append(toIndentedString(model)).append("\n"); - sb.append(" systemFingerprint: ").append(toIndentedString(systemFingerprint)).append("\n"); - sb.append(" choices: ").append(toIndentedString(choices)).append("\n"); - sb.append(" usage: ").append(toIndentedString(usage)).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 - * LLMModuleResultSynchronous} instance with all required arguments. - */ - public static Builder create() { - return (id) -> - (_object) -> - (created) -> - (model) -> - (choices) -> - (usage) -> - new LLMModuleResultSynchronous() - .id(id) - ._object(_object) - .created(created) - .model(model) - .choices(choices) - .usage(usage); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the id of this {@link LLMModuleResultSynchronous} instance. - * - * @param id ID of the response - * @return The LLMModuleResultSynchronous builder. - */ - Builder1 id(@Nonnull final String id); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the _object of this {@link LLMModuleResultSynchronous} instance. - * - * @param _object Object type - * @return The LLMModuleResultSynchronous builder. - */ - Builder2 _object(@Nonnull final String _object); - } - - /** Builder helper class. */ - public interface Builder2 { - /** - * Set the created of this {@link LLMModuleResultSynchronous} instance. - * - * @param created Unix timestamp - * @return The LLMModuleResultSynchronous builder. - */ - Builder3 created(@Nonnull final Integer created); - } - - /** Builder helper class. */ - public interface Builder3 { - /** - * Set the model of this {@link LLMModuleResultSynchronous} instance. - * - * @param model Model name - * @return The LLMModuleResultSynchronous builder. - */ - Builder4 model(@Nonnull final String model); - } - - /** Builder helper class. */ - public interface Builder4 { - /** - * Set the choices of this {@link LLMModuleResultSynchronous} instance. - * - * @param choices Choices - * @return The LLMModuleResultSynchronous builder. - */ - Builder5 choices(@Nonnull final List choices); - - /** - * Set the choices of this {@link LLMModuleResultSynchronous} instance. - * - * @param choices Choices - * @return The LLMModuleResultSynchronous builder. - */ - default Builder5 choices(@Nonnull final LLMChoice... choices) { - return choices(Arrays.asList(choices)); - } - } - - /** Builder helper class. */ - public interface Builder5 { - /** - * Set the usage of this {@link LLMModuleResultSynchronous} instance. - * - * @param usage The usage of this {@link LLMModuleResultSynchronous} - * @return The LLMModuleResultSynchronous instance. - */ - LLMModuleResultSynchronous usage(@Nonnull final TokenUsage usage); - } -} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LlamaGuard38bFilterConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LlamaGuard38bFilterConfig.java index 4e848cfc2..686c1592e 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LlamaGuard38bFilterConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LlamaGuard38bFilterConfig.java @@ -27,7 +27,7 @@ /** LlamaGuard38bFilterConfig */ // CHECKSTYLE:OFF -public class LlamaGuard38bFilterConfig implements FilterConfig +public class LlamaGuard38bFilterConfig implements InputFilterConfig, OutputFilterConfig // CHECKSTYLE:ON { /** Name of the filter provider type */ diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleConfigs.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleConfigs.java index 743f70e9c..3ab43534c 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleConfigs.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleConfigs.java @@ -28,26 +28,20 @@ public class ModuleConfigs // CHECKSTYLE:ON { - @JsonProperty("llm_module_config") - private LLMModuleConfig llmModuleConfig; + @JsonProperty("prompt_templating") + private PromptTemplatingModuleConfig promptTemplating; - @JsonProperty("templating_module_config") - private TemplatingModuleConfig templatingModuleConfig; + @JsonProperty("filtering") + private FilteringModuleConfig filtering; - @JsonProperty("filtering_module_config") - private FilteringModuleConfig filteringModuleConfig; + @JsonProperty("masking") + private MaskingModuleConfig masking; - @JsonProperty("masking_module_config") - private MaskingModuleConfig maskingModuleConfig; + @JsonProperty("grounding") + private GroundingModuleConfig grounding; - @JsonProperty("grounding_module_config") - private GroundingModuleConfig groundingModuleConfig; - - @JsonProperty("input_translation_module_config") - private SAPDocumentTranslation inputTranslationModuleConfig; - - @JsonProperty("output_translation_module_config") - private SAPDocumentTranslation outputTranslationModuleConfig; + @JsonProperty("translation") + private TranslationModuleConfig translation; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -56,244 +50,159 @@ public class ModuleConfigs protected ModuleConfigs() {} /** - * Set the llmModuleConfig of this {@link ModuleConfigs} instance and return the same instance. - * - * @param llmModuleConfig The llmModuleConfig of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs llmModuleConfig(@Nonnull final LLMModuleConfig llmModuleConfig) { - this.llmModuleConfig = llmModuleConfig; - return this; - } - - /** - * Get llmModuleConfig - * - * @return llmModuleConfig The llmModuleConfig of this {@link ModuleConfigs} instance. - */ - @Nonnull - public LLMModuleConfig getLlmModuleConfig() { - return llmModuleConfig; - } - - /** - * Set the llmModuleConfig of this {@link ModuleConfigs} instance. - * - * @param llmModuleConfig The llmModuleConfig of this {@link ModuleConfigs} - */ - public void setLlmModuleConfig(@Nonnull final LLMModuleConfig llmModuleConfig) { - this.llmModuleConfig = llmModuleConfig; - } - - /** - * Set the templatingModuleConfig of this {@link ModuleConfigs} instance and return the same - * instance. - * - * @param templatingModuleConfig The templatingModuleConfig of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs templatingModuleConfig( - @Nonnull final TemplatingModuleConfig templatingModuleConfig) { - this.templatingModuleConfig = templatingModuleConfig; - return this; - } - - /** - * Get templatingModuleConfig - * - * @return templatingModuleConfig The templatingModuleConfig of this {@link ModuleConfigs} - * instance. - */ - @Nonnull - public TemplatingModuleConfig getTemplatingModuleConfig() { - return templatingModuleConfig; - } - - /** - * Set the templatingModuleConfig of this {@link ModuleConfigs} instance. + * Set the promptTemplating of this {@link ModuleConfigs} instance and return the same instance. * - * @param templatingModuleConfig The templatingModuleConfig of this {@link ModuleConfigs} - */ - public void setTemplatingModuleConfig( - @Nonnull final TemplatingModuleConfig templatingModuleConfig) { - this.templatingModuleConfig = templatingModuleConfig; - } - - /** - * Set the filteringModuleConfig of this {@link ModuleConfigs} instance and return the same - * instance. - * - * @param filteringModuleConfig The filteringModuleConfig of this {@link ModuleConfigs} + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} * @return The same instance of this {@link ModuleConfigs} class */ @Nonnull - public ModuleConfigs filteringModuleConfig( - @Nullable final FilteringModuleConfig filteringModuleConfig) { - this.filteringModuleConfig = filteringModuleConfig; + public ModuleConfigs promptTemplating( + @Nonnull final PromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; return this; } /** - * Get filteringModuleConfig + * Get promptTemplating * - * @return filteringModuleConfig The filteringModuleConfig of this {@link ModuleConfigs} instance. + * @return promptTemplating The promptTemplating of this {@link ModuleConfigs} instance. */ @Nonnull - public FilteringModuleConfig getFilteringModuleConfig() { - return filteringModuleConfig; + public PromptTemplatingModuleConfig getPromptTemplating() { + return promptTemplating; } /** - * Set the filteringModuleConfig of this {@link ModuleConfigs} instance. + * Set the promptTemplating of this {@link ModuleConfigs} instance. * - * @param filteringModuleConfig The filteringModuleConfig of this {@link ModuleConfigs} + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} */ - public void setFilteringModuleConfig( - @Nullable final FilteringModuleConfig filteringModuleConfig) { - this.filteringModuleConfig = filteringModuleConfig; + public void setPromptTemplating(@Nonnull final PromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; } /** - * Set the maskingModuleConfig of this {@link ModuleConfigs} instance and return the same - * instance. + * Set the filtering of this {@link ModuleConfigs} instance and return the same instance. * - * @param maskingModuleConfig The maskingModuleConfig of this {@link ModuleConfigs} + * @param filtering The filtering of this {@link ModuleConfigs} * @return The same instance of this {@link ModuleConfigs} class */ @Nonnull - public ModuleConfigs maskingModuleConfig( - @Nullable final MaskingModuleConfig maskingModuleConfig) { - this.maskingModuleConfig = maskingModuleConfig; + public ModuleConfigs filtering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; return this; } /** - * Get maskingModuleConfig + * Get filtering * - * @return maskingModuleConfig The maskingModuleConfig of this {@link ModuleConfigs} instance. + * @return filtering The filtering of this {@link ModuleConfigs} instance. */ @Nonnull - public MaskingModuleConfig getMaskingModuleConfig() { - return maskingModuleConfig; + public FilteringModuleConfig getFiltering() { + return filtering; } /** - * Set the maskingModuleConfig of this {@link ModuleConfigs} instance. + * Set the filtering of this {@link ModuleConfigs} instance. * - * @param maskingModuleConfig The maskingModuleConfig of this {@link ModuleConfigs} + * @param filtering The filtering of this {@link ModuleConfigs} */ - public void setMaskingModuleConfig(@Nullable final MaskingModuleConfig maskingModuleConfig) { - this.maskingModuleConfig = maskingModuleConfig; + public void setFiltering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; } /** - * Set the groundingModuleConfig of this {@link ModuleConfigs} instance and return the same - * instance. + * Set the masking of this {@link ModuleConfigs} instance and return the same instance. * - * @param groundingModuleConfig The groundingModuleConfig of this {@link ModuleConfigs} + * @param masking The masking of this {@link ModuleConfigs} * @return The same instance of this {@link ModuleConfigs} class */ @Nonnull - public ModuleConfigs groundingModuleConfig( - @Nullable final GroundingModuleConfig groundingModuleConfig) { - this.groundingModuleConfig = groundingModuleConfig; + public ModuleConfigs masking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; return this; } /** - * Get groundingModuleConfig + * Get masking * - * @return groundingModuleConfig The groundingModuleConfig of this {@link ModuleConfigs} instance. + * @return masking The masking of this {@link ModuleConfigs} instance. */ @Nonnull - public GroundingModuleConfig getGroundingModuleConfig() { - return groundingModuleConfig; + public MaskingModuleConfig getMasking() { + return masking; } /** - * Set the groundingModuleConfig of this {@link ModuleConfigs} instance. + * Set the masking of this {@link ModuleConfigs} instance. * - * @param groundingModuleConfig The groundingModuleConfig of this {@link ModuleConfigs} + * @param masking The masking of this {@link ModuleConfigs} */ - public void setGroundingModuleConfig( - @Nullable final GroundingModuleConfig groundingModuleConfig) { - this.groundingModuleConfig = groundingModuleConfig; + public void setMasking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; } /** - * Set the inputTranslationModuleConfig of this {@link ModuleConfigs} instance and return the same - * instance. + * Set the grounding of this {@link ModuleConfigs} instance and return the same instance. * - * @param inputTranslationModuleConfig The inputTranslationModuleConfig of this {@link - * ModuleConfigs} + * @param grounding The grounding of this {@link ModuleConfigs} * @return The same instance of this {@link ModuleConfigs} class */ @Nonnull - public ModuleConfigs inputTranslationModuleConfig( - @Nullable final SAPDocumentTranslation inputTranslationModuleConfig) { - this.inputTranslationModuleConfig = inputTranslationModuleConfig; + public ModuleConfigs grounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; return this; } /** - * Get inputTranslationModuleConfig + * Get grounding * - * @return inputTranslationModuleConfig The inputTranslationModuleConfig of this {@link - * ModuleConfigs} instance. + * @return grounding The grounding of this {@link ModuleConfigs} instance. */ @Nonnull - public SAPDocumentTranslation getInputTranslationModuleConfig() { - return inputTranslationModuleConfig; + public GroundingModuleConfig getGrounding() { + return grounding; } /** - * Set the inputTranslationModuleConfig of this {@link ModuleConfigs} instance. + * Set the grounding of this {@link ModuleConfigs} instance. * - * @param inputTranslationModuleConfig The inputTranslationModuleConfig of this {@link - * ModuleConfigs} + * @param grounding The grounding of this {@link ModuleConfigs} */ - public void setInputTranslationModuleConfig( - @Nullable final SAPDocumentTranslation inputTranslationModuleConfig) { - this.inputTranslationModuleConfig = inputTranslationModuleConfig; + public void setGrounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; } /** - * Set the outputTranslationModuleConfig of this {@link ModuleConfigs} instance and return the - * same instance. + * Set the translation of this {@link ModuleConfigs} instance and return the same instance. * - * @param outputTranslationModuleConfig The outputTranslationModuleConfig of this {@link - * ModuleConfigs} + * @param translation The translation of this {@link ModuleConfigs} * @return The same instance of this {@link ModuleConfigs} class */ @Nonnull - public ModuleConfigs outputTranslationModuleConfig( - @Nullable final SAPDocumentTranslation outputTranslationModuleConfig) { - this.outputTranslationModuleConfig = outputTranslationModuleConfig; + public ModuleConfigs translation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; return this; } /** - * Get outputTranslationModuleConfig + * Get translation * - * @return outputTranslationModuleConfig The outputTranslationModuleConfig of this {@link - * ModuleConfigs} instance. + * @return translation The translation of this {@link ModuleConfigs} instance. */ @Nonnull - public SAPDocumentTranslation getOutputTranslationModuleConfig() { - return outputTranslationModuleConfig; + public TranslationModuleConfig getTranslation() { + return translation; } /** - * Set the outputTranslationModuleConfig of this {@link ModuleConfigs} instance. + * Set the translation of this {@link ModuleConfigs} instance. * - * @param outputTranslationModuleConfig The outputTranslationModuleConfig of this {@link - * ModuleConfigs} + * @param translation The translation of this {@link ModuleConfigs} */ - public void setOutputTranslationModuleConfig( - @Nullable final SAPDocumentTranslation outputTranslationModuleConfig) { - this.outputTranslationModuleConfig = outputTranslationModuleConfig; + public void setTranslation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; } /** @@ -334,18 +243,11 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (llmModuleConfig != null) declaredFields.put("llmModuleConfig", llmModuleConfig); - if (templatingModuleConfig != null) - declaredFields.put("templatingModuleConfig", templatingModuleConfig); - if (filteringModuleConfig != null) - declaredFields.put("filteringModuleConfig", filteringModuleConfig); - if (maskingModuleConfig != null) declaredFields.put("maskingModuleConfig", maskingModuleConfig); - if (groundingModuleConfig != null) - declaredFields.put("groundingModuleConfig", groundingModuleConfig); - if (inputTranslationModuleConfig != null) - declaredFields.put("inputTranslationModuleConfig", inputTranslationModuleConfig); - if (outputTranslationModuleConfig != null) - declaredFields.put("outputTranslationModuleConfig", outputTranslationModuleConfig); + if (promptTemplating != null) declaredFields.put("promptTemplating", promptTemplating); + if (filtering != null) declaredFields.put("filtering", filtering); + if (masking != null) declaredFields.put("masking", masking); + if (grounding != null) declaredFields.put("grounding", grounding); + if (translation != null) declaredFields.put("translation", translation); return declaredFields; } @@ -371,28 +273,17 @@ public boolean equals(@Nullable final java.lang.Object o) { } final ModuleConfigs moduleConfigs = (ModuleConfigs) o; return Objects.equals(this.cloudSdkCustomFields, moduleConfigs.cloudSdkCustomFields) - && Objects.equals(this.llmModuleConfig, moduleConfigs.llmModuleConfig) - && Objects.equals(this.templatingModuleConfig, moduleConfigs.templatingModuleConfig) - && Objects.equals(this.filteringModuleConfig, moduleConfigs.filteringModuleConfig) - && Objects.equals(this.maskingModuleConfig, moduleConfigs.maskingModuleConfig) - && Objects.equals(this.groundingModuleConfig, moduleConfigs.groundingModuleConfig) - && Objects.equals( - this.inputTranslationModuleConfig, moduleConfigs.inputTranslationModuleConfig) - && Objects.equals( - this.outputTranslationModuleConfig, moduleConfigs.outputTranslationModuleConfig); + && Objects.equals(this.promptTemplating, moduleConfigs.promptTemplating) + && Objects.equals(this.filtering, moduleConfigs.filtering) + && Objects.equals(this.masking, moduleConfigs.masking) + && Objects.equals(this.grounding, moduleConfigs.grounding) + && Objects.equals(this.translation, moduleConfigs.translation); } @Override public int hashCode() { return Objects.hash( - llmModuleConfig, - templatingModuleConfig, - filteringModuleConfig, - maskingModuleConfig, - groundingModuleConfig, - inputTranslationModuleConfig, - outputTranslationModuleConfig, - cloudSdkCustomFields); + promptTemplating, filtering, masking, grounding, translation, cloudSdkCustomFields); } @Override @@ -400,25 +291,11 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class ModuleConfigs {\n"); - sb.append(" llmModuleConfig: ").append(toIndentedString(llmModuleConfig)).append("\n"); - sb.append(" templatingModuleConfig: ") - .append(toIndentedString(templatingModuleConfig)) - .append("\n"); - sb.append(" filteringModuleConfig: ") - .append(toIndentedString(filteringModuleConfig)) - .append("\n"); - sb.append(" maskingModuleConfig: ") - .append(toIndentedString(maskingModuleConfig)) - .append("\n"); - sb.append(" groundingModuleConfig: ") - .append(toIndentedString(groundingModuleConfig)) - .append("\n"); - sb.append(" inputTranslationModuleConfig: ") - .append(toIndentedString(inputTranslationModuleConfig)) - .append("\n"); - sb.append(" outputTranslationModuleConfig: ") - .append(toIndentedString(outputTranslationModuleConfig)) - .append("\n"); + sb.append(" promptTemplating: ").append(toIndentedString(promptTemplating)).append("\n"); + sb.append(" filtering: ").append(toIndentedString(filtering)).append("\n"); + sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -441,33 +318,17 @@ private String toIndentedString(final java.lang.Object o) { * with all required arguments. */ public static Builder create() { - return (llmModuleConfig) -> - (templatingModuleConfig) -> - new ModuleConfigs() - .llmModuleConfig(llmModuleConfig) - .templatingModuleConfig(templatingModuleConfig); + return (promptTemplating) -> new ModuleConfigs().promptTemplating(promptTemplating); } /** Builder helper class. */ public interface Builder { /** - * Set the llmModuleConfig of this {@link ModuleConfigs} instance. - * - * @param llmModuleConfig The llmModuleConfig of this {@link ModuleConfigs} - * @return The ModuleConfigs builder. - */ - Builder1 llmModuleConfig(@Nonnull final LLMModuleConfig llmModuleConfig); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the templatingModuleConfig of this {@link ModuleConfigs} instance. + * Set the promptTemplating of this {@link ModuleConfigs} instance. * - * @param templatingModuleConfig The templatingModuleConfig of this {@link ModuleConfigs} + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} * @return The ModuleConfigs instance. */ - ModuleConfigs templatingModuleConfig( - @Nonnull final TemplatingModuleConfig templatingModuleConfig); + ModuleConfigs promptTemplating(@Nonnull final PromptTemplatingModuleConfig promptTemplating); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResults.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResults.java index 5db49a5cb..d5af953ad 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResults.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResults.java @@ -25,7 +25,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Results of each module. */ +/** Synchronous results of each module. */ // CHECKSTYLE:OFF public class ModuleResults // CHECKSTYLE:ON @@ -45,18 +45,18 @@ public class ModuleResults @JsonProperty("input_filtering") private GenericModuleResult inputFiltering; - @JsonProperty("llm") - private LLMModuleResult llm; - @JsonProperty("output_filtering") private GenericModuleResult outputFiltering; - @JsonProperty("output_unmasking") - private List outputUnmasking = new ArrayList<>(); - @JsonProperty("output_translation") private GenericModuleResult outputTranslation; + @JsonProperty("llm") + private LLMModuleResult llm; + + @JsonProperty("output_unmasking") + private List outputUnmasking = new ArrayList<>(); + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -234,145 +234,142 @@ public void setInputFiltering(@Nullable final GenericModuleResult inputFiltering } /** - * Set the llm of this {@link ModuleResults} instance and return the same instance. + * Set the outputFiltering of this {@link ModuleResults} instance and return the same instance. * - * @param llm The llm of this {@link ModuleResults} + * @param outputFiltering The outputFiltering of this {@link ModuleResults} * @return The same instance of this {@link ModuleResults} class */ @Nonnull - public ModuleResults llm(@Nullable final LLMModuleResult llm) { - this.llm = llm; + public ModuleResults outputFiltering(@Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; return this; } /** - * Get llm + * Get outputFiltering * - * @return llm The llm of this {@link ModuleResults} instance. + * @return outputFiltering The outputFiltering of this {@link ModuleResults} instance. */ @Nonnull - public LLMModuleResult getLlm() { - return llm; + public GenericModuleResult getOutputFiltering() { + return outputFiltering; } /** - * Set the llm of this {@link ModuleResults} instance. + * Set the outputFiltering of this {@link ModuleResults} instance. * - * @param llm The llm of this {@link ModuleResults} + * @param outputFiltering The outputFiltering of this {@link ModuleResults} */ - public void setLlm(@Nullable final LLMModuleResult llm) { - this.llm = llm; + public void setOutputFiltering(@Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; } /** - * Set the outputFiltering of this {@link ModuleResults} instance and return the same instance. + * Set the outputTranslation of this {@link ModuleResults} instance and return the same instance. * - * @param outputFiltering The outputFiltering of this {@link ModuleResults} + * @param outputTranslation The outputTranslation of this {@link ModuleResults} * @return The same instance of this {@link ModuleResults} class */ @Nonnull - public ModuleResults outputFiltering(@Nullable final GenericModuleResult outputFiltering) { - this.outputFiltering = outputFiltering; + public ModuleResults outputTranslation(@Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; return this; } /** - * Get outputFiltering + * Get outputTranslation * - * @return outputFiltering The outputFiltering of this {@link ModuleResults} instance. + * @return outputTranslation The outputTranslation of this {@link ModuleResults} instance. */ @Nonnull - public GenericModuleResult getOutputFiltering() { - return outputFiltering; + public GenericModuleResult getOutputTranslation() { + return outputTranslation; } /** - * Set the outputFiltering of this {@link ModuleResults} instance. + * Set the outputTranslation of this {@link ModuleResults} instance. * - * @param outputFiltering The outputFiltering of this {@link ModuleResults} + * @param outputTranslation The outputTranslation of this {@link ModuleResults} */ - public void setOutputFiltering(@Nullable final GenericModuleResult outputFiltering) { - this.outputFiltering = outputFiltering; + public void setOutputTranslation(@Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; } /** - * Set the outputUnmasking of this {@link ModuleResults} instance and return the same instance. + * Set the llm of this {@link ModuleResults} instance and return the same instance. * - * @param outputUnmasking The outputUnmasking of this {@link ModuleResults} + * @param llm The llm of this {@link ModuleResults} * @return The same instance of this {@link ModuleResults} class */ @Nonnull - public ModuleResults outputUnmasking( - @Nullable final List outputUnmasking) { - this.outputUnmasking = outputUnmasking; + public ModuleResults llm(@Nullable final LLMModuleResult llm) { + this.llm = llm; return this; } /** - * Add one outputUnmasking instance to this {@link ModuleResults}. + * Get llm * - * @param outputUnmaskingItem The outputUnmasking that should be added - * @return The same instance of type {@link ModuleResults} + * @return llm The llm of this {@link ModuleResults} instance. */ @Nonnull - public ModuleResults addOutputUnmaskingItem( - @Nonnull final ModuleResultsOutputUnmaskingInner outputUnmaskingItem) { - if (this.outputUnmasking == null) { - this.outputUnmasking = new ArrayList<>(); - } - this.outputUnmasking.add(outputUnmaskingItem); - return this; + public LLMModuleResult getLlm() { + return llm; } /** - * Get outputUnmasking + * Set the llm of this {@link ModuleResults} instance. * - * @return outputUnmasking The outputUnmasking of this {@link ModuleResults} instance. + * @param llm The llm of this {@link ModuleResults} */ - @Nonnull - public List getOutputUnmasking() { - return outputUnmasking; + public void setLlm(@Nullable final LLMModuleResult llm) { + this.llm = llm; } /** - * Set the outputUnmasking of this {@link ModuleResults} instance. + * Set the outputUnmasking of this {@link ModuleResults} instance and return the same instance. * * @param outputUnmasking The outputUnmasking of this {@link ModuleResults} + * @return The same instance of this {@link ModuleResults} class */ - public void setOutputUnmasking( - @Nullable final List outputUnmasking) { + @Nonnull + public ModuleResults outputUnmasking(@Nullable final List outputUnmasking) { this.outputUnmasking = outputUnmasking; + return this; } /** - * Set the outputTranslation of this {@link ModuleResults} instance and return the same instance. + * Add one outputUnmasking instance to this {@link ModuleResults}. * - * @param outputTranslation The outputTranslation of this {@link ModuleResults} - * @return The same instance of this {@link ModuleResults} class + * @param outputUnmaskingItem The outputUnmasking that should be added + * @return The same instance of type {@link ModuleResults} */ @Nonnull - public ModuleResults outputTranslation(@Nullable final GenericModuleResult outputTranslation) { - this.outputTranslation = outputTranslation; + public ModuleResults addOutputUnmaskingItem(@Nonnull final LLMChoice outputUnmaskingItem) { + if (this.outputUnmasking == null) { + this.outputUnmasking = new ArrayList<>(); + } + this.outputUnmasking.add(outputUnmaskingItem); return this; } /** - * Get outputTranslation + * Get outputUnmasking * - * @return outputTranslation The outputTranslation of this {@link ModuleResults} instance. + * @return outputUnmasking The outputUnmasking of this {@link ModuleResults} instance. */ @Nonnull - public GenericModuleResult getOutputTranslation() { - return outputTranslation; + public List getOutputUnmasking() { + return outputUnmasking; } /** - * Set the outputTranslation of this {@link ModuleResults} instance. + * Set the outputUnmasking of this {@link ModuleResults} instance. * - * @param outputTranslation The outputTranslation of this {@link ModuleResults} + * @param outputUnmasking The outputUnmasking of this {@link ModuleResults} */ - public void setOutputTranslation(@Nullable final GenericModuleResult outputTranslation) { - this.outputTranslation = outputTranslation; + public void setOutputUnmasking(@Nullable final List outputUnmasking) { + this.outputUnmasking = outputUnmasking; } /** @@ -418,10 +415,10 @@ public Map toMap() { if (inputTranslation != null) declaredFields.put("inputTranslation", inputTranslation); if (inputMasking != null) declaredFields.put("inputMasking", inputMasking); if (inputFiltering != null) declaredFields.put("inputFiltering", inputFiltering); - if (llm != null) declaredFields.put("llm", llm); if (outputFiltering != null) declaredFields.put("outputFiltering", outputFiltering); - if (outputUnmasking != null) declaredFields.put("outputUnmasking", outputUnmasking); if (outputTranslation != null) declaredFields.put("outputTranslation", outputTranslation); + if (llm != null) declaredFields.put("llm", llm); + if (outputUnmasking != null) declaredFields.put("outputUnmasking", outputUnmasking); return declaredFields; } @@ -452,10 +449,10 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.inputTranslation, moduleResults.inputTranslation) && Objects.equals(this.inputMasking, moduleResults.inputMasking) && Objects.equals(this.inputFiltering, moduleResults.inputFiltering) - && Objects.equals(this.llm, moduleResults.llm) && Objects.equals(this.outputFiltering, moduleResults.outputFiltering) - && Objects.equals(this.outputUnmasking, moduleResults.outputUnmasking) - && Objects.equals(this.outputTranslation, moduleResults.outputTranslation); + && Objects.equals(this.outputTranslation, moduleResults.outputTranslation) + && Objects.equals(this.llm, moduleResults.llm) + && Objects.equals(this.outputUnmasking, moduleResults.outputUnmasking); } @Override @@ -466,10 +463,10 @@ public int hashCode() { inputTranslation, inputMasking, inputFiltering, - llm, outputFiltering, - outputUnmasking, outputTranslation, + llm, + outputUnmasking, cloudSdkCustomFields); } @@ -483,10 +480,10 @@ public String toString() { sb.append(" inputTranslation: ").append(toIndentedString(inputTranslation)).append("\n"); sb.append(" inputMasking: ").append(toIndentedString(inputMasking)).append("\n"); sb.append(" inputFiltering: ").append(toIndentedString(inputFiltering)).append("\n"); - sb.append(" llm: ").append(toIndentedString(llm)).append("\n"); sb.append(" outputFiltering: ").append(toIndentedString(outputFiltering)).append("\n"); - sb.append(" outputUnmasking: ").append(toIndentedString(outputUnmasking)).append("\n"); sb.append(" outputTranslation: ").append(toIndentedString(outputTranslation)).append("\n"); + sb.append(" llm: ").append(toIndentedString(llm)).append("\n"); + sb.append(" outputUnmasking: ").append(toIndentedString(outputUnmasking)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsBase.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsBase.java new file mode 100644 index 000000000..5e8c22035 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsBase.java @@ -0,0 +1,421 @@ +/* + * 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.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; + +/** Results of each module of /embeddings endpoint(e.g. input masking). */ +// CHECKSTYLE:OFF +public class ModuleResultsBase +// CHECKSTYLE:ON +{ + @JsonProperty("grounding") + private GenericModuleResult grounding; + + @JsonProperty("templating") + private List templating = new ArrayList<>(); + + @JsonProperty("input_translation") + private GenericModuleResult inputTranslation; + + @JsonProperty("input_masking") + private GenericModuleResult inputMasking; + + @JsonProperty("input_filtering") + private GenericModuleResult inputFiltering; + + @JsonProperty("output_filtering") + private GenericModuleResult outputFiltering; + + @JsonProperty("output_translation") + private GenericModuleResult outputTranslation; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ModuleResultsBase. */ + protected ModuleResultsBase() {} + + /** + * Set the grounding of this {@link ModuleResultsBase} instance and return the same instance. + * + * @param grounding The grounding of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase grounding(@Nullable final GenericModuleResult grounding) { + this.grounding = grounding; + return this; + } + + /** + * Get grounding + * + * @return grounding The grounding of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getGrounding() { + return grounding; + } + + /** + * Set the grounding of this {@link ModuleResultsBase} instance. + * + * @param grounding The grounding of this {@link ModuleResultsBase} + */ + public void setGrounding(@Nullable final GenericModuleResult grounding) { + this.grounding = grounding; + } + + /** + * Set the templating of this {@link ModuleResultsBase} instance and return the same instance. + * + * @param templating The templating of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase templating(@Nullable final List templating) { + this.templating = templating; + return this; + } + + /** + * Add one templating instance to this {@link ModuleResultsBase}. + * + * @param templatingItem The templating that should be added + * @return The same instance of type {@link ModuleResultsBase} + */ + @Nonnull + public ModuleResultsBase addTemplatingItem(@Nonnull final ChatMessage templatingItem) { + if (this.templating == null) { + this.templating = new ArrayList<>(); + } + this.templating.add(templatingItem); + return this; + } + + /** + * Get templating + * + * @return templating The templating of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public List getTemplating() { + return templating; + } + + /** + * Set the templating of this {@link ModuleResultsBase} instance. + * + * @param templating The templating of this {@link ModuleResultsBase} + */ + public void setTemplating(@Nullable final List templating) { + this.templating = templating; + } + + /** + * Set the inputTranslation of this {@link ModuleResultsBase} instance and return the same + * instance. + * + * @param inputTranslation The inputTranslation of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase inputTranslation(@Nullable final GenericModuleResult inputTranslation) { + this.inputTranslation = inputTranslation; + return this; + } + + /** + * Get inputTranslation + * + * @return inputTranslation The inputTranslation of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getInputTranslation() { + return inputTranslation; + } + + /** + * Set the inputTranslation of this {@link ModuleResultsBase} instance. + * + * @param inputTranslation The inputTranslation of this {@link ModuleResultsBase} + */ + public void setInputTranslation(@Nullable final GenericModuleResult inputTranslation) { + this.inputTranslation = inputTranslation; + } + + /** + * Set the inputMasking of this {@link ModuleResultsBase} instance and return the same instance. + * + * @param inputMasking The inputMasking of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase inputMasking(@Nullable final GenericModuleResult inputMasking) { + this.inputMasking = inputMasking; + return this; + } + + /** + * Get inputMasking + * + * @return inputMasking The inputMasking of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getInputMasking() { + return inputMasking; + } + + /** + * Set the inputMasking of this {@link ModuleResultsBase} instance. + * + * @param inputMasking The inputMasking of this {@link ModuleResultsBase} + */ + public void setInputMasking(@Nullable final GenericModuleResult inputMasking) { + this.inputMasking = inputMasking; + } + + /** + * Set the inputFiltering of this {@link ModuleResultsBase} instance and return the same instance. + * + * @param inputFiltering The inputFiltering of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase inputFiltering(@Nullable final GenericModuleResult inputFiltering) { + this.inputFiltering = inputFiltering; + return this; + } + + /** + * Get inputFiltering + * + * @return inputFiltering The inputFiltering of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getInputFiltering() { + return inputFiltering; + } + + /** + * Set the inputFiltering of this {@link ModuleResultsBase} instance. + * + * @param inputFiltering The inputFiltering of this {@link ModuleResultsBase} + */ + public void setInputFiltering(@Nullable final GenericModuleResult inputFiltering) { + this.inputFiltering = inputFiltering; + } + + /** + * Set the outputFiltering of this {@link ModuleResultsBase} instance and return the same + * instance. + * + * @param outputFiltering The outputFiltering of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase outputFiltering(@Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; + return this; + } + + /** + * Get outputFiltering + * + * @return outputFiltering The outputFiltering of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getOutputFiltering() { + return outputFiltering; + } + + /** + * Set the outputFiltering of this {@link ModuleResultsBase} instance. + * + * @param outputFiltering The outputFiltering of this {@link ModuleResultsBase} + */ + public void setOutputFiltering(@Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; + } + + /** + * Set the outputTranslation of this {@link ModuleResultsBase} instance and return the same + * instance. + * + * @param outputTranslation The outputTranslation of this {@link ModuleResultsBase} + * @return The same instance of this {@link ModuleResultsBase} class + */ + @Nonnull + public ModuleResultsBase outputTranslation( + @Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; + return this; + } + + /** + * Get outputTranslation + * + * @return outputTranslation The outputTranslation of this {@link ModuleResultsBase} instance. + */ + @Nonnull + public GenericModuleResult getOutputTranslation() { + return outputTranslation; + } + + /** + * Set the outputTranslation of this {@link ModuleResultsBase} instance. + * + * @param outputTranslation The outputTranslation of this {@link ModuleResultsBase} + */ + public void setOutputTranslation(@Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; + } + + /** + * Get the names of the unrecognizable properties of the {@link ModuleResultsBase}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ModuleResultsBase} 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("ModuleResultsBase has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ModuleResultsBase} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (grounding != null) declaredFields.put("grounding", grounding); + if (templating != null) declaredFields.put("templating", templating); + if (inputTranslation != null) declaredFields.put("inputTranslation", inputTranslation); + if (inputMasking != null) declaredFields.put("inputMasking", inputMasking); + if (inputFiltering != null) declaredFields.put("inputFiltering", inputFiltering); + if (outputFiltering != null) declaredFields.put("outputFiltering", outputFiltering); + if (outputTranslation != null) declaredFields.put("outputTranslation", outputTranslation); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ModuleResultsBase} 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 ModuleResultsBase moduleResultsBase = (ModuleResultsBase) o; + return Objects.equals(this.cloudSdkCustomFields, moduleResultsBase.cloudSdkCustomFields) + && Objects.equals(this.grounding, moduleResultsBase.grounding) + && Objects.equals(this.templating, moduleResultsBase.templating) + && Objects.equals(this.inputTranslation, moduleResultsBase.inputTranslation) + && Objects.equals(this.inputMasking, moduleResultsBase.inputMasking) + && Objects.equals(this.inputFiltering, moduleResultsBase.inputFiltering) + && Objects.equals(this.outputFiltering, moduleResultsBase.outputFiltering) + && Objects.equals(this.outputTranslation, moduleResultsBase.outputTranslation); + } + + @Override + public int hashCode() { + return Objects.hash( + grounding, + templating, + inputTranslation, + inputMasking, + inputFiltering, + outputFiltering, + outputTranslation, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ModuleResultsBase {\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" templating: ").append(toIndentedString(templating)).append("\n"); + sb.append(" inputTranslation: ").append(toIndentedString(inputTranslation)).append("\n"); + sb.append(" inputMasking: ").append(toIndentedString(inputMasking)).append("\n"); + sb.append(" inputFiltering: ").append(toIndentedString(inputFiltering)).append("\n"); + sb.append(" outputFiltering: ").append(toIndentedString(outputFiltering)).append("\n"); + sb.append(" outputTranslation: ").append(toIndentedString(outputTranslation)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link ModuleResultsBase} instance. No arguments are required. */ + public static ModuleResultsBase create() { + return new ModuleResultsBase(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsStreaming.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsStreaming.java new file mode 100644 index 000000000..527b61a90 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsStreaming.java @@ -0,0 +1,522 @@ +/* + * 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.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; + +/** Streaming results of each module. */ +// CHECKSTYLE:OFF +public class ModuleResultsStreaming +// CHECKSTYLE:ON +{ + @JsonProperty("grounding") + private GenericModuleResult grounding; + + @JsonProperty("templating") + private List templating = new ArrayList<>(); + + @JsonProperty("input_translation") + private GenericModuleResult inputTranslation; + + @JsonProperty("input_masking") + private GenericModuleResult inputMasking; + + @JsonProperty("input_filtering") + private GenericModuleResult inputFiltering; + + @JsonProperty("output_filtering") + private GenericModuleResult outputFiltering; + + @JsonProperty("output_translation") + private GenericModuleResult outputTranslation; + + @JsonProperty("llm") + private LLMModuleResultStreaming llm; + + @JsonProperty("output_unmasking") + private List outputUnmasking = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ModuleResultsStreaming. */ + protected ModuleResultsStreaming() {} + + /** + * Set the grounding of this {@link ModuleResultsStreaming} instance and return the same instance. + * + * @param grounding The grounding of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming grounding(@Nullable final GenericModuleResult grounding) { + this.grounding = grounding; + return this; + } + + /** + * Get grounding + * + * @return grounding The grounding of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public GenericModuleResult getGrounding() { + return grounding; + } + + /** + * Set the grounding of this {@link ModuleResultsStreaming} instance. + * + * @param grounding The grounding of this {@link ModuleResultsStreaming} + */ + public void setGrounding(@Nullable final GenericModuleResult grounding) { + this.grounding = grounding; + } + + /** + * Set the templating of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param templating The templating of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming templating(@Nullable final List templating) { + this.templating = templating; + return this; + } + + /** + * Add one templating instance to this {@link ModuleResultsStreaming}. + * + * @param templatingItem The templating that should be added + * @return The same instance of type {@link ModuleResultsStreaming} + */ + @Nonnull + public ModuleResultsStreaming addTemplatingItem(@Nonnull final ChatMessage templatingItem) { + if (this.templating == null) { + this.templating = new ArrayList<>(); + } + this.templating.add(templatingItem); + return this; + } + + /** + * Get templating + * + * @return templating The templating of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public List getTemplating() { + return templating; + } + + /** + * Set the templating of this {@link ModuleResultsStreaming} instance. + * + * @param templating The templating of this {@link ModuleResultsStreaming} + */ + public void setTemplating(@Nullable final List templating) { + this.templating = templating; + } + + /** + * Set the inputTranslation of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param inputTranslation The inputTranslation of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming inputTranslation( + @Nullable final GenericModuleResult inputTranslation) { + this.inputTranslation = inputTranslation; + return this; + } + + /** + * Get inputTranslation + * + * @return inputTranslation The inputTranslation of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public GenericModuleResult getInputTranslation() { + return inputTranslation; + } + + /** + * Set the inputTranslation of this {@link ModuleResultsStreaming} instance. + * + * @param inputTranslation The inputTranslation of this {@link ModuleResultsStreaming} + */ + public void setInputTranslation(@Nullable final GenericModuleResult inputTranslation) { + this.inputTranslation = inputTranslation; + } + + /** + * Set the inputMasking of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param inputMasking The inputMasking of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming inputMasking(@Nullable final GenericModuleResult inputMasking) { + this.inputMasking = inputMasking; + return this; + } + + /** + * Get inputMasking + * + * @return inputMasking The inputMasking of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public GenericModuleResult getInputMasking() { + return inputMasking; + } + + /** + * Set the inputMasking of this {@link ModuleResultsStreaming} instance. + * + * @param inputMasking The inputMasking of this {@link ModuleResultsStreaming} + */ + public void setInputMasking(@Nullable final GenericModuleResult inputMasking) { + this.inputMasking = inputMasking; + } + + /** + * Set the inputFiltering of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param inputFiltering The inputFiltering of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming inputFiltering(@Nullable final GenericModuleResult inputFiltering) { + this.inputFiltering = inputFiltering; + return this; + } + + /** + * Get inputFiltering + * + * @return inputFiltering The inputFiltering of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public GenericModuleResult getInputFiltering() { + return inputFiltering; + } + + /** + * Set the inputFiltering of this {@link ModuleResultsStreaming} instance. + * + * @param inputFiltering The inputFiltering of this {@link ModuleResultsStreaming} + */ + public void setInputFiltering(@Nullable final GenericModuleResult inputFiltering) { + this.inputFiltering = inputFiltering; + } + + /** + * Set the outputFiltering of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param outputFiltering The outputFiltering of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming outputFiltering( + @Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; + return this; + } + + /** + * Get outputFiltering + * + * @return outputFiltering The outputFiltering of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public GenericModuleResult getOutputFiltering() { + return outputFiltering; + } + + /** + * Set the outputFiltering of this {@link ModuleResultsStreaming} instance. + * + * @param outputFiltering The outputFiltering of this {@link ModuleResultsStreaming} + */ + public void setOutputFiltering(@Nullable final GenericModuleResult outputFiltering) { + this.outputFiltering = outputFiltering; + } + + /** + * Set the outputTranslation of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param outputTranslation The outputTranslation of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming outputTranslation( + @Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; + return this; + } + + /** + * Get outputTranslation + * + * @return outputTranslation The outputTranslation of this {@link ModuleResultsStreaming} + * instance. + */ + @Nonnull + public GenericModuleResult getOutputTranslation() { + return outputTranslation; + } + + /** + * Set the outputTranslation of this {@link ModuleResultsStreaming} instance. + * + * @param outputTranslation The outputTranslation of this {@link ModuleResultsStreaming} + */ + public void setOutputTranslation(@Nullable final GenericModuleResult outputTranslation) { + this.outputTranslation = outputTranslation; + } + + /** + * Set the llm of this {@link ModuleResultsStreaming} instance and return the same instance. + * + * @param llm The llm of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming llm(@Nullable final LLMModuleResultStreaming llm) { + this.llm = llm; + return this; + } + + /** + * Get llm + * + * @return llm The llm of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public LLMModuleResultStreaming getLlm() { + return llm; + } + + /** + * Set the llm of this {@link ModuleResultsStreaming} instance. + * + * @param llm The llm of this {@link ModuleResultsStreaming} + */ + public void setLlm(@Nullable final LLMModuleResultStreaming llm) { + this.llm = llm; + } + + /** + * Set the outputUnmasking of this {@link ModuleResultsStreaming} instance and return the same + * instance. + * + * @param outputUnmasking The outputUnmasking of this {@link ModuleResultsStreaming} + * @return The same instance of this {@link ModuleResultsStreaming} class + */ + @Nonnull + public ModuleResultsStreaming outputUnmasking( + @Nullable final List outputUnmasking) { + this.outputUnmasking = outputUnmasking; + return this; + } + + /** + * Add one outputUnmasking instance to this {@link ModuleResultsStreaming}. + * + * @param outputUnmaskingItem The outputUnmasking that should be added + * @return The same instance of type {@link ModuleResultsStreaming} + */ + @Nonnull + public ModuleResultsStreaming addOutputUnmaskingItem( + @Nonnull final LLMChoiceStreaming outputUnmaskingItem) { + if (this.outputUnmasking == null) { + this.outputUnmasking = new ArrayList<>(); + } + this.outputUnmasking.add(outputUnmaskingItem); + return this; + } + + /** + * Get outputUnmasking + * + * @return outputUnmasking The outputUnmasking of this {@link ModuleResultsStreaming} instance. + */ + @Nonnull + public List getOutputUnmasking() { + return outputUnmasking; + } + + /** + * Set the outputUnmasking of this {@link ModuleResultsStreaming} instance. + * + * @param outputUnmasking The outputUnmasking of this {@link ModuleResultsStreaming} + */ + public void setOutputUnmasking(@Nullable final List outputUnmasking) { + this.outputUnmasking = outputUnmasking; + } + + /** + * Get the names of the unrecognizable properties of the {@link ModuleResultsStreaming}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ModuleResultsStreaming} 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( + "ModuleResultsStreaming has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ModuleResultsStreaming} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (grounding != null) declaredFields.put("grounding", grounding); + if (templating != null) declaredFields.put("templating", templating); + if (inputTranslation != null) declaredFields.put("inputTranslation", inputTranslation); + if (inputMasking != null) declaredFields.put("inputMasking", inputMasking); + if (inputFiltering != null) declaredFields.put("inputFiltering", inputFiltering); + if (outputFiltering != null) declaredFields.put("outputFiltering", outputFiltering); + if (outputTranslation != null) declaredFields.put("outputTranslation", outputTranslation); + if (llm != null) declaredFields.put("llm", llm); + if (outputUnmasking != null) declaredFields.put("outputUnmasking", outputUnmasking); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ModuleResultsStreaming} 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 ModuleResultsStreaming moduleResultsStreaming = (ModuleResultsStreaming) o; + return Objects.equals(this.cloudSdkCustomFields, moduleResultsStreaming.cloudSdkCustomFields) + && Objects.equals(this.grounding, moduleResultsStreaming.grounding) + && Objects.equals(this.templating, moduleResultsStreaming.templating) + && Objects.equals(this.inputTranslation, moduleResultsStreaming.inputTranslation) + && Objects.equals(this.inputMasking, moduleResultsStreaming.inputMasking) + && Objects.equals(this.inputFiltering, moduleResultsStreaming.inputFiltering) + && Objects.equals(this.outputFiltering, moduleResultsStreaming.outputFiltering) + && Objects.equals(this.outputTranslation, moduleResultsStreaming.outputTranslation) + && Objects.equals(this.llm, moduleResultsStreaming.llm) + && Objects.equals(this.outputUnmasking, moduleResultsStreaming.outputUnmasking); + } + + @Override + public int hashCode() { + return Objects.hash( + grounding, + templating, + inputTranslation, + inputMasking, + inputFiltering, + outputFiltering, + outputTranslation, + llm, + outputUnmasking, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ModuleResultsStreaming {\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" templating: ").append(toIndentedString(templating)).append("\n"); + sb.append(" inputTranslation: ").append(toIndentedString(inputTranslation)).append("\n"); + sb.append(" inputMasking: ").append(toIndentedString(inputMasking)).append("\n"); + sb.append(" inputFiltering: ").append(toIndentedString(inputFiltering)).append("\n"); + sb.append(" outputFiltering: ").append(toIndentedString(outputFiltering)).append("\n"); + sb.append(" outputTranslation: ").append(toIndentedString(outputTranslation)).append("\n"); + sb.append(" llm: ").append(toIndentedString(llm)).append("\n"); + sb.append(" outputUnmasking: ").append(toIndentedString(outputUnmasking)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link ModuleResultsStreaming} instance. No arguments are required. */ + public static ModuleResultsStreaming create() { + return new ModuleResultsStreaming(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OrchestrationConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OrchestrationConfig.java index 9cfde53b3..7c5fc2721 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OrchestrationConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OrchestrationConfig.java @@ -28,14 +28,11 @@ public class OrchestrationConfig // CHECKSTYLE:ON { - @JsonProperty("module_configurations") - private ModuleConfigs moduleConfigurations; + @JsonProperty("modules") + private ModuleConfigs modules; @JsonProperty("stream") - private Boolean stream = false; - - @JsonProperty("stream_options") - private GlobalStreamOptions streamOptions; + private GlobalStreamOptions stream; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -44,102 +41,67 @@ public class OrchestrationConfig protected OrchestrationConfig() {} /** - * Set the moduleConfigurations of this {@link OrchestrationConfig} instance and return the same - * instance. + * Set the modules of this {@link OrchestrationConfig} instance and return the same instance. * - * @param moduleConfigurations The moduleConfigurations of this {@link OrchestrationConfig} + * @param modules The modules of this {@link OrchestrationConfig} * @return The same instance of this {@link OrchestrationConfig} class */ @Nonnull - public OrchestrationConfig moduleConfigurations( - @Nonnull final ModuleConfigs moduleConfigurations) { - this.moduleConfigurations = moduleConfigurations; + public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) { + this.modules = modules; return this; } /** - * Get moduleConfigurations + * Get modules * - * @return moduleConfigurations The moduleConfigurations of this {@link OrchestrationConfig} - * instance. + * @return modules The modules of this {@link OrchestrationConfig} instance. */ @Nonnull - public ModuleConfigs getModuleConfigurations() { - return moduleConfigurations; + public ModuleConfigs getModules() { + return modules; } /** - * Set the moduleConfigurations of this {@link OrchestrationConfig} instance. + * Set the modules of this {@link OrchestrationConfig} instance. * - * @param moduleConfigurations The moduleConfigurations of this {@link OrchestrationConfig} + * @param modules The modules of this {@link OrchestrationConfig} */ - public void setModuleConfigurations(@Nonnull final ModuleConfigs moduleConfigurations) { - this.moduleConfigurations = moduleConfigurations; + public void setModules(@Nonnull final ModuleConfigs modules) { + this.modules = modules; } /** * Set the stream of this {@link OrchestrationConfig} instance and return the same instance. * - * @param stream If true, the response will be streamed back to the client + * @param stream The stream of this {@link OrchestrationConfig} * @return The same instance of this {@link OrchestrationConfig} class */ @Nonnull - public OrchestrationConfig stream(@Nullable final Boolean stream) { + public OrchestrationConfig stream(@Nullable final GlobalStreamOptions stream) { this.stream = stream; return this; } /** - * If true, the response will be streamed back to the client + * Get stream * * @return stream The stream of this {@link OrchestrationConfig} instance. */ @Nonnull - public Boolean isStream() { + public GlobalStreamOptions getStream() { return stream; } /** * Set the stream of this {@link OrchestrationConfig} instance. * - * @param stream If true, the response will be streamed back to the client + * @param stream The stream of this {@link OrchestrationConfig} */ - public void setStream(@Nullable final Boolean stream) { + public void setStream(@Nullable final GlobalStreamOptions stream) { this.stream = stream; } - /** - * Set the streamOptions of this {@link OrchestrationConfig} instance and return the same - * instance. - * - * @param streamOptions The streamOptions of this {@link OrchestrationConfig} - * @return The same instance of this {@link OrchestrationConfig} class - */ - @Nonnull - public OrchestrationConfig streamOptions(@Nullable final GlobalStreamOptions streamOptions) { - this.streamOptions = streamOptions; - return this; - } - - /** - * Get streamOptions - * - * @return streamOptions The streamOptions of this {@link OrchestrationConfig} instance. - */ - @Nonnull - public GlobalStreamOptions getStreamOptions() { - return streamOptions; - } - - /** - * Set the streamOptions of this {@link OrchestrationConfig} instance. - * - * @param streamOptions The streamOptions of this {@link OrchestrationConfig} - */ - public void setStreamOptions(@Nullable final GlobalStreamOptions streamOptions) { - this.streamOptions = streamOptions; - } - /** * Get the names of the unrecognizable properties of the {@link OrchestrationConfig}. * @@ -179,10 +141,8 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (moduleConfigurations != null) - declaredFields.put("moduleConfigurations", moduleConfigurations); + if (modules != null) declaredFields.put("modules", modules); if (stream != null) declaredFields.put("stream", stream); - if (streamOptions != null) declaredFields.put("streamOptions", streamOptions); return declaredFields; } @@ -208,14 +168,13 @@ public boolean equals(@Nullable final java.lang.Object o) { } final OrchestrationConfig orchestrationConfig = (OrchestrationConfig) o; return Objects.equals(this.cloudSdkCustomFields, orchestrationConfig.cloudSdkCustomFields) - && Objects.equals(this.moduleConfigurations, orchestrationConfig.moduleConfigurations) - && Objects.equals(this.stream, orchestrationConfig.stream) - && Objects.equals(this.streamOptions, orchestrationConfig.streamOptions); + && Objects.equals(this.modules, orchestrationConfig.modules) + && Objects.equals(this.stream, orchestrationConfig.stream); } @Override public int hashCode() { - return Objects.hash(moduleConfigurations, stream, streamOptions, cloudSdkCustomFields); + return Objects.hash(modules, stream, cloudSdkCustomFields); } @Override @@ -223,11 +182,8 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class OrchestrationConfig {\n"); - sb.append(" moduleConfigurations: ") - .append(toIndentedString(moduleConfigurations)) - .append("\n"); + sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); sb.append(" stream: ").append(toIndentedString(stream)).append("\n"); - sb.append(" streamOptions: ").append(toIndentedString(streamOptions)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -250,18 +206,17 @@ private String toIndentedString(final java.lang.Object o) { * instance with all required arguments. */ public static Builder create() { - return (moduleConfigurations) -> - new OrchestrationConfig().moduleConfigurations(moduleConfigurations); + return (modules) -> new OrchestrationConfig().modules(modules); } /** Builder helper class. */ public interface Builder { /** - * Set the moduleConfigurations of this {@link OrchestrationConfig} instance. + * Set the modules of this {@link OrchestrationConfig} instance. * - * @param moduleConfigurations The moduleConfigurations of this {@link OrchestrationConfig} + * @param modules The modules of this {@link OrchestrationConfig} * @return The OrchestrationConfig instance. */ - OrchestrationConfig moduleConfigurations(@Nonnull final ModuleConfigs moduleConfigurations); + OrchestrationConfig modules(@Nonnull final ModuleConfigs modules); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsOutputUnmaskingInner.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilterConfig.java similarity index 82% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsOutputUnmaskingInner.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilterConfig.java index 7088e9392..a8565a3f5 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ModuleResultsOutputUnmaskingInner.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilterConfig.java @@ -14,10 +14,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -/** ModuleResultsOutputUnmaskingInner */ +/** OutputFilterConfig */ @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) @JsonSubTypes({ - @JsonSubTypes.Type(value = LLMChoice.class), - @JsonSubTypes.Type(value = LLMChoiceStreaming.class), + @JsonSubTypes.Type(value = AzureContentSafetyOutputFilterConfig.class), + @JsonSubTypes.Type(value = LlamaGuard38bFilterConfig.class), }) -public interface ModuleResultsOutputUnmaskingInner {} +public interface OutputFilterConfig {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilteringConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilteringConfig.java index cdf477275..4e4d6a169 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilteringConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/OutputFilteringConfig.java @@ -32,7 +32,7 @@ public class OutputFilteringConfig // CHECKSTYLE:ON { @JsonProperty("filters") - private List filters = new ArrayList<>(); + private List filters = new ArrayList<>(); @JsonProperty("stream_options") private FilteringStreamOptions streamOptions; @@ -47,11 +47,11 @@ protected OutputFilteringConfig() {} * Set the filters of this {@link OutputFilteringConfig} instance and return the same instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (output filtering). * @return The same instance of this {@link OutputFilteringConfig} class */ @Nonnull - public OutputFilteringConfig filters(@Nonnull final List filters) { + public OutputFilteringConfig filters(@Nonnull final List filters) { this.filters = filters; return this; } @@ -63,7 +63,7 @@ public OutputFilteringConfig filters(@Nonnull final List filters) * @return The same instance of type {@link OutputFilteringConfig} */ @Nonnull - public OutputFilteringConfig addFiltersItem(@Nonnull final FilterConfig filtersItem) { + public OutputFilteringConfig addFiltersItem(@Nonnull final OutputFilterConfig filtersItem) { if (this.filters == null) { this.filters = new ArrayList<>(); } @@ -73,12 +73,12 @@ public OutputFilteringConfig addFiltersItem(@Nonnull final FilterConfig filtersI /** * Configuration for content filtering services that should be used for the given filtering step - * (input filtering or output filtering). + * (output filtering). * * @return filters The filters of this {@link OutputFilteringConfig} instance. */ @Nonnull - public List getFilters() { + public List getFilters() { return filters; } @@ -86,9 +86,9 @@ public List getFilters() { * Set the filters of this {@link OutputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (output filtering). */ - public void setFilters(@Nonnull final List filters) { + public void setFilters(@Nonnull final List filters) { this.filters = filters; } @@ -237,19 +237,19 @@ public interface Builder { * Set the filters of this {@link OutputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (output filtering). * @return The OutputFilteringConfig instance. */ - OutputFilteringConfig filters(@Nonnull final List filters); + OutputFilteringConfig filters(@Nonnull final List filters); /** * Set the filters of this {@link OutputFilteringConfig} instance. * * @param filters Configuration for content filtering services that should be used for the given - * filtering step (input filtering or output filtering). + * filtering step (output filtering). * @return The OutputFilteringConfig instance. */ - default OutputFilteringConfig filters(@Nonnull final FilterConfig... filters) { + default OutputFilteringConfig filters(@Nonnull final OutputFilterConfig... filters) { return filters(Arrays.asList(filters)); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfig.java new file mode 100644 index 000000000..98d06ea1d --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfig.java @@ -0,0 +1,240 @@ +/* + * 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.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; + +/** PromptTemplatingModuleConfig */ +// CHECKSTYLE:OFF +public class PromptTemplatingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("prompt") + private PromptTemplatingModuleConfigPrompt prompt; + + @JsonProperty("model") + private LLMModelDetails model; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PromptTemplatingModuleConfig. */ + protected PromptTemplatingModuleConfig() {} + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig prompt( + @Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get prompt + * + * @return prompt The prompt of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public PromptTemplatingModuleConfigPrompt getPrompt() { + return prompt; + } + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + */ + public void setPrompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig model(@Nonnull final LLMModelDetails model) { + this.model = model; + return this; + } + + /** + * Get model + * + * @return model The model of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public LLMModelDetails getModel() { + return model; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + */ + public void setModel(@Nonnull final LLMModelDetails model) { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplatingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplatingModuleConfig} + * 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( + "PromptTemplatingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplatingModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (prompt != null) declaredFields.put("prompt", prompt); + if (model != null) declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplatingModuleConfig} 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 PromptTemplatingModuleConfig promptTemplatingModuleConfig = + (PromptTemplatingModuleConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, promptTemplatingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.prompt, promptTemplatingModuleConfig.prompt) + && Objects.equals(this.model, promptTemplatingModuleConfig.model); + } + + @Override + public int hashCode() { + return Objects.hash(prompt, model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplatingModuleConfig {\n"); + sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * PromptTemplatingModuleConfig} instance with all required arguments. + */ + public static Builder create() { + return (prompt) -> (model) -> new PromptTemplatingModuleConfig().prompt(prompt).model(model); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + * @return The PromptTemplatingModuleConfig builder. + */ + Builder1 prompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + * @return The PromptTemplatingModuleConfig instance. + */ + PromptTemplatingModuleConfig model(@Nonnull final LLMModelDetails model); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplatingModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfigPrompt.java similarity index 84% rename from orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplatingModuleConfig.java rename to orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfigPrompt.java index a2f65146b..ef1267eab 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplatingModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/PromptTemplatingModuleConfigPrompt.java @@ -14,10 +14,13 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -/** TemplatingModuleConfig */ +/** + * The prompt template to be used. Can be either a user defined template or a reference to a + * template in the prompt registry. + */ @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) @JsonSubTypes({ @JsonSubTypes.Type(value = Template.class), @JsonSubTypes.Type(value = TemplateRef.class), }) -public interface TemplatingModuleConfig {} +public interface PromptTemplatingModuleConfigPrompt {} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ResponseChatMessage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ResponseChatMessage.java index 6cba8abdf..5957ef331 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ResponseChatMessage.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ResponseChatMessage.java @@ -111,7 +111,7 @@ protected ResponseChatMessage() {} * @return The same instance of this {@link ResponseChatMessage} class */ @Nonnull - public ResponseChatMessage role(@Nullable final RoleEnum role) { + public ResponseChatMessage role(@Nonnull final RoleEnum role) { this.role = role; return this; } @@ -131,7 +131,7 @@ public RoleEnum getRole() { * * @param role The role of this {@link ResponseChatMessage} */ - public void setRole(@Nullable final RoleEnum role) { + public void setRole(@Nonnull final RoleEnum role) { this.role = role; } @@ -348,8 +348,22 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link ResponseChatMessage} instance. No arguments are required. */ - public static ResponseChatMessage create() { - return new ResponseChatMessage(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link ResponseChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (role) -> new ResponseChatMessage().role(role); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the role of this {@link ResponseChatMessage} instance. + * + * @param role The role of this {@link ResponseChatMessage} + * @return The ResponseChatMessage instance. + */ + ResponseChatMessage role(@Nonnull final RoleEnum role); } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Template.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Template.java index f7b38d0d7..5dce760e1 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Template.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Template.java @@ -29,7 +29,7 @@ /** Template */ // CHECKSTYLE:OFF -public class Template implements TemplatingModuleConfig +public class Template implements PromptTemplatingModuleConfigPrompt // CHECKSTYLE:ON { @JsonProperty("template") diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateRef.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateRef.java index 11cad22f0..4d83583b0 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateRef.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateRef.java @@ -25,7 +25,7 @@ /** TemplateRef */ // CHECKSTYLE:OFF -public class TemplateRef implements TemplatingModuleConfig +public class TemplateRef implements PromptTemplatingModuleConfigPrompt // CHECKSTYLE:ON { @JsonProperty("template_ref") diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateResponseFormat.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateResponseFormat.java index 98094ef78..e4951acb2 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateResponseFormat.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TemplateResponseFormat.java @@ -16,8 +16,7 @@ /** * Response format that the model output should adhere to. This is the same as the OpenAI - * definition. Compatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer - * than gpt-3.5-turbo-1106. + * definition. */ @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) @JsonSubTypes({ diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TranslationModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TranslationModuleConfig.java new file mode 100644 index 000000000..22e82e088 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TranslationModuleConfig.java @@ -0,0 +1,208 @@ +/* + * 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.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Configuration for translation module */ +// CHECKSTYLE:OFF +public class TranslationModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("input") + private SAPDocumentTranslation input; + + @JsonProperty("output") + private SAPDocumentTranslation output; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TranslationModuleConfig. */ + protected TranslationModuleConfig() {} + + /** + * Set the input of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param input The input of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig input(@Nullable final SAPDocumentTranslation input) { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslation getInput() { + return input; + } + + /** + * Set the input of this {@link TranslationModuleConfig} instance. + * + * @param input The input of this {@link TranslationModuleConfig} + */ + public void setInput(@Nullable final SAPDocumentTranslation input) { + this.input = input; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param output The output of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig output(@Nullable final SAPDocumentTranslation output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output The output of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslation getOutput() { + return output; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance. + * + * @param output The output of this {@link TranslationModuleConfig} + */ + public void setOutput(@Nullable final SAPDocumentTranslation output) { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link TranslationModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TranslationModuleConfig} 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( + "TranslationModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TranslationModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TranslationModuleConfig} 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 TranslationModuleConfig translationModuleConfig = (TranslationModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, translationModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.input, translationModuleConfig.input) + && Objects.equals(this.output, translationModuleConfig.output); + } + + @Override + public int hashCode() { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TranslationModuleConfig {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link TranslationModuleConfig} instance. No arguments are required. */ + public static TranslationModuleConfig create() { + return new TranslationModuleConfig(); + } +} diff --git a/orchestration/src/main/resources/spec/orchestration.yaml b/orchestration/src/main/resources/spec/orchestration.yaml index 893f7a40f..a69688cea 100644 --- a/orchestration/src/main/resources/spec/orchestration.yaml +++ b/orchestration/src/main/resources/spec/orchestration.yaml @@ -1,5 +1,9 @@ openapi: 3.0.0 +servers: + - url: "/v2" + description: Internal Orchestration Service API + x-sap-shortText: "Orchestration provides common capabilities for business AI scenarios, such as content filtering, data masking, and grounding" info: @@ -9,12 +13,11 @@ info: name: SAP AI Core version: 0.0.1 -servers: - - url: "/v1" - tags: - name: OrchestrationCompletion description: Run an orchestrated completion inference request + - name: OrchestrationEmbeddings + description: Make an embeddings request paths: /completion: @@ -23,7 +26,7 @@ paths: - OrchestrationCompletion summary: orchestrated completion inference description: Run an orchestrated completion inference request - operationId: orchestration.v1.endpoints.create + operationId: orchestration.v2.endpoints.create requestBody: required: true content: @@ -37,22 +40,53 @@ paths: application/json: schema: $ref: "#/components/schemas/CompletionPostResponse" + text/event-stream: + schema: + $ref: "#/components/schemas/CompletionPostResponseStreaming" + "400": + $ref: "#/components/responses/BadRequest" + default: + $ref: "#/components/responses/CommonError" + + /embeddings: + post: + tags: + - OrchestrationEmbeddings + summary: orchestrated embeddings inference + description: > + Generate embeddings for input strings. + operationId: orchestration.v2.endpoints.create_embeddings + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EmbeddingsPostRequest" + responses: + "200": + description: "Successful response" + content: + application/json: + schema: + $ref: "#/components/schemas/EmbeddingsPostResponse" "400": $ref: "#/components/responses/BadRequest" default: $ref: "#/components/responses/CommonError" + + components: schemas: CompletionPostRequest: type: object required: - - orchestration_config + - config additionalProperties: false properties: - orchestration_config: + config: $ref: "#/components/schemas/OrchestrationConfig" - input_params: + placeholder_values: type: object example: groundingInput: "What is SAP Joule?" @@ -64,19 +98,190 @@ components: - $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 + additionalProperties: false + required: + - input + - config + properties: + config: + $ref: "#/components/schemas/EmbeddingsOrchestrationConfig" + input: + $ref: "#/components/schemas/EmbeddingsInput" + EmbeddingsOrchestrationConfig: + type: object + required: + - modules + additionalProperties: false + properties: + modules: + $ref: "#/components/schemas/EmbeddingsModuleConfigs" + EmbeddingsInput: + type: object + required: + - text + additionalProperties: false + properties: + text: + $ref: "#/components/schemas/EmbeddingsInputText" + type: + type: string + enum: ["text", "document", "query"] + EmbeddingsInputText: + oneOf: + - type: string + description: The string that will be turned into an embedding. + example: Hello World! + - type: array + description: The array of strings that will be turned into an embedding. + minItems: 1 + items: + type: string + minLength: 1 + example: ['Hello', 'World', '!'] + description: Text input for which embeddings need to be generated + example: ["This is an input string.", "This is another input string."] + EmbeddingsModuleConfigs: + type: object + required: + - embeddings + additionalProperties: false + properties: + embeddings: + $ref: "#/components/schemas/EmbeddingsModelConfig" + masking: + $ref: "#/components/schemas/MaskingModuleConfig" + EmbeddingsModelConfig: + type: object + required: + - model + additionalProperties: false + properties: + model: + $ref: "#/components/schemas/EmbeddingsModelDetails" + EmbeddingsModelDetails: + type: object + required: + - name + additionalProperties: false + properties: + name: + type: string + version: + type: string + default: "latest" + params: + $ref: "#/components/schemas/EmbeddingsModelParams" + EmbeddingsModelParams: + type: object + description: Additional parameters for generating input's embeddings. Default values are used for mandatory parameters. + additionalProperties: true + properties: + dimensions: + type: integer + description: > + The number of dimensions the resulting output embeddings should have. + encoding_format: + type: string + enum: [float, base64, binary] + description: > + OpenAI's spec allows for 'float' and 'base64' encoding formats. + normalize: + type: boolean + + EmbeddingsPostResponse: + type: object + additionalProperties: false + required: + - request_id + properties: + request_id: + type: string + intermediate_results: + $ref: "#/components/schemas/ModuleResultsBase" + final_result: + $ref: "#/components/schemas/EmbeddingsResponse" + EmbeddingsResponse: + type: object + description: The response from request to embedding model following OpenAI specification. + additionalProperties: false + required: + - object + - data + - model + - usage + properties: + object: + type: string + description: The object type, which is always "list". + enum: + - list + data: + type: array + description: The list of embeddings generated by the model. + items: + $ref: "#/components/schemas/EmbeddingResult" + model: + type: string + description: The name of the model used to generate the embedding. + usage: + $ref: "#/components/schemas/EmbeddingsUsage" + EmbeddingsUsage: + type: object + description: The usage information for the request. + additionalProperties: false + required: + - prompt_tokens + - total_tokens + properties: + prompt_tokens: + type: integer + description: The number of tokens used by the prompt. + total_tokens: + type: integer + description: The total number of tokens used by the request. + EmbeddingResult: + type: object + description: | + Represents an embedding vector returned by embedding endpoint. + additionalProperties: false + required: + - object + - embedding + - index + properties: + object: + type: string + description: The object type, which is always "embedding". + enum: + - embedding + embedding: + $ref: "#/components/schemas/Embedding" + index: + type: integer + description: The index of the embedding in the list of embeddings. + Embedding: + oneOf: + - type: array + items: + type: number + description: "An array of numbers representing the embedding." + - type: string + description: "A single base64 string representing the embedding." + + # Chat Completion Schemas ChatMessages: type: array items: $ref: "#/components/schemas/ChatMessage" - TemplatingChatMessage: type: array minItems: 1 items: $ref: "#/components/schemas/ChatMessage" - ChatMessage: - type: object oneOf: - $ref: "#/components/schemas/SystemChatMessage" - $ref: "#/components/schemas/UserChatMessage" @@ -131,7 +336,7 @@ components: - user required: - content - - role + - role UserChatMessageContent: oneOf: - type: string @@ -195,13 +400,17 @@ components: required: - 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. + # Functionally achieves the same result as both patterns permit responses without textual content + # OpenAI via null values, ours via field omission. ResponseChatMessage: type: object additionalProperties: false properties: role: type: string - enum: + enum: - assistant content: type: string @@ -209,6 +418,8 @@ components: type: string tool_calls: $ref: "#/components/schemas/MessageToolCalls" + required: + - role # below tool message definitions are copied from openai spec: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L11007 # only renaming them to differentiate them from the openai python classes MessageToolCalls: @@ -261,7 +472,6 @@ components: enum: ["text"] text: type: string - ChatDelta: type: object required: @@ -309,25 +519,23 @@ components: calling your function. required: - index - CompletionPostResponse: type: object required: - request_id - - orchestration_result - - module_results + - final_result + - intermediate_results properties: request_id: description: ID of the request type: string example: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" - module_results: + intermediate_results: $ref: "#/components/schemas/ModuleResults" - orchestration_result: + final_result: $ref: "#/components/schemas/LLMModuleResult" CompletionPostResponseStreaming: - # TODO: This seems unused in the spec, but used in our endpoints.py, related to Github #778 type: object required: - request_id @@ -335,50 +543,40 @@ components: request_id: description: ID of the request type: string - module_results: - $ref: "#/components/schemas/ModuleResults" - orchestration_result: + intermediate_results: + $ref: "#/components/schemas/ModuleResultsStreaming" + final_result: $ref: "#/components/schemas/LLMModuleResultStreaming" - OrchestrationConfig: type: object required: - - module_configurations + - modules additionalProperties: false properties: - module_configurations: + modules: $ref: "#/components/schemas/ModuleConfigs" stream: - type: boolean - description: If true, the response will be streamed back to the client - default: false - stream_options: $ref: "#/components/schemas/GlobalStreamOptions" - ModuleConfigs: type: object required: - - llm_module_config - - templating_module_config + - prompt_templating additionalProperties: false properties: - llm_module_config: - $ref: "#/components/schemas/LLMModuleConfig" - templating_module_config: - $ref: "#/components/schemas/TemplatingModuleConfig" - filtering_module_config: + prompt_templating: + $ref: "#/components/schemas/PromptTemplatingModuleConfig" + filtering: $ref: "#/components/schemas/FilteringModuleConfig" - masking_module_config: + masking: $ref: "#/components/schemas/MaskingModuleConfig" - grounding_module_config: + grounding: $ref: "#/components/schemas/GroundingModuleConfig" - input_translation_module_config: - $ref: "#/components/schemas/InputTranslationModuleConfig" - output_translation_module_config: - $ref: "#/components/schemas/OutputTranslationModuleConfig" - - ModuleResults: - description: Results of each module. + translation: + $ref: "#/components/schemas/TranslationModuleConfig" + # Abstract base class encompassing fields for both `ModuleResults` and `ModuleResultsStreaming` + # Not to be instantiated by llm-orchestration code + ModuleResultsBase: + description: Results of each module of /embeddings endpoint(e.g. input masking). type: object additionalProperties: false properties: @@ -392,24 +590,47 @@ components: $ref: "#/components/schemas/GenericModuleResult" input_filtering: $ref: "#/components/schemas/GenericModuleResult" - llm: - $ref: "#/components/schemas/LLMModuleResult" output_filtering: $ref: "#/components/schemas/GenericModuleResult" - output_unmasking: - type: array - items: - oneOf: - - $ref: "#/components/schemas/LLMChoice" - - $ref: "#/components/schemas/LLMChoiceStreaming" output_translation: $ref: "#/components/schemas/GenericModuleResult" - + ModuleResults: + description: Synchronous results of each module. + type: object + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ModuleResultsBase" + - type: object + properties: + llm: + $ref: "#/components/schemas/LLMModuleResult" + output_unmasking: + type: array + items: + $ref: "#/components/schemas/LLMChoice" + ModuleResultsStreaming: + description: Streaming results of each module. + type: object + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ModuleResultsBase" + - type: object + properties: + llm: + $ref: "#/components/schemas/LLMModuleResultStreaming" + output_unmasking: + type: array + items: + $ref: "#/components/schemas/LLMChoiceStreaming" GlobalStreamOptions: - description: Options for streaming. Will be ignored if stream is false. + description: Options for streaming. Will be ignored if enabled is false. type: object additionalProperties: false properties: + enabled: + type: boolean + description: If true, the response will be streamed back to the client + default: false chunk_size: type: integer description: Minimum number of characters per chunk that post-LLM modules operate on. @@ -424,34 +645,6 @@ components: type: string example: ["\n", ".", "?", "!"] - # --- LLM MODULE --- - LLMModuleConfig: - type: object - required: - - model_name - additionalProperties: false - properties: - model_name: - description: Model name as in LLM Access configuration - example: "gpt-4" - type: string - model_params: # optional, default values are used for mandatory model parameters - description: Model parameters - type: object - example: - max_tokens: 300 - temperature: 0.1 - frequency_penalty: 0 - presence_penalty: 0 - n: 2 - stream_options: - include_usage: true - additionalProperties: true - model_version: - description: Version of the model to use - type: string - default: "latest" - GenericModuleResult: type: object description: Generic module result @@ -465,16 +658,9 @@ components: data: type: object description: Additional data object from the module - LLMModuleResult: - description: Output of LLM module. Follows the OpenAI spec. - oneOf: - - $ref: "#/components/schemas/LLMModuleResultSynchronous" - - $ref: "#/components/schemas/LLMModuleResultStreaming" - - LLMModuleResultSynchronous: type: object - description: Output of LLM module. Follows the OpenAI spec. + description: Output from LLM. Follows the OpenAI spec. required: - id - object @@ -498,7 +684,7 @@ components: model: type: string description: Model name - example: "gpt-4" + example: "gpt-4o-mini" system_fingerprint: type: string description: System fingerprint @@ -510,7 +696,6 @@ components: $ref: "#/components/schemas/LLMChoice" usage: $ref: "#/components/schemas/TokenUsage" - LLMModuleResultStreaming: type: object description: Output of LLM module. Follows the OpenAI spec. @@ -543,7 +728,6 @@ components: $ref: "#/components/schemas/LLMChoiceStreaming" usage: $ref: "#/components/schemas/TokenUsage" - LLMChoice: type: object required: @@ -558,17 +742,11 @@ components: message: $ref: "#/components/schemas/ResponseChatMessage" logprobs: - type: object - description: Log probabilities - additionalProperties: - type: array - items: - type: number + $ref: '#/components/schemas/ChoiceLogprobs' finish_reason: type: string 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 - LLMChoiceStreaming: type: object required: @@ -581,16 +759,10 @@ components: delta: $ref: "#/components/schemas/ChatDelta" logprobs: - type: object - description: Log probabilities - additionalProperties: - type: array - items: - type: number + $ref: '#/components/schemas/ChoiceLogprobs' finish_reason: type: string description: Reason for stopping the model - TokenUsage: type: object description: Usage of tokens in the response @@ -612,12 +784,50 @@ components: description: Total number of tokens used example: 50 - # --- Templating Module --- - - TemplatingModuleConfig: - oneOf: - - $ref: "#/components/schemas/Template" - - $ref: "#/components/schemas/TemplateRef" + # --- Prompt Templating Module --- + PromptTemplatingModuleConfig: + type: object + required: + - prompt + - model + additionalProperties: false + properties: + prompt: + description: > + The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. + oneOf: + - $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 + required: + - name + additionalProperties: false + properties: + name: + type: string + description: Name of the model as in LLM Access configuration + example: "gpt-4o-mini" + version: + type: string + description: Version of the model to be used + default: "latest" + params: + type: object + description: Additional parameters for the model. Default values are used for mandatory parameters. + additionalProperties: true + example: + max_tokens: 300 + temperature: 0.1 + frequency_penalty: 0 + presence_penalty: 0 + n: 2 + stream_options: + include_usage: true # --- Templating Module with User Defined Template --- # response_format api definition taken from: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L12286 @@ -641,8 +851,6 @@ components: description: > Response format that the model output should adhere to. This is the same as the OpenAI definition. - - Compatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. oneOf: - $ref: "#/components/schemas/ResponseFormatText" - $ref: "#/components/schemas/ResponseFormatJsonObject" @@ -657,7 +865,8 @@ components: example: template: - role: user - content: "How can the features of AI in SAP BTP specifically {{?groundingOutput}}, be applied to {{?inputContext}}" + # escape curly braces to avoid jinja2 interpreting them + content: "How can the features of AI in SAP BTP specifically {{'{{?groundingOutput}}'}}, be applied to {{'{{?inputContext}}'}}" defaults: inputContext: The default text that will be used in the template if inputContext is not set @@ -855,11 +1064,11 @@ components: additionalProperties: false properties: filters: - description: Configuration for content filtering services that should be used for the given filtering step (input filtering or output filtering). + description: Configuration for content filtering services that should be used for the given filtering step (input filtering). type: array minItems: 1 items: - $ref: "#/components/schemas/FilterConfig" + $ref: "#/components/schemas/InputFilterConfig" OutputFilteringConfig: type: object @@ -868,11 +1077,11 @@ components: additionalProperties: false properties: filters: - description: Configuration for content filtering services that should be used for the given filtering step (input filtering or output filtering). + description: Configuration for content filtering services that should be used for the given filtering step (output filtering). type: array minItems: 1 items: - $ref: "#/components/schemas/FilterConfig" + $ref: "#/components/schemas/OutputFilterConfig" stream_options: $ref: "#/components/schemas/FilteringStreamOptions" @@ -888,12 +1097,32 @@ components: minimum: 0 maximum: 10000 - FilterConfig: + InputFilterConfig: + oneOf: + - $ref: "#/components/schemas/AzureContentSafetyInputFilterConfig" + - $ref: "#/components/schemas/LlamaGuard38bFilterConfig" + + OutputFilterConfig: oneOf: - - $ref: "#/components/schemas/AzureContentSafetyFilterConfig" + - $ref: "#/components/schemas/AzureContentSafetyOutputFilterConfig" - $ref: "#/components/schemas/LlamaGuard38bFilterConfig" - AzureContentSafetyFilterConfig: + AzureContentSafetyInputFilterConfig: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - azure_content_safety + example: azure_content_safety + config: + $ref: "#/components/schemas/AzureContentSafetyInput" + + AzureContentSafetyOutputFilterConfig: type: object required: - type @@ -906,20 +1135,38 @@ components: - azure_content_safety example: azure_content_safety config: - $ref: "#/components/schemas/AzureContentSafety" + $ref: "#/components/schemas/AzureContentSafetyOutput" + + AzureContentSafetyInput: + description: Filter configuration for Azure Content Safety + type: object + additionalProperties: false + properties: + hate: + $ref: "#/components/schemas/AzureThreshold" + self_harm: + $ref: "#/components/schemas/AzureThreshold" + sexual: + $ref: "#/components/schemas/AzureThreshold" + violence: + $ref: "#/components/schemas/AzureThreshold" + prompt_shield: + type: boolean + description: A flag to use prompt shield + default: false - AzureContentSafety: + AzureContentSafetyOutput: description: Filter configuration for Azure Content Safety type: object additionalProperties: false properties: - Hate: + hate: $ref: "#/components/schemas/AzureThreshold" - SelfHarm: + self_harm: $ref: "#/components/schemas/AzureThreshold" - Sexual: + sexual: $ref: "#/components/schemas/AzureThreshold" - Violence: + violence: $ref: "#/components/schemas/AzureThreshold" AzureThreshold: @@ -1042,15 +1289,67 @@ components: description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module DPIEntityConfig: + oneOf: + - $ref: "#/components/schemas/DPIStandardEntity" + - $ref: "#/components/schemas/DPICustomEntity" + + DPICustomEntity: + type: object + required: + - regex + - replacement_strategy + additionalProperties: false + properties: + regex: + description: Regular expression to match the entity + type: string + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: "#/components/schemas/DPIMethodConstant" + + DPIStandardEntity: type: object required: - type additionalProperties: false properties: type: - description: Type of entity to be masked - allOf: - - $ref: "#/components/schemas/DPIEntities" + $ref: "#/components/schemas/DPIEntities" + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: "#/components/schemas/DPIMethodConstant" + - $ref: "#/components/schemas/DPIMethodFabricatedData" + + DPIMethodConstant: + description: Replaces the entity with the specified value followed by an incrementing number + type: object + required: + - method + - value + additionalProperties: false + properties: + method: + type: string + enum: + - constant + value: + description: Value to be used for replacement + example: NAME_REDACTED + type: string + + DPIMethodFabricatedData: + description: Replaces the entity with a randomly generated value appropriate to its type. + type: object + required: + - method + additionalProperties: false + properties: + method: + type: string + enum: + - fabricated_data DPIEntities: description: Default entities supported by data privacy and integration service @@ -1077,6 +1376,7 @@ components: - profile-religious-group - profile-political-group - profile-pronouns-gender + - profile-ethnicity - profile-gender - profile-sexual-orientation - profile-trade-union @@ -1100,8 +1400,7 @@ components: config: type: object required: - - input_params - - output_param + - placeholders additionalProperties: false properties: filters: @@ -1110,17 +1409,25 @@ components: oneOf: - $ref: "#/components/schemas/DocumentGroundingFilter" description: Document grounding service filters to be used - input_params: - type: array - minItems: 1 - items: - type: string - example: groundingInput - description: Contains the input parameters used for grounding input questions - output_param: - type: string - description: Parameter name used for grounding output - example: groundingOutput + placeholders: + type: object + additionalProperties: false + required: + - input + - output + properties: + input: + type: array + minItems: 1 + items: + type: string + example: groundingInput + description: Contains the input parameters used for grounding input questions + output: + type: string + description: Placeholder name for grounding output + example: groundingOutput + description: Placeholders to be used for grounding input questions and output metadata_params: type: array items: @@ -1248,14 +1555,19 @@ components: title: SearchSelectOptionEnum # --- Translation Module --- - InputTranslationModuleConfig: - oneOf: - - $ref: "#/components/schemas/SAPDocumentTranslation" - - OutputTranslationModuleConfig: - oneOf: - - $ref: "#/components/schemas/SAPDocumentTranslation" - + TranslationModuleConfig: + type: object + description: Configuration for translation module + additionalProperties: false + properties: + input: + description: Configuration for input translation + oneOf: + - $ref: "#/components/schemas/SAPDocumentTranslation" + output: + description: Configuration for output translation + oneOf: + - $ref: "#/components/schemas/SAPDocumentTranslation" SAPDocumentTranslation: type: object required: @@ -1284,8 +1596,7 @@ components: type: string description: Language to which the text should be translated. example: "en-US" - - ErrorResponse: + Error: type: object required: - request_id @@ -1301,14 +1612,113 @@ components: example: 400 message: type: string - example: "Model name must be one of ['gpt-4', ...]" + example: "Model name must be one of ['gpt-4o-mini', ...]" location: type: string description: Where the error occurred example: "LLM Module" - module_results: + intermediate_results: $ref: "#/components/schemas/ModuleResults" + ErrorStreaming: + type: object + required: + - request_id + - code + - message + - location + properties: + request_id: + type: string + example: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + code: + type: integer + example: 500 + message: + type: string + example: "Model name must be one of ['gpt-4o-mini', ...]" + location: + type: string + description: Where the error occurred + example: "LLM Module" + intermediate_results: + $ref: "#/components/schemas/ModuleResultsStreaming" + + ErrorResponse: + type: object + required: + - error + properties: + error: + $ref: "#/components/schemas/Error" + + ErrorResponseStreaming: + type: object + required: + - error + properties: + error: + $ref: "#/components/schemas/ErrorStreaming" + + # ref : https://github.com/openai/openai-python/blob/main/src/openai/types/chat/chat_completion_token_logprob.py + ChatCompletionTokenLogprob: + type: object + required: + - token + - logprob + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token. + bytes: + type: array + items: + type: integer + format: int32 + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are multi-byte. + top_logprobs: + type: array + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs`. + items: + # This is the schema for the inner object within top_logprobs + type: object + required: + - token + - logprob + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token. + bytes: + type: array + items: + type: integer + format: int32 + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are multi-byte. + # ref : https://github.com/openai/openai-python/blob/main/src/openai/types/chat/chat_completion.py + ChoiceLogprobs: + type: object + description: Log probabilities for the choice. + properties: + content: + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + description: A list of message content tokens with log probability information. + refusal: + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + description: A list of message refusal tokens with log probability information. + responses: BadRequest: description: Bad Request @@ -1329,4 +1739,4 @@ components: type: http scheme: bearer bearerFormat: JWT - description: To use this API, you must have an AI Core access token. + description: To use this API, you must have an AI Core access token. \ No newline at end of file