Interface EmbeddingRequestParameters
- All Known Implementing Classes:
DefaultEmbeddingRequestParameters, OpenAiEmbeddingRequestParameters
The per-call parameters of an
EmbeddingRequest, such as dimensions() or inputType().
Provider integrations can extend this interface (via DefaultEmbeddingRequestParameters) to add
provider-specific parameters.
Every value carried by these parameters is identified by an EmbeddingParameter token. The set of
tokens actually populated is exposed via presentParameters(); an
EmbeddingModel rejects a request carrying a parameter it does not
list in EmbeddingModel.supportedParameters(), so a parameter a model
cannot apply is never silently ignored.
- Since:
- 1.18.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EmbeddingParameter<Integer> A token identifying the number of dimensions the resulting embeddings should have, for providers that support reducing the output dimensionality.static final EmbeddingRequestParametersEmpty parameters: nothing is populated, sopresentParameters()is empty.static final EmbeddingParameter<EmbeddingInputType> A token identifying theEmbeddingInputType(query vs document), for providers that encode queries and documents differently.static final EmbeddingParameter<String> A token identifying the name of the model to use for this request. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a newEmbeddingRequestParametersby combining the current parameters with the specified ones.<T> Tparameter(EmbeddingParameter<T> parameter) Returns the value of the given parameter, ornullif it is not populated.Returns the set of parameters that are actually populated (non-null) in this instance.
-
Field Details
-
MODEL_NAME
A token identifying the name of the model to use for this request. -
DIMENSIONS
A token identifying the number of dimensions the resulting embeddings should have, for providers that support reducing the output dimensionality. -
INPUT_TYPE
A token identifying theEmbeddingInputType(query vs document), for providers that encode queries and documents differently. -
EMPTY
Empty parameters: nothing is populated, sopresentParameters()is empty.
-
-
Method Details
-
modelName
String modelName() -
dimensions
Integer dimensions() -
inputType
EmbeddingInputType inputType() -
parameter
Returns the value of the given parameter, ornullif it is not populated.- Type Parameters:
T- the value type.- Parameters:
parameter- the parameter token.- Returns:
- the value, or
null.
-
presentParameters
Set<EmbeddingParameter<?>> presentParameters()Returns the set of parameters that are actually populated (non-null) in this instance. This is what anEmbeddingModelvalidates against itsEmbeddingModel.supportedParameters().- Returns:
- the populated parameters; never
null.
-
overrideWith
Creates a newEmbeddingRequestParametersby combining the current parameters with the specified ones. Values from the specified parameters override values from the current parameters when there is overlap. Neither instance is modified.- Parameters:
that- the parameters whose values will override the current ones.- Returns:
- a new combined
EmbeddingRequestParametersinstance.
-
builder
-