Class WorkersAiEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class AbstractWorkersAIModel
accountId, client, modelName -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with Builder.WorkersAiEmbeddingModel(String accountId, String modelName, String apiToken) Constructor with Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Builder access.embed(TextSegment textSegment) Embed the text content of aTextSegment.Embed a text.embedAll(List<TextSegment> textSegments) Embeds the text content of a list ofTextSegments.Returns the name of the underlying embedding model.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, provider, supportedContentTypes, supportedParameters
-
Constructor Details
-
WorkersAiEmbeddingModel
Constructor with Builder.- Parameters:
builder- builder.
-
WorkersAiEmbeddingModel
-
-
Method Details
-
builder
-
embed
Embed a text.- Specified by:
embedin interfaceEmbeddingModel- Parameters:
text- the text to embed.- Returns:
- the embedding.
-
embed
Embed 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
Embeds 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.
-
modelName
Description copied from interface:EmbeddingModelReturns 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.- Specified by:
modelNamein interfaceEmbeddingModel- Returns:
- the model name or a fallback value if not provided
-