跳转至

Events

VoiceStreamEvent module-attribute

来自 VoicePipeline 的事件,通过 StreamedAudioResult.stream() 进行流式传输。

VoiceStreamEventAudio dataclass

来自 VoicePipeline 的流式事件

Source code in agents/voice/events.py
@dataclass
class VoiceStreamEventAudio:
    """来自 VoicePipeline 的流式事件"""

    data: npt.NDArray[np.int16 | np.float32] | None
    """音频数据。"""

    type: Literal["voice_stream_event_audio"] = "voice_stream_event_audio"
    """事件类型。"""

data instance-attribute

data: NDArray[int16 | float32] | None

音频数据。

type class-attribute instance-attribute

type: Literal['voice_stream_event_audio'] = 'voice_stream_event_audio'

事件类型。

VoiceStreamEventLifecycle dataclass

来自 VoicePipeline 的流式事件

Source code in agents/voice/events.py
@dataclass
class VoiceStreamEventLifecycle:
    """来自 VoicePipeline 的流式事件"""

    event: Literal["turn_started", "turn_ended", "session_ended"]
    """发生的事件。"""

    type: Literal["voice_stream_event_lifecycle"] = "voice_stream_event_lifecycle"
    """事件类型。"""

event instance-attribute

event: Literal['turn_started', 'turn_ended', 'session_ended']

发生的事件。

type class-attribute instance-attribute

type: Literal['voice_stream_event_lifecycle'] = 'voice_stream_event_lifecycle'

事件类型。

VoiceStreamEventError dataclass

来自 VoicePipeline 的流式事件

Source code in agents/voice/events.py
@dataclass
class VoiceStreamEventError:
    """来自 VoicePipeline 的流式事件"""

    error: Exception
    """发生的错误。"""

    type: Literal["voice_stream_event_error"] = "voice_stream_event_error"
    """事件类型。"""

error instance-attribute

error: Exception

发生的错误。

type class-attribute instance-attribute

type: Literal['voice_stream_event_error'] = 'voice_stream_event_error'

事件类型。