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

OpenAIASRModel

class OpenAIASRModel(ASRModelBase)
源码Source agentscope/asr/_openai/_model.py:14–72

OpenAI ASR 模型,处理低延迟的实时语音与多模态交互。位于 agentscope.asr 包,继承自 ASRModelBase。核心成员包括 transcribe。

Batch speech recognition using OpenAI's Audio Transcriptions API. Declared in agentscope.asr. Extends ASRModelBase.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Parameters类class
参数,处理低延迟的实时语音与多模态交互。
Options supported by OpenAI transcription models.

构造器摘要Constructor Summary

构造器Constructor说明Description
def __init__(credential: OpenAICredential, model: str = 'gpt-4o-mini-transcribe', parameters: 'OpenAIASRModel.Parameter…
初始化 `OpenAIASRModel` 实例。
Creates a new instance.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
typeLiteral['openai_asr']
类型字段。
'openai_asr'
realtimebool
实时字段。
False

方法摘要Method Summary

方法Method说明Description
async def transcribe(audio: bytes | None = None, filename: str = 'audio.wav', **kwargs: Any) -> ASRResponseasync
执行 `transcribe` 方法。
Transcribe in-memory audio, using ``filename`` for its format.

构造器详情Constructor Detail

OpenAIASRModel

def __init__(credential: OpenAICredential, model: str = 'gpt-4o-mini-transcribe', parameters: 'OpenAIASRModel.Parameters | None' = None) -> None

初始化 OpenAIASRModel 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
credentialOpenAICredential凭证对象(类型 `OpenAICredential`)。The credential.
model默认default 'gpt-4o-mini-transcribe'str模型实例(类型 `str`)。The model.
parameters默认default None'OpenAIASRModel.Parameters | None'参数(类型 `'OpenAIASRModel.Parameters | None'`)。The parameters.
源码Source agentscope/asr/_openai/_model.py:35–49

属性详情Attribute Detail

type

Literal['openai_asr'] = 'openai_asr'

类型字段。声明为 Literal['openai_asr']。

The type field.

源码Source agentscope/asr/_openai/_model.py:29

realtime

bool = False

实时字段。声明为 bool。

The realtime field.

源码Source agentscope/asr/_openai/_model.py:32

方法详情Method Detail

transcribe

async def transcribe(audio: bytes | None = None, filename: str = 'audio.wav', **kwargs: Any) -> ASRResponse
async

执行 transcribe 方法。

Transcribe in-memory audio, using filename for its format.

参数Parameters
名称Name类型Type说明Description
audio默认default Nonebytes | None音频(类型 `bytes | None`)。The audio.
filename默认default 'audio.wav'strfilename(类型 `str`)。The filename.
kwargsAny关键字参数(类型 `Any`)。The kwargs.
返回Returns ASRResponse
返回ASRResponse。Returns ASR response.
源码Source agentscope/asr/_openai/_model.py:51–72

嵌套类详情Nested Class Detail

Parameters

class Parameters

参数,处理低延迟的实时语音与多模态交互。位于 agentscope.asr 包。

Options supported by OpenAI transcription models. Declared in agentscope.asr.

继承成员Inherited Members

基于官方固定版本源码静态生成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.