public final class Embedding

  1. Object
  2. Embedding
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.

Constructors

public Embedding(float[] vector, int index)Creates an embedding result.

Methods

public float[] getVector()
public int getIndex()
public int getDimensions()

Inherited methods

Constructor details

Embedding

public Embedding(float[] vector, int index)
Creates an embedding result.

Parameters

vector float[]
numeric embedding coordinates, defensively copied; a null value creates an empty vector
index int
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