Class DisabledEmbeddingModel
java.lang.Object
dev.langchain4j.model.embedding.DisabledEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
An
EmbeddingModel which throws a ModelDisabledException for all of its methods
This could be used in tests, or in libraries that extend this one to conditionally enable or disable functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionembed(TextSegment textSegment) Embed the text content of aTextSegment.Embed a text.embedAll(List<TextSegment> textSegments) Embeds the text content of a list ofTextSegments.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingModel
addListener, addListeners, defaultRequestParameters, dimension, doEmbed, embed, listeners, modelName, provider, supportedContentTypes, supportedParameters
-
Constructor Details
-
DisabledEmbeddingModel
public DisabledEmbeddingModel()
-
-
Method Details
-
embed
Description copied from interface:EmbeddingModelEmbed a text.- Specified by:
embedin interfaceEmbeddingModel- Parameters:
text- the text to embed.- Returns:
- the embedding.
-
embed
Description copied from interface:EmbeddingModelEmbed the text content of aTextSegment.This is a convenience method over
EmbeddingModel.embed(EmbeddingRequest), solistenersare notified and the model's default per-call parameters are applied here too.- Specified by:
embedin interfaceEmbeddingModel- Parameters:
textSegment- the text segment to embed.- Returns:
- the embedding.
-
embedAll
Description copied from interface:EmbeddingModelEmbeds the text content of a list ofTextSegments.This is a convenience method over
EmbeddingModel.embed(EmbeddingRequest), solistenersare notified and the model's default per-call parameters are applied here too. A provider implements its embedding logic by overridingEmbeddingModel.doEmbed(EmbeddingRequest)(preferred); it may still override this method for batch-specific behavior that the request/response API does not carry (for example applying a document title fromTextSegmentmetadata).- Specified by:
embedAllin interfaceEmbeddingModel- Parameters:
textSegments- the text segments to embed.- Returns:
- the embeddings.
-