AS AgentScopeAPI 手册 / API Reference
类class agentscope.embedding

EmbeddingModelCard

class EmbeddingModelCard(BaseModel)
源码Source agentscope/embedding/_embedding_model_card.py:12–179

向量化模型卡片,与模型服务通信并返回生成或向量化结果。位于 agentscope.embedding 包。核心成员包括 from_yaml。

Mirrors :class:~agentscope.model.ModelCard but tailored for embedding models. Uses input_types / output_types to describe model capabilities, and parameter_schema (built from the embedding class's Parameters + YAML parameter_overrides) to tell the frontend which knobs the user can adjust.

The output type application/x-embedding indicates that the model produces dense vector embeddings.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
typeLiteral['embedding_model']
类型字段。
'embedding_model'
namestr
名称字段。
Field(description='The model name used in API calls.')
labelstr
标签字段。
Field(description='Human-readable label for the frontend.')
statusLiteral['active', 'deprecated', 'sunset']
模型生命周期状态。
Field(default='active', description='The model lifecycle status.')
input_typeslist[str]
输入类型字段。
Field(default=['text/plain'], description='Supported input media types.')
output_typeslist[str]
输出类型字段。
Field(default=['application/x-embedding'], description='Supported output media types.')
dimensionsint
用于此模型的默认输出向量维度。
Field(..., description='Default output vector dimensions for this model.', gt=0)
supported_dimensionslist[int] | None
`supported_dimensions` 字段。
Field(default=None, description='If set, the only dimensions this model can produce. ``None`` means dimensions are fixed at :attr:`dimensions` and cannot be overridden.')
context_sizeint | None
上下文大小字段。
Field(default=None, description='Maximum input length (in tokens) per request.', gt=0)
parameter_schemadict
参数模式字段。
Field(default_factory=dict, description='JSON Schema for user-configurable parameters (built from the Parameters class + YAML overrides).')
parameter_overridesdict[str, dict]
`parameter_overrides` 字段。
Field(default_factory=dict, description='Raw parameter overrides from the YAML file.')

方法摘要Method Summary

方法Method说明Description
def from_yaml(yaml_path: str, parameter_class: Type[BaseModel]) -> Self
执行 `from_yaml` 方法。
Load an embedding model card from a YAML file.

属性详情Attribute Detail

type

Literal['embedding_model'] = 'embedding_model'

类型字段。声明为 Literal['embedding_model']。

The type field.

源码Source agentscope/embedding/_embedding_model_card.py:25

name

str = Field(description='The model name used in API calls.')

名称字段。声明为 str。

The model name used in API calls.

源码Source agentscope/embedding/_embedding_model_card.py:28

label

str = Field(description='Human-readable label for the frontend.')

标签字段。声明为 str。

Human-readable label for the frontend.

源码Source agentscope/embedding/_embedding_model_card.py:31

status

Literal['active', 'deprecated', 'sunset'] = Field(default='active', description='The model lifecycle status.')

模型生命周期状态。

The model lifecycle status.

源码Source agentscope/embedding/_embedding_model_card.py:34

input_types

list[str] = Field(default=['text/plain'], description='Supported input media types.')

输入类型字段。声明为 list[str]。

Supported input media types.

源码Source agentscope/embedding/_embedding_model_card.py:40

output_types

list[str] = Field(default=['application/x-embedding'], description='Supported output media types.')

输出类型字段。声明为 list[str]。

Supported output media types.

源码Source agentscope/embedding/_embedding_model_card.py:47

dimensions

int = Field(..., description='Default output vector dimensions for this model.', gt=0)

用于此模型的默认输出向量维度。

Default output vector dimensions for this model.

源码Source agentscope/embedding/_embedding_model_card.py:53

supported_dimensions

list[int] | None = Field(default=None, description='If set, the only dimensions this model can produce. ``None`` means dimensions are fixed at :attr:`dimensions` and cannot be overridden.')

supported_dimensions 字段。声明为 list[int] | None。

If set, the only dimensions this model can produce.

源码Source agentscope/embedding/_embedding_model_card.py:66

context_size

int | None = Field(default=None, description='Maximum input length (in tokens) per request.', gt=0)

上下文大小字段。声明为 int | None。

Maximum input length (in tokens) per request.

源码Source agentscope/embedding/_embedding_model_card.py:81

parameter_schema

dict = Field(default_factory=dict, description='JSON Schema for user-configurable parameters (built from the Parameters class + YAML overrides).')

参数模式字段。声明为 dict。

JSON Schema for user-configurable parameters (built from the Parameters class + YAML overrides).

源码Source agentscope/embedding/_embedding_model_card.py:88

parameter_overrides

dict[str, dict] = Field(default_factory=dict, description='Raw parameter overrides from the YAML file.')

parameter_overrides 字段。声明为 dict[str, dict]。

Raw parameter overrides from the YAML file.

源码Source agentscope/embedding/_embedding_model_card.py:99

方法详情Method Detail

from_yaml

def from_yaml(yaml_path: str, parameter_class: Type[BaseModel]) -> Self

执行 from_yaml 方法。

Merges the base parameter_class JSON Schema with parameter_overrides from the YAML — identical to the approach used by :meth:~agentscope.model.ModelCard.from_yaml.

参数Parameters
名称Name类型Type说明Description
yaml_pathstryaml 路径(类型 `str`)。Path to the YAML file.
parameter_classType[BaseModel]参数类(类型 `Type[BaseModel]`)。The `Parameters` class from the embedding model subclass.
返回Returns Self
返回自身。`EmbeddingModelCard`: The loaded model card.
源码Source agentscope/embedding/_embedding_model_card.py:106–179
基于官方固定版本源码静态生成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.