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 Summary
Modifier and TypeMethodDescriptiondefault intReturns the dimension of theEmbeddingproduced by this embedding model.embed(TextSegment textSegment) Embed the text content of a TextSegment.Embed a text.embedAll(List<TextSegment> textSegments) Embeds the text content of a list of TextSegments.default StringReturns the name of the underlying embedding model.
-
Method Details
-
embed
-
embed
Embed the text content of a TextSegment.- Parameters:
textSegment- the text segment to embed.- Returns:
- the embedding.
-
embedAll
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 theEmbeddingproduced by this embedding model.- Returns:
- dimension of the embedding
-
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
-