Interface EmbeddingModel

All Known Implementing Classes:
AbstractInProcessEmbeddingModel, AllMiniLmL6V2EmbeddingModel, AllMiniLmL6V2QuantizedEmbeddingModel, AzureOpenAiEmbeddingModel, BedrockCohereEmbeddingModel, BedrockTitanEmbeddingModel, BgeSmallEnEmbeddingModel, BgeSmallEnQuantizedEmbeddingModel, BgeSmallEnV15EmbeddingModel, BgeSmallEnV15QuantizedEmbeddingModel, BgeSmallZhV15EmbeddingModel, BgeSmallZhV15QuantizedEmbeddingModel, CohereEmbeddingModel, DimensionAwareEmbeddingModel, DisabledEmbeddingModel, E5SmallV2EmbeddingModel, E5SmallV2QuantizedEmbeddingModel, GitHubModelsEmbeddingModel, GoogleAiEmbeddingModel, HuggingFaceEmbeddingModel, JinaEmbeddingModel, JlamaEmbeddingModel, LocalAiEmbeddingModel, MistralAiEmbeddingModel, NomicEmbeddingModel, OllamaEmbeddingModel, OnnxEmbeddingModel, OpenAiEmbeddingModel, OpenAiOfficialEmbeddingModel, OracleEmbeddingModel, OvhAiEmbeddingModel, VertexAiEmbeddingModel, VoyageAiEmbeddingModel, WatsonxEmbeddingModel, WorkersAiEmbeddingModel

public interface EmbeddingModel
Represents a model that can convert a given text into an embedding (vector representation of the text).
  • Method Details

    • embed

      default Response<Embedding> embed(String text)
      Embed a text.
      Parameters:
      text - the text to embed.
      Returns:
      the embedding.
    • embed

      default Response<Embedding> embed(TextSegment textSegment)
      Embed the text content of a TextSegment.
      Parameters:
      textSegment - the text segment to embed.
      Returns:
      the embedding.
    • embedAll

      Response<List<Embedding>> embedAll(List<TextSegment> textSegments)
      Embeds the text content of a list of TextSegments.
      Parameters:
      textSegments - the text segments to embed.
      Returns:
      the embeddings.
    • dimension

      default int dimension()
      Returns the dimension of the Embedding produced by this embedding model.
      Returns:
      dimension of the embedding
    • modelName

      default String modelName()
      Returns the name of the underlying embedding model.

      Implementations are encouraged to override this method and provide the actual model name. The default implementation returns "unknown", which indicates that the model name is unknown.

      Returns:
      the model name or a fallback value if not provided