Class DashScopeMultiModalEmbedding
java.lang.Object
io.agentscope.core.embedding.dashscope.DashScopeMultiModalEmbedding
- All Implemented Interfaces:
EmbeddingModel
DashScope Multi-Modal Embedding Model implementation.
This implementation provides access to DashScope's multi-modal embedding API, supporting both text and image embedding operations via ContentBlock input. All content types are processed through the MultiModalEmbedding API for consistency.
Supports:
TextBlock- via DashScope MultiModalEmbedding API with MultiModalEmbeddingItemTextImageBlock- via DashScope MultiModalEmbedding API with MultiModalEmbeddingItemImage
Other ContentBlock types are not supported and will result in an EmbeddingException.
Supports timeout and retry configuration through ExecutionConfig.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for DashScopeMultiModalEmbedding. -
Constructor Summary
ConstructorsConstructorDescriptionDashScopeMultiModalEmbedding(String apiKey, String modelName, int dimensions, io.agentscope.core.model.ExecutionConfig defaultExecutionConfig, String baseUrl) Creates a new DashScope multi-modal embedding model instance. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder for DashScopeMultiModalEmbedding.reactor.core.publisher.Mono<double[]>embed(io.agentscope.core.message.ContentBlock block) Generate embedding vector for a single content block.intGet the dimension of embedding vectors produced by this model.Get the model name for logging and identification.
-
Constructor Details
-
DashScopeMultiModalEmbedding
public DashScopeMultiModalEmbedding(String apiKey, String modelName, int dimensions, io.agentscope.core.model.ExecutionConfig defaultExecutionConfig, String baseUrl) Creates a new DashScope multi-modal embedding model instance.- Parameters:
apiKey- the API key for DashScope authenticationmodelName- the model name (e.g., "multimodal-embedding-v1")dimensions- the dimension of embedding vectorsdefaultExecutionConfig- default execution configuration for timeout and retrybaseUrl- custom base URL for DashScope API (null for default)
-
-
Method Details
-
builder
Creates a new builder for DashScopeMultiModalEmbedding.- Returns:
- a new Builder instance
-
embed
public reactor.core.publisher.Mono<double[]> embed(io.agentscope.core.message.ContentBlock block) Description copied from interface:EmbeddingModelGenerate embedding vector for a single content block.Implementations should check the content block type and throw
EmbeddingExceptionif the type is not supported.- Specified by:
embedin interfaceEmbeddingModel- Parameters:
block- the content block to embed (e.g., TextBlock, ImageBlock)- Returns:
- Mono that emits a double array representing the embedding vector
-
getModelName
Description copied from interface:EmbeddingModelGet the model name for logging and identification.- Specified by:
getModelNamein interfaceEmbeddingModel- Returns:
- the model name
-
getDimensions
public int getDimensions()Description copied from interface:EmbeddingModelGet the dimension of embedding vectors produced by this model. The default value is 1024 if not specified.- Specified by:
getDimensionsin interfaceEmbeddingModel- Returns:
- the dimension of embedding vectors
-