agentscope.realtimeRealtimeModelCard
class RealtimeModelCard(BaseModel)
agentscope/realtime/_model_card.py:14–136实时模型卡片,处理低延迟的实时语音与多模态交互。位于 agentscope.realtime 包。核心成员包括 from_yaml、list_from_directory。
Describes one realtime model. Declared in agentscope.realtime.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
type | Literal['realtime_model'] | 类型字段。 | 'realtime_model' |
model_type | str | 模型类型字段。 | Field(default='', description='The adapter class this model belongs to, e.g. ``dashscope_omni_realtime``.') |
name | str | 名称字段。 | Field(description='The model identifier.') |
label | str | 标签字段。 | Field(description='Human-readable label for the UI.') |
status | Literal['active', 'deprecated', 'sunset'] | 模型的生命周期状态。 | Field(default='active', description='Lifecycle status of the model.') |
deprecated_at | datetime | None | `deprecated_at` 字段。 | Field(default=None, description='When the model was deprecated, if applicable.') |
release_date | date | None | `release_date` 字段。 | Field(default=None, description='The model release date, if known.') |
input_types | list[str] | 输入类型字段。 | Field(default_factory=lambda: ['audio/pcm'], description='Accepted input media types.') |
output_types | list[str] | 输出类型字段。 | Field(default_factory=lambda: ['audio/pcm', 'text/plain'], description='Media types the model produces.') |
input_sample_rate | int | `input_sample_rate` 字段。 | Field(default=16000, gt=0, description='Advertised input PCM sample rate in Hz.') |
output_sample_rate | int | `output_sample_rate` 字段。 | Field(default=24000, gt=0, description='Advertised output PCM sample rate in Hz.') |
supports_tools | bool | 支持工具字段。 | Field(default=False, description='Whether this model accepts tool schemas.') |
max_context_tokens | int | None | 最大上下文令牌数字段。 | Field(default=None, gt=0) |
max_audio_turns | int | None | 最大音频轮次字段。 | Field(default=None, gt=0) |
max_audio_duration_s | int | None | 最大音频时长 s字段。 | Field(default=None, gt=0) |
max_session_duration_s | int | None | 最大会话时长 s字段。 | Field(default=None, gt=0) |
parameter_schema | dict | 参数模式字段。 | Field(default_factory=dict) |
parameter_overrides | dict[str, dict] | `parameter_overrides` 字段。 | Field(default_factory=dict) |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def from_yaml(yaml_path: str | Path, parameter_class: Type[BaseModel]) -> Self | 执行 `from_yaml` 方法。 Load a card from YAML, seeding the parameter schema from *parameter_class*. |
def list_from_directory(yaml_dir: str | Path, parameter_class: Type[BaseModel]) -> list['RealtimeModelCard'] | 列出来自目录。 Load every ``*.yaml`` card in *yaml_dir*, skipping broken ones. |
属性详情Attribute Detail
type
Literal['realtime_model'] = 'realtime_model'类型字段。声明为 Literal['realtime_model']。
The type field.
agentscope/realtime/_model_card.py:19model_type
str = Field(default='', description='The adapter class this model belongs to, e.g. ``dashscope_omni_realtime``.')模型类型字段。声明为 str。
The adapter class this model belongs to, e.g.
agentscope/realtime/_model_card.py:21name
str = Field(description='The model identifier.')名称字段。声明为 str。
The model identifier.
agentscope/realtime/_model_card.py:27label
str = Field(description='Human-readable label for the UI.')标签字段。声明为 str。
Human-readable label for the UI.
agentscope/realtime/_model_card.py:28status
Literal['active', 'deprecated', 'sunset'] = Field(default='active', description='Lifecycle status of the model.')模型的生命周期状态。
Lifecycle status of the model.
agentscope/realtime/_model_card.py:30deprecated_at
datetime | None = Field(default=None, description='When the model was deprecated, if applicable.')deprecated_at 字段。声明为 datetime | None。
When the model was deprecated, if applicable.
agentscope/realtime/_model_card.py:34release_date
date | None = Field(default=None, description='The model release date, if known.')release_date 字段。声明为 date | None。
The model release date, if known.
agentscope/realtime/_model_card.py:38input_types
list[str] = Field(default_factory=lambda: ['audio/pcm'], description='Accepted input media types.')输入类型字段。声明为 list[str]。
Accepted input media types.
agentscope/realtime/_model_card.py:43output_types
list[str] = Field(default_factory=lambda: ['audio/pcm', 'text/plain'], description='Media types the model produces.')输出类型字段。声明为 list[str]。
Media types the model produces.
agentscope/realtime/_model_card.py:47input_sample_rate
int = Field(default=16000, gt=0, description='Advertised input PCM sample rate in Hz.')input_sample_rate 字段。声明为 int。
Advertised input PCM sample rate in Hz.
agentscope/realtime/_model_card.py:52output_sample_rate
int = Field(default=24000, gt=0, description='Advertised output PCM sample rate in Hz.')output_sample_rate 字段。声明为 int。
Advertised output PCM sample rate in Hz.
agentscope/realtime/_model_card.py:57supports_tools
bool = Field(default=False, description='Whether this model accepts tool schemas.')支持工具字段。声明为 bool。
Whether this model accepts tool schemas.
agentscope/realtime/_model_card.py:63max_context_tokens
int | None = Field(default=None, gt=0)最大上下文令牌数字段。声明为 int | None。
The max context tokens field.
agentscope/realtime/_model_card.py:70max_audio_turns
int | None = Field(default=None, gt=0)最大音频轮次字段。声明为 int | None。
The max audio turns field.
agentscope/realtime/_model_card.py:71max_audio_duration_s
int | None = Field(default=None, gt=0)最大音频时长 s字段。声明为 int | None。
The max audio duration s field.
agentscope/realtime/_model_card.py:72max_session_duration_s
int | None = Field(default=None, gt=0)最大会话时长 s字段。声明为 int | None。
The max session duration s field.
agentscope/realtime/_model_card.py:73parameter_schema
dict = Field(default_factory=dict)参数模式字段。声明为 dict。
The parameter schema field.
agentscope/realtime/_model_card.py:75parameter_overrides
dict[str, dict] = Field(default_factory=dict)parameter_overrides 字段。声明为 dict[str, dict]。
The parameter overrides field.
agentscope/realtime/_model_card.py:78方法详情Method Detail
from_yaml
def from_yaml(yaml_path: str | Path, parameter_class: Type[BaseModel]) -> Self
执行 from_yaml 方法。
Load a card from YAML, seeding the parameter schema from parameter_class.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
yaml_path | str | Path | yaml 路径(类型 `str | Path`)。Path to the YAML file. |
parameter_class | Type[BaseModel] | 参数类(类型 `Type[BaseModel]`)。The adapter's `Parameters` class, whose JSON schema seeds :attr:`parameter_schema`. |
agentscope/realtime/_model_card.py:82–117list_from_directory
def list_from_directory(yaml_dir: str | Path, parameter_class: Type[BaseModel]) -> list['RealtimeModelCard']
列出来自目录。
Load every *.yaml card in yaml_dir, skipping broken ones.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
yaml_dir | str | Path | yaml 目录(类型 `str | Path`)。The yaml dir. |
parameter_class | Type[BaseModel] | 参数类(类型 `Type[BaseModel]`)。The parameter class. |
agentscope/realtime/_model_card.py:120–136