java.lang.Object
java.lang.Record
org.elasticsearch.inference.InferenceString
This class represents a String which may be raw text, or the String representation of some other data such as an image in base64
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes the type of data represented by anInferenceString -
Constructor Summary
ConstructorsConstructorDescriptionInferenceString(String value, InferenceString.DataType dataType) Constructs anInferenceStringwith the given value andInferenceString.DataType -
Method Summary
Modifier and TypeMethodDescriptiondataType()Returns the value of thedataTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisImage()booleanisText()final StringtoString()Returns a string representation of this record class.toStringList(List<InferenceString> inferenceStrings) Converts a list ofInferenceStringto a list ofString.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
InferenceString
Constructs anInferenceStringwith the given value andInferenceString.DataType- Parameters:
value- the String valuedataType- the type of data that the String represents
-
-
Method Details
-
isImage
public boolean isImage() -
isText
public boolean isText() -
toStringList
Converts a list ofInferenceStringto a list ofString. This method should only be called in code paths that do not deal with multimodal inputs; where all inputs are guaranteed to be raw text, since it discards theInferenceString.DataTypeassociated with each input.- Parameters:
inferenceStrings- The list ofInferenceStringto convert to a list ofString- Returns:
- a list of String inference inputs that do not contain any non-text inputs
-
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). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
dataType
Returns the value of thedataTyperecord component.- Returns:
- the value of the
dataTyperecord component
-