Class SpringAiEmbeddingService

  • All Implemented Interfaces:
    com.embabel.common.ai.model.AiModel , com.embabel.common.ai.model.EmbeddingService , com.embabel.common.ai.model.EmbeddingServiceMetadata , com.embabel.common.ai.model.ModelMetadata , com.embabel.common.core.types.HasInfoString

    
    public final class SpringAiEmbeddingService
     implements EmbeddingService
                        

    Wraps a Spring AI EmbeddingModel exposing an embedding service.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Integer getDimensions() Dimension of the embedding vectors produced by this model
      String getName() Name of the LLM, such as "gpt-3.
      String getProvider() Name of the provider, such as "OpenAI"
      EmbeddingModel getModel()
      FloatArray embed(String text) Embed a single text in vector space
      List<FloatArray> embed(List<String> texts) Embed multiple texts in vector space Use this method for better performance when embedding multiple texts
      • Methods inherited from class com.embabel.common.ai.model.ModelMetadata

        getType
      • Methods inherited from class com.embabel.common.ai.model.AiModel

        infoString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpringAiEmbeddingService

        SpringAiEmbeddingService(String name, String provider, EmbeddingModel model)
    • Method Detail

      • getName

         String getName()

        Name of the LLM, such as "gpt-3.5-turbo"

      • embed

         List<FloatArray> embed(List<String> texts)

        Embed multiple texts in vector space Use this method for better performance when embedding multiple texts

        Returns:

        list of embedding vectors corresponding to the input texts