sarvamai 0.1.23a6__py3-none-any.whl → 0.1.23a8__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 (50) hide show
  1. sarvamai/__init__.py +52 -0
  2. sarvamai/client.py +3 -0
  3. sarvamai/core/client_wrapper.py +2 -2
  4. sarvamai/doc_digitization_job/__init__.py +4 -0
  5. sarvamai/doc_digitization_job/client.py +776 -0
  6. sarvamai/doc_digitization_job/job.py +496 -0
  7. sarvamai/doc_digitization_job/raw_client.py +1176 -0
  8. sarvamai/requests/__init__.py +20 -0
  9. sarvamai/requests/doc_digitization_create_job_response.py +25 -0
  10. sarvamai/requests/doc_digitization_download_files_response.py +37 -0
  11. sarvamai/requests/doc_digitization_error_details.py +21 -0
  12. sarvamai/requests/doc_digitization_error_message.py +11 -0
  13. sarvamai/requests/doc_digitization_job_detail.py +64 -0
  14. sarvamai/requests/doc_digitization_job_parameters.py +21 -0
  15. sarvamai/requests/doc_digitization_job_status_response.py +65 -0
  16. sarvamai/requests/doc_digitization_page_error.py +24 -0
  17. sarvamai/requests/doc_digitization_upload_files_response.py +34 -0
  18. sarvamai/requests/doc_digitization_webhook_callback.py +19 -0
  19. sarvamai/requests/speech_to_text_response.py +14 -6
  20. sarvamai/requests/speech_to_text_transcription_data.py +0 -14
  21. sarvamai/requests/speech_to_text_translate_response.py +9 -6
  22. sarvamai/requests/speech_to_text_translate_transcription_data.py +0 -13
  23. sarvamai/speech_to_text_streaming/client.py +2 -30
  24. sarvamai/speech_to_text_streaming/raw_client.py +2 -30
  25. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +1 -25
  26. sarvamai/types/__init__.py +30 -0
  27. sarvamai/types/doc_digitization_create_job_response.py +37 -0
  28. sarvamai/types/doc_digitization_download_files_response.py +47 -0
  29. sarvamai/types/doc_digitization_error_code.py +15 -0
  30. sarvamai/types/doc_digitization_error_details.py +33 -0
  31. sarvamai/types/doc_digitization_error_message.py +23 -0
  32. sarvamai/types/doc_digitization_job_detail.py +74 -0
  33. sarvamai/types/doc_digitization_job_detail_state.py +7 -0
  34. sarvamai/types/doc_digitization_job_parameters.py +33 -0
  35. sarvamai/types/doc_digitization_job_state.py +7 -0
  36. sarvamai/types/doc_digitization_job_status_response.py +75 -0
  37. sarvamai/types/doc_digitization_output_format.py +5 -0
  38. sarvamai/types/doc_digitization_page_error.py +36 -0
  39. sarvamai/types/doc_digitization_supported_language.py +32 -0
  40. sarvamai/types/doc_digitization_upload_files_response.py +44 -0
  41. sarvamai/types/doc_digitization_webhook_callback.py +31 -0
  42. sarvamai/types/speech_to_text_language.py +1 -24
  43. sarvamai/types/speech_to_text_response.py +14 -6
  44. sarvamai/types/speech_to_text_transcription_data.py +0 -14
  45. sarvamai/types/speech_to_text_translate_language.py +1 -25
  46. sarvamai/types/speech_to_text_translate_response.py +9 -6
  47. sarvamai/types/speech_to_text_translate_transcription_data.py +0 -13
  48. {sarvamai-0.1.23a6.dist-info → sarvamai-0.1.23a8.dist-info}/METADATA +1 -1
  49. {sarvamai-0.1.23a6.dist-info → sarvamai-0.1.23a8.dist-info}/RECORD +50 -21
  50. {sarvamai-0.1.23a6.dist-info → sarvamai-0.1.23a8.dist-info}/WHEEL +0 -0
@@ -0,0 +1,37 @@
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 .doc_digitization_job_parameters import DocDigitizationJobParameters
8
+ from .doc_digitization_job_state import DocDigitizationJobState
9
+ from .storage_container_type import StorageContainerType
10
+
11
+
12
+ class DocDigitizationCreateJobResponse(UniversalBaseModel):
13
+ job_id: str = pydantic.Field()
14
+ """
15
+ Unique job identifier (UUID)
16
+ """
17
+
18
+ storage_container_type: StorageContainerType = pydantic.Field()
19
+ """
20
+ Storage Container Type
21
+ """
22
+
23
+ job_parameters: DocDigitizationJobParameters = pydantic.Field()
24
+ """
25
+ Job configuration parameters
26
+ """
27
+
28
+ job_state: DocDigitizationJobState
29
+
30
+ if IS_PYDANTIC_V2:
31
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
32
+ else:
33
+
34
+ class Config:
35
+ frozen = True
36
+ smart_union = True
37
+ extra = pydantic.Extra.allow
@@ -0,0 +1,47 @@
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 .doc_digitization_job_state import DocDigitizationJobState
8
+ from .file_signed_url_details import FileSignedUrlDetails
9
+ from .storage_container_type import StorageContainerType
10
+
11
+
12
+ class DocDigitizationDownloadFilesResponse(UniversalBaseModel):
13
+ """
14
+ Response for download-files endpoint.
15
+ """
16
+
17
+ job_id: str = pydantic.Field()
18
+ """
19
+ Job identifier (UUID)
20
+ """
21
+
22
+ job_state: DocDigitizationJobState = pydantic.Field()
23
+ """
24
+ Current job state
25
+ """
26
+
27
+ storage_container_type: StorageContainerType = pydantic.Field()
28
+ """
29
+ Storage backend type
30
+ """
31
+
32
+ download_urls: typing.Dict[str, FileSignedUrlDetails] = pydantic.Field()
33
+ """
34
+ Map of filename to presigned download URL details
35
+ """
36
+
37
+ error_code: typing.Optional[str] = None
38
+ error_message: typing.Optional[str] = None
39
+
40
+ if IS_PYDANTIC_V2:
41
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
42
+ else:
43
+
44
+ class Config:
45
+ frozen = True
46
+ smart_union = True
47
+ extra = pydantic.Extra.allow
@@ -0,0 +1,15 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocDigitizationErrorCode = typing.Union[
6
+ typing.Literal[
7
+ "invalid_request_error",
8
+ "internal_server_error",
9
+ "insufficient_quota_error",
10
+ "invalid_api_key_error",
11
+ "rate_limit_exceeded_error",
12
+ "high_load_error",
13
+ ],
14
+ typing.Any,
15
+ ]
@@ -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 .doc_digitization_error_code import DocDigitizationErrorCode
8
+
9
+
10
+ class DocDigitizationErrorDetails(UniversalBaseModel):
11
+ message: str = pydantic.Field()
12
+ """
13
+ Message describing the error
14
+ """
15
+
16
+ code: DocDigitizationErrorCode = pydantic.Field()
17
+ """
18
+ Error code for the specific error that has occurred.
19
+ """
20
+
21
+ request_id: typing.Optional[str] = pydantic.Field(default=None)
22
+ """
23
+ Unique identifier for the request. Format: date_UUID4
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,23 @@
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 .doc_digitization_error_details import DocDigitizationErrorDetails
8
+
9
+
10
+ class DocDigitizationErrorMessage(UniversalBaseModel):
11
+ error: DocDigitizationErrorDetails = pydantic.Field()
12
+ """
13
+ Error details
14
+ """
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -0,0 +1,74 @@
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 .doc_digitization_job_detail_state import DocDigitizationJobDetailState
8
+ from .doc_digitization_page_error import DocDigitizationPageError
9
+ from .task_file_details import TaskFileDetails
10
+
11
+
12
+ class DocDigitizationJobDetail(UniversalBaseModel):
13
+ """
14
+ Processing details for a single input file with page-level metrics.
15
+ """
16
+
17
+ inputs: typing.List[TaskFileDetails] = pydantic.Field()
18
+ """
19
+ Input file(s) for this task
20
+ """
21
+
22
+ outputs: typing.List[TaskFileDetails] = pydantic.Field()
23
+ """
24
+ Output file(s) produced
25
+ """
26
+
27
+ state: DocDigitizationJobDetailState = pydantic.Field()
28
+ """
29
+ Processing state for this file
30
+ """
31
+
32
+ total_pages: typing.Optional[int] = pydantic.Field(default=None)
33
+ """
34
+ Total pages/images in the input file
35
+ """
36
+
37
+ pages_processed: typing.Optional[int] = pydantic.Field(default=None)
38
+ """
39
+ Number of pages processed so far
40
+ """
41
+
42
+ pages_succeeded: typing.Optional[int] = pydantic.Field(default=None)
43
+ """
44
+ Number of pages successfully processed
45
+ """
46
+
47
+ pages_failed: typing.Optional[int] = pydantic.Field(default=None)
48
+ """
49
+ Number of pages that failed processing
50
+ """
51
+
52
+ error_message: typing.Optional[str] = pydantic.Field(default=None)
53
+ """
54
+ Error message if processing failed
55
+ """
56
+
57
+ error_code: typing.Optional[str] = pydantic.Field(default=None)
58
+ """
59
+ Standardized error code if failed
60
+ """
61
+
62
+ page_errors: typing.Optional[typing.List[DocDigitizationPageError]] = pydantic.Field(default=None)
63
+ """
64
+ Detailed errors for each failed page
65
+ """
66
+
67
+ if IS_PYDANTIC_V2:
68
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
69
+ else:
70
+
71
+ class Config:
72
+ frozen = True
73
+ smart_union = True
74
+ extra = pydantic.Extra.allow
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocDigitizationJobDetailState = typing.Union[
6
+ typing.Literal["Pending", "Running", "Success", "PartialSuccess", "Failed"], typing.Any
7
+ ]
@@ -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 .doc_digitization_output_format import DocDigitizationOutputFormat
8
+ from .doc_digitization_supported_language import DocDigitizationSupportedLanguage
9
+
10
+
11
+ class DocDigitizationJobParameters(UniversalBaseModel):
12
+ """
13
+ Job parameters for document digitization.
14
+ """
15
+
16
+ language: typing.Optional[DocDigitizationSupportedLanguage] = pydantic.Field(default=None)
17
+ """
18
+ ISO language code for the document
19
+ """
20
+
21
+ output_format: typing.Optional[DocDigitizationOutputFormat] = pydantic.Field(default=None)
22
+ """
23
+ Output format: html or md
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,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocDigitizationJobState = typing.Union[
6
+ typing.Literal["Accepted", "Pending", "Running", "Completed", "PartiallyCompleted", "Failed"], typing.Any
7
+ ]
@@ -0,0 +1,75 @@
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
+ from .doc_digitization_job_detail import DocDigitizationJobDetail
9
+ from .doc_digitization_job_state import DocDigitizationJobState
10
+ from .storage_container_type import StorageContainerType
11
+
12
+
13
+ class DocDigitizationJobStatusResponse(UniversalBaseModel):
14
+ """
15
+ Response model for job status endpoint.
16
+ """
17
+
18
+ job_id: str = pydantic.Field()
19
+ """
20
+ Job identifier (UUID)
21
+ """
22
+
23
+ job_state: DocDigitizationJobState = pydantic.Field()
24
+ """
25
+ Current job state
26
+ """
27
+
28
+ created_at: dt.datetime = pydantic.Field()
29
+ """
30
+ Job creation timestamp (ISO 8601)
31
+ """
32
+
33
+ updated_at: dt.datetime = pydantic.Field()
34
+ """
35
+ Last update timestamp (ISO 8601)
36
+ """
37
+
38
+ storage_container_type: StorageContainerType = pydantic.Field()
39
+ """
40
+ Storage backend type
41
+ """
42
+
43
+ total_files: typing.Optional[int] = pydantic.Field(default=None)
44
+ """
45
+ Total input files (always 1)
46
+ """
47
+
48
+ successful_files_count: typing.Optional[int] = pydantic.Field(default=None)
49
+ """
50
+ Files that completed successfully
51
+ """
52
+
53
+ failed_files_count: typing.Optional[int] = pydantic.Field(default=None)
54
+ """
55
+ Files that failed
56
+ """
57
+
58
+ error_message: typing.Optional[str] = pydantic.Field(default=None)
59
+ """
60
+ Job-level error message
61
+ """
62
+
63
+ job_details: typing.Optional[typing.List[DocDigitizationJobDetail]] = pydantic.Field(default=None)
64
+ """
65
+ Per-file processing details with page metrics
66
+ """
67
+
68
+ if IS_PYDANTIC_V2:
69
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
70
+ else:
71
+
72
+ class Config:
73
+ frozen = True
74
+ smart_union = True
75
+ 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
+ DocDigitizationOutputFormat = typing.Union[typing.Literal["html", "md"], typing.Any]
@@ -0,0 +1,36 @@
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 DocDigitizationPageError(UniversalBaseModel):
10
+ """
11
+ Error details for a specific page.
12
+ """
13
+
14
+ page_number: int = pydantic.Field()
15
+ """
16
+ Page number that failed
17
+ """
18
+
19
+ error_code: str = pydantic.Field()
20
+ """
21
+ Standardized error code
22
+ """
23
+
24
+ error_message: str = pydantic.Field()
25
+ """
26
+ Human-readable error description
27
+ """
28
+
29
+ if IS_PYDANTIC_V2:
30
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
31
+ else:
32
+
33
+ class Config:
34
+ frozen = True
35
+ smart_union = True
36
+ extra = pydantic.Extra.allow
@@ -0,0 +1,32 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocDigitizationSupportedLanguage = typing.Union[
6
+ typing.Literal[
7
+ "hi",
8
+ "en",
9
+ "bn",
10
+ "gu",
11
+ "kn",
12
+ "ml",
13
+ "mr",
14
+ "or",
15
+ "pa",
16
+ "ta",
17
+ "te",
18
+ "ur",
19
+ "as",
20
+ "bodo",
21
+ "doi",
22
+ "ks",
23
+ "kok",
24
+ "mai",
25
+ "mni",
26
+ "ne",
27
+ "sa",
28
+ "sat",
29
+ "sd",
30
+ ],
31
+ typing.Any,
32
+ ]
@@ -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 .doc_digitization_job_state import DocDigitizationJobState
8
+ from .file_signed_url_details import FileSignedUrlDetails
9
+ from .storage_container_type import StorageContainerType
10
+
11
+
12
+ class DocDigitizationUploadFilesResponse(UniversalBaseModel):
13
+ """
14
+ Response with presigned upload URLs
15
+ """
16
+
17
+ job_id: str = pydantic.Field()
18
+ """
19
+ Job identifier
20
+ """
21
+
22
+ job_state: DocDigitizationJobState = pydantic.Field()
23
+ """
24
+ Current job state
25
+ """
26
+
27
+ upload_urls: typing.Dict[str, FileSignedUrlDetails] = pydantic.Field()
28
+ """
29
+ Map of filename to presigned upload URL details
30
+ """
31
+
32
+ storage_container_type: StorageContainerType = pydantic.Field()
33
+ """
34
+ Storage backend type
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,31 @@
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 DocDigitizationWebhookCallback(UniversalBaseModel):
10
+ """
11
+ Webhook configuration for job completion notification
12
+ """
13
+
14
+ url: str = pydantic.Field()
15
+ """
16
+ HTTPS webhook URL to call upon job completion (HTTP not allowed)
17
+ """
18
+
19
+ auth_token: typing.Optional[str] = pydantic.Field(default=None)
20
+ """
21
+ Authorization token sent as X-SARVAM-JOB-CALLBACK-TOKEN header
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -4,30 +4,7 @@ import typing
4
4
 
5
5
  SpeechToTextLanguage = typing.Union[
6
6
  typing.Literal[
7
- "unknown",
8
- "hi-IN",
9
- "bn-IN",
10
- "kn-IN",
11
- "ml-IN",
12
- "mr-IN",
13
- "od-IN",
14
- "pa-IN",
15
- "ta-IN",
16
- "te-IN",
17
- "en-IN",
18
- "gu-IN",
19
- "as-IN",
20
- "ur-IN",
21
- "ne-IN",
22
- "kok-IN",
23
- "ks-IN",
24
- "sd-IN",
25
- "sa-IN",
26
- "sat-IN",
27
- "mni-IN",
28
- "brx-IN",
29
- "mai-IN",
30
- "doi-IN",
7
+ "unknown", "hi-IN", "bn-IN", "kn-IN", "ml-IN", "mr-IN", "od-IN", "pa-IN", "ta-IN", "te-IN", "en-IN", "gu-IN"
31
8
  ],
32
9
  typing.Any,
33
10
  ]
@@ -4,22 +4,30 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .diarized_transcript import DiarizedTranscript
8
+ from .timestamps_model import TimestampsModel
7
9
 
8
10
 
9
11
  class SpeechToTextResponse(UniversalBaseModel):
10
- request_id: str = pydantic.Field()
12
+ request_id: typing.Optional[str] = None
13
+ transcript: str = pydantic.Field()
11
14
  """
12
- Unique identifier for the request
15
+ The transcribed text from the provided audio file.
13
16
  """
14
17
 
15
- transcript: str = pydantic.Field()
18
+ timestamps: typing.Optional[TimestampsModel] = pydantic.Field(default=None)
16
19
  """
17
- The transcribed text from the provided audio file.
20
+ Contains timestamps for the transcribed text. This field is included only if with_timestamps is set to true
21
+ """
22
+
23
+ diarized_transcript: typing.Optional[DiarizedTranscript] = pydantic.Field(default=None)
24
+ """
25
+ Diarized transcript of the provided speech
18
26
  """
19
27
 
20
- language_code: str = pydantic.Field()
28
+ language_code: typing.Optional[str] = pydantic.Field(default=None)
21
29
  """
22
- The BCP-47 code of language spoken in the input (e.g., hi-IN, en-IN). If multiple languages are detected, returns the most predominant spoken language.
30
+ This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null
23
31
  """
24
32
 
25
33
  if IS_PYDANTIC_V2:
@@ -33,20 +33,6 @@ class SpeechToTextTranscriptionData(UniversalBaseModel):
33
33
  BCP-47 code of detected language
34
34
  """
35
35
 
36
- language_probability: typing.Optional[float] = pydantic.Field(default=None)
37
- """
38
- Float value (0.0 to 1.0) indicating the probability of the detected language being correct. Higher values indicate higher confidence.
39
-
40
- **When it returns a value:**
41
- - When `language_code` is not provided in the request
42
- - When `language_code` is set to `unknown`
43
-
44
- **When it returns null:**
45
- - When a specific `language_code` is provided (language detection is skipped)
46
-
47
- The parameter is always present in the response.
48
- """
49
-
50
36
  metrics: TranscriptionMetrics
51
37
 
52
38
  if IS_PYDANTIC_V2:
@@ -3,30 +3,6 @@
3
3
  import typing
4
4
 
5
5
  SpeechToTextTranslateLanguage = typing.Union[
6
- typing.Literal[
7
- "hi-IN",
8
- "bn-IN",
9
- "kn-IN",
10
- "ml-IN",
11
- "mr-IN",
12
- "od-IN",
13
- "pa-IN",
14
- "ta-IN",
15
- "te-IN",
16
- "gu-IN",
17
- "en-IN",
18
- "as-IN",
19
- "ur-IN",
20
- "ne-IN",
21
- "kok-IN",
22
- "ks-IN",
23
- "sd-IN",
24
- "sa-IN",
25
- "sat-IN",
26
- "mni-IN",
27
- "brx-IN",
28
- "mai-IN",
29
- "doi-IN",
30
- ],
6
+ typing.Literal["hi-IN", "bn-IN", "kn-IN", "ml-IN", "mr-IN", "od-IN", "pa-IN", "ta-IN", "te-IN", "gu-IN", "en-IN"],
31
7
  typing.Any,
32
8
  ]
@@ -4,22 +4,25 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .diarized_transcript import DiarizedTranscript
8
+ from .speech_to_text_translate_language import SpeechToTextTranslateLanguage
7
9
 
8
10
 
9
11
  class SpeechToTextTranslateResponse(UniversalBaseModel):
10
- request_id: str = pydantic.Field()
12
+ request_id: typing.Optional[str] = None
13
+ transcript: str = pydantic.Field()
11
14
  """
12
- Unique identifier for the request
15
+ Transcript of the provided speech
13
16
  """
14
17
 
15
- transcript: str = pydantic.Field()
18
+ language_code: typing.Optional[SpeechToTextTranslateLanguage] = pydantic.Field(default=None)
16
19
  """
17
- English translation of the provided speech
20
+ This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null
18
21
  """
19
22
 
20
- language_code: str = pydantic.Field()
23
+ diarized_transcript: typing.Optional[DiarizedTranscript] = pydantic.Field(default=None)
21
24
  """
22
- The BCP-47 code of the detected source language spoken in the input (e.g., hi-IN, kn-IN).
25
+ Diarized transcript of the provided speech
23
26
  """
24
27
 
25
28
  if IS_PYDANTIC_V2: