Module org.elasticsearch.server
Package org.elasticsearch.inference
Record Class MinimalServiceSettings
java.lang.Object
java.lang.Record
org.elasticsearch.inference.MinimalServiceSettings
- Record Components:
 taskType- the type of task the inference model performs.dimensions- the number of dimensions for the embeddings, applicable only forTaskType.TEXT_EMBEDDING(nullable).similarity- the similarity measure used for embeddings, applicable only forTaskType.TEXT_EMBEDDING(nullable).elementType- the type of elements in the embeddings, applicable only forTaskType.TEXT_EMBEDDING(nullable).
- All Implemented Interfaces:
 Diffable<MinimalServiceSettings>,SimpleDiffable<MinimalServiceSettings>,NamedWriteable,VersionedNamedWriteable,Writeable,FilteredXContent,ServiceSettings,ToXContent,ToXContentObject
public record MinimalServiceSettings(String service, TaskType taskType, Integer dimensions, SimilarityMeasure similarity, DenseVectorFieldMapper.ElementType elementType)
extends Record
implements ServiceSettings, SimpleDiffable<MinimalServiceSettings>
Defines the base settings required to configure an inference endpoint.
 These settings are immutable and describe the input and output types that the endpoint will handle.
 They capture the essential properties of an inference model, ensuring the endpoint is correctly configured.
 Key properties include:
 
taskType- Specifies the type of task the model performs, such as classification or text embeddings.dimensions,similarity, andelementType- These settings are applicable only when thetaskTypeisTaskType.TEXT_EMBEDDING. They define the structure and behavior of embeddings.
- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.SimpleDiffable
SimpleDiffable.CompleteDiff<T extends Diffable<T>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> - 
Field Summary
FieldsFields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTYFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS - 
Constructor Summary
ConstructorsConstructorDescriptionMinimalServiceSettings(String service, TaskType taskType, Integer dimensions, SimilarityMeasure similarity, DenseVectorFieldMapper.ElementType elementType) Creates an instance of aMinimalServiceSettingsrecord class.MinimalServiceSettings(Model model)  - 
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the givenMinimalServiceSettingsis equivalent to the current definition.static MinimalServiceSettingschatCompletion(String serviceName) static MinimalServiceSettingscompletion(String serviceName) Returns the value of thedimensionsrecord component.Returns the value of theelementTyperecord component.final booleanIndicates whether some other object is "equal to" this one.Returns aToXContentObjectthat only writes the exposed fields.The minimal version of the recipient this object can be sent toReturns the name of the writeable objectfinal inthashCode()Returns a hash code value for this object.modelId()The model to use in the inference endpoint (e.g.static MinimalServiceSettingsparse(XContentParser parser) static Diff<MinimalServiceSettings> static MinimalServiceSettingsservice()Returns the value of theservicerecord component.Returns the value of thesimilarityrecord component.static MinimalServiceSettingssparseEmbedding(String serviceName) taskType()Returns the value of thetaskTyperecord component.static MinimalServiceSettingstextEmbedding(String serviceName, int dimensions, SimilarityMeasure similarity, DenseVectorFieldMapper.ElementType elementType) toString()Returns a string representation of this record class.toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.inference.ServiceSettings
dimensionsSetByUserMethods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diffMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment 
- 
Field Details
- 
NAME
- See Also:
 
 - 
SERVICE_FIELD
- See Also:
 
 - 
TASK_TYPE_FIELD
- See Also:
 
 
 - 
 - 
Constructor Details
- 
MinimalServiceSettings
public MinimalServiceSettings(@Nullable String service, TaskType taskType, @Nullable Integer dimensions, @Nullable SimilarityMeasure similarity, @Nullable DenseVectorFieldMapper.ElementType elementType) Creates an instance of aMinimalServiceSettingsrecord class.- Parameters:
 service- the value for theservicerecord componenttaskType- the value for thetaskTyperecord componentdimensions- the value for thedimensionsrecord componentsimilarity- the value for thesimilarityrecord componentelementType- the value for theelementTyperecord component
 - 
MinimalServiceSettings
 - 
MinimalServiceSettings
- Throws:
 IOException
 
 - 
 - 
Method Details
- 
parse
- Throws:
 IOException
 - 
textEmbedding
public static MinimalServiceSettings textEmbedding(String serviceName, int dimensions, SimilarityMeasure similarity, DenseVectorFieldMapper.ElementType elementType)  - 
sparseEmbedding
 - 
rerank
 - 
completion
 - 
chatCompletion
 - 
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
 writeToin interfaceWriteable- Throws:
 IOException
 - 
getWriteableName
Description copied from interface:VersionedNamedWriteableReturns the name of the writeable object- Specified by:
 getWriteableNamein interfaceNamedWriteable- Specified by:
 getWriteableNamein interfaceVersionedNamedWriteable
 - 
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to- Specified by:
 getMinimalSupportedVersionin interfaceVersionedNamedWriteable
 - 
getFilteredXContentObject
Description copied from interface:FilteredXContentReturns aToXContentObjectthat only writes the exposed fields. Any hidden fields are not written.- Specified by:
 getFilteredXContentObjectin interfaceFilteredXContent
 - 
modelId
Description copied from interface:ServiceSettingsThe model to use in the inference endpoint (e.g. text-embedding-ada-002). Sometimes the model is not defined in the service settings. This can happen for external providers (e.g. hugging face, azure ai studio) where the provider requires that the model be chosen when initializing a deployment within their service. In this situation, return null.- Specified by:
 modelIdin interfaceServiceSettings- Returns:
 - the model used to perform inference or null if the model is not defined
 
 - 
readDiffFrom
- Throws:
 IOException
 - 
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
 toXContentin interfaceToXContent- Throws:
 IOException
 - 
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. - 
canMergeWith
Checks if the givenMinimalServiceSettingsis equivalent to the current definition. - 
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. - 
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). - 
service
Returns the value of theservicerecord component.- Returns:
 - the value of the 
servicerecord component 
 - 
taskType
Returns the value of thetaskTyperecord component.- Returns:
 - the value of the 
taskTyperecord component 
 - 
dimensions
Returns the value of thedimensionsrecord component.- Specified by:
 dimensionsin interfaceServiceSettings- Returns:
 - the value of the 
dimensionsrecord component 
 - 
similarity
Returns the value of thesimilarityrecord component.- Specified by:
 similarityin interfaceServiceSettings- Returns:
 - the value of the 
similarityrecord component 
 - 
elementType
Returns the value of theelementTyperecord component.- Specified by:
 elementTypein interfaceServiceSettings- Returns:
 - the value of the 
elementTyperecord component 
 
 -