agentscope.embeddingEmbeddingModelCard
class EmbeddingModelCard(BaseModel)
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 |
|---|---|---|---|
type | Literal['embedding_model'] | 类型字段。 | 'embedding_model' |
name | str | 名称字段。 | Field(description='The model name used in API calls.') |
label | str | 标签字段。 | Field(description='Human-readable label for the frontend.') |
status | Literal['active', 'deprecated', 'sunset'] | 模型生命周期状态。 | Field(default='active', description='The model lifecycle status.') |
input_types | list[str] | 输入类型字段。 | Field(default=['text/plain'], description='Supported input media types.') |
output_types | list[str] | 输出类型字段。 | Field(default=['application/x-embedding'], description='Supported output media types.') |
dimensions | int | 用于此模型的默认输出向量维度。 | Field(..., description='Default output vector dimensions for this model.', gt=0) |
supported_dimensions | list[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_size | int | None | 上下文大小字段。 | Field(default=None, description='Maximum input length (in tokens) per request.', gt=0) |
parameter_schema | dict | 参数模式字段。 | Field(default_factory=dict, description='JSON Schema for user-configurable parameters (built from the Parameters class + YAML overrides).') |
parameter_overrides | dict[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.
agentscope/embedding/_embedding_model_card.py:25name
str = Field(description='The model name used in API calls.')名称字段。声明为 str。
The model name used in API calls.
agentscope/embedding/_embedding_model_card.py:28label
str = Field(description='Human-readable label for the frontend.')标签字段。声明为 str。
Human-readable label for the frontend.
agentscope/embedding/_embedding_model_card.py:31status
Literal['active', 'deprecated', 'sunset'] = Field(default='active', description='The model lifecycle status.')模型生命周期状态。
The model lifecycle status.
agentscope/embedding/_embedding_model_card.py:34input_types
list[str] = Field(default=['text/plain'], description='Supported input media types.')输入类型字段。声明为 list[str]。
Supported input media types.
agentscope/embedding/_embedding_model_card.py:40output_types
list[str] = Field(default=['application/x-embedding'], description='Supported output media types.')输出类型字段。声明为 list[str]。
Supported output media types.
agentscope/embedding/_embedding_model_card.py:47dimensions
int = Field(..., description='Default output vector dimensions for this model.', gt=0)用于此模型的默认输出向量维度。
Default output vector dimensions for this model.
agentscope/embedding/_embedding_model_card.py:53supported_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.
agentscope/embedding/_embedding_model_card.py:66context_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.
agentscope/embedding/_embedding_model_card.py:81parameter_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).
agentscope/embedding/_embedding_model_card.py:88parameter_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.
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
yaml_path | str | yaml 路径(类型 `str`)。Path to the YAML file. |
parameter_class | Type[BaseModel] | 参数类(类型 `Type[BaseModel]`)。The `Parameters` class from the embedding model subclass. |
agentscope/embedding/_embedding_model_card.py:106–179