Class EmbeddingCreateParams.Input
-
- All Implemented Interfaces:
public final class EmbeddingCreateParams.InputInput text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEmbeddingCreateParams.Input.VisitorAn interface that defines how to map each variant of Input to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>string()The string that will be turned into an embedding. final Optional<List<String>>arrayOfStrings()The array of strings that will be turned into an embedding. final Optional<List<Long>>arrayOfTokens()The array of integers that will be turned into an embedding. final Optional<List<List<Long>>>arrayOfTokenArrays()The array of arrays containing integers that will be turned into an embedding. final BooleanisString()final BooleanisArrayOfStrings()final BooleanisArrayOfTokens()final BooleanisArrayOfTokenArrays()final StringasString()The string that will be turned into an embedding. final List<String>asArrayOfStrings()The array of strings that will be turned into an embedding. final List<Long>asArrayOfTokens()The array of integers that will be turned into an embedding. final List<List<Long>>asArrayOfTokenArrays()The array of arrays containing integers that will be turned into an embedding. final Optional<JsonValue>_json()final <T extends Any> Taccept(EmbeddingCreateParams.Input.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final EmbeddingCreateParams.Inputvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static EmbeddingCreateParams.InputofString(String string)The string that will be turned into an embedding. final static EmbeddingCreateParams.InputofArrayOfStrings(List<String> arrayOfStrings)The array of strings that will be turned into an embedding. final static EmbeddingCreateParams.InputofArrayOfTokens(List<Long> arrayOfTokens)The array of integers that will be turned into an embedding. final static EmbeddingCreateParams.InputofArrayOfTokenArrays(List<List<Long>> arrayOfTokenArrays)The array of arrays containing integers that will be turned into an embedding. -
-
Method Detail
-
arrayOfStrings
final Optional<List<String>> arrayOfStrings()
The array of strings that will be turned into an embedding.
-
arrayOfTokens
final Optional<List<Long>> arrayOfTokens()
The array of integers that will be turned into an embedding.
-
arrayOfTokenArrays
final Optional<List<List<Long>>> arrayOfTokenArrays()
The array of arrays containing integers that will be turned into an embedding.
-
isArrayOfStrings
final Boolean isArrayOfStrings()
-
isArrayOfTokens
final Boolean isArrayOfTokens()
-
isArrayOfTokenArrays
final Boolean isArrayOfTokenArrays()
-
asArrayOfStrings
final List<String> asArrayOfStrings()
The array of strings that will be turned into an embedding.
-
asArrayOfTokens
final List<Long> asArrayOfTokens()
The array of integers that will be turned into an embedding.
-
asArrayOfTokenArrays
final List<List<Long>> asArrayOfTokenArrays()
The array of arrays containing integers that will be turned into an embedding.
-
accept
final <T extends Any> T accept(EmbeddingCreateParams.Input.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = input.accept(new Input.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final EmbeddingCreateParams.Input validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofString
final static EmbeddingCreateParams.Input ofString(String string)
The string that will be turned into an embedding.
-
ofArrayOfStrings
final static EmbeddingCreateParams.Input ofArrayOfStrings(List<String> arrayOfStrings)
The array of strings that will be turned into an embedding.
-
ofArrayOfTokens
final static EmbeddingCreateParams.Input ofArrayOfTokens(List<Long> arrayOfTokens)
The array of integers that will be turned into an embedding.
-
ofArrayOfTokenArrays
final static EmbeddingCreateParams.Input ofArrayOfTokenArrays(List<List<Long>> arrayOfTokenArrays)
The array of arrays containing integers that will be turned into an embedding.
-
-
-
-