Package com.openai.models.embeddings
Class EmbeddingValue
-
- All Implemented Interfaces:
public final class EmbeddingValueRepresents embedding data that can be either a list of floats or base64-encoded string. This union type allows for efficient handling of both formats.
This class is immutable - all instances are thread-safe and cannot be modified after creation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEmbeddingValue.VisitorAn interface that defines how to map each variant of EmbeddingValue to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<List<Float>>floats()final Optional<String>base64()final BooleanisFloats()Returns true if this value contains a list of floats. final BooleanisBase64()Returns true if this value contains base64 string data. final List<Float>asFloats()Returns the embedding data as a list of floats. final StringasBase64()Returns the embedding data as a base64 string. final JsonValue_json()final <T extends Any> Taccept(EmbeddingValue.Visitor<T> visitor)final EmbeddingValuevalidate()final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static EmbeddingValueofFloats(List<Float> floats)final static EmbeddingValueofBase64(String base64)-
-
Method Detail
-
asFloats
final List<Float> asFloats()
Returns the embedding data as a list of floats.
If this value represents base64 string data, then it's decoded into floats.
-
asBase64
final String asBase64()
Returns the embedding data as a base64 string.
If this value represents a list of floats, then it's decoded into floats.
-
accept
final <T extends Any> T accept(EmbeddingValue.Visitor<T> visitor)
-
validate
final EmbeddingValue validate()
-
ofFloats
final static EmbeddingValue ofFloats(List<Float> floats)
-
ofBase64
final static EmbeddingValue ofBase64(String base64)
-
-
-
-