Class Embedding

java.lang.Object
org.springframework.ai.embedding.Embedding
All Implemented Interfaces:
ModelResult<float[]>

public class Embedding extends Object implements ModelResult<float[]>
Represents a single embedding vector.
  • Constructor Details

    • Embedding

      public Embedding(float[] embedding, Integer index)
      Creates a new Embedding instance.
      Parameters:
      embedding - the embedding vector values.
      index - the embedding index in a list of embeddings.
    • Embedding

      public Embedding(float[] embedding, Integer index, EmbeddingResultMetadata metadata)
      Creates a new Embedding instance.
      Parameters:
      embedding - the embedding vector values.
      index - the embedding index in a list of embeddings.
      metadata - the metadata associated with the embedding.
  • Method Details

    • getOutput

      public float[] getOutput()
      Description copied from interface: ModelResult
      Retrieves the output generated by the AI model.
      Specified by:
      getOutput in interface ModelResult<float[]>
      Returns:
      Get the embedding vector values.
    • getIndex

      public Integer getIndex()
      Returns:
      Get the embedding index in a list of embeddings.
    • getMetadata

      public EmbeddingResultMetadata getMetadata()
      Description copied from interface: ModelResult
      Retrieves the metadata associated with the result of an AI model.
      Specified by:
      getMetadata in interface ModelResult<float[]>
      Returns:
      Get the metadata associated with the embedding.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object