cartesia 2.0.3__tar.gz → 2.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. {cartesia-2.0.3 → cartesia-2.0.5}/PKG-INFO +159 -2
  2. {cartesia-2.0.3 → cartesia-2.0.5}/README.md +158 -1
  3. {cartesia-2.0.3 → cartesia-2.0.5}/pyproject.toml +1 -1
  4. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/__init__.py +46 -1
  5. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/base_client.py +2 -0
  6. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/client.py +5 -0
  7. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/client_wrapper.py +1 -1
  8. cartesia-2.0.5/src/cartesia/stt/__init__.py +51 -0
  9. cartesia-2.0.5/src/cartesia/stt/_async_websocket.py +284 -0
  10. cartesia-2.0.5/src/cartesia/stt/_websocket.py +272 -0
  11. cartesia-2.0.5/src/cartesia/stt/requests/__init__.py +27 -0
  12. cartesia-2.0.5/src/cartesia/stt/requests/done_message.py +14 -0
  13. cartesia-2.0.5/src/cartesia/stt/requests/error_message.py +16 -0
  14. cartesia-2.0.5/src/cartesia/stt/requests/flush_done_message.py +14 -0
  15. cartesia-2.0.5/src/cartesia/stt/requests/streaming_transcription_response.py +39 -0
  16. cartesia-2.0.5/src/cartesia/stt/requests/transcript_message.py +33 -0
  17. cartesia-2.0.5/src/cartesia/stt/requests/transcription_response.py +21 -0
  18. cartesia-2.0.5/src/cartesia/stt/socket_client.py +195 -0
  19. cartesia-2.0.5/src/cartesia/stt/types/__init__.py +29 -0
  20. cartesia-2.0.5/src/cartesia/stt/types/done_message.py +26 -0
  21. cartesia-2.0.5/src/cartesia/stt/types/error_message.py +27 -0
  22. cartesia-2.0.5/src/cartesia/stt/types/flush_done_message.py +26 -0
  23. cartesia-2.0.5/src/cartesia/stt/types/streaming_transcription_response.py +92 -0
  24. cartesia-2.0.5/src/cartesia/stt/types/stt_encoding.py +5 -0
  25. cartesia-2.0.5/src/cartesia/stt/types/transcript_message.py +44 -0
  26. cartesia-2.0.5/src/cartesia/stt/types/transcription_response.py +32 -0
  27. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/_websocket.py +3 -3
  28. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/__init__.py +0 -0
  29. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/client.py +0 -0
  30. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/requests/__init__.py +0 -0
  31. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/requests/api_info.py +0 -0
  32. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/types/__init__.py +0 -0
  33. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/api_status/types/api_info.py +0 -0
  34. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/__init__.py +0 -0
  35. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/client.py +0 -0
  36. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/requests/__init__.py +0 -0
  37. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/requests/token_grant.py +0 -0
  38. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/requests/token_request.py +0 -0
  39. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/requests/token_response.py +0 -0
  40. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/types/__init__.py +0 -0
  41. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/types/token_grant.py +0 -0
  42. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/types/token_request.py +0 -0
  43. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/auth/types/token_response.py +0 -0
  44. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/__init__.py +0 -0
  45. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/api_error.py +0 -0
  46. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/datetime_utils.py +0 -0
  47. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/file.py +0 -0
  48. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/http_client.py +0 -0
  49. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/jsonable_encoder.py +0 -0
  50. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/pagination.py +0 -0
  51. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/pydantic_utilities.py +0 -0
  52. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/query_encoder.py +0 -0
  53. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/remove_none_from_dict.py +0 -0
  54. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/request_options.py +0 -0
  55. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/core/serialization.py +0 -0
  56. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/__init__.py +0 -0
  57. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/__init__.py +0 -0
  58. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/create_dataset_request.py +0 -0
  59. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/dataset.py +0 -0
  60. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/dataset_file.py +0 -0
  61. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/paginated_dataset_files.py +0 -0
  62. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/requests/paginated_datasets.py +0 -0
  63. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/__init__.py +0 -0
  64. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/create_dataset_request.py +0 -0
  65. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/dataset.py +0 -0
  66. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/dataset_file.py +0 -0
  67. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/file_purpose.py +0 -0
  68. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/paginated_dataset_files.py +0 -0
  69. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/datasets/types/paginated_datasets.py +0 -0
  70. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/embedding/__init__.py +0 -0
  71. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/embedding/types/__init__.py +0 -0
  72. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/embedding/types/embedding.py +0 -0
  73. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/environment.py +0 -0
  74. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/infill/__init__.py +0 -0
  75. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/infill/client.py +0 -0
  76. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/py.typed +0 -0
  77. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/__init__.py +0 -0
  78. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/_async_websocket.py +0 -0
  79. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/client.py +0 -0
  80. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/__init__.py +0 -0
  81. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/cancel_context_request.py +0 -0
  82. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/controls.py +0 -0
  83. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/generation_request.py +0 -0
  84. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/mp_3_output_format.py +0 -0
  85. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/output_format.py +0 -0
  86. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/phoneme_timestamps.py +0 -0
  87. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/raw_output_format.py +0 -0
  88. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/speed.py +0 -0
  89. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/tts_request.py +0 -0
  90. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/tts_request_embedding_specifier.py +0 -0
  91. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/tts_request_id_specifier.py +0 -0
  92. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/tts_request_voice_specifier.py +0 -0
  93. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/wav_output_format.py +0 -0
  94. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_base_response.py +0 -0
  95. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_chunk_response.py +0 -0
  96. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_done_response.py +0 -0
  97. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_error_response.py +0 -0
  98. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_flush_done_response.py +0 -0
  99. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_phoneme_timestamps_response.py +0 -0
  100. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_raw_output_format.py +0 -0
  101. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_request.py +0 -0
  102. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_response.py +0 -0
  103. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_stream_options.py +0 -0
  104. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_timestamps_response.py +0 -0
  105. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_tts_output.py +0 -0
  106. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/web_socket_tts_request.py +0 -0
  107. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/requests/word_timestamps.py +0 -0
  108. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/socket_client.py +0 -0
  109. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/__init__.py +0 -0
  110. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/cancel_context_request.py +0 -0
  111. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/context_id.py +0 -0
  112. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/controls.py +0 -0
  113. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/emotion.py +0 -0
  114. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/flush_id.py +0 -0
  115. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/generation_request.py +0 -0
  116. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/model_speed.py +0 -0
  117. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/mp_3_output_format.py +0 -0
  118. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/natural_specifier.py +0 -0
  119. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/numerical_specifier.py +0 -0
  120. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/output_format.py +0 -0
  121. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/phoneme_timestamps.py +0 -0
  122. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/raw_encoding.py +0 -0
  123. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/raw_output_format.py +0 -0
  124. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/speed.py +0 -0
  125. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/supported_language.py +0 -0
  126. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/tts_request.py +0 -0
  127. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/tts_request_embedding_specifier.py +0 -0
  128. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/tts_request_id_specifier.py +0 -0
  129. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/tts_request_voice_specifier.py +0 -0
  130. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/wav_output_format.py +0 -0
  131. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_base_response.py +0 -0
  132. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_chunk_response.py +0 -0
  133. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_done_response.py +0 -0
  134. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_error_response.py +0 -0
  135. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_flush_done_response.py +0 -0
  136. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_phoneme_timestamps_response.py +0 -0
  137. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_raw_output_format.py +0 -0
  138. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_request.py +0 -0
  139. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_response.py +0 -0
  140. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_stream_options.py +0 -0
  141. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_timestamps_response.py +0 -0
  142. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_tts_output.py +0 -0
  143. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/web_socket_tts_request.py +0 -0
  144. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/types/word_timestamps.py +0 -0
  145. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/utils/constants.py +0 -0
  146. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/utils/tts.py +0 -0
  147. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/tts/utils/types.py +0 -0
  148. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/version.py +0 -0
  149. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/__init__.py +0 -0
  150. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/client.py +0 -0
  151. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/requests/__init__.py +0 -0
  152. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/requests/streaming_response.py +0 -0
  153. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/types/__init__.py +0 -0
  154. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/types/output_format_container.py +0 -0
  155. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voice_changer/types/streaming_response.py +0 -0
  156. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/__init__.py +0 -0
  157. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/client.py +0 -0
  158. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/__init__.py +0 -0
  159. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/create_voice_request.py +0 -0
  160. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/embedding_response.py +0 -0
  161. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/embedding_specifier.py +0 -0
  162. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/get_voices_response.py +0 -0
  163. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/id_specifier.py +0 -0
  164. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/localize_dialect.py +0 -0
  165. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/localize_voice_request.py +0 -0
  166. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/mix_voice_specifier.py +0 -0
  167. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/mix_voices_request.py +0 -0
  168. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/update_voice_request.py +0 -0
  169. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/voice.py +0 -0
  170. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/requests/voice_metadata.py +0 -0
  171. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/__init__.py +0 -0
  172. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/base_voice_id.py +0 -0
  173. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/clone_mode.py +0 -0
  174. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/create_voice_request.py +0 -0
  175. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/embedding_response.py +0 -0
  176. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/embedding_specifier.py +0 -0
  177. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/gender.py +0 -0
  178. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/gender_presentation.py +0 -0
  179. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/get_voices_response.py +0 -0
  180. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/id_specifier.py +0 -0
  181. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_dialect.py +0 -0
  182. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_english_dialect.py +0 -0
  183. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_french_dialect.py +0 -0
  184. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_portuguese_dialect.py +0 -0
  185. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_spanish_dialect.py +0 -0
  186. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_target_language.py +0 -0
  187. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/localize_voice_request.py +0 -0
  188. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/mix_voice_specifier.py +0 -0
  189. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/mix_voices_request.py +0 -0
  190. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/update_voice_request.py +0 -0
  191. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/voice.py +0 -0
  192. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/voice_expand_options.py +0 -0
  193. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/voice_id.py +0 -0
  194. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/voice_metadata.py +0 -0
  195. {cartesia-2.0.3 → cartesia-2.0.5}/src/cartesia/voices/types/weight.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cartesia
3
- Version: 2.0.3
3
+ Version: 2.0.5
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -213,6 +213,161 @@ p.terminate()
213
213
  ws.close() # Close the websocket connection
214
214
  ```
215
215
 
216
+ ## Speech-to-Text (STT) with Websockets
217
+
218
+ ```python
219
+ from cartesia import Cartesia
220
+ import os
221
+
222
+ client = Cartesia(api_key=os.getenv("CARTESIA_API_KEY"))
223
+
224
+ # Load your audio file as bytes
225
+ with open("path/to/audio.wav", "rb") as f:
226
+ audio_data = f.read()
227
+
228
+ # Convert to audio chunks (20ms chunks used here for a streaming example)
229
+ # This chunk size is calculated for 16kHz, 16-bit audio: 16000 * 0.02 * 2 = 640 bytes
230
+ chunk_size = 640
231
+ audio_chunks = [audio_data[i:i+chunk_size] for i in range(0, len(audio_data), chunk_size)]
232
+
233
+ # Create websocket connection
234
+ ws = client.stt.websocket(
235
+ model="ink-whisper",
236
+ language="en", # Must match the language of your audio
237
+ encoding="pcm_s16le", # Must match your audio's encoding format
238
+ sample_rate=16000, # Must match your audio's sample rate
239
+ )
240
+
241
+ # Send audio chunks (streaming approach)
242
+ for chunk in audio_chunks:
243
+ ws.send(chunk)
244
+
245
+ # Finalize and close
246
+ ws.send("finalize")
247
+ ws.send("done")
248
+
249
+ # Receive transcription results
250
+ for result in ws.receive():
251
+ if result['type'] == 'transcript':
252
+ print(f"Transcription: {result['text']}")
253
+ if result['is_final']:
254
+ print("Final result received")
255
+ elif result['type'] == 'done':
256
+ break
257
+
258
+ ws.close()
259
+ ```
260
+
261
+ ### Async Streaming Speech-to-Text (STT) with Websockets
262
+
263
+ For real-time streaming applications, here's a more practical async example that demonstrates concurrent audio processing and result handling:
264
+
265
+ ```python
266
+ import asyncio
267
+ import os
268
+ from cartesia import AsyncCartesia
269
+
270
+ async def streaming_stt_example():
271
+ """
272
+ Advanced async STT example for real-time streaming applications.
273
+ This example simulates streaming audio processing with proper error handling.
274
+ """
275
+ client = AsyncCartesia(api_key=os.getenv("CARTESIA_API_KEY"))
276
+
277
+ try:
278
+ # Create websocket connection
279
+ ws = await client.stt.websocket(
280
+ model="ink-whisper",
281
+ language="en", # Must match the language of your audio
282
+ encoding="pcm_s16le", # Must match your audio's encoding format
283
+ sample_rate=16000, # Must match your audio's sample rate
284
+ )
285
+
286
+ # Simulate streaming audio data (replace with your audio source)
287
+ async def audio_stream():
288
+ """Simulate real-time audio streaming - replace with actual audio capture"""
289
+ # Load audio file for simulation
290
+ with open("path/to/audio.wav", "rb") as f:
291
+ audio_data = f.read()
292
+
293
+ # Stream in 100ms chunks (realistic for real-time processing)
294
+ chunk_size = int(16000 * 0.1 * 2) # 100ms at 16kHz, 16-bit
295
+
296
+ for i in range(0, len(audio_data), chunk_size):
297
+ chunk = audio_data[i:i + chunk_size]
298
+ if chunk:
299
+ yield chunk
300
+ # Simulate real-time streaming delay
301
+ await asyncio.sleep(0.1)
302
+
303
+ # Send audio and receive results concurrently
304
+ async def send_audio():
305
+ """Send audio chunks to the STT websocket"""
306
+ try:
307
+ async for chunk in audio_stream():
308
+ await ws.send(chunk)
309
+ print(f"Sent audio chunk of {len(chunk)} bytes")
310
+ # Small delay to simulate realtime applications
311
+ await asyncio.sleep(0.02)
312
+
313
+ # Signal end of audio stream
314
+ await ws.send("finalize")
315
+ await ws.send("done")
316
+ print("Audio streaming completed")
317
+
318
+ except Exception as e:
319
+ print(f"Error sending audio: {e}")
320
+
321
+ async def receive_transcripts():
322
+ """Receive and process transcription results"""
323
+ full_transcript = ""
324
+
325
+ try:
326
+ async for result in ws.receive():
327
+ if result['type'] == 'transcript':
328
+ text = result['text']
329
+ is_final = result['is_final']
330
+
331
+ if is_final:
332
+ # Final result - this text won't change
333
+ full_transcript += text + " "
334
+ print(f"FINAL: {text}")
335
+ else:
336
+ # Partial result - may change as more audio is processed
337
+ print(f"PARTIAL: {text}")
338
+
339
+ elif result['type'] == 'done':
340
+ print("Transcription completed")
341
+ break
342
+
343
+ except Exception as e:
344
+ print(f"Error receiving transcripts: {e}")
345
+
346
+ return full_transcript.strip()
347
+
348
+ print("Starting streaming STT...")
349
+
350
+ # Use asyncio.gather to run audio sending and transcript receiving concurrently
351
+ _, final_transcript = await asyncio.gather(
352
+ send_audio(),
353
+ receive_transcripts()
354
+ )
355
+
356
+ print(f"\nComplete transcript: {final_transcript}")
357
+
358
+ # Clean up
359
+ await ws.close()
360
+
361
+ except Exception as e:
362
+ print(f"STT streaming error: {e}")
363
+ finally:
364
+ await client.close()
365
+
366
+ # Run the example
367
+ if __name__ == "__main__":
368
+ asyncio.run(streaming_stt_example())
369
+ ```
370
+
216
371
  ## Voices
217
372
 
218
373
  List all available Voices with `client.voices.list`, which returns an iterable that automatically handles pagination:
@@ -358,7 +513,6 @@ new_voice = client.voices.create(
358
513
  language="en"
359
514
  )
360
515
  ```
361
-
362
516
  ### Custom Client
363
517
 
364
518
  You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
@@ -412,3 +566,6 @@ $ git commit --amend -m "manually regenerate from docs" # optional
412
566
 
413
567
  From https://github.com/cartesia-ai/docs click `Actions` then `Release Python SDK`. (Requires permissions.)
414
568
 
569
+
570
+
571
+
@@ -181,6 +181,161 @@ p.terminate()
181
181
  ws.close() # Close the websocket connection
182
182
  ```
183
183
 
184
+ ## Speech-to-Text (STT) with Websockets
185
+
186
+ ```python
187
+ from cartesia import Cartesia
188
+ import os
189
+
190
+ client = Cartesia(api_key=os.getenv("CARTESIA_API_KEY"))
191
+
192
+ # Load your audio file as bytes
193
+ with open("path/to/audio.wav", "rb") as f:
194
+ audio_data = f.read()
195
+
196
+ # Convert to audio chunks (20ms chunks used here for a streaming example)
197
+ # This chunk size is calculated for 16kHz, 16-bit audio: 16000 * 0.02 * 2 = 640 bytes
198
+ chunk_size = 640
199
+ audio_chunks = [audio_data[i:i+chunk_size] for i in range(0, len(audio_data), chunk_size)]
200
+
201
+ # Create websocket connection
202
+ ws = client.stt.websocket(
203
+ model="ink-whisper",
204
+ language="en", # Must match the language of your audio
205
+ encoding="pcm_s16le", # Must match your audio's encoding format
206
+ sample_rate=16000, # Must match your audio's sample rate
207
+ )
208
+
209
+ # Send audio chunks (streaming approach)
210
+ for chunk in audio_chunks:
211
+ ws.send(chunk)
212
+
213
+ # Finalize and close
214
+ ws.send("finalize")
215
+ ws.send("done")
216
+
217
+ # Receive transcription results
218
+ for result in ws.receive():
219
+ if result['type'] == 'transcript':
220
+ print(f"Transcription: {result['text']}")
221
+ if result['is_final']:
222
+ print("Final result received")
223
+ elif result['type'] == 'done':
224
+ break
225
+
226
+ ws.close()
227
+ ```
228
+
229
+ ### Async Streaming Speech-to-Text (STT) with Websockets
230
+
231
+ For real-time streaming applications, here's a more practical async example that demonstrates concurrent audio processing and result handling:
232
+
233
+ ```python
234
+ import asyncio
235
+ import os
236
+ from cartesia import AsyncCartesia
237
+
238
+ async def streaming_stt_example():
239
+ """
240
+ Advanced async STT example for real-time streaming applications.
241
+ This example simulates streaming audio processing with proper error handling.
242
+ """
243
+ client = AsyncCartesia(api_key=os.getenv("CARTESIA_API_KEY"))
244
+
245
+ try:
246
+ # Create websocket connection
247
+ ws = await client.stt.websocket(
248
+ model="ink-whisper",
249
+ language="en", # Must match the language of your audio
250
+ encoding="pcm_s16le", # Must match your audio's encoding format
251
+ sample_rate=16000, # Must match your audio's sample rate
252
+ )
253
+
254
+ # Simulate streaming audio data (replace with your audio source)
255
+ async def audio_stream():
256
+ """Simulate real-time audio streaming - replace with actual audio capture"""
257
+ # Load audio file for simulation
258
+ with open("path/to/audio.wav", "rb") as f:
259
+ audio_data = f.read()
260
+
261
+ # Stream in 100ms chunks (realistic for real-time processing)
262
+ chunk_size = int(16000 * 0.1 * 2) # 100ms at 16kHz, 16-bit
263
+
264
+ for i in range(0, len(audio_data), chunk_size):
265
+ chunk = audio_data[i:i + chunk_size]
266
+ if chunk:
267
+ yield chunk
268
+ # Simulate real-time streaming delay
269
+ await asyncio.sleep(0.1)
270
+
271
+ # Send audio and receive results concurrently
272
+ async def send_audio():
273
+ """Send audio chunks to the STT websocket"""
274
+ try:
275
+ async for chunk in audio_stream():
276
+ await ws.send(chunk)
277
+ print(f"Sent audio chunk of {len(chunk)} bytes")
278
+ # Small delay to simulate realtime applications
279
+ await asyncio.sleep(0.02)
280
+
281
+ # Signal end of audio stream
282
+ await ws.send("finalize")
283
+ await ws.send("done")
284
+ print("Audio streaming completed")
285
+
286
+ except Exception as e:
287
+ print(f"Error sending audio: {e}")
288
+
289
+ async def receive_transcripts():
290
+ """Receive and process transcription results"""
291
+ full_transcript = ""
292
+
293
+ try:
294
+ async for result in ws.receive():
295
+ if result['type'] == 'transcript':
296
+ text = result['text']
297
+ is_final = result['is_final']
298
+
299
+ if is_final:
300
+ # Final result - this text won't change
301
+ full_transcript += text + " "
302
+ print(f"FINAL: {text}")
303
+ else:
304
+ # Partial result - may change as more audio is processed
305
+ print(f"PARTIAL: {text}")
306
+
307
+ elif result['type'] == 'done':
308
+ print("Transcription completed")
309
+ break
310
+
311
+ except Exception as e:
312
+ print(f"Error receiving transcripts: {e}")
313
+
314
+ return full_transcript.strip()
315
+
316
+ print("Starting streaming STT...")
317
+
318
+ # Use asyncio.gather to run audio sending and transcript receiving concurrently
319
+ _, final_transcript = await asyncio.gather(
320
+ send_audio(),
321
+ receive_transcripts()
322
+ )
323
+
324
+ print(f"\nComplete transcript: {final_transcript}")
325
+
326
+ # Clean up
327
+ await ws.close()
328
+
329
+ except Exception as e:
330
+ print(f"STT streaming error: {e}")
331
+ finally:
332
+ await client.close()
333
+
334
+ # Run the example
335
+ if __name__ == "__main__":
336
+ asyncio.run(streaming_stt_example())
337
+ ```
338
+
184
339
  ## Voices
185
340
 
186
341
  List all available Voices with `client.voices.list`, which returns an iterable that automatically handles pagination:
@@ -326,7 +481,6 @@ new_voice = client.voices.create(
326
481
  language="en"
327
482
  )
328
483
  ```
329
-
330
484
  ### Custom Client
331
485
 
332
486
  You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
@@ -379,3 +533,6 @@ $ git commit --amend -m "manually regenerate from docs" # optional
379
533
  ### Automatically generating new SDK releases
380
534
 
381
535
  From https://github.com/cartesia-ai/docs click `Actions` then `Release Python SDK`. (Requires permissions.)
536
+
537
+
538
+
@@ -3,7 +3,7 @@ name = "cartesia"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "cartesia"
6
- version = "2.0.3"
6
+ version = "2.0.5"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -1,6 +1,6 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from . import api_status, auth, datasets, embedding, infill, tts, voice_changer, voices
3
+ from . import api_status, auth, datasets, embedding, infill, stt, tts, voice_changer, voices
4
4
  from .api_status import ApiInfo, ApiInfoParams
5
5
  from .auth import TokenGrant, TokenGrantParams, TokenRequest, TokenRequestParams, TokenResponse, TokenResponseParams
6
6
  from .client import AsyncCartesia, Cartesia
@@ -19,6 +19,29 @@ from .datasets import (
19
19
  )
20
20
  from .embedding import Embedding
21
21
  from .environment import CartesiaEnvironment
22
+ from .stt import (
23
+ DoneMessage,
24
+ DoneMessageParams,
25
+ ErrorMessage,
26
+ ErrorMessageParams,
27
+ FlushDoneMessage,
28
+ FlushDoneMessageParams,
29
+ StreamingTranscriptionResponse,
30
+ StreamingTranscriptionResponseParams,
31
+ StreamingTranscriptionResponse_Done,
32
+ StreamingTranscriptionResponse_DoneParams,
33
+ StreamingTranscriptionResponse_Error,
34
+ StreamingTranscriptionResponse_ErrorParams,
35
+ StreamingTranscriptionResponse_FlushDone,
36
+ StreamingTranscriptionResponse_FlushDoneParams,
37
+ StreamingTranscriptionResponse_Transcript,
38
+ StreamingTranscriptionResponse_TranscriptParams,
39
+ SttEncoding,
40
+ TranscriptMessage,
41
+ TranscriptMessageParams,
42
+ TranscriptionResponse,
43
+ TranscriptionResponseParams,
44
+ )
22
45
  from .tts import (
23
46
  CancelContextRequest,
24
47
  CancelContextRequestParams,
@@ -173,13 +196,19 @@ __all__ = [
173
196
  "DatasetFile",
174
197
  "DatasetFileParams",
175
198
  "DatasetParams",
199
+ "DoneMessage",
200
+ "DoneMessageParams",
176
201
  "Embedding",
177
202
  "EmbeddingResponse",
178
203
  "EmbeddingResponseParams",
179
204
  "EmbeddingSpecifier",
180
205
  "EmbeddingSpecifierParams",
181
206
  "Emotion",
207
+ "ErrorMessage",
208
+ "ErrorMessageParams",
182
209
  "FilePurpose",
210
+ "FlushDoneMessage",
211
+ "FlushDoneMessageParams",
183
212
  "FlushId",
184
213
  "Gender",
185
214
  "GenderPresentation",
@@ -235,6 +264,17 @@ __all__ = [
235
264
  "StreamingResponse_DoneParams",
236
265
  "StreamingResponse_Error",
237
266
  "StreamingResponse_ErrorParams",
267
+ "StreamingTranscriptionResponse",
268
+ "StreamingTranscriptionResponseParams",
269
+ "StreamingTranscriptionResponse_Done",
270
+ "StreamingTranscriptionResponse_DoneParams",
271
+ "StreamingTranscriptionResponse_Error",
272
+ "StreamingTranscriptionResponse_ErrorParams",
273
+ "StreamingTranscriptionResponse_FlushDone",
274
+ "StreamingTranscriptionResponse_FlushDoneParams",
275
+ "StreamingTranscriptionResponse_Transcript",
276
+ "StreamingTranscriptionResponse_TranscriptParams",
277
+ "SttEncoding",
238
278
  "SupportedLanguage",
239
279
  "TokenGrant",
240
280
  "TokenGrantParams",
@@ -242,6 +282,10 @@ __all__ = [
242
282
  "TokenRequestParams",
243
283
  "TokenResponse",
244
284
  "TokenResponseParams",
285
+ "TranscriptMessage",
286
+ "TranscriptMessageParams",
287
+ "TranscriptionResponse",
288
+ "TranscriptionResponseParams",
245
289
  "TtsRequest",
246
290
  "TtsRequestEmbeddingSpecifier",
247
291
  "TtsRequestEmbeddingSpecifierParams",
@@ -307,6 +351,7 @@ __all__ = [
307
351
  "datasets",
308
352
  "embedding",
309
353
  "infill",
354
+ "stt",
310
355
  "tts",
311
356
  "voice_changer",
312
357
  "voices",
@@ -7,6 +7,7 @@ from .core.client_wrapper import SyncClientWrapper
7
7
  from .api_status.client import ApiStatusClient
8
8
  from .auth.client import AuthClient
9
9
  from .infill.client import InfillClient
10
+ from .stt.socket_client import AsyncSttClientWithWebsocket, SttClientWithWebsocket
10
11
  from .tts.client import TtsClient
11
12
  from .voice_changer.client import VoiceChangerClient
12
13
  from .voices.client import VoicesClient
@@ -80,6 +81,7 @@ class BaseCartesia:
80
81
  self.api_status = ApiStatusClient(client_wrapper=self._client_wrapper)
81
82
  self.auth = AuthClient(client_wrapper=self._client_wrapper)
82
83
  self.infill = InfillClient(client_wrapper=self._client_wrapper)
84
+ self.stt = SttClientWithWebsocket(client_wrapper=self._client_wrapper)
83
85
  self.tts = TtsClient(client_wrapper=self._client_wrapper)
84
86
  self.voice_changer = VoiceChangerClient(client_wrapper=self._client_wrapper)
85
87
  self.voices = VoicesClient(client_wrapper=self._client_wrapper)
@@ -8,6 +8,7 @@ import httpx
8
8
 
9
9
  from .base_client import AsyncBaseCartesia, BaseCartesia
10
10
  from .environment import CartesiaEnvironment
11
+ from .stt.socket_client import AsyncSttClientWithWebsocket, SttClientWithWebsocket
11
12
  from .tts.socket_client import AsyncTtsClientWithWebsocket, TtsClientWithWebsocket
12
13
 
13
14
 
@@ -66,6 +67,7 @@ class Cartesia(BaseCartesia):
66
67
  follow_redirects=follow_redirects,
67
68
  httpx_client=httpx_client,
68
69
  )
70
+ self.stt = SttClientWithWebsocket(client_wrapper=self._client_wrapper)
69
71
  self.tts = TtsClientWithWebsocket(client_wrapper=self._client_wrapper)
70
72
 
71
73
  def __enter__(self):
@@ -143,6 +145,9 @@ class AsyncCartesia(AsyncBaseCartesia):
143
145
  self._session = None
144
146
  self._loop = None
145
147
  self.max_num_connections = max_num_connections
148
+ self.stt = AsyncSttClientWithWebsocket(
149
+ client_wrapper=self._client_wrapper, get_session=self._get_session
150
+ )
146
151
  self.tts = AsyncTtsClientWithWebsocket(
147
152
  client_wrapper=self._client_wrapper, get_session=self._get_session
148
153
  )
@@ -16,7 +16,7 @@ class BaseClientWrapper:
16
16
  headers: typing.Dict[str, str] = {
17
17
  "X-Fern-Language": "Python",
18
18
  "X-Fern-SDK-Name": "cartesia",
19
- "X-Fern-SDK-Version": "2.0.3",
19
+ "X-Fern-SDK-Version": "2.0.5",
20
20
  }
21
21
  headers["X-API-Key"] = self.api_key
22
22
  headers["Cartesia-Version"] = "2024-11-13"
@@ -0,0 +1,51 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import (
4
+ DoneMessage,
5
+ ErrorMessage,
6
+ FlushDoneMessage,
7
+ StreamingTranscriptionResponse,
8
+ StreamingTranscriptionResponse_Done,
9
+ StreamingTranscriptionResponse_Error,
10
+ StreamingTranscriptionResponse_FlushDone,
11
+ StreamingTranscriptionResponse_Transcript,
12
+ SttEncoding,
13
+ TranscriptMessage,
14
+ TranscriptionResponse,
15
+ )
16
+ from .requests import (
17
+ DoneMessageParams,
18
+ ErrorMessageParams,
19
+ FlushDoneMessageParams,
20
+ StreamingTranscriptionResponseParams,
21
+ StreamingTranscriptionResponse_DoneParams,
22
+ StreamingTranscriptionResponse_ErrorParams,
23
+ StreamingTranscriptionResponse_FlushDoneParams,
24
+ StreamingTranscriptionResponse_TranscriptParams,
25
+ TranscriptMessageParams,
26
+ TranscriptionResponseParams,
27
+ )
28
+
29
+ __all__ = [
30
+ "DoneMessage",
31
+ "DoneMessageParams",
32
+ "ErrorMessage",
33
+ "ErrorMessageParams",
34
+ "FlushDoneMessage",
35
+ "FlushDoneMessageParams",
36
+ "StreamingTranscriptionResponse",
37
+ "StreamingTranscriptionResponseParams",
38
+ "StreamingTranscriptionResponse_Done",
39
+ "StreamingTranscriptionResponse_DoneParams",
40
+ "StreamingTranscriptionResponse_Error",
41
+ "StreamingTranscriptionResponse_ErrorParams",
42
+ "StreamingTranscriptionResponse_FlushDone",
43
+ "StreamingTranscriptionResponse_FlushDoneParams",
44
+ "StreamingTranscriptionResponse_Transcript",
45
+ "StreamingTranscriptionResponse_TranscriptParams",
46
+ "SttEncoding",
47
+ "TranscriptMessage",
48
+ "TranscriptMessageParams",
49
+ "TranscriptionResponse",
50
+ "TranscriptionResponseParams",
51
+ ]