Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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<String, Object> 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 \&quot;5m\&quot; (5 minutes).
* \&quot;1h\&quot; (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 \&quot;5m\&quot; (5 minutes). \&quot;1h\&quot; (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 \&quot;5m\&quot; (5 minutes).
* \&quot;1h\&quot; (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<String> 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<String, Object> toMap() {
final Map<String, Object> 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);
}
}
Loading