Package io.agentscope.core.embedding
Interface EmbeddingModel
- All Known Implementing Classes:
DashScopeMultiModalEmbedding,DashScopeTextEmbedding,OllamaTextEmbedding,OpenAITextEmbedding
public interface EmbeddingModel
Interface for embedding models supporting multimodal content.
This interface provides a unified API for generating vector embeddings from content blocks.
Each implementation determines which content block types it supports:
- Text-only models (e.g., DashScopeTextEmbedding) support
TextBlock - Multimodal models (e.g., DashScopeMultiModalEmbedding) support
TextBlockandImageBlock
Embedding models are used in RAG (Retrieval-Augmented Generation) systems to convert content into vector representations for semantic search and similarity matching.
-
Method Summary
Modifier and TypeMethodDescriptionreactor.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.
-
Method Details
-
embed
reactor.core.publisher.Mono<double[]> embed(io.agentscope.core.message.ContentBlock block) Generate embedding vector for a single content block.Implementations should check the content block type and throw
EmbeddingExceptionif the type is not supported.- Parameters:
block- the content block to embed (e.g., TextBlock, ImageBlock)- Returns:
- Mono that emits a double array representing the embedding vector
- Throws:
EmbeddingException- if embedding generation fails or content block type is not supported
-
getModelName
String getModelName()Get the model name for logging and identification.- Returns:
- the model name
-
getDimensions
int getDimensions()Get the dimension of embedding vectors produced by this model. The default value is 1024 if not specified.- Returns:
- the dimension of embedding vectors
-