Record Class MlChunkedTextEmbeddingFloatResults.EmbeddingChunk

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

public static record MlChunkedTextEmbeddingFloatResults.EmbeddingChunk(String matchedText, double[] embedding) extends Record implements Writeable, ToXContentObject
  • 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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface 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