Class EmbeddingUtil

java.lang.Object
org.springframework.ai.embedding.EmbeddingUtil

public class EmbeddingUtil extends Object
Author:
Christian Tzolov
  • Constructor Details

    • EmbeddingUtil

      public EmbeddingUtil()
  • Method Details

    • dimensions

      public static int dimensions(EmbeddingClient embeddingClient, String modelName)
      Return the dimension of the requested embedding model name. If the model name is unknown uses the EmbeddingClient to perform a dummy EmbeddingClient#embed and count the response dimensions.
      Parameters:
      embeddingClient - Fall-back client to determine, empirically the dimensions.
      modelName - Embedding model name to retrieve the dimensions for.
      Returns:
      Returns the embedding dimensions for the modelName.