Open jay2jp opened 2 weeks ago
Added cancellation functionality to the WebSocket implementation, following the Cartesia API documentation.
Added new cancel method to _WebSocket class that implements the cancellation API described in: https://docs.cartesia.ai/api-reference/tts/working-with-web-sockets/contexts#cancelling-requests
cancel
_WebSocket
Created separate request handling for cancellation to maintain API clarity:
_construct_tts_request_cancel
send
model_id
transcript
output_format
_TTSContext
i have added lines towards the end of the read me showing how this works
WebSocket Cancellation Implementation
Added cancellation functionality to the WebSocket implementation, following the Cartesia API documentation.
Changes
Added new
cancel
method to_WebSocket
class that implements the cancellation API described in: https://docs.cartesia.ai/api-reference/tts/working-with-web-sockets/contexts#cancelling-requestsCreated separate request handling for cancellation to maintain API clarity:
_construct_tts_request_cancel
function to handle cancel requestssend
method to preserve required parameters (model_id
,transcript
,output_format
)Implementation Notes
_WebSocket
class as it's our primary websocket implementation_TTSContext
class due to limited experience with that component_WebSocket
class and are working as expectedDocumentation
i have added lines towards the end of the read me showing how this works