sarvamai 0.1.5a5__py3-none-any.whl → 0.1.5a6__py3-none-any.whl
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/__init__.py +1 -45
- sarvamai/chat/__init__.py +0 -2
- sarvamai/chat/client.py +10 -9
- sarvamai/chat/raw_client.py +37 -48
- sarvamai/client.py +31 -13
- sarvamai/core/__init__.py +0 -5
- sarvamai/core/api_error.py +5 -13
- sarvamai/core/client_wrapper.py +20 -17
- sarvamai/core/http_client.py +24 -70
- sarvamai/core/http_response.py +11 -19
- sarvamai/core/pydantic_utilities.py +108 -69
- sarvamai/environment.py +3 -10
- sarvamai/errors/__init__.py +0 -2
- sarvamai/errors/bad_request_error.py +3 -4
- sarvamai/errors/forbidden_error.py +3 -4
- sarvamai/errors/internal_server_error.py +3 -4
- sarvamai/errors/service_unavailable_error.py +2 -4
- sarvamai/errors/too_many_requests_error.py +3 -4
- sarvamai/errors/unprocessable_entity_error.py +3 -4
- sarvamai/requests/__init__.py +0 -18
- sarvamai/requests/chat_completion_request_message.py +1 -3
- sarvamai/requests/create_chat_completion_response.py +2 -2
- sarvamai/requests/diarized_transcript.py +1 -2
- sarvamai/requests/error_details.py +1 -0
- sarvamai/requests/language_identification_response.py +1 -0
- sarvamai/requests/speech_to_text_response.py +2 -1
- sarvamai/requests/speech_to_text_translate_response.py +1 -0
- sarvamai/requests/text_to_speech_response.py +2 -2
- sarvamai/requests/timestamps_model.py +1 -2
- sarvamai/requests/translation_response.py +1 -0
- sarvamai/requests/transliteration_response.py +1 -0
- sarvamai/speech_to_text/__init__.py +0 -2
- sarvamai/speech_to_text/client.py +14 -13
- sarvamai/speech_to_text/raw_client.py +68 -99
- sarvamai/text/__init__.py +0 -2
- sarvamai/text/client.py +25 -24
- sarvamai/text/raw_client.py +91 -126
- sarvamai/text_to_speech/__init__.py +0 -2
- sarvamai/text_to_speech/client.py +11 -10
- sarvamai/text_to_speech/raw_client.py +38 -49
- sarvamai/types/__init__.py +0 -24
- sarvamai/types/chat_completion_request_assistant_message.py +3 -3
- sarvamai/types/chat_completion_request_message.py +2 -3
- sarvamai/types/chat_completion_request_system_message.py +3 -3
- sarvamai/types/chat_completion_request_user_message.py +3 -3
- sarvamai/types/chat_completion_response_message.py +3 -3
- sarvamai/types/choice.py +4 -4
- sarvamai/types/completion_usage.py +3 -3
- sarvamai/types/create_chat_completion_response.py +3 -3
- sarvamai/types/diarized_entry.py +3 -3
- sarvamai/types/diarized_transcript.py +3 -3
- sarvamai/types/error_details.py +3 -3
- sarvamai/types/error_message.py +4 -4
- sarvamai/types/language_identification_response.py +2 -2
- sarvamai/types/speech_to_text_response.py +3 -3
- sarvamai/types/speech_to_text_translate_response.py +3 -3
- sarvamai/types/text_to_speech_response.py +2 -2
- sarvamai/types/timestamps_model.py +2 -2
- sarvamai/types/translation_response.py +2 -2
- sarvamai/types/transliteration_response.py +2 -2
- sarvamai-0.1.5a6.dist-info/METADATA +174 -0
- sarvamai-0.1.5a6.dist-info/RECORD +106 -0
- sarvamai/core/events.py +0 -30
- sarvamai/core/force_multipart.py +0 -16
- sarvamai/requests/audio_data.py +0 -21
- sarvamai/requests/audio_message.py +0 -8
- sarvamai/requests/error_data.py +0 -15
- sarvamai/requests/events_data.py +0 -17
- sarvamai/requests/speech_to_text_streaming_response.py +0 -10
- sarvamai/requests/speech_to_text_streaming_response_data.py +0 -9
- sarvamai/requests/transcription_data.py +0 -35
- sarvamai/requests/transcription_metrics.py +0 -15
- sarvamai/speech_to_text_streaming/__init__.py +0 -7
- sarvamai/speech_to_text_streaming/client.py +0 -189
- sarvamai/speech_to_text_streaming/raw_client.py +0 -166
- sarvamai/speech_to_text_streaming/socket_client.py +0 -129
- sarvamai/speech_to_text_streaming/types/__init__.py +0 -8
- sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +0 -8
- sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +0 -5
- sarvamai/types/audio_data.py +0 -33
- sarvamai/types/audio_data_encoding.py +0 -5
- sarvamai/types/audio_message.py +0 -20
- sarvamai/types/error_data.py +0 -27
- sarvamai/types/events_data.py +0 -28
- sarvamai/types/format.py +0 -5
- sarvamai/types/speech_to_text_streaming_response.py +0 -22
- sarvamai/types/speech_to_text_streaming_response_data.py +0 -9
- sarvamai/types/speech_to_text_streaming_response_type.py +0 -5
- sarvamai/types/transcription_data.py +0 -45
- sarvamai/types/transcription_metrics.py +0 -27
- sarvamai-0.1.5a5.dist-info/METADATA +0 -28
- sarvamai-0.1.5a5.dist-info/RECORD +0 -134
- {sarvamai-0.1.5a5.dist-info → sarvamai-0.1.5a6.dist-info}/WHEEL +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
from contextlib import asynccontextmanager, contextmanager
|
|
5
|
-
|
|
6
|
-
import httpx
|
|
7
|
-
import websockets
|
|
8
|
-
import websockets.sync.client as websockets_sync_client
|
|
9
|
-
from ..core.api_error import ApiError
|
|
10
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
11
|
-
from ..core.request_options import RequestOptions
|
|
12
|
-
from .socket_client import AsyncSpeechToTextStreamingSocketClient, SpeechToTextStreamingSocketClient
|
|
13
|
-
from .types.speech_to_text_streaming_language_code import SpeechToTextStreamingLanguageCode
|
|
14
|
-
from .types.speech_to_text_streaming_model import SpeechToTextStreamingModel
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class RawSpeechToTextStreamingClient:
|
|
18
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
-
self._client_wrapper = client_wrapper
|
|
20
|
-
|
|
21
|
-
@contextmanager
|
|
22
|
-
def connect(
|
|
23
|
-
self,
|
|
24
|
-
*,
|
|
25
|
-
language_code: SpeechToTextStreamingLanguageCode,
|
|
26
|
-
model: SpeechToTextStreamingModel,
|
|
27
|
-
high_vad_sensitivity: typing.Optional[str] = None,
|
|
28
|
-
vad_signals: typing.Optional[str] = None,
|
|
29
|
-
api_subscription_key: typing.Optional[str] = None,
|
|
30
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
31
|
-
) -> typing.Iterator[SpeechToTextStreamingSocketClient]:
|
|
32
|
-
"""
|
|
33
|
-
WebSocket channel for real-time speech to text streaming
|
|
34
|
-
|
|
35
|
-
Parameters
|
|
36
|
-
----------
|
|
37
|
-
language_code : SpeechToTextStreamingLanguageCode
|
|
38
|
-
Language code for speech recognition
|
|
39
|
-
|
|
40
|
-
model : SpeechToTextStreamingModel
|
|
41
|
-
Speech to text model to use
|
|
42
|
-
|
|
43
|
-
high_vad_sensitivity : typing.Optional[str]
|
|
44
|
-
Enable high VAD (Voice Activity Detection) sensitivity
|
|
45
|
-
|
|
46
|
-
vad_signals : typing.Optional[str]
|
|
47
|
-
Enable VAD signals in response
|
|
48
|
-
|
|
49
|
-
api_subscription_key : typing.Optional[str]
|
|
50
|
-
API subscription key for authentication
|
|
51
|
-
|
|
52
|
-
request_options : typing.Optional[RequestOptions]
|
|
53
|
-
Request-specific configuration.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
SpeechToTextStreamingSocketClient
|
|
58
|
-
"""
|
|
59
|
-
ws_url = self._client_wrapper.get_environment().production + "/speech-to-text/ws"
|
|
60
|
-
query_params = httpx.QueryParams()
|
|
61
|
-
if language_code is not None:
|
|
62
|
-
query_params = query_params.add("language-code", language_code)
|
|
63
|
-
if model is not None:
|
|
64
|
-
query_params = query_params.add("model", model)
|
|
65
|
-
if high_vad_sensitivity is not None:
|
|
66
|
-
query_params = query_params.add("high_vad_sensitivity", high_vad_sensitivity)
|
|
67
|
-
if vad_signals is not None:
|
|
68
|
-
query_params = query_params.add("vad_signals", vad_signals)
|
|
69
|
-
ws_url = ws_url + f"?{query_params}"
|
|
70
|
-
headers = self._client_wrapper.get_headers()
|
|
71
|
-
if api_subscription_key is not None:
|
|
72
|
-
headers["Api-Subscription-Key"] = str(api_subscription_key)
|
|
73
|
-
if request_options and "additional_headers" in request_options:
|
|
74
|
-
headers.update(request_options["additional_headers"])
|
|
75
|
-
try:
|
|
76
|
-
with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol:
|
|
77
|
-
yield SpeechToTextStreamingSocketClient(websocket=protocol)
|
|
78
|
-
except websockets.exceptions.InvalidStatusCode as exc:
|
|
79
|
-
status_code: int = exc.status_code
|
|
80
|
-
if status_code == 401:
|
|
81
|
-
raise ApiError(
|
|
82
|
-
status_code=status_code,
|
|
83
|
-
headers=dict(headers),
|
|
84
|
-
body="Websocket initialized with invalid credentials.",
|
|
85
|
-
)
|
|
86
|
-
raise ApiError(
|
|
87
|
-
status_code=status_code,
|
|
88
|
-
headers=dict(headers),
|
|
89
|
-
body="Unexpected error when initializing websocket connection.",
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
class AsyncRawSpeechToTextStreamingClient:
|
|
94
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
95
|
-
self._client_wrapper = client_wrapper
|
|
96
|
-
|
|
97
|
-
@asynccontextmanager
|
|
98
|
-
async def connect(
|
|
99
|
-
self,
|
|
100
|
-
*,
|
|
101
|
-
language_code: SpeechToTextStreamingLanguageCode,
|
|
102
|
-
model: SpeechToTextStreamingModel,
|
|
103
|
-
high_vad_sensitivity: typing.Optional[str] = None,
|
|
104
|
-
vad_signals: typing.Optional[str] = None,
|
|
105
|
-
api_subscription_key: typing.Optional[str] = None,
|
|
106
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
107
|
-
) -> typing.AsyncIterator[AsyncSpeechToTextStreamingSocketClient]:
|
|
108
|
-
"""
|
|
109
|
-
WebSocket channel for real-time speech to text streaming
|
|
110
|
-
|
|
111
|
-
Parameters
|
|
112
|
-
----------
|
|
113
|
-
language_code : SpeechToTextStreamingLanguageCode
|
|
114
|
-
Language code for speech recognition
|
|
115
|
-
|
|
116
|
-
model : SpeechToTextStreamingModel
|
|
117
|
-
Speech to text model to use
|
|
118
|
-
|
|
119
|
-
high_vad_sensitivity : typing.Optional[str]
|
|
120
|
-
Enable high VAD (Voice Activity Detection) sensitivity
|
|
121
|
-
|
|
122
|
-
vad_signals : typing.Optional[str]
|
|
123
|
-
Enable VAD signals in response
|
|
124
|
-
|
|
125
|
-
api_subscription_key : typing.Optional[str]
|
|
126
|
-
API subscription key for authentication
|
|
127
|
-
|
|
128
|
-
request_options : typing.Optional[RequestOptions]
|
|
129
|
-
Request-specific configuration.
|
|
130
|
-
|
|
131
|
-
Returns
|
|
132
|
-
-------
|
|
133
|
-
AsyncSpeechToTextStreamingSocketClient
|
|
134
|
-
"""
|
|
135
|
-
ws_url = self._client_wrapper.get_environment().production + "/speech-to-text/ws"
|
|
136
|
-
query_params = httpx.QueryParams()
|
|
137
|
-
if language_code is not None:
|
|
138
|
-
query_params = query_params.add("language-code", language_code)
|
|
139
|
-
if model is not None:
|
|
140
|
-
query_params = query_params.add("model", model)
|
|
141
|
-
if high_vad_sensitivity is not None:
|
|
142
|
-
query_params = query_params.add("high_vad_sensitivity", high_vad_sensitivity)
|
|
143
|
-
if vad_signals is not None:
|
|
144
|
-
query_params = query_params.add("vad_signals", vad_signals)
|
|
145
|
-
ws_url = ws_url + f"?{query_params}"
|
|
146
|
-
headers = self._client_wrapper.get_headers()
|
|
147
|
-
if api_subscription_key is not None:
|
|
148
|
-
headers["Api-Subscription-Key"] = str(api_subscription_key)
|
|
149
|
-
if request_options and "additional_headers" in request_options:
|
|
150
|
-
headers.update(request_options["additional_headers"])
|
|
151
|
-
try:
|
|
152
|
-
async with websockets.connect(ws_url, extra_headers=headers) as protocol:
|
|
153
|
-
yield AsyncSpeechToTextStreamingSocketClient(websocket=protocol)
|
|
154
|
-
except websockets.exceptions.InvalidStatusCode as exc:
|
|
155
|
-
status_code: int = exc.status_code
|
|
156
|
-
if status_code == 401:
|
|
157
|
-
raise ApiError(
|
|
158
|
-
status_code=status_code,
|
|
159
|
-
headers=dict(headers),
|
|
160
|
-
body="Websocket initialized with invalid credentials.",
|
|
161
|
-
)
|
|
162
|
-
raise ApiError(
|
|
163
|
-
status_code=status_code,
|
|
164
|
-
headers=dict(headers),
|
|
165
|
-
body="Unexpected error when initializing websocket connection.",
|
|
166
|
-
)
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
import typing
|
|
5
|
-
|
|
6
|
-
import websockets
|
|
7
|
-
import websockets.sync.connection as websockets_sync_connection
|
|
8
|
-
from ..core.events import EventEmitterMixin, EventType
|
|
9
|
-
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
-
from ..types.audio_message import AudioMessage
|
|
11
|
-
from ..types.speech_to_text_streaming_response import SpeechToTextStreamingResponse
|
|
12
|
-
|
|
13
|
-
SpeechToTextStreamingSocketClientResponse = typing.Union[SpeechToTextStreamingResponse]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class AsyncSpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
17
|
-
def __init__(self, *, websocket: websockets.WebSocketClientProtocol):
|
|
18
|
-
super().__init__()
|
|
19
|
-
self._websocket = websocket
|
|
20
|
-
|
|
21
|
-
async def __aiter__(self):
|
|
22
|
-
async for message in self._websocket:
|
|
23
|
-
yield parse_obj_as(SpeechToTextStreamingSocketClientResponse, message) # type: ignore
|
|
24
|
-
|
|
25
|
-
async def start_listening(self):
|
|
26
|
-
"""
|
|
27
|
-
Start listening for messages on the websocket connection.
|
|
28
|
-
|
|
29
|
-
Emits events in the following order:
|
|
30
|
-
- EventType.OPEN when connection is established
|
|
31
|
-
- EventType.MESSAGE for each message received
|
|
32
|
-
- EventType.ERROR if an error occurs
|
|
33
|
-
- EventType.CLOSE when connection is closed
|
|
34
|
-
"""
|
|
35
|
-
self._emit(EventType.OPEN, None)
|
|
36
|
-
try:
|
|
37
|
-
async for raw_message in self._websocket:
|
|
38
|
-
parsed = parse_obj_as(SpeechToTextStreamingSocketClientResponse, raw_message) # type: ignore
|
|
39
|
-
self._emit(EventType.MESSAGE, parsed)
|
|
40
|
-
except websockets.WebSocketException as exc:
|
|
41
|
-
self._emit(EventType.ERROR, exc)
|
|
42
|
-
finally:
|
|
43
|
-
self._emit(EventType.CLOSE, None)
|
|
44
|
-
|
|
45
|
-
async def send_audio_message(self, message: AudioMessage) -> None:
|
|
46
|
-
"""
|
|
47
|
-
Send a message to the websocket connection.
|
|
48
|
-
The message will be sent as a AudioMessage.
|
|
49
|
-
"""
|
|
50
|
-
await self._send_model(message)
|
|
51
|
-
|
|
52
|
-
async def recv(self) -> SpeechToTextStreamingSocketClientResponse:
|
|
53
|
-
"""
|
|
54
|
-
Receive a message from the websocket connection.
|
|
55
|
-
"""
|
|
56
|
-
data = await self._websocket.recv()
|
|
57
|
-
return parse_obj_as(SpeechToTextStreamingSocketClientResponse, data) # type: ignore
|
|
58
|
-
|
|
59
|
-
async def _send(self, data: typing.Any) -> None:
|
|
60
|
-
"""
|
|
61
|
-
Send a message to the websocket connection.
|
|
62
|
-
"""
|
|
63
|
-
if isinstance(data, dict):
|
|
64
|
-
data = json.dumps(data)
|
|
65
|
-
await self._websocket.send(data)
|
|
66
|
-
|
|
67
|
-
async def _send_model(self, data: typing.Any) -> None:
|
|
68
|
-
"""
|
|
69
|
-
Send a Pydantic model to the websocket connection.
|
|
70
|
-
"""
|
|
71
|
-
await self._send(data.dict())
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class SpeechToTextStreamingSocketClient(EventEmitterMixin):
|
|
75
|
-
def __init__(self, *, websocket: websockets_sync_connection.Connection):
|
|
76
|
-
super().__init__()
|
|
77
|
-
self._websocket = websocket
|
|
78
|
-
|
|
79
|
-
def __iter__(self):
|
|
80
|
-
for message in self._websocket:
|
|
81
|
-
yield parse_obj_as(SpeechToTextStreamingSocketClientResponse, message) # type: ignore
|
|
82
|
-
|
|
83
|
-
def start_listening(self):
|
|
84
|
-
"""
|
|
85
|
-
Start listening for messages on the websocket connection.
|
|
86
|
-
|
|
87
|
-
Emits events in the following order:
|
|
88
|
-
- EventType.OPEN when connection is established
|
|
89
|
-
- EventType.MESSAGE for each message received
|
|
90
|
-
- EventType.ERROR if an error occurs
|
|
91
|
-
- EventType.CLOSE when connection is closed
|
|
92
|
-
"""
|
|
93
|
-
self._emit(EventType.OPEN, None)
|
|
94
|
-
try:
|
|
95
|
-
for raw_message in self._websocket:
|
|
96
|
-
parsed = parse_obj_as(SpeechToTextStreamingSocketClientResponse, raw_message) # type: ignore
|
|
97
|
-
self._emit(EventType.MESSAGE, parsed)
|
|
98
|
-
except websockets.WebSocketException as exc:
|
|
99
|
-
self._emit(EventType.ERROR, exc)
|
|
100
|
-
finally:
|
|
101
|
-
self._emit(EventType.CLOSE, None)
|
|
102
|
-
|
|
103
|
-
def send_audio_message(self, message: AudioMessage) -> None:
|
|
104
|
-
"""
|
|
105
|
-
Send a message to the websocket connection.
|
|
106
|
-
The message will be sent as a AudioMessage.
|
|
107
|
-
"""
|
|
108
|
-
self._send_model(message)
|
|
109
|
-
|
|
110
|
-
def recv(self) -> SpeechToTextStreamingSocketClientResponse:
|
|
111
|
-
"""
|
|
112
|
-
Receive a message from the websocket connection.
|
|
113
|
-
"""
|
|
114
|
-
data = self._websocket.recv()
|
|
115
|
-
return parse_obj_as(SpeechToTextStreamingSocketClientResponse, data) # type: ignore
|
|
116
|
-
|
|
117
|
-
def _send(self, data: typing.Any) -> None:
|
|
118
|
-
"""
|
|
119
|
-
Send a message to the websocket connection.
|
|
120
|
-
"""
|
|
121
|
-
if isinstance(data, dict):
|
|
122
|
-
data = json.dumps(data)
|
|
123
|
-
self._websocket.send(data)
|
|
124
|
-
|
|
125
|
-
def _send_model(self, data: typing.Any) -> None:
|
|
126
|
-
"""
|
|
127
|
-
Send a Pydantic model to the websocket connection.
|
|
128
|
-
"""
|
|
129
|
-
self._send(data.dict())
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
# isort: skip_file
|
|
4
|
-
|
|
5
|
-
from .speech_to_text_streaming_language_code import SpeechToTextStreamingLanguageCode
|
|
6
|
-
from .speech_to_text_streaming_model import SpeechToTextStreamingModel
|
|
7
|
-
|
|
8
|
-
__all__ = ["SpeechToTextStreamingLanguageCode", "SpeechToTextStreamingModel"]
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
SpeechToTextStreamingLanguageCode = typing.Union[
|
|
6
|
-
typing.Literal["en-IN", "hi-IN", "bn-IN", "gu-IN", "kn-IN", "ml-IN", "mr-IN", "od-IN", "pa-IN", "ta-IN", "te-IN"],
|
|
7
|
-
typing.Any,
|
|
8
|
-
]
|
sarvamai/types/audio_data.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
from .audio_data_encoding import AudioDataEncoding
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class AudioData(UniversalBaseModel):
|
|
11
|
-
data: str = pydantic.Field()
|
|
12
|
-
"""
|
|
13
|
-
Base64 encoded audio data
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
sample_rate: int = pydantic.Field()
|
|
17
|
-
"""
|
|
18
|
-
Audio sample rate in Hz (16kHz preferred, 8kHz least preferred)
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
encoding: AudioDataEncoding = pydantic.Field()
|
|
22
|
-
"""
|
|
23
|
-
Audio encoding format
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
if IS_PYDANTIC_V2:
|
|
27
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
28
|
-
else:
|
|
29
|
-
|
|
30
|
-
class Config:
|
|
31
|
-
frozen = True
|
|
32
|
-
smart_union = True
|
|
33
|
-
extra = pydantic.Extra.allow
|
sarvamai/types/audio_message.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
from .audio_data import AudioData
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class AudioMessage(UniversalBaseModel):
|
|
11
|
-
audio: AudioData
|
|
12
|
-
|
|
13
|
-
if IS_PYDANTIC_V2:
|
|
14
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
15
|
-
else:
|
|
16
|
-
|
|
17
|
-
class Config:
|
|
18
|
-
frozen = True
|
|
19
|
-
smart_union = True
|
|
20
|
-
extra = pydantic.Extra.allow
|
sarvamai/types/error_data.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ErrorData(UniversalBaseModel):
|
|
10
|
-
error: str = pydantic.Field()
|
|
11
|
-
"""
|
|
12
|
-
Error message
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
code: str = pydantic.Field()
|
|
16
|
-
"""
|
|
17
|
-
Error code
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
if IS_PYDANTIC_V2:
|
|
21
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
-
else:
|
|
23
|
-
|
|
24
|
-
class Config:
|
|
25
|
-
frozen = True
|
|
26
|
-
smart_union = True
|
|
27
|
-
extra = pydantic.Extra.allow
|
sarvamai/types/events_data.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import datetime as dt
|
|
4
|
-
import typing
|
|
5
|
-
|
|
6
|
-
import pydantic
|
|
7
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class EventsData(UniversalBaseModel):
|
|
11
|
-
event_type: str = pydantic.Field()
|
|
12
|
-
"""
|
|
13
|
-
Type of event
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
timestamp: dt.datetime = pydantic.Field()
|
|
17
|
-
"""
|
|
18
|
-
Event timestamp
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
if IS_PYDANTIC_V2:
|
|
22
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
23
|
-
else:
|
|
24
|
-
|
|
25
|
-
class Config:
|
|
26
|
-
frozen = True
|
|
27
|
-
smart_union = True
|
|
28
|
-
extra = pydantic.Extra.allow
|
sarvamai/types/format.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
from .speech_to_text_streaming_response_data import SpeechToTextStreamingResponseData
|
|
8
|
-
from .speech_to_text_streaming_response_type import SpeechToTextStreamingResponseType
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class SpeechToTextStreamingResponse(UniversalBaseModel):
|
|
12
|
-
type: SpeechToTextStreamingResponseType
|
|
13
|
-
data: SpeechToTextStreamingResponseData
|
|
14
|
-
|
|
15
|
-
if IS_PYDANTIC_V2:
|
|
16
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
-
else:
|
|
18
|
-
|
|
19
|
-
class Config:
|
|
20
|
-
frozen = True
|
|
21
|
-
smart_union = True
|
|
22
|
-
extra = pydantic.Extra.allow
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
from .error_data import ErrorData
|
|
6
|
-
from .events_data import EventsData
|
|
7
|
-
from .transcription_data import TranscriptionData
|
|
8
|
-
|
|
9
|
-
SpeechToTextStreamingResponseData = typing.Union[TranscriptionData, ErrorData, EventsData]
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
from .transcription_metrics import TranscriptionMetrics
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TranscriptionData(UniversalBaseModel):
|
|
11
|
-
request_id: str = pydantic.Field()
|
|
12
|
-
"""
|
|
13
|
-
Unique identifier for the request
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
transcript: str = pydantic.Field()
|
|
17
|
-
"""
|
|
18
|
-
Transcript of the provided speech
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
timestamps: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
22
|
-
"""
|
|
23
|
-
Timestamp information (if available)
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
diarized_transcript: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
27
|
-
"""
|
|
28
|
-
Diarized transcript of the provided speech
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
language_code: typing.Optional[str] = pydantic.Field(default=None)
|
|
32
|
-
"""
|
|
33
|
-
BCP-47 code of detected language
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
metrics: TranscriptionMetrics
|
|
37
|
-
|
|
38
|
-
if IS_PYDANTIC_V2:
|
|
39
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
40
|
-
else:
|
|
41
|
-
|
|
42
|
-
class Config:
|
|
43
|
-
frozen = True
|
|
44
|
-
smart_union = True
|
|
45
|
-
extra = pydantic.Extra.allow
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TranscriptionMetrics(UniversalBaseModel):
|
|
10
|
-
audio_duration: float = pydantic.Field()
|
|
11
|
-
"""
|
|
12
|
-
Duration of processed audio in seconds
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
processing_latency: float = pydantic.Field()
|
|
16
|
-
"""
|
|
17
|
-
Processing latency in seconds
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
if IS_PYDANTIC_V2:
|
|
21
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
-
else:
|
|
23
|
-
|
|
24
|
-
class Config:
|
|
25
|
-
frozen = True
|
|
26
|
-
smart_union = True
|
|
27
|
-
extra = pydantic.Extra.allow
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: sarvamai
|
|
3
|
-
Version: 0.1.5a5
|
|
4
|
-
Summary:
|
|
5
|
-
Requires-Python: >=3.8,<4.0
|
|
6
|
-
Classifier: Intended Audience :: Developers
|
|
7
|
-
Classifier: Operating System :: MacOS
|
|
8
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Classifier: Operating System :: POSIX
|
|
11
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
-
Classifier: Programming Language :: Python
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Classifier: Typing :: Typed
|
|
21
|
-
Requires-Dist: httpx (>=0.21.2)
|
|
22
|
-
Requires-Dist: pydantic (>=1.9.2)
|
|
23
|
-
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
24
|
-
Requires-Dist: typing_extensions (>=4.0.0)
|
|
25
|
-
Requires-Dist: websockets (==12.0)
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-
|