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 1089a76c0..5287cbae8 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,22 +46,4 @@ 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 deleted file mode 100644 index 4418aea33..000000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingMultiFormat.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * 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 7e13cfde8..c5f45f1b4 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,21 +44,6 @@ 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/EmbeddingsModelParams.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParams.java index d9bcabe22..e401734b4 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,8 +13,10 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; @@ -34,8 +36,68 @@ 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 EmbeddingsModelParamsEncodingFormat encodingFormat; + private EncodingFormatEnum encodingFormat; @JsonProperty("normalize") private Boolean normalize; @@ -81,33 +143,33 @@ public void setDimensions(@Nullable final Integer dimensions) { * Set the encodingFormat of this {@link EmbeddingsModelParams} instance and return the same * instance. * - * @param encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} + * @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 EmbeddingsModelParamsEncodingFormat encodingFormat) { + public EmbeddingsModelParams encodingFormat(@Nullable final EncodingFormatEnum encodingFormat) { this.encodingFormat = encodingFormat; return this; } /** - * Get encodingFormat + * OpenAI's spec allows for 'float' and 'base64' encoding formats. * * @return encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} instance. */ @Nonnull - public EmbeddingsModelParamsEncodingFormat getEncodingFormat() { + public EncodingFormatEnum getEncodingFormat() { return encodingFormat; } /** * Set the encodingFormat of this {@link EmbeddingsModelParams} instance. * - * @param encodingFormat The encodingFormat of this {@link EmbeddingsModelParams} + * @param encodingFormat OpenAI's spec allows for 'float' and 'base64' + * encoding formats. */ - public void setEncodingFormat( - @Nullable final EmbeddingsModelParamsEncodingFormat encodingFormat) { + public void setEncodingFormat(@Nullable final EncodingFormatEnum 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 deleted file mode 100644 index 70befd6f9..000000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EmbeddingsModelParamsEncodingFormat.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index 1572bc7d0..000000000 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/EncodingFormat.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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/resources/spec/orchestration.yaml b/orchestration/src/main/resources/spec/orchestration.yaml index 64ae00d86..213aac2ac 100644 --- a/orchestration/src/main/resources/spec/orchestration.yaml +++ b/orchestration/src/main/resources/spec/orchestration.yaml @@ -85,119 +85,6 @@ 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: @@ -272,7 +159,7 @@ components: $ref: "#/components/schemas/EmbeddingsInputText" type: type: string - enum: ["text", "document", "query", "search_document", "search_query", "classification", "clustering", "image"] + enum: ["text", "document", "query"] EmbeddingsInputText: oneOf: - type: string @@ -330,11 +217,6 @@ components: 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. @@ -345,14 +227,9 @@ components: description: > The number of dimensions the resulting output embeddings should have. encoding_format: - oneOf: - - $ref: "#/components/schemas/EncodingFormat" - - type: array - items: - $ref: "#/components/schemas/EncodingFormat" - minItems: 1 + type: string + enum: [float, base64, binary] 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 @@ -429,52 +306,14 @@ components: index: type: integer description: The index of the embedding in the list of embeddings. - 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: "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" + - 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: