sarvamai 0.1.6__py3-none-any.whl → 0.1.7a0__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.
Files changed (39) hide show
  1. sarvamai/__init__.py +60 -1
  2. sarvamai/client.py +3 -0
  3. sarvamai/core/client_wrapper.py +2 -2
  4. sarvamai/errors/service_unavailable_error.py +1 -2
  5. sarvamai/requests/__init__.py +22 -0
  6. sarvamai/requests/base_job_parameters.py +7 -0
  7. sarvamai/requests/bulk_job_callback.py +15 -0
  8. sarvamai/requests/bulk_job_init_response_v_1.py +27 -0
  9. sarvamai/requests/file_signed_url_details.py +10 -0
  10. sarvamai/requests/files_download_response.py +15 -0
  11. sarvamai/requests/files_request.py +10 -0
  12. sarvamai/requests/files_upload_response.py +15 -0
  13. sarvamai/requests/job_status_v_1.py +70 -0
  14. sarvamai/requests/speech_to_text_job_parameters.py +32 -0
  15. sarvamai/requests/task_detail_v_1.py +15 -0
  16. sarvamai/requests/task_file_details.py +8 -0
  17. sarvamai/speech_to_text/raw_client.py +8 -9
  18. sarvamai/speech_to_text_job/__init__.py +4 -0
  19. sarvamai/speech_to_text_job/client.py +454 -0
  20. sarvamai/speech_to_text_job/raw_client.py +1189 -0
  21. sarvamai/types/__init__.py +28 -0
  22. sarvamai/types/base_job_parameters.py +17 -0
  23. sarvamai/types/bulk_job_callback.py +27 -0
  24. sarvamai/types/bulk_job_init_response_v_1.py +39 -0
  25. sarvamai/types/file_signed_url_details.py +20 -0
  26. sarvamai/types/files_download_response.py +25 -0
  27. sarvamai/types/files_request.py +20 -0
  28. sarvamai/types/files_upload_response.py +25 -0
  29. sarvamai/types/job_state.py +5 -0
  30. sarvamai/types/job_status_v_1.py +80 -0
  31. sarvamai/types/speech_to_text_job_parameters.py +44 -0
  32. sarvamai/types/storage_container_type.py +5 -0
  33. sarvamai/types/task_detail_v_1.py +25 -0
  34. sarvamai/types/task_file_details.py +20 -0
  35. sarvamai/types/task_state.py +5 -0
  36. sarvamai-0.1.7a0.dist-info/METADATA +1192 -0
  37. {sarvamai-0.1.6.dist-info → sarvamai-0.1.7a0.dist-info}/RECORD +38 -10
  38. sarvamai-0.1.6.dist-info/METADATA +0 -28
  39. {sarvamai-0.1.6.dist-info → sarvamai-0.1.7a0.dist-info}/WHEEL +0 -0
@@ -4,6 +4,9 @@
4
4
 
5
5
  from .audio_data import AudioData
6
6
  from .audio_message import AudioMessage
7
+ from .base_job_parameters import BaseJobParameters
8
+ from .bulk_job_callback import BulkJobCallback
9
+ from .bulk_job_init_response_v_1 import BulkJobInitResponseV1
7
10
  from .chat_completion_request_assistant_message import ChatCompletionRequestAssistantMessage
8
11
  from .chat_completion_request_message import (
9
12
  ChatCompletionRequestMessage,
@@ -25,8 +28,14 @@ from .error_data import ErrorData
25
28
  from .error_details import ErrorDetails
26
29
  from .error_message import ErrorMessage
27
30
  from .events_data import EventsData
31
+ from .file_signed_url_details import FileSignedUrlDetails
32
+ from .files_download_response import FilesDownloadResponse
33
+ from .files_request import FilesRequest
34
+ from .files_upload_response import FilesUploadResponse
28
35
  from .finish_reason import FinishReason
29
36
  from .format import Format
37
+ from .job_state import JobState
38
+ from .job_status_v_1 import JobStatusV1
30
39
  from .language_identification_response import LanguageIdentificationResponse
31
40
  from .numerals_format import NumeralsFormat
32
41
  from .reasoning_effort import ReasoningEffort
@@ -34,6 +43,7 @@ from .response_type import ResponseType
34
43
  from .role import Role
35
44
  from .sarvam_model_ids import SarvamModelIds
36
45
  from .speech_sample_rate import SpeechSampleRate
46
+ from .speech_to_text_job_parameters import SpeechToTextJobParameters
37
47
  from .speech_to_text_language import SpeechToTextLanguage
38
48
  from .speech_to_text_model import SpeechToTextModel
39
49
  from .speech_to_text_response import SpeechToTextResponse
@@ -48,6 +58,10 @@ from .speech_to_text_translate_streaming_response import SpeechToTextTranslateSt
48
58
  from .speech_to_text_translate_transcription_data import SpeechToTextTranslateTranscriptionData
49
59
  from .spoken_form_numerals_format import SpokenFormNumeralsFormat
50
60
  from .stop_configuration import StopConfiguration
61
+ from .storage_container_type import StorageContainerType
62
+ from .task_detail_v_1 import TaskDetailV1
63
+ from .task_file_details import TaskFileDetails
64
+ from .task_state import TaskState
51
65
  from .text_to_speech_language import TextToSpeechLanguage
52
66
  from .text_to_speech_model import TextToSpeechModel
53
67
  from .text_to_speech_response import TextToSpeechResponse
@@ -68,6 +82,9 @@ from .transliteration_response import TransliterationResponse
68
82
  __all__ = [
69
83
  "AudioData",
70
84
  "AudioMessage",
85
+ "BaseJobParameters",
86
+ "BulkJobCallback",
87
+ "BulkJobInitResponseV1",
71
88
  "ChatCompletionRequestAssistantMessage",
72
89
  "ChatCompletionRequestMessage",
73
90
  "ChatCompletionRequestMessage_Assistant",
@@ -87,8 +104,14 @@ __all__ = [
87
104
  "ErrorDetails",
88
105
  "ErrorMessage",
89
106
  "EventsData",
107
+ "FileSignedUrlDetails",
108
+ "FilesDownloadResponse",
109
+ "FilesRequest",
110
+ "FilesUploadResponse",
90
111
  "FinishReason",
91
112
  "Format",
113
+ "JobState",
114
+ "JobStatusV1",
92
115
  "LanguageIdentificationResponse",
93
116
  "NumeralsFormat",
94
117
  "ReasoningEffort",
@@ -96,6 +119,7 @@ __all__ = [
96
119
  "Role",
97
120
  "SarvamModelIds",
98
121
  "SpeechSampleRate",
122
+ "SpeechToTextJobParameters",
99
123
  "SpeechToTextLanguage",
100
124
  "SpeechToTextModel",
101
125
  "SpeechToTextResponse",
@@ -110,6 +134,10 @@ __all__ = [
110
134
  "SpeechToTextTranslateTranscriptionData",
111
135
  "SpokenFormNumeralsFormat",
112
136
  "StopConfiguration",
137
+ "StorageContainerType",
138
+ "TaskDetailV1",
139
+ "TaskFileDetails",
140
+ "TaskState",
113
141
  "TextToSpeechLanguage",
114
142
  "TextToSpeechModel",
115
143
  "TextToSpeechResponse",
@@ -0,0 +1,17 @@
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 BaseJobParameters(UniversalBaseModel):
10
+ if IS_PYDANTIC_V2:
11
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
12
+ else:
13
+
14
+ class Config:
15
+ frozen = True
16
+ smart_union = True
17
+ extra = pydantic.Extra.allow
@@ -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 BulkJobCallback(UniversalBaseModel):
10
+ url: str = pydantic.Field()
11
+ """
12
+ Webhook url to call upon job completion
13
+ """
14
+
15
+ auth_token: typing.Optional[str] = pydantic.Field(default=None)
16
+ """
17
+ Authorization token required for the callback Url
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
@@ -0,0 +1,39 @@
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 .base_job_parameters import BaseJobParameters
8
+ from .bulk_job_callback import BulkJobCallback
9
+ from .job_state import JobState
10
+ from .storage_container_type import StorageContainerType
11
+
12
+
13
+ class BulkJobInitResponseV1(UniversalBaseModel):
14
+ job_id: str = pydantic.Field()
15
+ """
16
+ Job UUID.
17
+ """
18
+
19
+ storage_container_type: StorageContainerType = pydantic.Field()
20
+ """
21
+ Storage Container Type
22
+ """
23
+
24
+ job_parameters: BaseJobParameters
25
+ job_state: JobState
26
+ owner_id: str
27
+ callback: typing.Optional[BulkJobCallback] = pydantic.Field(default=None)
28
+ """
29
+ Parameters for callback URL
30
+ """
31
+
32
+ if IS_PYDANTIC_V2:
33
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
+ else:
35
+
36
+ class Config:
37
+ frozen = True
38
+ smart_union = True
39
+ 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
+
8
+
9
+ class FileSignedUrlDetails(UniversalBaseModel):
10
+ file_url: str
11
+ file_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
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
@@ -0,0 +1,25 @@
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 .file_signed_url_details import FileSignedUrlDetails
8
+ from .job_state import JobState
9
+ from .storage_container_type import StorageContainerType
10
+
11
+
12
+ class FilesDownloadResponse(UniversalBaseModel):
13
+ job_id: str
14
+ job_state: JobState
15
+ download_urls: typing.Dict[str, FileSignedUrlDetails]
16
+ storage_container_type: StorageContainerType
17
+
18
+ if IS_PYDANTIC_V2:
19
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
+ else:
21
+
22
+ class Config:
23
+ frozen = True
24
+ smart_union = True
25
+ 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
+
8
+
9
+ class FilesRequest(UniversalBaseModel):
10
+ job_id: str
11
+ files: typing.List[str]
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
@@ -0,0 +1,25 @@
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 .file_signed_url_details import FileSignedUrlDetails
8
+ from .job_state import JobState
9
+ from .storage_container_type import StorageContainerType
10
+
11
+
12
+ class FilesUploadResponse(UniversalBaseModel):
13
+ job_id: str
14
+ job_state: JobState
15
+ upload_urls: typing.Dict[str, FileSignedUrlDetails]
16
+ storage_container_type: StorageContainerType
17
+
18
+ if IS_PYDANTIC_V2:
19
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
+ else:
21
+
22
+ class Config:
23
+ frozen = True
24
+ smart_union = True
25
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ JobState = typing.Union[typing.Literal["Accepted", "Pending", "Running", "Completed", "Failed"], typing.Any]
@@ -0,0 +1,80 @@
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 .job_state import JobState
8
+ from .storage_container_type import StorageContainerType
9
+ from .task_detail_v_1 import TaskDetailV1
10
+
11
+
12
+ class JobStatusV1(UniversalBaseModel):
13
+ job_state: JobState = pydantic.Field()
14
+ """
15
+ Job State
16
+ """
17
+
18
+ created_at: str = pydantic.Field()
19
+ """
20
+ Created At
21
+ """
22
+
23
+ updated_at: str = pydantic.Field()
24
+ """
25
+ Updated At
26
+ """
27
+
28
+ job_id: str = pydantic.Field()
29
+ """
30
+ Job Id
31
+ """
32
+
33
+ total_files: typing.Optional[int] = pydantic.Field(default=None)
34
+ """
35
+ Total Files
36
+ """
37
+
38
+ successful_files_count: typing.Optional[int] = pydantic.Field(default=None)
39
+ """
40
+ Success Count
41
+ """
42
+
43
+ failed_files_count: typing.Optional[int] = pydantic.Field(default=None)
44
+ """
45
+ Failed Count
46
+ """
47
+
48
+ owner_id: str = pydantic.Field()
49
+ """
50
+ Owner of the job
51
+ """
52
+
53
+ storage_container_type: StorageContainerType = pydantic.Field()
54
+ """
55
+ Storage Container Type
56
+ """
57
+
58
+ error_message: typing.Optional[str] = pydantic.Field(default=None)
59
+ """
60
+ Error Message
61
+ """
62
+
63
+ job_details: typing.Optional[typing.List[TaskDetailV1]] = pydantic.Field(default=None)
64
+ """
65
+ Job details at file level.
66
+ """
67
+
68
+ num_internal_retries: typing.Optional[int] = pydantic.Field(default=None)
69
+ """
70
+ Number of internal retries
71
+ """
72
+
73
+ if IS_PYDANTIC_V2:
74
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
75
+ else:
76
+
77
+ class Config:
78
+ frozen = True
79
+ smart_union = True
80
+ extra = pydantic.Extra.allow
@@ -0,0 +1,44 @@
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_model import SpeechToTextModel
8
+ from .speech_to_text_translate_language import SpeechToTextTranslateLanguage
9
+
10
+
11
+ class SpeechToTextJobParameters(UniversalBaseModel):
12
+ language_code: typing.Optional[SpeechToTextTranslateLanguage] = pydantic.Field(default=None)
13
+ """
14
+ Language code
15
+ """
16
+
17
+ model: typing.Optional[SpeechToTextModel] = pydantic.Field(default=None)
18
+ """
19
+ Model to be used for speech to text
20
+ """
21
+
22
+ with_timestamps: typing.Optional[bool] = pydantic.Field(default=None)
23
+ """
24
+ Whether to include timestamps in the response
25
+ """
26
+
27
+ with_diarization: typing.Optional[bool] = pydantic.Field(default=None)
28
+ """
29
+ Enables speaker diarization, which identifies and separates different speakers in the audio. In beta mode
30
+ """
31
+
32
+ num_speakers: typing.Optional[int] = pydantic.Field(default=None)
33
+ """
34
+ Number of speakers to be detected in the audio. This is used when with_diarization is true.
35
+ """
36
+
37
+ if IS_PYDANTIC_V2:
38
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
39
+ else:
40
+
41
+ class Config:
42
+ frozen = True
43
+ smart_union = True
44
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ StorageContainerType = typing.Union[typing.Literal["Azure", "Local", "Google", "Azure_V1"], typing.Any]
@@ -0,0 +1,25 @@
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 .task_file_details import TaskFileDetails
8
+ from .task_state import TaskState
9
+
10
+
11
+ class TaskDetailV1(UniversalBaseModel):
12
+ inputs: typing.Optional[typing.List[TaskFileDetails]] = None
13
+ outputs: typing.Optional[typing.List[TaskFileDetails]] = None
14
+ state: typing.Optional[TaskState] = None
15
+ error_message: typing.Optional[str] = None
16
+ exception_name: typing.Optional[str] = None
17
+
18
+ if IS_PYDANTIC_V2:
19
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
+ else:
21
+
22
+ class Config:
23
+ frozen = True
24
+ smart_union = True
25
+ 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
+
8
+
9
+ class TaskFileDetails(UniversalBaseModel):
10
+ file_name: str
11
+ file_id: str
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
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ TaskState = typing.Union[typing.Literal["Success", "API Error", "Internal Server Error"], typing.Any]