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

RealtimeModelCard

class RealtimeModelCard(BaseModel)
源码Source 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
typeLiteral['realtime_model']
类型字段。
'realtime_model'
model_typestr
模型类型字段。
Field(default='', description='The adapter class this model belongs to, e.g. ``dashscope_omni_realtime``.')
namestr
名称字段。
Field(description='The model identifier.')
labelstr
标签字段。
Field(description='Human-readable label for the UI.')
statusLiteral['active', 'deprecated', 'sunset']
模型的生命周期状态。
Field(default='active', description='Lifecycle status of the model.')
deprecated_atdatetime | None
`deprecated_at` 字段。
Field(default=None, description='When the model was deprecated, if applicable.')
release_datedate | None
`release_date` 字段。
Field(default=None, description='The model release date, if known.')
input_typeslist[str]
输入类型字段。
Field(default_factory=lambda: ['audio/pcm'], description='Accepted input media types.')
output_typeslist[str]
输出类型字段。
Field(default_factory=lambda: ['audio/pcm', 'text/plain'], description='Media types the model produces.')
input_sample_rateint
`input_sample_rate` 字段。
Field(default=16000, gt=0, description='Advertised input PCM sample rate in Hz.')
output_sample_rateint
`output_sample_rate` 字段。
Field(default=24000, gt=0, description='Advertised output PCM sample rate in Hz.')
supports_toolsbool
支持工具字段。
Field(default=False, description='Whether this model accepts tool schemas.')
max_context_tokensint | None
最大上下文令牌数字段。
Field(default=None, gt=0)
max_audio_turnsint | None
最大音频轮次字段。
Field(default=None, gt=0)
max_audio_duration_sint | None
最大音频时长 s字段。
Field(default=None, gt=0)
max_session_duration_sint | None
最大会话时长 s字段。
Field(default=None, gt=0)
parameter_schemadict
参数模式字段。
Field(default_factory=dict)
parameter_overridesdict[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.

源码Source agentscope/realtime/_model_card.py:19

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

源码Source agentscope/realtime/_model_card.py:21

name

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

名称字段。声明为 str。

The model identifier.

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

label

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

标签字段。声明为 str。

Human-readable label for the UI.

源码Source agentscope/realtime/_model_card.py:28

status

Literal['active', 'deprecated', 'sunset'] = Field(default='active', description='Lifecycle status of the model.')

模型的生命周期状态。

Lifecycle status of the model.

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

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

源码Source agentscope/realtime/_model_card.py:34

release_date

date | None = Field(default=None, description='The model release date, if known.')

release_date 字段。声明为 date | None。

The model release date, if known.

源码Source agentscope/realtime/_model_card.py:38

input_types

list[str] = Field(default_factory=lambda: ['audio/pcm'], description='Accepted input media types.')

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

Accepted input media types.

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

output_types

list[str] = Field(default_factory=lambda: ['audio/pcm', 'text/plain'], description='Media types the model produces.')

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

Media types the model produces.

源码Source agentscope/realtime/_model_card.py:47

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

源码Source agentscope/realtime/_model_card.py:52

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

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

supports_tools

bool = Field(default=False, description='Whether this model accepts tool schemas.')

支持工具字段。声明为 bool。

Whether this model accepts tool schemas.

源码Source agentscope/realtime/_model_card.py:63

max_context_tokens

int | None = Field(default=None, gt=0)

最大上下文令牌数字段。声明为 int | None。

The max context tokens field.

源码Source agentscope/realtime/_model_card.py:70

max_audio_turns

int | None = Field(default=None, gt=0)

最大音频轮次字段。声明为 int | None。

The max audio turns field.

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

max_audio_duration_s

int | None = Field(default=None, gt=0)

最大音频时长 s字段。声明为 int | None。

The max audio duration s field.

源码Source agentscope/realtime/_model_card.py:72

max_session_duration_s

int | None = Field(default=None, gt=0)

最大会话时长 s字段。声明为 int | None。

The max session duration s field.

源码Source agentscope/realtime/_model_card.py:73

parameter_schema

dict = Field(default_factory=dict)

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

The parameter schema field.

源码Source agentscope/realtime/_model_card.py:75

parameter_overrides

dict[str, dict] = Field(default_factory=dict)

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

The parameter overrides field.

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

参数Parameters
名称Name类型Type说明Description
yaml_pathstr | Pathyaml 路径(类型 `str | Path`)。Path to the YAML file.
parameter_classType[BaseModel]参数类(类型 `Type[BaseModel]`)。The adapter's `Parameters` class, whose JSON schema seeds :attr:`parameter_schema`.
返回Returns Self
返回自身。`RealtimeModelCard`: The loaded card.
源码Source agentscope/realtime/_model_card.py:82–117

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

参数Parameters
名称Name类型Type说明Description
yaml_dirstr | Pathyaml 目录(类型 `str | Path`)。The yaml dir.
parameter_classType[BaseModel]参数类(类型 `Type[BaseModel]`)。The parameter class.
返回Returns list['RealtimeModelCard']
返回'RealtimeModelCard'列表。Returns a list of realtime model card.
源码Source agentscope/realtime/_model_card.py:120–136
基于官方固定版本源码静态生成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.