sarvamai 0.1.5a10__tar.gz → 0.1.5a13__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.
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/PKG-INFO +1 -1
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/pyproject.toml +1 -1
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/__init__.py +30 -11
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/client.py +10 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/client_wrapper.py +2 -2
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/__init__.py +12 -4
- sarvamai-0.1.5a13/src/sarvamai/requests/config_message.py +17 -0
- sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_response_data.py +9 -0
- sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_streaming_response.py +10 -0
- sarvamai-0.1.5a10/src/sarvamai/requests/transcription_data.py → sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_transcription_data.py +2 -2
- sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_translate_response_data.py +11 -0
- sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_translate_streaming_response.py +10 -0
- sarvamai-0.1.5a13/src/sarvamai/requests/speech_to_text_translate_transcription_data.py +23 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/client.py +4 -4
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/raw_client.py +4 -4
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/socket_client.py +30 -5
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/__init__.py +7 -0
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/client.py +176 -0
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/raw_client.py +153 -0
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/socket_client.py +191 -0
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/types/__init__.py +7 -0
- sarvamai-0.1.5a13/src/sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_model.py +5 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/__init__.py +14 -6
- sarvamai-0.1.5a13/src/sarvamai/types/config_message.py +27 -0
- sarvamai-0.1.5a13/src/sarvamai/types/response_type.py +5 -0
- sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_response_data.py +9 -0
- sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_streaming_response.py +22 -0
- sarvamai-0.1.5a10/src/sarvamai/types/transcription_data.py → sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_transcription_data.py +2 -2
- sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_translate_response_data.py +9 -0
- sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_translate_streaming_response.py +22 -0
- sarvamai-0.1.5a13/src/sarvamai/types/speech_to_text_translate_transcription_data.py +35 -0
- sarvamai-0.1.5a10/src/sarvamai/requests/speech_to_text_streaming_response.py +0 -10
- sarvamai-0.1.5a10/src/sarvamai/requests/speech_to_text_streaming_response_data.py +0 -9
- sarvamai-0.1.5a10/src/sarvamai/types/speech_to_text_streaming_response.py +0 -22
- sarvamai-0.1.5a10/src/sarvamai/types/speech_to_text_streaming_response_data.py +0 -9
- sarvamai-0.1.5a10/src/sarvamai/types/speech_to_text_streaming_response_type.py +0 -5
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/README.md +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/chat/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/chat/client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/chat/raw_client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/api_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/datetime_utils.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/events.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/file.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/force_multipart.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/http_client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/http_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/jsonable_encoder.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/pydantic_utilities.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/query_encoder.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/remove_none_from_dict.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/request_options.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/core/serialization.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/environment.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/bad_request_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/forbidden_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/internal_server_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/service_unavailable_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/too_many_requests_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/errors/unprocessable_entity_error.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/play.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/py.typed +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/audio_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/audio_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/chat_completion_request_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/choice.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/completion_usage.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/create_chat_completion_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/diarized_entry.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/diarized_transcript.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/error_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/error_details.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/error_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/events_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/language_identification_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/speech_to_text_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/speech_to_text_translate_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/stop_configuration.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/text_to_speech_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/timestamps_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/transcription_metrics.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/translation_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/requests/transliteration_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text/client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text/raw_client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/types/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text/client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text/raw_client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text_to_speech/__init__.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text_to_speech/client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/text_to_speech/raw_client.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/audio_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/audio_data_encoding.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/audio_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/chat_completion_request_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/choice.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/completion_usage.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/create_chat_completion_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/diarized_entry.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/diarized_transcript.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/error_code.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/error_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/error_details.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/error_message.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/events_data.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/finish_reason.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/format.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/language_identification_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/numerals_format.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/reasoning_effort.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/role.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/sarvam_model_ids.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_sample_rate.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_translate_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_translate_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/speech_to_text_translate_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/spoken_form_numerals_format.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/stop_configuration.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/text_to_speech_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/text_to_speech_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/text_to_speech_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/text_to_speech_speaker.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/timestamps_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/transcription_metrics.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translate_mode.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translate_model.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translate_source_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translate_speaker_gender.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translate_target_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translation_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/translatiterate_target_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/transliterate_mode.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/transliterate_source_language.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/types/transliteration_response.py +0 -0
- {sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/version.py +0 -0
|
@@ -16,6 +16,7 @@ from .types import (
|
|
|
16
16
|
ChatCompletionResponseMessage,
|
|
17
17
|
Choice,
|
|
18
18
|
CompletionUsage,
|
|
19
|
+
ConfigMessage,
|
|
19
20
|
CreateChatCompletionResponse,
|
|
20
21
|
DiarizedEntry,
|
|
21
22
|
DiarizedTranscript,
|
|
@@ -29,18 +30,22 @@ from .types import (
|
|
|
29
30
|
LanguageIdentificationResponse,
|
|
30
31
|
NumeralsFormat,
|
|
31
32
|
ReasoningEffort,
|
|
33
|
+
ResponseType,
|
|
32
34
|
Role,
|
|
33
35
|
SarvamModelIds,
|
|
34
36
|
SpeechSampleRate,
|
|
35
37
|
SpeechToTextLanguage,
|
|
36
38
|
SpeechToTextModel,
|
|
37
39
|
SpeechToTextResponse,
|
|
40
|
+
SpeechToTextResponseData,
|
|
38
41
|
SpeechToTextStreamingResponse,
|
|
39
|
-
|
|
40
|
-
SpeechToTextStreamingResponseType,
|
|
42
|
+
SpeechToTextTranscriptionData,
|
|
41
43
|
SpeechToTextTranslateLanguage,
|
|
42
44
|
SpeechToTextTranslateModel,
|
|
43
45
|
SpeechToTextTranslateResponse,
|
|
46
|
+
SpeechToTextTranslateResponseData,
|
|
47
|
+
SpeechToTextTranslateStreamingResponse,
|
|
48
|
+
SpeechToTextTranslateTranscriptionData,
|
|
44
49
|
SpokenFormNumeralsFormat,
|
|
45
50
|
StopConfiguration,
|
|
46
51
|
TextToSpeechLanguage,
|
|
@@ -48,7 +53,6 @@ from .types import (
|
|
|
48
53
|
TextToSpeechResponse,
|
|
49
54
|
TextToSpeechSpeaker,
|
|
50
55
|
TimestampsModel,
|
|
51
|
-
TranscriptionData,
|
|
52
56
|
TranscriptionMetrics,
|
|
53
57
|
TranslateMode,
|
|
54
58
|
TranslateModel,
|
|
@@ -69,7 +73,7 @@ from .errors import (
|
|
|
69
73
|
TooManyRequestsError,
|
|
70
74
|
UnprocessableEntityError,
|
|
71
75
|
)
|
|
72
|
-
from . import chat, speech_to_text, speech_to_text_streaming, text, text_to_speech
|
|
76
|
+
from . import chat, speech_to_text, speech_to_text_streaming, speech_to_text_translate_streaming, text, text_to_speech
|
|
73
77
|
from .client import AsyncSarvamAI, SarvamAI
|
|
74
78
|
from .environment import SarvamAIEnvironment
|
|
75
79
|
from .requests import (
|
|
@@ -85,6 +89,7 @@ from .requests import (
|
|
|
85
89
|
ChatCompletionResponseMessageParams,
|
|
86
90
|
ChoiceParams,
|
|
87
91
|
CompletionUsageParams,
|
|
92
|
+
ConfigMessageParams,
|
|
88
93
|
CreateChatCompletionResponseParams,
|
|
89
94
|
DiarizedEntryParams,
|
|
90
95
|
DiarizedTranscriptParams,
|
|
@@ -93,19 +98,23 @@ from .requests import (
|
|
|
93
98
|
ErrorMessageParams,
|
|
94
99
|
EventsDataParams,
|
|
95
100
|
LanguageIdentificationResponseParams,
|
|
101
|
+
SpeechToTextResponseDataParams,
|
|
96
102
|
SpeechToTextResponseParams,
|
|
97
|
-
SpeechToTextStreamingResponseDataParams,
|
|
98
103
|
SpeechToTextStreamingResponseParams,
|
|
104
|
+
SpeechToTextTranscriptionDataParams,
|
|
105
|
+
SpeechToTextTranslateResponseDataParams,
|
|
99
106
|
SpeechToTextTranslateResponseParams,
|
|
107
|
+
SpeechToTextTranslateStreamingResponseParams,
|
|
108
|
+
SpeechToTextTranslateTranscriptionDataParams,
|
|
100
109
|
StopConfigurationParams,
|
|
101
110
|
TextToSpeechResponseParams,
|
|
102
111
|
TimestampsModelParams,
|
|
103
|
-
TranscriptionDataParams,
|
|
104
112
|
TranscriptionMetricsParams,
|
|
105
113
|
TranslationResponseParams,
|
|
106
114
|
TransliterationResponseParams,
|
|
107
115
|
)
|
|
108
116
|
from .speech_to_text_streaming import SpeechToTextStreamingLanguageCode, SpeechToTextStreamingModel
|
|
117
|
+
from .speech_to_text_translate_streaming import SpeechToTextTranslateStreamingModel
|
|
109
118
|
from .version import __version__
|
|
110
119
|
|
|
111
120
|
__all__ = [
|
|
@@ -136,6 +145,8 @@ __all__ = [
|
|
|
136
145
|
"ChoiceParams",
|
|
137
146
|
"CompletionUsage",
|
|
138
147
|
"CompletionUsageParams",
|
|
148
|
+
"ConfigMessage",
|
|
149
|
+
"ConfigMessageParams",
|
|
139
150
|
"CreateChatCompletionResponse",
|
|
140
151
|
"CreateChatCompletionResponseParams",
|
|
141
152
|
"DiarizedEntry",
|
|
@@ -159,6 +170,7 @@ __all__ = [
|
|
|
159
170
|
"LanguageIdentificationResponseParams",
|
|
160
171
|
"NumeralsFormat",
|
|
161
172
|
"ReasoningEffort",
|
|
173
|
+
"ResponseType",
|
|
162
174
|
"Role",
|
|
163
175
|
"SarvamAI",
|
|
164
176
|
"SarvamAIEnvironment",
|
|
@@ -168,18 +180,26 @@ __all__ = [
|
|
|
168
180
|
"SpeechToTextLanguage",
|
|
169
181
|
"SpeechToTextModel",
|
|
170
182
|
"SpeechToTextResponse",
|
|
183
|
+
"SpeechToTextResponseData",
|
|
184
|
+
"SpeechToTextResponseDataParams",
|
|
171
185
|
"SpeechToTextResponseParams",
|
|
172
186
|
"SpeechToTextStreamingLanguageCode",
|
|
173
187
|
"SpeechToTextStreamingModel",
|
|
174
188
|
"SpeechToTextStreamingResponse",
|
|
175
|
-
"SpeechToTextStreamingResponseData",
|
|
176
|
-
"SpeechToTextStreamingResponseDataParams",
|
|
177
189
|
"SpeechToTextStreamingResponseParams",
|
|
178
|
-
"
|
|
190
|
+
"SpeechToTextTranscriptionData",
|
|
191
|
+
"SpeechToTextTranscriptionDataParams",
|
|
179
192
|
"SpeechToTextTranslateLanguage",
|
|
180
193
|
"SpeechToTextTranslateModel",
|
|
181
194
|
"SpeechToTextTranslateResponse",
|
|
195
|
+
"SpeechToTextTranslateResponseData",
|
|
196
|
+
"SpeechToTextTranslateResponseDataParams",
|
|
182
197
|
"SpeechToTextTranslateResponseParams",
|
|
198
|
+
"SpeechToTextTranslateStreamingModel",
|
|
199
|
+
"SpeechToTextTranslateStreamingResponse",
|
|
200
|
+
"SpeechToTextTranslateStreamingResponseParams",
|
|
201
|
+
"SpeechToTextTranslateTranscriptionData",
|
|
202
|
+
"SpeechToTextTranslateTranscriptionDataParams",
|
|
183
203
|
"SpokenFormNumeralsFormat",
|
|
184
204
|
"StopConfiguration",
|
|
185
205
|
"StopConfigurationParams",
|
|
@@ -191,8 +211,6 @@ __all__ = [
|
|
|
191
211
|
"TimestampsModel",
|
|
192
212
|
"TimestampsModelParams",
|
|
193
213
|
"TooManyRequestsError",
|
|
194
|
-
"TranscriptionData",
|
|
195
|
-
"TranscriptionDataParams",
|
|
196
214
|
"TranscriptionMetrics",
|
|
197
215
|
"TranscriptionMetricsParams",
|
|
198
216
|
"TranslateMode",
|
|
@@ -212,6 +230,7 @@ __all__ = [
|
|
|
212
230
|
"chat",
|
|
213
231
|
"speech_to_text",
|
|
214
232
|
"speech_to_text_streaming",
|
|
233
|
+
"speech_to_text_translate_streaming",
|
|
215
234
|
"text",
|
|
216
235
|
"text_to_speech",
|
|
217
236
|
]
|
|
@@ -10,6 +10,10 @@ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
10
10
|
from .environment import SarvamAIEnvironment
|
|
11
11
|
from .speech_to_text.client import AsyncSpeechToTextClient, SpeechToTextClient
|
|
12
12
|
from .speech_to_text_streaming.client import AsyncSpeechToTextStreamingClient, SpeechToTextStreamingClient
|
|
13
|
+
from .speech_to_text_translate_streaming.client import (
|
|
14
|
+
AsyncSpeechToTextTranslateStreamingClient,
|
|
15
|
+
SpeechToTextTranslateStreamingClient,
|
|
16
|
+
)
|
|
13
17
|
from .text.client import AsyncTextClient, TextClient
|
|
14
18
|
from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient
|
|
15
19
|
|
|
@@ -79,6 +83,9 @@ class SarvamAI:
|
|
|
79
83
|
self.text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
80
84
|
self.chat = ChatClient(client_wrapper=self._client_wrapper)
|
|
81
85
|
self.speech_to_text_streaming = SpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
86
|
+
self.speech_to_text_translate_streaming = SpeechToTextTranslateStreamingClient(
|
|
87
|
+
client_wrapper=self._client_wrapper
|
|
88
|
+
)
|
|
82
89
|
|
|
83
90
|
|
|
84
91
|
class AsyncSarvamAI:
|
|
@@ -146,3 +153,6 @@ class AsyncSarvamAI:
|
|
|
146
153
|
self.text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
147
154
|
self.chat = AsyncChatClient(client_wrapper=self._client_wrapper)
|
|
148
155
|
self.speech_to_text_streaming = AsyncSpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
156
|
+
self.speech_to_text_translate_streaming = AsyncSpeechToTextTranslateStreamingClient(
|
|
157
|
+
client_wrapper=self._client_wrapper
|
|
158
|
+
)
|
|
@@ -17,10 +17,10 @@ class BaseClientWrapper:
|
|
|
17
17
|
|
|
18
18
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
19
19
|
headers: typing.Dict[str, str] = {
|
|
20
|
-
"User-Agent": "sarvamai/0.1.
|
|
20
|
+
"User-Agent": "sarvamai/0.1.5a13",
|
|
21
21
|
"X-Fern-Language": "Python",
|
|
22
22
|
"X-Fern-SDK-Name": "sarvamai",
|
|
23
|
-
"X-Fern-SDK-Version": "0.1.
|
|
23
|
+
"X-Fern-SDK-Version": "0.1.5a13",
|
|
24
24
|
}
|
|
25
25
|
headers["api-subscription-key"] = self.api_subscription_key
|
|
26
26
|
return headers
|
|
@@ -16,6 +16,7 @@ from .chat_completion_request_user_message import ChatCompletionRequestUserMessa
|
|
|
16
16
|
from .chat_completion_response_message import ChatCompletionResponseMessageParams
|
|
17
17
|
from .choice import ChoiceParams
|
|
18
18
|
from .completion_usage import CompletionUsageParams
|
|
19
|
+
from .config_message import ConfigMessageParams
|
|
19
20
|
from .create_chat_completion_response import CreateChatCompletionResponseParams
|
|
20
21
|
from .diarized_entry import DiarizedEntryParams
|
|
21
22
|
from .diarized_transcript import DiarizedTranscriptParams
|
|
@@ -25,13 +26,16 @@ from .error_message import ErrorMessageParams
|
|
|
25
26
|
from .events_data import EventsDataParams
|
|
26
27
|
from .language_identification_response import LanguageIdentificationResponseParams
|
|
27
28
|
from .speech_to_text_response import SpeechToTextResponseParams
|
|
29
|
+
from .speech_to_text_response_data import SpeechToTextResponseDataParams
|
|
28
30
|
from .speech_to_text_streaming_response import SpeechToTextStreamingResponseParams
|
|
29
|
-
from .
|
|
31
|
+
from .speech_to_text_transcription_data import SpeechToTextTranscriptionDataParams
|
|
30
32
|
from .speech_to_text_translate_response import SpeechToTextTranslateResponseParams
|
|
33
|
+
from .speech_to_text_translate_response_data import SpeechToTextTranslateResponseDataParams
|
|
34
|
+
from .speech_to_text_translate_streaming_response import SpeechToTextTranslateStreamingResponseParams
|
|
35
|
+
from .speech_to_text_translate_transcription_data import SpeechToTextTranslateTranscriptionDataParams
|
|
31
36
|
from .stop_configuration import StopConfigurationParams
|
|
32
37
|
from .text_to_speech_response import TextToSpeechResponseParams
|
|
33
38
|
from .timestamps_model import TimestampsModelParams
|
|
34
|
-
from .transcription_data import TranscriptionDataParams
|
|
35
39
|
from .transcription_metrics import TranscriptionMetricsParams
|
|
36
40
|
from .translation_response import TranslationResponseParams
|
|
37
41
|
from .transliteration_response import TransliterationResponseParams
|
|
@@ -49,6 +53,7 @@ __all__ = [
|
|
|
49
53
|
"ChatCompletionResponseMessageParams",
|
|
50
54
|
"ChoiceParams",
|
|
51
55
|
"CompletionUsageParams",
|
|
56
|
+
"ConfigMessageParams",
|
|
52
57
|
"CreateChatCompletionResponseParams",
|
|
53
58
|
"DiarizedEntryParams",
|
|
54
59
|
"DiarizedTranscriptParams",
|
|
@@ -57,14 +62,17 @@ __all__ = [
|
|
|
57
62
|
"ErrorMessageParams",
|
|
58
63
|
"EventsDataParams",
|
|
59
64
|
"LanguageIdentificationResponseParams",
|
|
65
|
+
"SpeechToTextResponseDataParams",
|
|
60
66
|
"SpeechToTextResponseParams",
|
|
61
|
-
"SpeechToTextStreamingResponseDataParams",
|
|
62
67
|
"SpeechToTextStreamingResponseParams",
|
|
68
|
+
"SpeechToTextTranscriptionDataParams",
|
|
69
|
+
"SpeechToTextTranslateResponseDataParams",
|
|
63
70
|
"SpeechToTextTranslateResponseParams",
|
|
71
|
+
"SpeechToTextTranslateStreamingResponseParams",
|
|
72
|
+
"SpeechToTextTranslateTranscriptionDataParams",
|
|
64
73
|
"StopConfigurationParams",
|
|
65
74
|
"TextToSpeechResponseParams",
|
|
66
75
|
"TimestampsModelParams",
|
|
67
|
-
"TranscriptionDataParams",
|
|
68
76
|
"TranscriptionMetricsParams",
|
|
69
77
|
"TranslationResponseParams",
|
|
70
78
|
"TransliterationResponseParams",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import typing_extensions
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ConfigMessageParams(typing_extensions.TypedDict):
|
|
9
|
+
type: typing.Literal["config"]
|
|
10
|
+
"""
|
|
11
|
+
Message type identifier for configuration
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
prompt: typing_extensions.NotRequired[str]
|
|
15
|
+
"""
|
|
16
|
+
Prompt for ASR model to improve transcription accuracy
|
|
17
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from .error_data import ErrorDataParams
|
|
6
|
+
from .events_data import EventsDataParams
|
|
7
|
+
from .speech_to_text_transcription_data import SpeechToTextTranscriptionDataParams
|
|
8
|
+
|
|
9
|
+
SpeechToTextResponseDataParams = typing.Union[SpeechToTextTranscriptionDataParams, ErrorDataParams, EventsDataParams]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing_extensions
|
|
4
|
+
from ..types.response_type import ResponseType
|
|
5
|
+
from .speech_to_text_response_data import SpeechToTextResponseDataParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SpeechToTextStreamingResponseParams(typing_extensions.TypedDict):
|
|
9
|
+
type: ResponseType
|
|
10
|
+
data: SpeechToTextResponseDataParams
|
|
@@ -6,7 +6,7 @@ import typing_extensions
|
|
|
6
6
|
from .transcription_metrics import TranscriptionMetricsParams
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class SpeechToTextTranscriptionDataParams(typing_extensions.TypedDict):
|
|
10
10
|
request_id: str
|
|
11
11
|
"""
|
|
12
12
|
Unique identifier for the request
|
|
@@ -14,7 +14,7 @@ class TranscriptionDataParams(typing_extensions.TypedDict):
|
|
|
14
14
|
|
|
15
15
|
transcript: str
|
|
16
16
|
"""
|
|
17
|
-
Transcript of the provided speech
|
|
17
|
+
Transcript of the provided speech in original language
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
timestamps: typing_extensions.NotRequired[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from .error_data import ErrorDataParams
|
|
6
|
+
from .events_data import EventsDataParams
|
|
7
|
+
from .speech_to_text_translate_transcription_data import SpeechToTextTranslateTranscriptionDataParams
|
|
8
|
+
|
|
9
|
+
SpeechToTextTranslateResponseDataParams = typing.Union[
|
|
10
|
+
SpeechToTextTranslateTranscriptionDataParams, ErrorDataParams, EventsDataParams
|
|
11
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing_extensions
|
|
4
|
+
from ..types.response_type import ResponseType
|
|
5
|
+
from .speech_to_text_translate_response_data import SpeechToTextTranslateResponseDataParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SpeechToTextTranslateStreamingResponseParams(typing_extensions.TypedDict):
|
|
9
|
+
type: ResponseType
|
|
10
|
+
data: SpeechToTextTranslateResponseDataParams
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing_extensions
|
|
4
|
+
from .transcription_metrics import TranscriptionMetricsParams
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SpeechToTextTranslateTranscriptionDataParams(typing_extensions.TypedDict):
|
|
8
|
+
request_id: str
|
|
9
|
+
"""
|
|
10
|
+
Unique identifier for the request
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
transcript: str
|
|
14
|
+
"""
|
|
15
|
+
English translation of the provided speech
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
language_code: typing_extensions.NotRequired[str]
|
|
19
|
+
"""
|
|
20
|
+
BCP-47 code of detected source language (null when language detection is in progress)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
metrics: TranscriptionMetricsParams
|
|
@@ -35,7 +35,7 @@ class SpeechToTextStreamingClient:
|
|
|
35
35
|
self,
|
|
36
36
|
*,
|
|
37
37
|
language_code: SpeechToTextStreamingLanguageCode,
|
|
38
|
-
model: SpeechToTextStreamingModel,
|
|
38
|
+
model: typing.Optional[SpeechToTextStreamingModel] = None,
|
|
39
39
|
high_vad_sensitivity: typing.Optional[str] = None,
|
|
40
40
|
vad_signals: typing.Optional[str] = None,
|
|
41
41
|
api_subscription_key: typing.Optional[str] = None,
|
|
@@ -49,7 +49,7 @@ class SpeechToTextStreamingClient:
|
|
|
49
49
|
language_code : SpeechToTextStreamingLanguageCode
|
|
50
50
|
Language code for speech recognition
|
|
51
51
|
|
|
52
|
-
model : SpeechToTextStreamingModel
|
|
52
|
+
model : typing.Optional[SpeechToTextStreamingModel]
|
|
53
53
|
Speech to text model to use
|
|
54
54
|
|
|
55
55
|
high_vad_sensitivity : typing.Optional[str]
|
|
@@ -122,7 +122,7 @@ class AsyncSpeechToTextStreamingClient:
|
|
|
122
122
|
self,
|
|
123
123
|
*,
|
|
124
124
|
language_code: SpeechToTextStreamingLanguageCode,
|
|
125
|
-
model: SpeechToTextStreamingModel,
|
|
125
|
+
model: typing.Optional[SpeechToTextStreamingModel] = None,
|
|
126
126
|
high_vad_sensitivity: typing.Optional[str] = None,
|
|
127
127
|
vad_signals: typing.Optional[str] = None,
|
|
128
128
|
api_subscription_key: typing.Optional[str] = None,
|
|
@@ -136,7 +136,7 @@ class AsyncSpeechToTextStreamingClient:
|
|
|
136
136
|
language_code : SpeechToTextStreamingLanguageCode
|
|
137
137
|
Language code for speech recognition
|
|
138
138
|
|
|
139
|
-
model : SpeechToTextStreamingModel
|
|
139
|
+
model : typing.Optional[SpeechToTextStreamingModel]
|
|
140
140
|
Speech to text model to use
|
|
141
141
|
|
|
142
142
|
high_vad_sensitivity : typing.Optional[str]
|
|
@@ -23,7 +23,7 @@ class RawSpeechToTextStreamingClient:
|
|
|
23
23
|
self,
|
|
24
24
|
*,
|
|
25
25
|
language_code: SpeechToTextStreamingLanguageCode,
|
|
26
|
-
model: SpeechToTextStreamingModel,
|
|
26
|
+
model: typing.Optional[SpeechToTextStreamingModel] = None,
|
|
27
27
|
high_vad_sensitivity: typing.Optional[str] = None,
|
|
28
28
|
vad_signals: typing.Optional[str] = None,
|
|
29
29
|
api_subscription_key: typing.Optional[str] = None,
|
|
@@ -37,7 +37,7 @@ class RawSpeechToTextStreamingClient:
|
|
|
37
37
|
language_code : SpeechToTextStreamingLanguageCode
|
|
38
38
|
Language code for speech recognition
|
|
39
39
|
|
|
40
|
-
model : SpeechToTextStreamingModel
|
|
40
|
+
model : typing.Optional[SpeechToTextStreamingModel]
|
|
41
41
|
Speech to text model to use
|
|
42
42
|
|
|
43
43
|
high_vad_sensitivity : typing.Optional[str]
|
|
@@ -99,7 +99,7 @@ class AsyncRawSpeechToTextStreamingClient:
|
|
|
99
99
|
self,
|
|
100
100
|
*,
|
|
101
101
|
language_code: SpeechToTextStreamingLanguageCode,
|
|
102
|
-
model: SpeechToTextStreamingModel,
|
|
102
|
+
model: typing.Optional[SpeechToTextStreamingModel] = None,
|
|
103
103
|
high_vad_sensitivity: typing.Optional[str] = None,
|
|
104
104
|
vad_signals: typing.Optional[str] = None,
|
|
105
105
|
api_subscription_key: typing.Optional[str] = None,
|
|
@@ -113,7 +113,7 @@ class AsyncRawSpeechToTextStreamingClient:
|
|
|
113
113
|
language_code : SpeechToTextStreamingLanguageCode
|
|
114
114
|
Language code for speech recognition
|
|
115
115
|
|
|
116
|
-
model : SpeechToTextStreamingModel
|
|
116
|
+
model : typing.Optional[SpeechToTextStreamingModel]
|
|
117
117
|
Speech to text model to use
|
|
118
118
|
|
|
119
119
|
high_vad_sensitivity : typing.Optional[str]
|
{sarvamai-0.1.5a10 → sarvamai-0.1.5a13}/src/sarvamai/speech_to_text_streaming/socket_client.py
RENAMED
|
@@ -7,6 +7,7 @@ import websockets
|
|
|
7
7
|
import websockets.sync.connection as websockets_sync_connection
|
|
8
8
|
from ..core.events import EventEmitterMixin, EventType
|
|
9
9
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from ..types.audio_data import AudioData
|
|
10
11
|
from ..types.audio_message import AudioMessage
|
|
11
12
|
from ..types.speech_to_text_streaming_response import SpeechToTextStreamingResponse
|
|
12
13
|
|
|
@@ -44,7 +45,19 @@ class AsyncSpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
|
44
45
|
finally:
|
|
45
46
|
self._emit(EventType.CLOSE, None)
|
|
46
47
|
|
|
47
|
-
async def
|
|
48
|
+
async def transcribe(self, audio: str, encoding="audio/wav", sample_rate=16000):
|
|
49
|
+
"""
|
|
50
|
+
Sends transcription request to the server.
|
|
51
|
+
:param audio: Base64 encoded audio data
|
|
52
|
+
:param encoding: Audio encoding format (default is "audio/wav")
|
|
53
|
+
:param sample_rate: Audio sample rate in Hz (default is 16000)
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
return await self._send_speech_to_text_streaming_audio_message(
|
|
57
|
+
message=AudioMessage(audio=AudioData(data=audio, sample_rate=sample_rate, encoding=encoding))
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
async def _send_speech_to_text_streaming_audio_message(self, message: AudioMessage) -> None:
|
|
48
61
|
"""
|
|
49
62
|
Send a message to the websocket connection.
|
|
50
63
|
The message will be sent as a AudioMessage.
|
|
@@ -81,6 +94,7 @@ class SpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
|
81
94
|
|
|
82
95
|
def __iter__(self):
|
|
83
96
|
for message in self._websocket:
|
|
97
|
+
message = json.loads(message) if isinstance(message, str) else message
|
|
84
98
|
yield parse_obj_as(SpeechToTextStreamingSocketClientResponse, message) # type: ignore
|
|
85
99
|
|
|
86
100
|
def start_listening(self):
|
|
@@ -104,12 +118,16 @@ class SpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
|
104
118
|
finally:
|
|
105
119
|
self._emit(EventType.CLOSE, None)
|
|
106
120
|
|
|
107
|
-
def
|
|
121
|
+
def transcribe(self, audio: str, encoding="audio/wav", sample_rate=16000) -> None:
|
|
108
122
|
"""
|
|
109
|
-
|
|
110
|
-
|
|
123
|
+
Sends transcription request to the server.
|
|
124
|
+
:param audio: Base64 encoded audio data
|
|
125
|
+
:param encoding (Optional): Audio encoding format (default is "audio/wav")
|
|
126
|
+
:param sample_rate (Optional): Audio sample rate in Hz (default is 16000)
|
|
111
127
|
"""
|
|
112
|
-
self.
|
|
128
|
+
return self._send_speech_to_text_streaming_audio_message(
|
|
129
|
+
message=AudioMessage(audio=AudioData(data=audio, sample_rate=sample_rate, encoding=encoding))
|
|
130
|
+
)
|
|
113
131
|
|
|
114
132
|
def recv(self) -> SpeechToTextStreamingSocketClientResponse:
|
|
115
133
|
"""
|
|
@@ -119,6 +137,13 @@ class SpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
|
119
137
|
data = json.loads(data) if isinstance(data, str) else data
|
|
120
138
|
return parse_obj_as(SpeechToTextStreamingSocketClientResponse, data) # type: ignore
|
|
121
139
|
|
|
140
|
+
def _send_speech_to_text_streaming_audio_message(self, message: AudioMessage) -> None:
|
|
141
|
+
"""
|
|
142
|
+
Send a message to the websocket connection.
|
|
143
|
+
The message will be sent as a AudioMessage.
|
|
144
|
+
"""
|
|
145
|
+
self._send_model(message)
|
|
146
|
+
|
|
122
147
|
def _send(self, data: typing.Any) -> None:
|
|
123
148
|
"""
|
|
124
149
|
Send a message to the websocket connection.
|