Module org.elasticsearch.xcore
Record Class TextEmbeddingBitResults
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.core.inference.results.TextEmbeddingBitResults
- All Implemented Interfaces:
NamedWriteable,Writeable,ChunkedToXContent,InferenceServiceResults,EmbeddingResults<TextEmbeddingByteResults.Embedding>,TextEmbeddingResults<TextEmbeddingByteResults.Embedding>
public record TextEmbeddingBitResults(List<TextEmbeddingByteResults.Embedding> embeddings)
extends Record
implements TextEmbeddingResults<TextEmbeddingByteResults.Embedding>
Writes a text embedding result in the follow json format
{
"text_embedding_bytes": [
{
"embedding": [
23
]
},
{
"embedding": [
-23
]
}
]
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xpack.core.inference.results.EmbeddingResults
EmbeddingResults.Chunk, EmbeddingResults.Embedding<E extends EmbeddingResults.Embedding<E>>Nested classes/interfaces inherited from interface org.elasticsearch.inference.InferenceServiceResults
InferenceServiceResults.ResultNested 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
ConstructorsConstructorDescriptionCreates an instance of aTextEmbeddingBitResultsrecord 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, toXContentChunkedV7Methods inherited from interface org.elasticsearch.inference.InferenceServiceResults
isStreaming, publisher
-
Field Details
-
NAME
- See Also:
-
TEXT_EMBEDDING_BITS
- See Also:
-
-
Constructor Details
-
TextEmbeddingBitResults
- Throws:
IOException
-
TextEmbeddingBitResults
Creates an instance of aTextEmbeddingBitResultsrecord class.- Parameters:
embeddings- the value for theembeddingsrecord component
-
-
Method Details
-
getFirstEmbeddingSize
public int getFirstEmbeddingSize()Description copied from interface:TextEmbeddingResultsReturns the first text embedding entry in the result list's array size.- Specified by:
getFirstEmbeddingSizein interfaceTextEmbeddingResults<TextEmbeddingByteResults.Embedding>- 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- Specified by:
toXContentChunkedin interfaceInferenceServiceResults
-
writeTo
- Specified by:
writeToin interfaceInferenceServiceResults- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceInferenceServiceResults- 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.- Specified by:
embeddingsin interfaceEmbeddingResults<TextEmbeddingByteResults.Embedding>- Returns:
- the value of the
embeddingsrecord component
-