diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheControl.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheControl.java new file mode 100644 index 000000000..5473e5a98 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheControl.java @@ -0,0 +1,345 @@ +/* + * Orchestration v2 + * 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; + +/** + * Cache control directive for Anthropic prompt caching. Only applicable to Anthropic Claude models. + * When set, marks the content block as a cache breakpoint. + */ +// CHECKSTYLE:OFF +public class CacheControl +// CHECKSTYLE:ON +{ + /** Gets or Sets type */ + public enum TypeEnum { + /** The EPHEMERAL option of this CacheControl */ + EPHEMERAL("ephemeral"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this CacheControl */ + 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 CacheControl + */ + @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; + + /** + * Time-to-live for the cache entry. Default is \"5m\" (5 minutes). \"1h\" (1 + * hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + */ + public enum TtlEnum { + /** The _5M option of this CacheControl */ + _5M("5m"), + + /** The _1H option of this CacheControl */ + _1H("1h"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this CacheControl */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TtlEnum(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 CacheControl + */ + @JsonCreator + @Nonnull + public static TtlEnum fromValue(@Nonnull final String value) { + for (TtlEnum b : TtlEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("ttl") + private TtlEnum ttl; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CacheControl. */ + protected CacheControl() {} + + /** + * Set the type of this {@link CacheControl} instance and return the same instance. + * + * @param type The type of this {@link CacheControl} + * @return The same instance of this {@link CacheControl} class + */ + @Nonnull + public CacheControl type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link CacheControl} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link CacheControl} instance. + * + * @param type The type of this {@link CacheControl} + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the ttl of this {@link CacheControl} instance and return the same instance. + * + * @param ttl Time-to-live for the cache entry. Default is \"5m\" (5 minutes). + * \"1h\" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, + * Sonnet 4.5). + * @return The same instance of this {@link CacheControl} class + */ + @Nonnull + public CacheControl ttl(@Nullable final TtlEnum ttl) { + this.ttl = ttl; + return this; + } + + /** + * Time-to-live for the cache entry. Default is \"5m\" (5 minutes). \"1h\" (1 + * hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + * + * @return ttl The ttl of this {@link CacheControl} instance. + */ + @Nonnull + public TtlEnum getTtl() { + return ttl; + } + + /** + * Set the ttl of this {@link CacheControl} instance. + * + * @param ttl Time-to-live for the cache entry. Default is \"5m\" (5 minutes). + * \"1h\" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, + * Sonnet 4.5). + */ + public void setTtl(@Nullable final TtlEnum ttl) { + this.ttl = ttl; + } + + /** + * Get the names of the unrecognizable properties of the {@link CacheControl}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CacheControl} 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("CacheControl has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CacheControl} 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 (ttl != null) declaredFields.put("ttl", ttl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CacheControl} 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 CacheControl cacheControl = (CacheControl) o; + return Objects.equals(this.cloudSdkCustomFields, cacheControl.cloudSdkCustomFields) + && Objects.equals(this.type, cacheControl.type) + && Objects.equals(this.ttl, cacheControl.ttl); + } + + @Override + public int hashCode() { + return Objects.hash(type, ttl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CacheControl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" ttl: ").append(toIndentedString(ttl)).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 CacheControl} instance + * with all required arguments. + */ + public static Builder create() { + return (type) -> new CacheControl().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link CacheControl} instance. + * + * @param type The type of this {@link CacheControl} + * @return The CacheControl instance. + */ + CacheControl type(@Nonnull final TypeEnum type); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheCreationTokenDetails.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheCreationTokenDetails.java new file mode 100644 index 000000000..a6bd62e6a --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/CacheCreationTokenDetails.java @@ -0,0 +1,222 @@ +/* + * Orchestration v2 + * 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; + +/** Breakdown of cache creation tokens by TTL (Anthropic only). */ +// CHECKSTYLE:OFF +public class CacheCreationTokenDetails +// CHECKSTYLE:ON +{ + @JsonProperty("ephemeral_5m_input_tokens") + private Integer ephemeral5mInputTokens; + + @JsonProperty("ephemeral_1h_input_tokens") + private Integer ephemeral1hInputTokens; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CacheCreationTokenDetails. */ + protected CacheCreationTokenDetails() {} + + /** + * Set the ephemeral5mInputTokens of this {@link CacheCreationTokenDetails} instance and return + * the same instance. + * + * @param ephemeral5mInputTokens Tokens cached with 5-minute TTL. + * @return The same instance of this {@link CacheCreationTokenDetails} class + */ + @Nonnull + public CacheCreationTokenDetails ephemeral5mInputTokens( + @Nullable final Integer ephemeral5mInputTokens) { + this.ephemeral5mInputTokens = ephemeral5mInputTokens; + return this; + } + + /** + * Tokens cached with 5-minute TTL. + * + * @return ephemeral5mInputTokens The ephemeral5mInputTokens of this {@link + * CacheCreationTokenDetails} instance. + */ + @Nonnull + public Integer getEphemeral5mInputTokens() { + return ephemeral5mInputTokens; + } + + /** + * Set the ephemeral5mInputTokens of this {@link CacheCreationTokenDetails} instance. + * + * @param ephemeral5mInputTokens Tokens cached with 5-minute TTL. + */ + public void setEphemeral5mInputTokens(@Nullable final Integer ephemeral5mInputTokens) { + this.ephemeral5mInputTokens = ephemeral5mInputTokens; + } + + /** + * Set the ephemeral1hInputTokens of this {@link CacheCreationTokenDetails} instance and return + * the same instance. + * + * @param ephemeral1hInputTokens Tokens cached with 1-hour TTL. + * @return The same instance of this {@link CacheCreationTokenDetails} class + */ + @Nonnull + public CacheCreationTokenDetails ephemeral1hInputTokens( + @Nullable final Integer ephemeral1hInputTokens) { + this.ephemeral1hInputTokens = ephemeral1hInputTokens; + return this; + } + + /** + * Tokens cached with 1-hour TTL. + * + * @return ephemeral1hInputTokens The ephemeral1hInputTokens of this {@link + * CacheCreationTokenDetails} instance. + */ + @Nonnull + public Integer getEphemeral1hInputTokens() { + return ephemeral1hInputTokens; + } + + /** + * Set the ephemeral1hInputTokens of this {@link CacheCreationTokenDetails} instance. + * + * @param ephemeral1hInputTokens Tokens cached with 1-hour TTL. + */ + public void setEphemeral1hInputTokens(@Nullable final Integer ephemeral1hInputTokens) { + this.ephemeral1hInputTokens = ephemeral1hInputTokens; + } + + /** + * Get the names of the unrecognizable properties of the {@link CacheCreationTokenDetails}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CacheCreationTokenDetails} 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( + "CacheCreationTokenDetails has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CacheCreationTokenDetails} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (ephemeral5mInputTokens != null) + declaredFields.put("ephemeral5mInputTokens", ephemeral5mInputTokens); + if (ephemeral1hInputTokens != null) + declaredFields.put("ephemeral1hInputTokens", ephemeral1hInputTokens); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CacheCreationTokenDetails} 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 CacheCreationTokenDetails cacheCreationTokenDetails = (CacheCreationTokenDetails) o; + return Objects.equals(this.cloudSdkCustomFields, cacheCreationTokenDetails.cloudSdkCustomFields) + && Objects.equals( + this.ephemeral5mInputTokens, cacheCreationTokenDetails.ephemeral5mInputTokens) + && Objects.equals( + this.ephemeral1hInputTokens, cacheCreationTokenDetails.ephemeral1hInputTokens); + } + + @Override + public int hashCode() { + return Objects.hash(ephemeral5mInputTokens, ephemeral1hInputTokens, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CacheCreationTokenDetails {\n"); + sb.append(" ephemeral5mInputTokens: ") + .append(toIndentedString(ephemeral5mInputTokens)) + .append("\n"); + sb.append(" ephemeral1hInputTokens: ") + .append(toIndentedString(ephemeral1hInputTokens)) + .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 CacheCreationTokenDetails} instance. No arguments are required. */ + public static CacheCreationTokenDetails create() { + return new CacheCreationTokenDetails(); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTool.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTool.java index e5c505f09..06c98f84a 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTool.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTool.java @@ -90,6 +90,9 @@ public static TypeEnum fromValue(@Nonnull final String value) { @JsonProperty("function") private FunctionObject function; + @JsonProperty("cache_control") + private CacheControl cacheControl; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -158,6 +161,37 @@ public void setFunction(@Nonnull final FunctionObject function) { this.function = function; } + /** + * Set the cacheControl of this {@link ChatCompletionTool} instance and return the same instance. + * + * @param cacheControl The cacheControl of this {@link ChatCompletionTool} + * @return The same instance of this {@link ChatCompletionTool} class + */ + @Nonnull + public ChatCompletionTool cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link ChatCompletionTool} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link ChatCompletionTool} instance. + * + * @param cacheControl The cacheControl of this {@link ChatCompletionTool} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + /** * Get the names of the unrecognizable properties of the {@link ChatCompletionTool}. * @@ -198,6 +232,7 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (type != null) declaredFields.put("type", type); if (function != null) declaredFields.put("function", function); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); return declaredFields; } @@ -224,12 +259,13 @@ public boolean equals(@Nullable final java.lang.Object o) { final ChatCompletionTool chatCompletionTool = (ChatCompletionTool) o; return Objects.equals(this.cloudSdkCustomFields, chatCompletionTool.cloudSdkCustomFields) && Objects.equals(this.type, chatCompletionTool.type) - && Objects.equals(this.function, chatCompletionTool.function); + && Objects.equals(this.function, chatCompletionTool.function) + && Objects.equals(this.cacheControl, chatCompletionTool.cacheControl); } @Override public int hashCode() { - return Objects.hash(type, function, cloudSdkCustomFields); + return Objects.hash(type, function, cacheControl, cloudSdkCustomFields); } @Override @@ -239,6 +275,7 @@ public String toString() { sb.append("class ChatCompletionTool {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" function: ").append(toIndentedString(function)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).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/DPIConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIConfig.java index cd9af25de..b22e98b5a 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DPIConfig.java @@ -159,6 +159,66 @@ public static MethodEnum fromValue(@Nonnull final String value) { @JsonProperty("mask_grounding_input") private DPIConfigMaskGroundingInput maskGroundingInput; + /** Type of masking method to be used for file inputs. Required if file inputs are provided. */ + public enum MaskFileInputMethodEnum { + /** The ANONYMIZATION option of this DPIConfig */ + ANONYMIZATION("anonymization"), + + /** The SKIP option of this DPIConfig */ + SKIP("skip"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MaskFileInputMethodEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static MaskFileInputMethodEnum fromValue(@Nonnull final String value) { + for (MaskFileInputMethodEnum b : MaskFileInputMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("mask_file_input_method") + private MaskFileInputMethodEnum maskFileInputMethod; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -352,6 +412,40 @@ public void setMaskGroundingInput( this.maskGroundingInput = maskGroundingInput; } + /** + * Set the maskFileInputMethod of this {@link DPIConfig} instance and return the same instance. + * + * @param maskFileInputMethod Type of masking method to be used for file inputs. Required if file + * inputs are provided. + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig maskFileInputMethod( + @Nullable final MaskFileInputMethodEnum maskFileInputMethod) { + this.maskFileInputMethod = maskFileInputMethod; + return this; + } + + /** + * Type of masking method to be used for file inputs. Required if file inputs are provided. + * + * @return maskFileInputMethod The maskFileInputMethod of this {@link DPIConfig} instance. + */ + @Nonnull + public MaskFileInputMethodEnum getMaskFileInputMethod() { + return maskFileInputMethod; + } + + /** + * Set the maskFileInputMethod of this {@link DPIConfig} instance. + * + * @param maskFileInputMethod Type of masking method to be used for file inputs. Required if file + * inputs are provided. + */ + public void setMaskFileInputMethod(@Nullable final MaskFileInputMethodEnum maskFileInputMethod) { + this.maskFileInputMethod = maskFileInputMethod; + } + /** * Get the names of the unrecognizable properties of the {@link DPIConfig}. * @@ -395,6 +489,7 @@ public Map toMap() { if (entities != null) declaredFields.put("entities", entities); if (allowlist != null) declaredFields.put("allowlist", allowlist); if (maskGroundingInput != null) declaredFields.put("maskGroundingInput", maskGroundingInput); + if (maskFileInputMethod != null) declaredFields.put("maskFileInputMethod", maskFileInputMethod); return declaredFields; } @@ -424,13 +519,20 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.method, dpIConfig.method) && Objects.equals(this.entities, dpIConfig.entities) && Objects.equals(this.allowlist, dpIConfig.allowlist) - && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput); + && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput) + && Objects.equals(this.maskFileInputMethod, dpIConfig.maskFileInputMethod); } @Override public int hashCode() { return Objects.hash( - type, method, entities, allowlist, maskGroundingInput, cloudSdkCustomFields); + type, + method, + entities, + allowlist, + maskGroundingInput, + maskFileInputMethod, + cloudSdkCustomFields); } @Override @@ -443,6 +545,9 @@ public String toString() { sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); sb.append(" allowlist: ").append(toIndentedString(allowlist)).append("\n"); sb.append(" maskGroundingInput: ").append(toIndentedString(maskGroundingInput)).append("\n"); + sb.append(" maskFileInputMethod: ") + .append(toIndentedString(maskFileInputMethod)) + .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/Embedding.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/Embedding.java index 5287cbae8..1089a76c0 100644 --- 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 @@ -46,4 +46,22 @@ record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String v static InnerString create(@Nonnull final String val) { return new InnerString(val); } + + /** Helper class to create {@code EmbeddingMultiFormat } that implements {@link Embedding}. */ + record InnerEmbeddingMultiFormat( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull EmbeddingMultiFormat value) + implements Embedding {} + + /** + * Creator to enable deserialization of {@code EmbeddingMultiFormat }. + * + * @param val the value to use + * @return a new instance of {@link InnerEmbeddingMultiFormat}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerEmbeddingMultiFormat createInnerEmbeddingMultiFormat( + @Nonnull final EmbeddingMultiFormat val) { + return new InnerEmbeddingMultiFormat(val); + } } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingMultiFormat.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingMultiFormat.java new file mode 100644 index 000000000..4418aea33 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingMultiFormat.java @@ -0,0 +1,423 @@ +/* + * Orchestration v2 + * 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; + +/** + * A dictionary mapping encoding format names to their embeddings. Used when multiple encoding + * formats are requested (Cohere-specific). + */ +// CHECKSTYLE:OFF +public class EmbeddingMultiFormat +// CHECKSTYLE:ON +{ + @JsonProperty("float") + private float[] _float; + + @JsonProperty("int8") + private List int8 = new ArrayList<>(); + + @JsonProperty("uint8") + private List uint8 = new ArrayList<>(); + + @JsonProperty("base64") + private String base64; + + @JsonProperty("binary") + private List binary = new ArrayList<>(); + + @JsonProperty("ubinary") + private List ubinary = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingMultiFormat. */ + protected EmbeddingMultiFormat() {} + + /** + * Set the _float of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param _float Float encoding format - array of floating point numbers + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat _float(@Nullable final float[] _float) { + this._float = _float; + return this; + } + + /** + * Float encoding format - array of floating point numbers + * + * @return _float The _float of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public float[] getFloat() { + return _float; + } + + /** + * Set the _float of this {@link EmbeddingMultiFormat} instance. + * + * @param _float Float encoding format - array of floating point numbers + */ + public void setFloat(@Nullable final float[] _float) { + this._float = _float; + } + + /** + * Set the int8 of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param int8 Int8 encoding format - array of 8-bit integers + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat int8(@Nullable final List int8) { + this.int8 = int8; + return this; + } + + /** + * Add one int8 instance to this {@link EmbeddingMultiFormat}. + * + * @param int8Item The int8 that should be added + * @return The same instance of type {@link EmbeddingMultiFormat} + */ + @Nonnull + public EmbeddingMultiFormat addInt8Item(@Nonnull final Integer int8Item) { + if (this.int8 == null) { + this.int8 = new ArrayList<>(); + } + this.int8.add(int8Item); + return this; + } + + /** + * Int8 encoding format - array of 8-bit integers + * + * @return int8 The int8 of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public List getInt8() { + return int8; + } + + /** + * Set the int8 of this {@link EmbeddingMultiFormat} instance. + * + * @param int8 Int8 encoding format - array of 8-bit integers + */ + public void setInt8(@Nullable final List int8) { + this.int8 = int8; + } + + /** + * Set the uint8 of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param uint8 Uint8 encoding format - array of unsigned 8-bit integers + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat uint8(@Nullable final List uint8) { + this.uint8 = uint8; + return this; + } + + /** + * Add one uint8 instance to this {@link EmbeddingMultiFormat}. + * + * @param uint8Item The uint8 that should be added + * @return The same instance of type {@link EmbeddingMultiFormat} + */ + @Nonnull + public EmbeddingMultiFormat addUint8Item(@Nonnull final Integer uint8Item) { + if (this.uint8 == null) { + this.uint8 = new ArrayList<>(); + } + this.uint8.add(uint8Item); + return this; + } + + /** + * Uint8 encoding format - array of unsigned 8-bit integers + * + * @return uint8 The uint8 of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public List getUint8() { + return uint8; + } + + /** + * Set the uint8 of this {@link EmbeddingMultiFormat} instance. + * + * @param uint8 Uint8 encoding format - array of unsigned 8-bit integers + */ + public void setUint8(@Nullable final List uint8) { + this.uint8 = uint8; + } + + /** + * Set the base64 of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param base64 Base64 encoding format - base64 encoded string + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat base64(@Nullable final String base64) { + this.base64 = base64; + return this; + } + + /** + * Base64 encoding format - base64 encoded string + * + * @return base64 The base64 of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public String getBase64() { + return base64; + } + + /** + * Set the base64 of this {@link EmbeddingMultiFormat} instance. + * + * @param base64 Base64 encoding format - base64 encoded string + */ + public void setBase64(@Nullable final String base64) { + this.base64 = base64; + } + + /** + * Set the binary of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param binary Binary encoding format - array of integers + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat binary(@Nullable final List binary) { + this.binary = binary; + return this; + } + + /** + * Add one binary instance to this {@link EmbeddingMultiFormat}. + * + * @param binaryItem The binary that should be added + * @return The same instance of type {@link EmbeddingMultiFormat} + */ + @Nonnull + public EmbeddingMultiFormat addBinaryItem(@Nonnull final Integer binaryItem) { + if (this.binary == null) { + this.binary = new ArrayList<>(); + } + this.binary.add(binaryItem); + return this; + } + + /** + * Binary encoding format - array of integers + * + * @return binary The binary of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public List getBinary() { + return binary; + } + + /** + * Set the binary of this {@link EmbeddingMultiFormat} instance. + * + * @param binary Binary encoding format - array of integers + */ + public void setBinary(@Nullable final List binary) { + this.binary = binary; + } + + /** + * Set the ubinary of this {@link EmbeddingMultiFormat} instance and return the same instance. + * + * @param ubinary Ubinary encoding format - array of unsigned integers + * @return The same instance of this {@link EmbeddingMultiFormat} class + */ + @Nonnull + public EmbeddingMultiFormat ubinary(@Nullable final List ubinary) { + this.ubinary = ubinary; + return this; + } + + /** + * Add one ubinary instance to this {@link EmbeddingMultiFormat}. + * + * @param ubinaryItem The ubinary that should be added + * @return The same instance of type {@link EmbeddingMultiFormat} + */ + @Nonnull + public EmbeddingMultiFormat addUbinaryItem(@Nonnull final Integer ubinaryItem) { + if (this.ubinary == null) { + this.ubinary = new ArrayList<>(); + } + this.ubinary.add(ubinaryItem); + return this; + } + + /** + * Ubinary encoding format - array of unsigned integers + * + * @return ubinary The ubinary of this {@link EmbeddingMultiFormat} instance. + */ + @Nonnull + public List getUbinary() { + return ubinary; + } + + /** + * Set the ubinary of this {@link EmbeddingMultiFormat} instance. + * + * @param ubinary Ubinary encoding format - array of unsigned integers + */ + public void setUbinary(@Nullable final List ubinary) { + this.ubinary = ubinary; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingMultiFormat}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingMultiFormat} 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( + "EmbeddingMultiFormat has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingMultiFormat} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (_float != null) declaredFields.put("_float", _float); + if (int8 != null) declaredFields.put("int8", int8); + if (uint8 != null) declaredFields.put("uint8", uint8); + if (base64 != null) declaredFields.put("base64", base64); + if (binary != null) declaredFields.put("binary", binary); + if (ubinary != null) declaredFields.put("ubinary", ubinary); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingMultiFormat} 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 EmbeddingMultiFormat embeddingMultiFormat = (EmbeddingMultiFormat) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingMultiFormat.cloudSdkCustomFields) + && Arrays.equals(this._float, embeddingMultiFormat._float) + && Objects.equals(this.int8, embeddingMultiFormat.int8) + && Objects.equals(this.uint8, embeddingMultiFormat.uint8) + && Objects.equals(this.base64, embeddingMultiFormat.base64) + && Objects.equals(this.binary, embeddingMultiFormat.binary) + && Objects.equals(this.ubinary, embeddingMultiFormat.ubinary); + } + + @Override + public int hashCode() { + return Objects.hash( + Arrays.hashCode(_float), int8, uint8, base64, binary, ubinary, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingMultiFormat {\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" int8: ").append(toIndentedString(int8)).append("\n"); + sb.append(" uint8: ").append(toIndentedString(uint8)).append("\n"); + sb.append(" base64: ").append(toIndentedString(base64)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" ubinary: ").append(toIndentedString(ubinary)).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 EmbeddingMultiFormat} instance. No arguments are required. */ + public static EmbeddingMultiFormat create() { + return new EmbeddingMultiFormat(); + } +} 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 index c5f45f1b4..7e13cfde8 100644 --- 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 @@ -44,6 +44,21 @@ public enum TypeEnum { /** The QUERY option of this EmbeddingsInput */ QUERY("query"), + /** The SEARCH_DOCUMENT option of this EmbeddingsInput */ + SEARCH_DOCUMENT("search_document"), + + /** The SEARCH_QUERY option of this EmbeddingsInput */ + SEARCH_QUERY("search_query"), + + /** The CLASSIFICATION option of this EmbeddingsInput */ + CLASSIFICATION("classification"), + + /** The CLUSTERING option of this EmbeddingsInput */ + CLUSTERING("clustering"), + + /** The IMAGE option of this EmbeddingsInput */ + IMAGE("image"), + /** The UNKNOWN_DEFAULT_OPEN_API option of this EmbeddingsInput */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); 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 index bd27a812e..4823eb32d 100644 --- 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 @@ -146,7 +146,7 @@ public void setParams(@Nullable final EmbeddingsModelParams params) { * Set the timeout of this {@link EmbeddingsModelDetails} instance and return the same instance. * * @param timeout Timeout for the Embeddings request in seconds. This parameter is currently - * ignored for Vertex AI models. Minimum: 1 Maximum: 600 + * ignored for Vertex AI models. Minimum: 1 Maximum: 1200 * @return The same instance of this {@link EmbeddingsModelDetails} class */ @Nonnull @@ -157,7 +157,7 @@ public EmbeddingsModelDetails timeout(@Nullable final Integer timeout) { /** * Timeout for the Embeddings request in seconds. This parameter is currently ignored for Vertex - * AI models. minimum: 1 maximum: 600 + * AI models. minimum: 1 maximum: 1200 * * @return timeout The timeout of this {@link EmbeddingsModelDetails} instance. */ @@ -170,7 +170,7 @@ public Integer getTimeout() { * Set the timeout of this {@link EmbeddingsModelDetails} instance. * * @param timeout Timeout for the Embeddings request in seconds. This parameter is currently - * ignored for Vertex AI models. Minimum: 1 Maximum: 600 + * ignored for Vertex AI models. Minimum: 1 Maximum: 1200 */ public void setTimeout(@Nullable final Integer timeout) { this.timeout = timeout; 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 index e401734b4..d9bcabe22 100644 --- 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 @@ -13,10 +13,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; @@ -36,68 +34,8 @@ public class EmbeddingsModelParams @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; + private EmbeddingsModelParamsEncodingFormat encodingFormat; @JsonProperty("normalize") private Boolean normalize; @@ -143,33 +81,33 @@ public void setDimensions(@Nullable final Integer 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. + * @param encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} * @return The same instance of this {@link EmbeddingsModelParams} class */ @Nonnull - public EmbeddingsModelParams encodingFormat(@Nullable final EncodingFormatEnum encodingFormat) { + public EmbeddingsModelParams encodingFormat( + @Nullable final EmbeddingsModelParamsEncodingFormat encodingFormat) { this.encodingFormat = encodingFormat; return this; } /** - * OpenAI's spec allows for 'float' and 'base64' encoding formats. + * Get encodingFormat * * @return encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} instance. */ @Nonnull - public EncodingFormatEnum getEncodingFormat() { + public EmbeddingsModelParamsEncodingFormat getEncodingFormat() { return encodingFormat; } /** * Set the encodingFormat of this {@link EmbeddingsModelParams} instance. * - * @param encodingFormat OpenAI's spec allows for 'float' and 'base64' - * encoding formats. + * @param encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} */ - public void setEncodingFormat(@Nullable final EncodingFormatEnum encodingFormat) { + public void setEncodingFormat( + @Nullable final EmbeddingsModelParamsEncodingFormat encodingFormat) { this.encodingFormat = encodingFormat; } diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParamsEncodingFormat.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParamsEncodingFormat.java new file mode 100644 index 000000000..70befd6f9 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParamsEncodingFormat.java @@ -0,0 +1,62 @@ +/* + * Orchestration v2 + * 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; + +/** + * The format to return the embeddings in. Can be a single format or an array of formats. + * OpenAI's spec allows for 'float' and 'base64' encoding formats. + */ +public interface EmbeddingsModelParamsEncodingFormat { + /** + * Helper class to create {@code List } that implements {@link + * EmbeddingsModelParamsEncodingFormat}. + */ + record ListOfEncodingFormats( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements EmbeddingsModelParamsEncodingFormat {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val the value to use + * @return a new instance of {@link ListOfEncodingFormats}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfEncodingFormats createListOfEncodingFormats( + @Nonnull final List val) { + return new ListOfEncodingFormats(val); + } + + /** + * Helper class to create {@code EncodingFormat } that implements {@link + * EmbeddingsModelParamsEncodingFormat}. + */ + record InnerEncodingFormat( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull EncodingFormat value) + implements EmbeddingsModelParamsEncodingFormat {} + + /** + * Creator to enable deserialization of {@code EncodingFormat }. + * + * @param val the value to use + * @return a new instance of {@link InnerEncodingFormat}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerEncodingFormat createInnerEncodingFormat(@Nonnull final EncodingFormat val) { + return new InnerEncodingFormat(val); + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EncodingFormat.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EncodingFormat.java new file mode 100644 index 000000000..1572bc7d0 --- /dev/null +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EncodingFormat.java @@ -0,0 +1,72 @@ +/* + * Orchestration v2 + * 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.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Encoding format for embeddings. */ +public enum EncodingFormat { + FLOAT("float"), + + BASE64("base64"), + + BINARY("binary"), + + INT8("int8"), + + UINT8("uint8"), + + UBINARY("ubinary"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + EncodingFormat(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static EncodingFormat fromValue(@Nonnull final String value) { + for (final EncodingFormat b : EncodingFormat.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java index ca9f4d1e9..7cbf84155 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/LLMModelDetails.java @@ -169,7 +169,7 @@ public void setParams(@Nullable final Map params) { * Set the timeout of this {@link LLMModelDetails} instance and return the same instance. * * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for - * Vertex AI models. Minimum: 1 Maximum: 600 + * Vertex AI models. Minimum: 1 Maximum: 1200 * @return The same instance of this {@link LLMModelDetails} class */ @Nonnull @@ -180,7 +180,7 @@ public LLMModelDetails timeout(@Nullable final Integer timeout) { /** * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI - * models. minimum: 1 maximum: 600 + * models. minimum: 1 maximum: 1200 * * @return timeout The timeout of this {@link LLMModelDetails} instance. */ @@ -193,7 +193,7 @@ public Integer getTimeout() { * Set the timeout of this {@link LLMModelDetails} instance. * * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for - * Vertex AI models. Minimum: 1 Maximum: 600 + * Vertex AI models. Minimum: 1 Maximum: 1200 */ public void setTimeout(@Nullable final Integer timeout) { this.timeout = timeout; diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java index 329bac277..063ee3d6f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/MaskingModuleConfigMaskingProviders.java @@ -44,8 +44,8 @@ protected MaskingModuleConfigMaskingProviders() {} * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and * return the same instance. * - * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed Sept - * 15, 2026. Use `providers` property instead. + * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed + * March 20, 2027. Use `providers` property instead. * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class */ @Nonnull @@ -72,7 +72,7 @@ public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( } /** - * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use + * List of masking service providers. **DEPRECATED**: will be removed March 20, 2027. Use * `providers` property instead. * * @return maskingProviders The maskingProviders of this {@link @@ -88,8 +88,8 @@ public List getMaskingProviders() { /** * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * - * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed Sept - * 15, 2026. Use `providers` property instead. + * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed + * March 20, 2027. Use `providers` property instead. */ public void setMaskingProviders(@Nonnull final List maskingProviders) { this.maskingProviders = maskingProviders; @@ -212,7 +212,7 @@ public interface Builder { * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed - * Sept 15, 2026. Use `providers` property instead. + * March 20, 2027. Use `providers` property instead. * @return The MaskingModuleConfigMaskingProviders instance. */ MaskingModuleConfigMaskingProviders maskingProviders( @@ -222,7 +222,7 @@ MaskingModuleConfigMaskingProviders maskingProviders( * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed - * Sept 15, 2026. Use `providers` property instead. + * March 20, 2027. Use `providers` property instead. * @return The MaskingModuleConfigMaskingProviders instance. */ default MaskingModuleConfigMaskingProviders maskingProviders( diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TextContent.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TextContent.java index b1e2e1b36..a91da6ae9 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TextContent.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TextContent.java @@ -90,6 +90,9 @@ public static TypeEnum fromValue(@Nonnull final String value) { @JsonProperty("text") private String text; + @JsonProperty("cache_control") + private CacheControl cacheControl; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -158,6 +161,37 @@ public void setText(@Nonnull final String text) { this.text = text; } + /** + * Set the cacheControl of this {@link TextContent} instance and return the same instance. + * + * @param cacheControl The cacheControl of this {@link TextContent} + * @return The same instance of this {@link TextContent} class + */ + @Nonnull + public TextContent cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link TextContent} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link TextContent} instance. + * + * @param cacheControl The cacheControl of this {@link TextContent} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + /** * Get the names of the unrecognizable properties of the {@link TextContent}. * @@ -198,6 +232,7 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (type != null) declaredFields.put("type", type); if (text != null) declaredFields.put("text", text); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); return declaredFields; } @@ -224,12 +259,13 @@ public boolean equals(@Nullable final java.lang.Object o) { final TextContent textContent = (TextContent) o; return Objects.equals(this.cloudSdkCustomFields, textContent.cloudSdkCustomFields) && Objects.equals(this.type, textContent.type) - && Objects.equals(this.text, textContent.text); + && Objects.equals(this.text, textContent.text) + && Objects.equals(this.cacheControl, textContent.cacheControl); } @Override public int hashCode() { - return Objects.hash(type, text, cloudSdkCustomFields); + return Objects.hash(type, text, cacheControl, cloudSdkCustomFields); } @Override @@ -239,6 +275,7 @@ public String toString() { sb.append("class TextContent {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).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/TokenUsagePromptTokensDetails.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TokenUsagePromptTokensDetails.java index 43bd23553..e5f15b423 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TokenUsagePromptTokensDetails.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/TokenUsagePromptTokensDetails.java @@ -34,6 +34,12 @@ public class TokenUsagePromptTokensDetails @JsonProperty("cached_tokens") private Integer cachedTokens; + @JsonProperty("cache_creation_tokens") + private Integer cacheCreationTokens; + + @JsonProperty("cache_creation_token_details") + private CacheCreationTokenDetails cacheCreationTokenDetails; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -104,6 +110,77 @@ public void setCachedTokens(@Nullable final Integer cachedTokens) { this.cachedTokens = cachedTokens; } + /** + * Set the cacheCreationTokens of this {@link TokenUsagePromptTokensDetails} instance and return + * the same instance. + * + * @param cacheCreationTokens Number of tokens written to the cache (Anthropic only). + * @return The same instance of this {@link TokenUsagePromptTokensDetails} class + */ + @Nonnull + public TokenUsagePromptTokensDetails cacheCreationTokens( + @Nullable final Integer cacheCreationTokens) { + this.cacheCreationTokens = cacheCreationTokens; + return this; + } + + /** + * Number of tokens written to the cache (Anthropic only). + * + * @return cacheCreationTokens The cacheCreationTokens of this {@link + * TokenUsagePromptTokensDetails} instance. + */ + @Nonnull + public Integer getCacheCreationTokens() { + return cacheCreationTokens; + } + + /** + * Set the cacheCreationTokens of this {@link TokenUsagePromptTokensDetails} instance. + * + * @param cacheCreationTokens Number of tokens written to the cache (Anthropic only). + */ + public void setCacheCreationTokens(@Nullable final Integer cacheCreationTokens) { + this.cacheCreationTokens = cacheCreationTokens; + } + + /** + * Set the cacheCreationTokenDetails of this {@link TokenUsagePromptTokensDetails} instance and + * return the same instance. + * + * @param cacheCreationTokenDetails The cacheCreationTokenDetails of this {@link + * TokenUsagePromptTokensDetails} + * @return The same instance of this {@link TokenUsagePromptTokensDetails} class + */ + @Nonnull + public TokenUsagePromptTokensDetails cacheCreationTokenDetails( + @Nullable final CacheCreationTokenDetails cacheCreationTokenDetails) { + this.cacheCreationTokenDetails = cacheCreationTokenDetails; + return this; + } + + /** + * Get cacheCreationTokenDetails + * + * @return cacheCreationTokenDetails The cacheCreationTokenDetails of this {@link + * TokenUsagePromptTokensDetails} instance. + */ + @Nonnull + public CacheCreationTokenDetails getCacheCreationTokenDetails() { + return cacheCreationTokenDetails; + } + + /** + * Set the cacheCreationTokenDetails of this {@link TokenUsagePromptTokensDetails} instance. + * + * @param cacheCreationTokenDetails The cacheCreationTokenDetails of this {@link + * TokenUsagePromptTokensDetails} + */ + public void setCacheCreationTokenDetails( + @Nullable final CacheCreationTokenDetails cacheCreationTokenDetails) { + this.cacheCreationTokenDetails = cacheCreationTokenDetails; + } + /** * Get the names of the unrecognizable properties of the {@link TokenUsagePromptTokensDetails}. * @@ -146,6 +223,9 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (audioTokens != null) declaredFields.put("audioTokens", audioTokens); if (cachedTokens != null) declaredFields.put("cachedTokens", cachedTokens); + if (cacheCreationTokens != null) declaredFields.put("cacheCreationTokens", cacheCreationTokens); + if (cacheCreationTokenDetails != null) + declaredFields.put("cacheCreationTokenDetails", cacheCreationTokenDetails); return declaredFields; } @@ -175,12 +255,22 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals( this.cloudSdkCustomFields, tokenUsagePromptTokensDetails.cloudSdkCustomFields) && Objects.equals(this.audioTokens, tokenUsagePromptTokensDetails.audioTokens) - && Objects.equals(this.cachedTokens, tokenUsagePromptTokensDetails.cachedTokens); + && Objects.equals(this.cachedTokens, tokenUsagePromptTokensDetails.cachedTokens) + && Objects.equals( + this.cacheCreationTokens, tokenUsagePromptTokensDetails.cacheCreationTokens) + && Objects.equals( + this.cacheCreationTokenDetails, + tokenUsagePromptTokensDetails.cacheCreationTokenDetails); } @Override public int hashCode() { - return Objects.hash(audioTokens, cachedTokens, cloudSdkCustomFields); + return Objects.hash( + audioTokens, + cachedTokens, + cacheCreationTokens, + cacheCreationTokenDetails, + cloudSdkCustomFields); } @Override @@ -190,6 +280,12 @@ public String toString() { sb.append("class TokenUsagePromptTokensDetails {\n"); sb.append(" audioTokens: ").append(toIndentedString(audioTokens)).append("\n"); sb.append(" cachedTokens: ").append(toIndentedString(cachedTokens)).append("\n"); + sb.append(" cacheCreationTokens: ") + .append(toIndentedString(cacheCreationTokens)) + .append("\n"); + sb.append(" cacheCreationTokenDetails: ") + .append(toIndentedString(cacheCreationTokenDetails)) + .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/UserChatMessageContentItem.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/UserChatMessageContentItem.java index 2de971c1a..c3f1d9721 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/UserChatMessageContentItem.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/UserChatMessageContentItem.java @@ -102,6 +102,9 @@ public static TypeEnum fromValue(@Nonnull final String value) { @JsonProperty("file") private FileContent _file; + @JsonProperty("cache_control") + private CacheControl cacheControl; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -233,6 +236,38 @@ public void setFile(@Nullable final FileContent _file) { this._file = _file; } + /** + * Set the cacheControl of this {@link UserChatMessageContentItem} instance and return the same + * instance. + * + * @param cacheControl The cacheControl of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link UserChatMessageContentItem} instance. + * + * @param cacheControl The cacheControl of this {@link UserChatMessageContentItem} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + /** * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. * @@ -277,6 +312,7 @@ public Map toMap() { if (text != null) declaredFields.put("text", text); if (imageUrl != null) declaredFields.put("imageUrl", imageUrl); if (_file != null) declaredFields.put("_file", _file); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); return declaredFields; } @@ -306,12 +342,13 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.type, userChatMessageContentItem.type) && Objects.equals(this.text, userChatMessageContentItem.text) && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl) - && Objects.equals(this._file, userChatMessageContentItem._file); + && Objects.equals(this._file, userChatMessageContentItem._file) + && Objects.equals(this.cacheControl, userChatMessageContentItem.cacheControl); } @Override public int hashCode() { - return Objects.hash(type, text, imageUrl, _file, cloudSdkCustomFields); + return Objects.hash(type, text, imageUrl, _file, cacheControl, cloudSdkCustomFields); } @Override @@ -323,6 +360,7 @@ public String toString() { sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/orchestration/src/main/resources/spec/orchestration.yaml b/orchestration/src/main/resources/spec/orchestration.yaml index 0b8685a53..a064c44eb 100644 --- a/orchestration/src/main/resources/spec/orchestration.yaml +++ b/orchestration/src/main/resources/spec/orchestration.yaml @@ -40,6 +40,9 @@ paths: summary: orchestrated completion inference description: Run an orchestrated completion inference request operationId: orchestration.v2.endpoints.create + parameters: + - $ref: "#/components/parameters/AIResourceGroup" + - $ref: "#/components/parameters/AIObjectStoreSecretName" requestBody: required: true content: @@ -82,6 +85,119 @@ paths: application/json: schema: $ref: "#/components/schemas/EmbeddingsPostResponse" + examples: + array_embeddings: + summary: Array format (single encoding_format) + description: Standard response format when a single encoding format is requested. Used by OpenAI, AWS Bedrock, VertexAI, Nvidia, and Cohere with single format. + value: + request_id: "d4a67ea1-2bf9-4df7-8105-d48203ccff76" + final_result: + object: "list" + data: + - object: "embedding" + embedding: + - 0.015282119 + - 0.013516456 + - 0.002541946 + - -0.010837519 + index: 0 + - object: "embedding" + embedding: + - 0.035031624 + - -0.0077586817 + - 0.018221147 + - 0.00446712 + index: 1 + model: "text-embedding-ada-002" + usage: + prompt_tokens: 5 + total_tokens: 5 + base64_embeddings: + summary: Base64 string format (single encoding_format) + description: Response format when base64 encoding format is requested. The embedding is returned as a base64-encoded string. + value: + request_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + final_result: + object: "list" + data: + - object: "embedding" + embedding: "2mF6PCB0XTzHliY72Y8xvOalM6uLmZjLyu7ze9==" + index: 0 + - object: "embedding" + embedding: "8nB7QDB1YUzImiZ82Z9ywPbmN7vMnajMzv8zf+==" + index: 1 + model: "text-embedding-3-large" + usage: + prompt_tokens: 5 + total_tokens: 5 + cohere_multi_type_embeddings: + summary: Dictionary format (multiple encoding_formats - Cohere only) + description: Response format when multiple encoding formats are requested (Cohere-specific feature). Each result contains a dictionary mapping format names to their respective embeddings. + value: + request_id: "f5ba36c6-a687-4e0c-b7e4-26b623256baf" + final_result: + object: "list" + data: + - object: "embedding" + embedding: + float: + - 0.015282119 + - 0.013516456 + - 0.002541946 + - -0.010837519 + uint8: + - 142 + - 137 + - 124 + - 106 + index: 0 + - object: "embedding" + embedding: + float: + - 0.035031624 + - -0.0077586817 + - 0.018221147 + - 0.00446712 + uint8: + - 151 + - 119 + - 133 + - 125 + index: 1 + model: "cohere--single-serving-embed" + usage: + prompt_tokens: 12 + total_tokens: 12 + cohere_mixed_types_embeddings: + summary: Dictionary format with mixed types (Cohere only) + description: Response format when multiple encoding formats of different types are requested (e.g., float arrays and base64 strings). + value: + request_id: "11c785a2-09c7-4b12-b86e-3a3ff7ece72e" + final_result: + object: "dict" + data: + - object: "embedding" + embedding: + float: + - 0.015282119 + - 0.013516456 + - 0.002541946 + - -0.010837519 + base64: "2mF6PCB0XTzHliY72Y8xvOalM6uLmZjLyu7ze9==" + index: 0 + - object: "embedding" + embedding: + float: + - 0.035031624 + - -0.0077586817 + - 0.018221147 + - 0.00446712 + base64: "8nB7QDB1YUzImiZ82Z9ywPbmN7vMnajMzv8zf+==" + index: 1 + model: "cohere--single-serving-embed" + usage: + prompt_tokens: 12 + total_tokens: 12 "400": $ref: "#/components/responses/BadRequest" default: @@ -89,6 +205,27 @@ paths: components: + parameters: + AIResourceGroup: + in: header + name: AI-Resource-Group + description: "Feedback specific - resource group of the feedback service object store secret." + required: false + schema: + maxLength: 253 + minLength: 3 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9.-]{1,251}[a-zA-Z0-9]$ + type: string + AIObjectStoreSecretName: + in: header + name: AI-Object-Store-Secret-Name + description: "Feedback specific - name of the feedback service object store secret." + required: false + schema: + maxLength: 233 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string securitySchemes: Oauth2: type: oauth2 @@ -135,7 +272,7 @@ components: $ref: "#/components/schemas/EmbeddingsInputText" type: type: string - enum: ["text", "document", "query"] + enum: ["text", "document", "query", "search_document", "search_query", "classification", "clustering", "image"] EmbeddingsInputText: oneOf: - type: string @@ -186,13 +323,18 @@ components: type: integer default: 600 minimum: 1 - maximum: 600 + maximum: 1200 max_retries: description: Maximum number of retries for the Embeddings request. This parameter is currently ignored for Vertex AI models. type: integer default: 2 minimum: 0 maximum: 5 + EncodingFormat: + type: string + enum: [float, base64, binary, int8, uint8, ubinary] + description: Encoding format for embeddings. + EmbeddingsModelParams: type: object description: Additional parameters for generating input's embeddings. Default values are used for mandatory parameters. @@ -203,9 +345,14 @@ components: description: > The number of dimensions the resulting output embeddings should have. encoding_format: - type: string - enum: [float, base64, binary] + oneOf: + - $ref: "#/components/schemas/EncodingFormat" + - type: array + items: + $ref: "#/components/schemas/EncodingFormat" + minItems: 1 description: > + The format to return the embeddings in. Can be a single format or an array of formats. OpenAI's spec allows for 'float' and 'base64' encoding formats. normalize: type: boolean @@ -282,14 +429,52 @@ components: index: type: integer description: The index of the embedding in the list of embeddings. - Embedding: - oneOf: - - type: array + EmbeddingFloatArray: + type: array + items: + type: number + description: "An array of floating point numbers representing the embedding. " + EmbeddingBase64String: + type: string + description: "A single base64 string representing the embedding." + EmbeddingMultiFormat: + type: object + description: "A dictionary mapping encoding format names to their embeddings. Used when multiple encoding formats are requested (Cohere-specific)." + additionalProperties: false + properties: + float: + type: array items: type: number - description: "An array of numbers representing the embedding." - - type: string - description: "A single base64 string representing the embedding." + description: "Float encoding format - array of floating point numbers" + int8: + type: array + items: + type: integer + description: "Int8 encoding format - array of 8-bit integers" + uint8: + type: array + items: + type: integer + description: "Uint8 encoding format - array of unsigned 8-bit integers" + base64: + type: string + description: "Base64 encoding format - base64 encoded string" + binary: + type: array + items: + type: integer + description: "Binary encoding format - array of integers" + ubinary: + type: array + items: + type: integer + description: "Ubinary encoding format - array of unsigned integers" + Embedding: + oneOf: + - $ref: "#/components/schemas/EmbeddingFloatArray" + - $ref: "#/components/schemas/EmbeddingBase64String" + - $ref: "#/components/schemas/EmbeddingMultiFormat" # Chat Completion Schemas ChatMessages: @@ -380,6 +565,8 @@ components: $ref: "#/components/schemas/ImageContentUrl" file: $ref: "#/components/schemas/FileContent" + cache_control: + $ref: "#/components/schemas/CacheControl" required: - type ImageContentUrl: @@ -507,6 +694,37 @@ components: enum: ["text"] text: type: string + cache_control: + $ref: "#/components/schemas/CacheControl" + CacheControl: + type: object + description: > + Cache control directive for Anthropic prompt caching. Only applicable to + Anthropic Claude models. When set, marks the content block as a cache breakpoint. + additionalProperties: false + required: + - type + properties: + type: + type: string + enum: ["ephemeral"] + ttl: + type: string + description: > + Time-to-live for the cache entry. Default is "5m" (5 minutes). + "1h" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + enum: ["5m", "1h"] + CacheCreationTokenDetails: + type: object + description: Breakdown of cache creation tokens by TTL (Anthropic only). + additionalProperties: false + properties: + ephemeral_5m_input_tokens: + type: integer + description: Tokens cached with 5-minute TTL. + ephemeral_1h_input_tokens: + type: integer + description: Tokens cached with 1-hour TTL. ChatDelta: type: object required: @@ -708,7 +926,7 @@ components: message: type: string description: Some message created from the module - example: Input to LLM is masked successfully. + example: Masking module executed successfully on LLM input. data: type: object description: Additional data object from the module @@ -911,6 +1129,12 @@ components: cached_tokens: type: integer description: Cached tokens present in the prompt. + cache_creation_tokens: + type: integer + description: > + Number of tokens written to the cache (Anthropic only). + cache_creation_token_details: + $ref: "#/components/schemas/CacheCreationTokenDetails" completion_tokens_details: type: object description: Breakdown of tokens used in a completion. @@ -988,7 +1212,7 @@ components: type: integer default: 600 minimum: 1 - maximum: 600 + maximum: 1200 max_retries: description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. type: integer @@ -1119,6 +1343,8 @@ components: description: The type of the tool. Currently, only `function` is supported. function: $ref: "#/components/schemas/FunctionObject" + cache_control: + $ref: "#/components/schemas/CacheControl" required: - type - function @@ -1440,7 +1666,7 @@ components: properties: masking_providers: deprecated: true - description: "List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead." + description: "List of masking service providers. **DEPRECATED**: will be removed March 20, 2027. Use `providers` property instead." type: array minItems: 1 items: @@ -1492,6 +1718,12 @@ components: type: boolean default: false description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module + mask_file_input_method: + description: Type of masking method to be used for file inputs. Required if file inputs are provided. + type: string + enum: + - anonymization + - skip DPIEntityConfig: oneOf: