Module org.elasticsearch.xcore
Record Class InferenceTextEmbeddingByteResults
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.core.inference.results.InferenceTextEmbeddingByteResults
- All Implemented Interfaces:
NamedWriteable,Writeable,ChunkedToXContent,InferenceServiceResults,TextEmbedding
public record InferenceTextEmbeddingByteResults(List<InferenceTextEmbeddingByteResults.InferenceByteEmbedding> embeddings)
extends Record
implements InferenceServiceResults, TextEmbedding
Writes a text embedding result in the follow json format
{
"text_embedding": [
{
"embedding": [
23
]
},
{
"embedding": [
-23
]
}
]
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordNested 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.common.xcontent.ChunkedToXContent
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionInferenceTextEmbeddingByteResults(List<InferenceTextEmbeddingByteResults.InferenceByteEmbedding> embeddings) Creates an instance of aInferenceTextEmbeddingByteResultsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns the value of theembeddingsrecord component.booleanIndicates whether some other object is "equal to" this one.intReturns the first text embedding entry in the result list's array size.inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) List<? extends InferenceResults> List<? extends InferenceResults> voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8Methods inherited from interface org.elasticsearch.inference.InferenceServiceResults
isStreaming, publisher
-
Field Details
-
NAME
- See Also:
-
TEXT_EMBEDDING_BYTES
- See Also:
-
-
Constructor Details
-
InferenceTextEmbeddingByteResults
- Throws:
IOException
-
InferenceTextEmbeddingByteResults
public InferenceTextEmbeddingByteResults(List<InferenceTextEmbeddingByteResults.InferenceByteEmbedding> embeddings) Creates an instance of aInferenceTextEmbeddingByteResultsrecord class.- Parameters:
embeddings- the value for theembeddingsrecord component
-
-
Method Details
-
getFirstEmbeddingSize
public int getFirstEmbeddingSize()Description copied from interface:TextEmbeddingReturns the first text embedding entry in the result list's array size.- Specified by:
getFirstEmbeddingSizein interfaceTextEmbedding- Returns:
- the size of the text embedding
-
toXContentChunked
public Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) - Specified by:
toXContentChunkedin interfaceChunkedToXContent
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
transformToCoordinationFormat
- Specified by:
transformToCoordinationFormatin interfaceInferenceServiceResults
-
transformToLegacyFormat
- Specified by:
transformToLegacyFormatin interfaceInferenceServiceResults
-
asMap
- Specified by:
asMapin interfaceInferenceServiceResults
-
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). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
embeddings
Returns the value of theembeddingsrecord component.- Returns:
- the value of the
embeddingsrecord component
-