Record Class MlChunkedTextEmbeddingFloatResults.EmbeddingChunk

java.lang.Object
java.lang.Record
org.elasticsearch.xpack.core.ml.inference.results.MlChunkedTextEmbeddingFloatResults.EmbeddingChunk
All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject
Enclosing class:
MlChunkedTextEmbeddingFloatResults

public static record MlChunkedTextEmbeddingFloatResults.EmbeddingChunk(String matchedText, double[] embedding) extends Record implements Writeable, org.elasticsearch.xcontent.ToXContentObject
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY, EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    EmbeddingChunk(String matchedText, double[] embedding)
    Creates an instance of a EmbeddingChunk record class.
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    double[]
    Returns the value of the embedding record component.
    boolean
    It appears the default equals function for a record does not call Arrays.equals() for the embedding array.
    int
    Use Arrays.hashCode() on the embedding array
    Returns the value of the matchedText record component.
    final String
    Returns a string representation of this record class.
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    void
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentObject

    isFragment
  • Constructor Details

    • EmbeddingChunk

      public EmbeddingChunk(StreamInput in) throws IOException
      Throws:
      IOException
    • EmbeddingChunk

      public EmbeddingChunk(String matchedText, double[] embedding)
      Creates an instance of a EmbeddingChunk record class.
      Parameters:
      matchedText - the value for the matchedText record component
      embedding - the value for the embedding record component
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • asMap

      public Map<String,Object> asMap()
    • equals

      public boolean equals(Object o)
      It appears the default equals function for a record does not call Arrays.equals() for the embedding array.
      Specified by:
      equals in class Record
    • hashCode

      public int hashCode()
      Use Arrays.hashCode() on the embedding array
      Specified by:
      hashCode in class Record
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • matchedText

      public String matchedText()
      Returns the value of the matchedText record component.
      Returns:
      the value of the matchedText record component
    • embedding

      public double[] embedding()
      Returns the value of the embedding record component.
      Returns:
      the value of the embedding record component