类class
agentscope.asrOpenAIASRModel
class OpenAIASRModel(ASRModelBase)
源码Source
agentscope/asr/_openai/_model.py:14–72OpenAI 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 |
|---|---|---|---|
type | Literal['openai_asr'] | 类型字段。 | 'openai_asr' |
realtime | bool | 实时字段。 | 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 |
|---|---|---|
credential | OpenAICredential | 凭证对象(类型 `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:29realtime
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 None | bytes | None | 音频(类型 `bytes | None`)。The audio. |
filename默认default 'audio.wav' | str | filename(类型 `str`)。The filename. |
kwargs | Any | 关键字参数(类型 `Any`)。The kwargs. |
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.