agentscope.modelModelCard
class ModelCard(BaseModel)
agentscope/model/_model_card.py:11–168模型卡片类。位于 agentscope.model 包。核心成员包括 from_yaml。
The model card class. Declared in agentscope.model.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
type | Literal['chat_model'] | 类型字段。 | 'chat_model' |
model_class | str | 模型类字段。 | Field(default='', description='The model implementation class type (e.g. openai_chat).') |
name | str | 模型的名称。 | Field(description='The name of the model') |
label | str | 模型标签。 | Field(description='The model label.') |
status | Literal['active', 'deprecated', 'sunset'] | 模型状态。 | Field(title='Status', description='The model status') |
deprecated_at | datetime | None | `deprecated_at` 字段。 | Field(default=None, description='The model deprecation date and time.', title='Deprecation date') |
input_types | list[str] | 输入类型字段。 | Field(description='The supported model input types.', title='Input types', default=['text/plain']) |
output_types | list[str] | 输出类型字段。 | Field(description='The supported model output types.', title='Output types', default=['text/plain']) |
context_size | int | 上下文大小。 | Field(title='Context size', description='The context size.', gt=0) |
output_size | int | 输出大小字段。 | Field(title='Max output tokens', description='The maximum number of tokens.', gt=0) |
parameter_schema | dict | 参数模式字段。 | — |
parameters_overrides | dict[str, dict] | `parameters_overrides` 字段。 | — |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def from_yaml(yaml_path: str, parameter_class: Type[BaseModel]) -> Self | 执行 `from_yaml` 方法。 Read a model card from a YAML file, and merge the parameter schema with the override parameter schema in the yaml file. |
属性详情Attribute Detail
type
Literal['chat_model'] = 'chat_model'类型字段。声明为 Literal['chat_model']。
The type field.
agentscope/model/_model_card.py:14model_class
str = Field(default='', description='The model implementation class type (e.g. openai_chat).')模型类字段。声明为 str。
The model implementation class type (e.g.
agentscope/model/_model_card.py:17name
str = Field(description='The name of the model')模型的名称。
The name of the model
agentscope/model/_model_card.py:24label
str = Field(description='The model label.')模型标签。
The model label.
agentscope/model/_model_card.py:27status
Literal['active', 'deprecated', 'sunset'] = Field(title='Status', description='The model status')模型状态。
The model status
agentscope/model/_model_card.py:30deprecated_at
datetime | None = Field(default=None, description='The model deprecation date and time.', title='Deprecation date')deprecated_at 字段。声明为 datetime | None。
The model deprecation date and time.
agentscope/model/_model_card.py:36input_types
list[str] = Field(description='The supported model input types.', title='Input types', default=['text/plain'])输入类型字段。声明为 list[str]。
The supported model input types.
agentscope/model/_model_card.py:43output_types
list[str] = Field(description='The supported model output types.', title='Output types', default=['text/plain'])输出类型字段。声明为 list[str]。
The supported model output types.
agentscope/model/_model_card.py:50context_size
int = Field(title='Context size', description='The context size.', gt=0)上下文大小。
The context size.
agentscope/model/_model_card.py:57output_size
int = Field(title='Max output tokens', description='The maximum number of tokens.', gt=0)输出大小字段。声明为 int。
The maximum number of tokens.
agentscope/model/_model_card.py:64parameter_schema
dict参数模式字段。声明为 dict。
The parameter schema field.
agentscope/model/_model_card.py:71parameters_overrides
dict[str, dict]parameters_overrides 字段。声明为 dict[str, dict]。
The parameters overrides field.
agentscope/model/_model_card.py:75方法详情Method Detail
from_yaml
def from_yaml(yaml_path: str, parameter_class: Type[BaseModel]) -> Self
执行 from_yaml 方法。
Read a model card from a YAML file, and merge the parameter schema with the override parameter schema in the yaml file.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
yaml_path | str | yaml 路径(类型 `str`)。Path to the YAML file |
parameter_class | Type[BaseModel] | 参数类(类型 `Type[BaseModel]`)。The parameter class (e.g., DashScopeChatParameters) |
agentscope/model/_model_card.py:80–168