Module org.elasticsearch.server
Package org.elasticsearch.inference
Record Class InferenceStringGroup
java.lang.Object
java.lang.Record
org.elasticsearch.inference.InferenceStringGroup
- Record Components:
inferenceStrings- the list ofInferenceStringwhich should result in generating a single embedding vector
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentObject
public record InferenceStringGroup(List<InferenceString> inferenceStrings)
extends Record
implements Writeable, ToXContentObject
This class represents a group of one or more
InferenceString which will produce a single embedding when passed to an embedding
provider. Conceptually, this object is equivalent to a "content" object in the embedding request, e.g.
"input": {
"content": [
{"type": "text", "format": "text", "value": "text input"},
{"type": "image", "format": "base64", "value": "data:image/png;base64,..."}
]
}
-
Nested Class Summary
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
FieldsModifier and TypeFieldDescriptionstatic final ConstructingObjectParser<InferenceStringGroup, Void> Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionInferenceStringGroup(String input) InferenceStringGroup(List<InferenceString> inferenceStrings) Creates an instance of aInferenceStringGrouprecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinferenceStringsrecord component.static InferenceStringGroupparse(XContentParser parser) static List<InferenceString> toInferenceStringList(List<InferenceStringGroup> inferenceStringGroups) Converts a list ofInferenceStringGroupto an equally-sized list ofInferenceString.final StringtoString()Returns a string representation of this record class.toStringList(List<InferenceStringGroup> inferenceStringGroups) Converts a list ofInferenceStringGroupto an equally-sized list ofString.toXContent(XContentBuilder builder, ToXContent.Params params) value()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.xcontent.ToXContentObject
isFragment
-
Field Details
-
PARSER
-
-
Constructor Details
-
InferenceStringGroup
- Throws:
IOException
-
InferenceStringGroup
-
InferenceStringGroup
-
InferenceStringGroup
Creates an instance of aInferenceStringGrouprecord class.- Parameters:
inferenceStrings- the value for theinferenceStringsrecord component
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
parse
- Throws:
IOException
-
value
-
textValue
-
toInferenceStringList
public static List<InferenceString> toInferenceStringList(List<InferenceStringGroup> inferenceStringGroups) Converts a list ofInferenceStringGroupto an equally-sized list ofInferenceString.This method should only be called in code paths that do not handle grouped embedding inputs, i.e. code paths that expect to generate one embedding per input rather than one embedding for multiple inputs.
- Parameters:
inferenceStringGroups- the list ofInferenceStringGroupto convert- Returns:
- a list of
InferenceString
-
toStringList
Converts a list ofInferenceStringGroupto an equally-sized list ofString.This method should only be called in code paths that both do not handle grouped embedding inputs AND that do not deal with multimodal inputs, i.e. code paths that expect to generate one embedding per input rather than one embedding for multiple inputs, AND where all inputs are guaranteed to be raw text.
- Parameters:
inferenceStringGroups- the list ofInferenceStringGroupto convert- Returns:
- a list of
InferenceString
-
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. -
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). -
inferenceStrings
Returns the value of theinferenceStringsrecord component.- Returns:
- the value of the
inferenceStringsrecord component
-