EmbeddingModel
public interface EmbeddingModel
io/agentscope/core/embedding/EmbeddingModel.java:36–65定义向量化模型契约的接口。位于 io.agentscope.core.embedding 包。核心成员包括 embed、getModelName、getDimensions。
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
io.agentscope.core.message.TextBlock -
Multimodal models (e.g., DashScopeMultiModalEmbedding) support
io.agentscope.core.message.TextBlockandio.agentscope.core.message.ImageBlock
Embedding models are used in RAG (Retrieval-Augmented Generation) systems to convert content into vector representations for semantic search and similarity matching.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<double[]> embed(ContentBlock block) | 设置该参数。 Generate embedding vector for a single content block. |
public String getModelName() | 获取模型名称。 Get the model name for logging and identification. |
public int getDimensions() | 获取维度。 Get the dimension of embedding vectors produced by this model. |
方法详情Method Detail
embed
public Mono<double[]> embed(ContentBlock block)
设置该参数。
Generate embedding vector for a single content block.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
block | ContentBlock | 内容块(类型 `ContentBlock`)。the content block to embed (e.g., TextBlock, ImageBlock) |
Mono<double[]>EmbeddingException可能抛出 `EmbeddingException`。if embedding generation fails or content block type is not supported
io/agentscope/core/embedding/EmbeddingModel.java:49getModelName
public String getModelName()
获取模型名称。
Get the model name for logging and identification.
Stringio/agentscope/core/embedding/EmbeddingModel.java:56getDimensions
public int getDimensions()
获取维度。
Get the dimension of embedding vectors produced by this model.
intio/agentscope/core/embedding/EmbeddingModel.java:64