Add output.audio.played message handling and update documentation
- Introduced `output.audio.played` message type for client acknowledgment of audio playback completion. - Updated `DuplexPipeline` to track client playback state and handle playback completion events. - Enhanced session handling to route `output.audio.played` messages to the pipeline. - Revised API documentation to include details about the new message type and its fields. - Updated schema documentation to reflect the addition of `output.audio.played` in the message flow.
This commit is contained in:
@@ -45,6 +45,15 @@ class ResponseCancelMessage(_StrictModel):
|
||||
graceful: bool = False
|
||||
|
||||
|
||||
class OutputAudioPlayedMessage(_StrictModel):
|
||||
type: Literal["output.audio.played"]
|
||||
tts_id: str = Field(..., min_length=1)
|
||||
response_id: Optional[str] = None
|
||||
turn_id: Optional[str] = None
|
||||
played_at_ms: Optional[int] = Field(default=None, ge=0)
|
||||
played_ms: Optional[int] = Field(default=None, ge=0)
|
||||
|
||||
|
||||
class ToolCallResultStatus(_StrictModel):
|
||||
code: int
|
||||
message: str
|
||||
@@ -67,6 +76,7 @@ CLIENT_MESSAGE_TYPES = {
|
||||
"session.stop": SessionStopMessage,
|
||||
"input.text": InputTextMessage,
|
||||
"response.cancel": ResponseCancelMessage,
|
||||
"output.audio.played": OutputAudioPlayedMessage,
|
||||
"tool_call.results": ToolCallResultsMessage,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user