sarvamai 0.1.5a6__py3-none-any.whl → 0.1.5a7__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 +45 -1
- sarvamai/chat/__init__.py +2 -0
- sarvamai/chat/client.py +9 -10
- sarvamai/chat/raw_client.py +48 -37
- sarvamai/client.py +13 -31
- sarvamai/core/__init__.py +5 -0
- sarvamai/core/api_error.py +13 -5
- sarvamai/core/client_wrapper.py +17 -20
- sarvamai/core/events.py +30 -0
- sarvamai/core/force_multipart.py +16 -0
- sarvamai/core/http_client.py +70 -24
- sarvamai/core/http_response.py +19 -11
- sarvamai/core/pydantic_utilities.py +69 -108
- sarvamai/environment.py +10 -3
- sarvamai/errors/__init__.py +2 -0
- sarvamai/errors/bad_request_error.py +4 -3
- sarvamai/errors/forbidden_error.py +4 -3
- sarvamai/errors/internal_server_error.py +4 -3
- sarvamai/errors/service_unavailable_error.py +4 -2
- sarvamai/errors/too_many_requests_error.py +4 -3
- sarvamai/errors/unprocessable_entity_error.py +4 -3
- sarvamai/requests/__init__.py +18 -0
- sarvamai/requests/audio_data.py +21 -0
- sarvamai/requests/audio_message.py +8 -0
- sarvamai/requests/chat_completion_request_message.py +3 -1
- sarvamai/requests/create_chat_completion_response.py +2 -2
- sarvamai/requests/diarized_transcript.py +2 -1
- sarvamai/requests/error_data.py +15 -0
- sarvamai/requests/error_details.py +0 -1
- sarvamai/requests/events_data.py +17 -0
- sarvamai/requests/language_identification_response.py +0 -1
- sarvamai/requests/speech_to_text_response.py +1 -2
- sarvamai/requests/speech_to_text_streaming_response.py +10 -0
- sarvamai/requests/speech_to_text_streaming_response_data.py +9 -0
- sarvamai/requests/speech_to_text_translate_response.py +0 -1
- sarvamai/requests/text_to_speech_response.py +2 -2
- sarvamai/requests/timestamps_model.py +2 -1
- sarvamai/requests/transcription_data.py +35 -0
- sarvamai/requests/transcription_metrics.py +15 -0
- sarvamai/requests/translation_response.py +0 -1
- sarvamai/requests/transliteration_response.py +0 -1
- sarvamai/speech_to_text/__init__.py +2 -0
- sarvamai/speech_to_text/client.py +13 -14
- sarvamai/speech_to_text/raw_client.py +99 -68
- sarvamai/speech_to_text_streaming/__init__.py +7 -0
- sarvamai/speech_to_text_streaming/client.py +189 -0
- sarvamai/speech_to_text_streaming/raw_client.py +166 -0
- sarvamai/speech_to_text_streaming/socket_client.py +129 -0
- sarvamai/speech_to_text_streaming/types/__init__.py +8 -0
- sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +8 -0
- sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +5 -0
- sarvamai/text/__init__.py +2 -0
- sarvamai/text/client.py +24 -25
- sarvamai/text/raw_client.py +126 -91
- sarvamai/text_to_speech/__init__.py +2 -0
- sarvamai/text_to_speech/client.py +10 -11
- sarvamai/text_to_speech/raw_client.py +49 -38
- sarvamai/types/__init__.py +24 -0
- sarvamai/types/audio_data.py +33 -0
- sarvamai/types/audio_data_encoding.py +5 -0
- sarvamai/types/audio_message.py +20 -0
- sarvamai/types/chat_completion_request_assistant_message.py +3 -3
- sarvamai/types/chat_completion_request_message.py +3 -2
- 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_data.py +27 -0
- sarvamai/types/error_details.py +3 -3
- sarvamai/types/error_message.py +4 -4
- sarvamai/types/events_data.py +28 -0
- sarvamai/types/format.py +5 -0
- sarvamai/types/language_identification_response.py +2 -2
- sarvamai/types/speech_to_text_response.py +3 -3
- sarvamai/types/speech_to_text_streaming_response.py +22 -0
- sarvamai/types/speech_to_text_streaming_response_data.py +9 -0
- sarvamai/types/speech_to_text_streaming_response_type.py +5 -0
- 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/transcription_data.py +45 -0
- sarvamai/types/transcription_metrics.py +27 -0
- sarvamai/types/translation_response.py +2 -2
- sarvamai/types/transliteration_response.py +2 -2
- sarvamai-0.1.5a7.dist-info/METADATA +28 -0
- sarvamai-0.1.5a7.dist-info/RECORD +134 -0
- sarvamai-0.1.5a6.dist-info/METADATA +0 -174
- sarvamai-0.1.5a6.dist-info/RECORD +0 -106
- {sarvamai-0.1.5a6.dist-info → sarvamai-0.1.5a7.dist-info}/WHEEL +0 -0
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from ..
|
|
7
|
-
from ..
|
|
8
|
-
from ..
|
|
9
|
-
from ..core.request_options import RequestOptions
|
|
10
|
-
from ..core.http_response import HttpResponse
|
|
11
|
-
from ..types.text_to_speech_response import TextToSpeechResponse
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
12
9
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from ..core.request_options import RequestOptions
|
|
13
11
|
from ..errors.bad_request_error import BadRequestError
|
|
14
12
|
from ..errors.forbidden_error import ForbiddenError
|
|
15
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
16
|
-
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
17
13
|
from ..errors.internal_server_error import InternalServerError
|
|
18
|
-
from
|
|
19
|
-
from ..
|
|
20
|
-
from ..
|
|
21
|
-
from ..
|
|
14
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
15
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
16
|
+
from ..types.speech_sample_rate import SpeechSampleRate
|
|
17
|
+
from ..types.text_to_speech_language import TextToSpeechLanguage
|
|
18
|
+
from ..types.text_to_speech_model import TextToSpeechModel
|
|
19
|
+
from ..types.text_to_speech_response import TextToSpeechResponse
|
|
20
|
+
from ..types.text_to_speech_speaker import TextToSpeechSpeaker
|
|
22
21
|
|
|
23
22
|
# this is used as the default value for optional parameters
|
|
24
23
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -97,6 +96,7 @@ class RawTextToSpeechClient:
|
|
|
97
96
|
"""
|
|
98
97
|
_response = self._client_wrapper.httpx_client.request(
|
|
99
98
|
"text-to-speech",
|
|
99
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
100
100
|
method="POST",
|
|
101
101
|
json={
|
|
102
102
|
"text": text,
|
|
@@ -127,58 +127,63 @@ class RawTextToSpeechClient:
|
|
|
127
127
|
return HttpResponse(response=_response, data=_data)
|
|
128
128
|
if _response.status_code == 400:
|
|
129
129
|
raise BadRequestError(
|
|
130
|
-
|
|
130
|
+
headers=dict(_response.headers),
|
|
131
|
+
body=typing.cast(
|
|
131
132
|
typing.Optional[typing.Any],
|
|
132
133
|
parse_obj_as(
|
|
133
134
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
134
135
|
object_=_response.json(),
|
|
135
136
|
),
|
|
136
|
-
)
|
|
137
|
+
),
|
|
137
138
|
)
|
|
138
139
|
if _response.status_code == 403:
|
|
139
140
|
raise ForbiddenError(
|
|
140
|
-
|
|
141
|
+
headers=dict(_response.headers),
|
|
142
|
+
body=typing.cast(
|
|
141
143
|
typing.Optional[typing.Any],
|
|
142
144
|
parse_obj_as(
|
|
143
145
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
144
146
|
object_=_response.json(),
|
|
145
147
|
),
|
|
146
|
-
)
|
|
148
|
+
),
|
|
147
149
|
)
|
|
148
150
|
if _response.status_code == 422:
|
|
149
151
|
raise UnprocessableEntityError(
|
|
150
|
-
|
|
152
|
+
headers=dict(_response.headers),
|
|
153
|
+
body=typing.cast(
|
|
151
154
|
typing.Optional[typing.Any],
|
|
152
155
|
parse_obj_as(
|
|
153
156
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
154
157
|
object_=_response.json(),
|
|
155
158
|
),
|
|
156
|
-
)
|
|
159
|
+
),
|
|
157
160
|
)
|
|
158
161
|
if _response.status_code == 429:
|
|
159
162
|
raise TooManyRequestsError(
|
|
160
|
-
|
|
163
|
+
headers=dict(_response.headers),
|
|
164
|
+
body=typing.cast(
|
|
161
165
|
typing.Optional[typing.Any],
|
|
162
166
|
parse_obj_as(
|
|
163
167
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
164
168
|
object_=_response.json(),
|
|
165
169
|
),
|
|
166
|
-
)
|
|
170
|
+
),
|
|
167
171
|
)
|
|
168
172
|
if _response.status_code == 500:
|
|
169
173
|
raise InternalServerError(
|
|
170
|
-
|
|
174
|
+
headers=dict(_response.headers),
|
|
175
|
+
body=typing.cast(
|
|
171
176
|
typing.Optional[typing.Any],
|
|
172
177
|
parse_obj_as(
|
|
173
178
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
174
179
|
object_=_response.json(),
|
|
175
180
|
),
|
|
176
|
-
)
|
|
181
|
+
),
|
|
177
182
|
)
|
|
178
183
|
_response_json = _response.json()
|
|
179
184
|
except JSONDecodeError:
|
|
180
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
181
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
185
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
186
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
182
187
|
|
|
183
188
|
|
|
184
189
|
class AsyncRawTextToSpeechClient:
|
|
@@ -254,6 +259,7 @@ class AsyncRawTextToSpeechClient:
|
|
|
254
259
|
"""
|
|
255
260
|
_response = await self._client_wrapper.httpx_client.request(
|
|
256
261
|
"text-to-speech",
|
|
262
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
257
263
|
method="POST",
|
|
258
264
|
json={
|
|
259
265
|
"text": text,
|
|
@@ -284,55 +290,60 @@ class AsyncRawTextToSpeechClient:
|
|
|
284
290
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
285
291
|
if _response.status_code == 400:
|
|
286
292
|
raise BadRequestError(
|
|
287
|
-
|
|
293
|
+
headers=dict(_response.headers),
|
|
294
|
+
body=typing.cast(
|
|
288
295
|
typing.Optional[typing.Any],
|
|
289
296
|
parse_obj_as(
|
|
290
297
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
291
298
|
object_=_response.json(),
|
|
292
299
|
),
|
|
293
|
-
)
|
|
300
|
+
),
|
|
294
301
|
)
|
|
295
302
|
if _response.status_code == 403:
|
|
296
303
|
raise ForbiddenError(
|
|
297
|
-
|
|
304
|
+
headers=dict(_response.headers),
|
|
305
|
+
body=typing.cast(
|
|
298
306
|
typing.Optional[typing.Any],
|
|
299
307
|
parse_obj_as(
|
|
300
308
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
301
309
|
object_=_response.json(),
|
|
302
310
|
),
|
|
303
|
-
)
|
|
311
|
+
),
|
|
304
312
|
)
|
|
305
313
|
if _response.status_code == 422:
|
|
306
314
|
raise UnprocessableEntityError(
|
|
307
|
-
|
|
315
|
+
headers=dict(_response.headers),
|
|
316
|
+
body=typing.cast(
|
|
308
317
|
typing.Optional[typing.Any],
|
|
309
318
|
parse_obj_as(
|
|
310
319
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
311
320
|
object_=_response.json(),
|
|
312
321
|
),
|
|
313
|
-
)
|
|
322
|
+
),
|
|
314
323
|
)
|
|
315
324
|
if _response.status_code == 429:
|
|
316
325
|
raise TooManyRequestsError(
|
|
317
|
-
|
|
326
|
+
headers=dict(_response.headers),
|
|
327
|
+
body=typing.cast(
|
|
318
328
|
typing.Optional[typing.Any],
|
|
319
329
|
parse_obj_as(
|
|
320
330
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
321
331
|
object_=_response.json(),
|
|
322
332
|
),
|
|
323
|
-
)
|
|
333
|
+
),
|
|
324
334
|
)
|
|
325
335
|
if _response.status_code == 500:
|
|
326
336
|
raise InternalServerError(
|
|
327
|
-
|
|
337
|
+
headers=dict(_response.headers),
|
|
338
|
+
body=typing.cast(
|
|
328
339
|
typing.Optional[typing.Any],
|
|
329
340
|
parse_obj_as(
|
|
330
341
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
331
342
|
object_=_response.json(),
|
|
332
343
|
),
|
|
333
|
-
)
|
|
344
|
+
),
|
|
334
345
|
)
|
|
335
346
|
_response_json = _response.json()
|
|
336
347
|
except JSONDecodeError:
|
|
337
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
338
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
348
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
349
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
sarvamai/types/__init__.py
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .audio_data import AudioData
|
|
6
|
+
from .audio_data_encoding import AudioDataEncoding
|
|
7
|
+
from .audio_message import AudioMessage
|
|
3
8
|
from .chat_completion_request_assistant_message import ChatCompletionRequestAssistantMessage
|
|
4
9
|
from .chat_completion_request_message import (
|
|
5
10
|
ChatCompletionRequestMessage,
|
|
@@ -16,9 +21,12 @@ from .create_chat_completion_response import CreateChatCompletionResponse
|
|
|
16
21
|
from .diarized_entry import DiarizedEntry
|
|
17
22
|
from .diarized_transcript import DiarizedTranscript
|
|
18
23
|
from .error_code import ErrorCode
|
|
24
|
+
from .error_data import ErrorData
|
|
19
25
|
from .error_details import ErrorDetails
|
|
20
26
|
from .error_message import ErrorMessage
|
|
27
|
+
from .events_data import EventsData
|
|
21
28
|
from .finish_reason import FinishReason
|
|
29
|
+
from .format import Format
|
|
22
30
|
from .language_identification_response import LanguageIdentificationResponse
|
|
23
31
|
from .numerals_format import NumeralsFormat
|
|
24
32
|
from .reasoning_effort import ReasoningEffort
|
|
@@ -28,6 +36,9 @@ from .speech_sample_rate import SpeechSampleRate
|
|
|
28
36
|
from .speech_to_text_language import SpeechToTextLanguage
|
|
29
37
|
from .speech_to_text_model import SpeechToTextModel
|
|
30
38
|
from .speech_to_text_response import SpeechToTextResponse
|
|
39
|
+
from .speech_to_text_streaming_response import SpeechToTextStreamingResponse
|
|
40
|
+
from .speech_to_text_streaming_response_data import SpeechToTextStreamingResponseData
|
|
41
|
+
from .speech_to_text_streaming_response_type import SpeechToTextStreamingResponseType
|
|
31
42
|
from .speech_to_text_translate_language import SpeechToTextTranslateLanguage
|
|
32
43
|
from .speech_to_text_translate_model import SpeechToTextTranslateModel
|
|
33
44
|
from .speech_to_text_translate_response import SpeechToTextTranslateResponse
|
|
@@ -38,6 +49,8 @@ from .text_to_speech_model import TextToSpeechModel
|
|
|
38
49
|
from .text_to_speech_response import TextToSpeechResponse
|
|
39
50
|
from .text_to_speech_speaker import TextToSpeechSpeaker
|
|
40
51
|
from .timestamps_model import TimestampsModel
|
|
52
|
+
from .transcription_data import TranscriptionData
|
|
53
|
+
from .transcription_metrics import TranscriptionMetrics
|
|
41
54
|
from .translate_mode import TranslateMode
|
|
42
55
|
from .translate_model import TranslateModel
|
|
43
56
|
from .translate_source_language import TranslateSourceLanguage
|
|
@@ -50,6 +63,9 @@ from .transliterate_source_language import TransliterateSourceLanguage
|
|
|
50
63
|
from .transliteration_response import TransliterationResponse
|
|
51
64
|
|
|
52
65
|
__all__ = [
|
|
66
|
+
"AudioData",
|
|
67
|
+
"AudioDataEncoding",
|
|
68
|
+
"AudioMessage",
|
|
53
69
|
"ChatCompletionRequestAssistantMessage",
|
|
54
70
|
"ChatCompletionRequestMessage",
|
|
55
71
|
"ChatCompletionRequestMessage_Assistant",
|
|
@@ -64,9 +80,12 @@ __all__ = [
|
|
|
64
80
|
"DiarizedEntry",
|
|
65
81
|
"DiarizedTranscript",
|
|
66
82
|
"ErrorCode",
|
|
83
|
+
"ErrorData",
|
|
67
84
|
"ErrorDetails",
|
|
68
85
|
"ErrorMessage",
|
|
86
|
+
"EventsData",
|
|
69
87
|
"FinishReason",
|
|
88
|
+
"Format",
|
|
70
89
|
"LanguageIdentificationResponse",
|
|
71
90
|
"NumeralsFormat",
|
|
72
91
|
"ReasoningEffort",
|
|
@@ -76,6 +95,9 @@ __all__ = [
|
|
|
76
95
|
"SpeechToTextLanguage",
|
|
77
96
|
"SpeechToTextModel",
|
|
78
97
|
"SpeechToTextResponse",
|
|
98
|
+
"SpeechToTextStreamingResponse",
|
|
99
|
+
"SpeechToTextStreamingResponseData",
|
|
100
|
+
"SpeechToTextStreamingResponseType",
|
|
79
101
|
"SpeechToTextTranslateLanguage",
|
|
80
102
|
"SpeechToTextTranslateModel",
|
|
81
103
|
"SpeechToTextTranslateResponse",
|
|
@@ -86,6 +108,8 @@ __all__ = [
|
|
|
86
108
|
"TextToSpeechResponse",
|
|
87
109
|
"TextToSpeechSpeaker",
|
|
88
110
|
"TimestampsModel",
|
|
111
|
+
"TranscriptionData",
|
|
112
|
+
"TranscriptionMetrics",
|
|
89
113
|
"TranslateMode",
|
|
90
114
|
"TranslateModel",
|
|
91
115
|
"TranslateSourceLanguage",
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
3
|
import typing
|
|
7
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
class ChatCompletionRequestAssistantMessage(UniversalBaseModel):
|
|
10
10
|
content: str = pydantic.Field()
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import typing
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import pydantic
|
|
8
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class ChatCompletionRequestMessage_Assistant(UniversalBaseModel):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
3
|
import typing
|
|
7
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
class ChatCompletionRequestSystemMessage(UniversalBaseModel):
|
|
10
10
|
content: str = pydantic.Field()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
3
|
import typing
|
|
7
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
class ChatCompletionRequestUserMessage(UniversalBaseModel):
|
|
10
10
|
content: str = pydantic.Field()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import typing
|
|
4
|
+
|
|
4
5
|
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
5
7
|
from .role import Role
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
-
import typing
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ChatCompletionResponseMessage(UniversalBaseModel):
|
sarvamai/types/choice.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
5
|
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
6
7
|
from .chat_completion_response_message import ChatCompletionResponseMessage
|
|
7
|
-
from
|
|
8
|
-
import typing
|
|
8
|
+
from .finish_reason import FinishReason
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Choice(UniversalBaseModel):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
3
|
import typing
|
|
7
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
class CompletionUsage(UniversalBaseModel):
|
|
10
10
|
completion_tokens: int = pydantic.Field()
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
3
|
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
6
7
|
from .choice import Choice
|
|
7
8
|
from .completion_usage import CompletionUsage
|
|
8
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class CreateChatCompletionResponse(UniversalBaseModel):
|
sarvamai/types/diarized_entry.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import pydantic
|
|
5
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
3
|
import typing
|
|
7
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
class DiarizedEntry(UniversalBaseModel):
|
|
10
10
|
transcript: str = pydantic.Field()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
3
|
import typing
|
|
5
|
-
|
|
4
|
+
|
|
6
5
|
import pydantic
|
|
7
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .diarized_entry import DiarizedEntry
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class DiarizedTranscript(UniversalBaseModel):
|
|
@@ -0,0 +1,27 @@
|
|
|
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/error_details.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import typing
|
|
4
|
+
|
|
4
5
|
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
5
7
|
from .error_code import ErrorCode
|
|
6
|
-
import typing
|
|
7
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ErrorDetails(UniversalBaseModel):
|
sarvamai/types/error_message.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
from .error_details import ErrorDetails
|
|
5
|
-
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
3
|
import typing
|
|
8
4
|
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .error_details import ErrorDetails
|
|
8
|
+
|
|
9
9
|
|
|
10
10
|
class ErrorMessage(UniversalBaseModel):
|
|
11
11
|
error: ErrorDetails = pydantic.Field()
|
|
@@ -0,0 +1,28 @@
|
|
|
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
ADDED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
3
|
import typing
|
|
4
|
+
|
|
5
5
|
import pydantic
|
|
6
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class LanguageIdentificationResponse(UniversalBaseModel):
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
3
|
import typing
|
|
4
|
+
|
|
5
5
|
import pydantic
|
|
6
|
-
from .
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
from .diarized_transcript import DiarizedTranscript
|
|
8
|
-
from
|
|
8
|
+
from .timestamps_model import TimestampsModel
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class SpeechToTextResponse(UniversalBaseModel):
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -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 ErrorData
|
|
6
|
+
from .events_data import EventsData
|
|
7
|
+
from .transcription_data import TranscriptionData
|
|
8
|
+
|
|
9
|
+
SpeechToTextStreamingResponseData = typing.Union[TranscriptionData, ErrorData, EventsData]
|