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

ModelCard

class ModelCard(BaseModel)
源码Source 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
typeLiteral['chat_model']
类型字段。
'chat_model'
model_classstr
模型类字段。
Field(default='', description='The model implementation class type (e.g. openai_chat).')
namestr
模型的名称。
Field(description='The name of the model')
labelstr
模型标签。
Field(description='The model label.')
statusLiteral['active', 'deprecated', 'sunset']
模型状态。
Field(title='Status', description='The model status')
deprecated_atdatetime | None
`deprecated_at` 字段。
Field(default=None, description='The model deprecation date and time.', title='Deprecation date')
input_typeslist[str]
输入类型字段。
Field(description='The supported model input types.', title='Input types', default=['text/plain'])
output_typeslist[str]
输出类型字段。
Field(description='The supported model output types.', title='Output types', default=['text/plain'])
context_sizeint
上下文大小。
Field(title='Context size', description='The context size.', gt=0)
output_sizeint
输出大小字段。
Field(title='Max output tokens', description='The maximum number of tokens.', gt=0)
parameter_schemadict
参数模式字段。
—
parameters_overridesdict[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.

源码Source agentscope/model/_model_card.py:14

model_class

str = Field(default='', description='The model implementation class type (e.g. openai_chat).')

模型类字段。声明为 str。

The model implementation class type (e.g.

源码Source agentscope/model/_model_card.py:17

name

str = Field(description='The name of the model')

模型的名称。

The name of the model

源码Source agentscope/model/_model_card.py:24

label

str = Field(description='The model label.')

模型标签。

The model label.

源码Source agentscope/model/_model_card.py:27

status

Literal['active', 'deprecated', 'sunset'] = Field(title='Status', description='The model status')

模型状态。

The model status

源码Source agentscope/model/_model_card.py:30

deprecated_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.

源码Source agentscope/model/_model_card.py:36

input_types

list[str] = Field(description='The supported model input types.', title='Input types', default=['text/plain'])

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

The supported model input types.

源码Source agentscope/model/_model_card.py:43

output_types

list[str] = Field(description='The supported model output types.', title='Output types', default=['text/plain'])

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

The supported model output types.

源码Source agentscope/model/_model_card.py:50

context_size

int = Field(title='Context size', description='The context size.', gt=0)

上下文大小。

The context size.

源码Source agentscope/model/_model_card.py:57

output_size

int = Field(title='Max output tokens', description='The maximum number of tokens.', gt=0)

输出大小字段。声明为 int。

The maximum number of tokens.

源码Source agentscope/model/_model_card.py:64

parameter_schema

dict

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

The parameter schema field.

源码Source agentscope/model/_model_card.py:71

parameters_overrides

dict[str, dict]

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

The parameters overrides field.

源码Source 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.

参数Parameters
名称Name类型Type说明Description
yaml_pathstryaml 路径(类型 `str`)。Path to the YAML file
parameter_classType[BaseModel]参数类(类型 `Type[BaseModel]`)。The parameter class (e.g., DashScopeChatParameters)
返回Returns Self
返回自身。`list[ModelCard]`:
源码Source agentscope/model/_model_card.py:80–168
基于官方固定版本源码静态生成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.