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 EmbeddingModeladdListener(EmbeddingModelListener listener) Wraps thisEmbeddingModelwith a listening model that dispatches events to the provided listener.default EmbeddingModeladdListeners(List<EmbeddingModelListener> listeners) Wraps thisEmbeddingModelwith a listening model that dispatches events to the provided listeners.default 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
-
addListener
Wraps thisEmbeddingModelwith a listening model that dispatches events to the provided listener.- Parameters:
listener- The listener to add.- Returns:
- An observing
EmbeddingModelthat will dispatch events to the provided listener. - Since:
- 1.11.0
-
addListeners
Wraps thisEmbeddingModelwith a listening model that dispatches events to the provided listeners.Listeners are called in the order of iteration.
- Parameters:
listeners- The listeners to add.- Returns:
- An observing
EmbeddingModelthat will dispatch events to the provided listeners. - Since:
- 1.11.0
-