AS AgentScopeAPI 手册 / API Reference

EmbeddingModel

public interface EmbeddingModel
源码Source 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.TextBlock and io.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.

参数Parameters
名称Name类型Type说明Description
blockContentBlock内容块(类型 `ContentBlock`)。the content block to embed (e.g., TextBlock, ImageBlock)
返回Returns Mono<double[]>
返回Mono。Mono that emits a double array representing the embedding vector
抛出Throws
  • EmbeddingException 可能抛出 `EmbeddingException`。if embedding generation fails or content block type is not supported
源码Source io/agentscope/core/embedding/EmbeddingModel.java:49

getModelName

public String getModelName()

获取模型名称。

Get the model name for logging and identification.

返回Returns String
模型名称。the model name
源码Source io/agentscope/core/embedding/EmbeddingModel.java:56

getDimensions

public int getDimensions()

获取维度。

Get the dimension of embedding vectors produced by this model.

返回Returns int
向量化向量的维度。the dimension of embedding vectors
源码Source io/agentscope/core/embedding/EmbeddingModel.java:64
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.