java.lang.Object
org.elasticsearch.xpack.core.inference.results.TextEmbeddingUtils

public class TextEmbeddingUtils extends Object
  • Method Details

    • getFirstEmbeddingSize

      public static int getFirstEmbeddingSize(List<EmbeddingInt> embeddings) throws IllegalStateException
      Returns the first text embedding entry's array size.
      Parameters:
      embeddings - the list of embeddings
      Returns:
      the size of the text embedding
      Throws:
      IllegalStateException - if the list of embeddings is empty
    • validateInputSizeAgainstEmbeddings

      public static void validateInputSizeAgainstEmbeddings(List<String> inputs, int embeddingSize)
      Throws an exception if the number of elements in the input text list is different than the results in text embedding response.