Class Embedding

java.lang.Object
com.codename1.ai.Embedding

public final class Embedding extends Object
One vector returned by an embedding provider. The vector is defensively copied on construction and access so callers cannot mutate stored results. getIndex() identifies the corresponding input position in a batched EmbeddingRequest.
  • Constructor Details

    • Embedding

      public Embedding(float[] vector, int index)
      Creates an embedding result.
      Parameters:
      vector - numeric embedding coordinates, defensively copied; a null value creates an empty vector
      index - zero-based position of the corresponding request input
  • Method Details

    • getVector

      public float[] getVector()
      Returns:
      a defensive copy of the embedding coordinates
    • getIndex

      public int getIndex()
      Returns:
      zero-based position of this item in the request
    • getDimensions

      public int getDimensions()
      Returns:
      number of coordinates in the embedding