sarvamai 0.1.5a6__tar.gz → 0.1.5a8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sarvamai-0.1.5a8/PKG-INFO +28 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/pyproject.toml +25 -4
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/__init__.py +45 -1
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/chat/__init__.py +2 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/chat/client.py +9 -10
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/chat/raw_client.py +48 -37
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/client.py +13 -31
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/__init__.py +5 -0
- sarvamai-0.1.5a8/src/sarvamai/core/api_error.py +23 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/client_wrapper.py +17 -20
- sarvamai-0.1.5a8/src/sarvamai/core/events.py +30 -0
- sarvamai-0.1.5a8/src/sarvamai/core/force_multipart.py +16 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/http_client.py +70 -24
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/http_response.py +19 -11
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/pydantic_utilities.py +69 -108
- sarvamai-0.1.5a8/src/sarvamai/environment.py +14 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/errors/__init__.py +2 -0
- sarvamai-0.1.5a8/src/sarvamai/errors/bad_request_error.py +10 -0
- sarvamai-0.1.5a8/src/sarvamai/errors/forbidden_error.py +10 -0
- sarvamai-0.1.5a8/src/sarvamai/errors/internal_server_error.py +10 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/errors/service_unavailable_error.py +4 -2
- sarvamai-0.1.5a8/src/sarvamai/errors/too_many_requests_error.py +10 -0
- sarvamai-0.1.5a8/src/sarvamai/errors/unprocessable_entity_error.py +10 -0
- sarvamai-0.1.5a8/src/sarvamai/py.typed +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/__init__.py +18 -0
- sarvamai-0.1.5a8/src/sarvamai/requests/audio_data.py +21 -0
- sarvamai-0.1.5a8/src/sarvamai/requests/audio_message.py +8 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/chat_completion_request_message.py +3 -1
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/create_chat_completion_response.py +2 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/diarized_transcript.py +2 -1
- sarvamai-0.1.5a8/src/sarvamai/requests/error_data.py +15 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/error_details.py +0 -1
- sarvamai-0.1.5a8/src/sarvamai/requests/events_data.py +17 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/language_identification_response.py +0 -1
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/speech_to_text_response.py +1 -2
- sarvamai-0.1.5a8/src/sarvamai/requests/speech_to_text_streaming_response.py +10 -0
- sarvamai-0.1.5a8/src/sarvamai/requests/speech_to_text_streaming_response_data.py +9 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/speech_to_text_translate_response.py +0 -1
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/text_to_speech_response.py +2 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/timestamps_model.py +2 -1
- sarvamai-0.1.5a8/src/sarvamai/requests/transcription_data.py +35 -0
- sarvamai-0.1.5a8/src/sarvamai/requests/transcription_metrics.py +15 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/translation_response.py +0 -1
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/transliteration_response.py +0 -1
- {sarvamai-0.1.5a6/src/sarvamai/text_to_speech → sarvamai-0.1.5a8/src/sarvamai/speech_to_text}/__init__.py +2 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/speech_to_text/client.py +13 -14
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/speech_to_text/raw_client.py +99 -68
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/__init__.py +7 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/client.py +189 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/raw_client.py +166 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/socket_client.py +133 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/types/__init__.py +8 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +8 -0
- sarvamai-0.1.5a8/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +5 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/text/__init__.py +2 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/text/client.py +24 -25
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/text/raw_client.py +126 -91
- {sarvamai-0.1.5a6/src/sarvamai/speech_to_text → sarvamai-0.1.5a8/src/sarvamai/text_to_speech}/__init__.py +2 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/text_to_speech/client.py +10 -11
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/text_to_speech/raw_client.py +49 -38
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/__init__.py +24 -0
- sarvamai-0.1.5a8/src/sarvamai/types/audio_data.py +33 -0
- sarvamai-0.1.5a8/src/sarvamai/types/audio_data_encoding.py +5 -0
- sarvamai-0.1.5a8/src/sarvamai/types/audio_message.py +20 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/chat_completion_request_assistant_message.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/chat_completion_request_message.py +3 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/chat_completion_request_system_message.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/chat_completion_request_user_message.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/chat_completion_response_message.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/choice.py +4 -4
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/completion_usage.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/create_chat_completion_response.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/diarized_entry.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/diarized_transcript.py +3 -3
- sarvamai-0.1.5a8/src/sarvamai/types/error_data.py +27 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/error_details.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/error_message.py +4 -4
- sarvamai-0.1.5a8/src/sarvamai/types/events_data.py +28 -0
- sarvamai-0.1.5a8/src/sarvamai/types/format.py +5 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/language_identification_response.py +2 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_response.py +3 -3
- sarvamai-0.1.5a8/src/sarvamai/types/speech_to_text_streaming_response.py +22 -0
- sarvamai-0.1.5a8/src/sarvamai/types/speech_to_text_streaming_response_data.py +9 -0
- sarvamai-0.1.5a8/src/sarvamai/types/speech_to_text_streaming_response_type.py +5 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_translate_response.py +3 -3
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/text_to_speech_response.py +2 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/timestamps_model.py +2 -2
- sarvamai-0.1.5a8/src/sarvamai/types/transcription_data.py +45 -0
- sarvamai-0.1.5a8/src/sarvamai/types/transcription_metrics.py +27 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translation_response.py +2 -2
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/transliteration_response.py +2 -2
- sarvamai-0.1.5a6/PKG-INFO +0 -174
- sarvamai-0.1.5a6/README.md +0 -147
- sarvamai-0.1.5a6/src/sarvamai/core/api_error.py +0 -15
- sarvamai-0.1.5a6/src/sarvamai/environment.py +0 -7
- sarvamai-0.1.5a6/src/sarvamai/errors/bad_request_error.py +0 -9
- sarvamai-0.1.5a6/src/sarvamai/errors/forbidden_error.py +0 -9
- sarvamai-0.1.5a6/src/sarvamai/errors/internal_server_error.py +0 -9
- sarvamai-0.1.5a6/src/sarvamai/errors/too_many_requests_error.py +0 -9
- sarvamai-0.1.5a6/src/sarvamai/errors/unprocessable_entity_error.py +0 -9
- /sarvamai-0.1.5a6/src/sarvamai/py.typed → /sarvamai-0.1.5a8/README.md +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/datetime_utils.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/file.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/jsonable_encoder.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/query_encoder.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/remove_none_from_dict.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/request_options.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/core/serialization.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/play.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/choice.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/completion_usage.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/diarized_entry.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/error_message.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/requests/stop_configuration.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/error_code.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/finish_reason.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/numerals_format.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/reasoning_effort.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/role.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/sarvam_model_ids.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_sample_rate.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_model.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_translate_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/speech_to_text_translate_model.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/spoken_form_numerals_format.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/stop_configuration.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/text_to_speech_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/text_to_speech_model.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/text_to_speech_speaker.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translate_mode.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translate_model.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translate_source_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translate_speaker_gender.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translate_target_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/translatiterate_target_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/transliterate_mode.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/types/transliterate_source_language.py +0 -0
- {sarvamai-0.1.5a6 → sarvamai-0.1.5a8}/src/sarvamai/version.py +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sarvamai
|
|
3
|
+
Version: 0.1.5a8
|
|
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
|
+
|
|
@@ -3,7 +3,7 @@ name = "sarvamai"
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "sarvamai"
|
|
6
|
-
version = "0.1.
|
|
6
|
+
version = "0.1.5a8"
|
|
7
7
|
description = ""
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
authors = []
|
|
@@ -39,14 +39,15 @@ httpx = ">=0.21.2"
|
|
|
39
39
|
pydantic = ">= 1.9.2"
|
|
40
40
|
pydantic-core = "^2.18.2"
|
|
41
41
|
typing_extensions = ">= 4.0.0"
|
|
42
|
+
websockets = "12.0"
|
|
42
43
|
|
|
43
|
-
[tool.poetry.dev
|
|
44
|
-
mypy = "1.0
|
|
44
|
+
[tool.poetry.group.dev.dependencies]
|
|
45
|
+
mypy = "==1.13.0"
|
|
45
46
|
pytest = "^7.4.0"
|
|
46
47
|
pytest-asyncio = "^0.23.5"
|
|
47
48
|
python-dateutil = "^2.9.0"
|
|
48
49
|
types-python-dateutil = "^2.9.0.20240316"
|
|
49
|
-
ruff = "
|
|
50
|
+
ruff = "==0.11.5"
|
|
50
51
|
|
|
51
52
|
[tool.pytest.ini_options]
|
|
52
53
|
testpaths = [ "tests" ]
|
|
@@ -58,6 +59,26 @@ plugins = ["pydantic.mypy"]
|
|
|
58
59
|
[tool.ruff]
|
|
59
60
|
line-length = 120
|
|
60
61
|
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = [
|
|
64
|
+
"E", # pycodestyle errors
|
|
65
|
+
"F", # pyflakes
|
|
66
|
+
"I", # isort
|
|
67
|
+
]
|
|
68
|
+
ignore = [
|
|
69
|
+
"E402", # Module level import not at top of file
|
|
70
|
+
"E501", # Line too long
|
|
71
|
+
"E711", # Comparison to `None` should be `cond is not None`
|
|
72
|
+
"E712", # Avoid equality comparisons to `True`; use `if ...:` checks
|
|
73
|
+
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
|
|
74
|
+
"E722", # Do not use bare `except`
|
|
75
|
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
|
76
|
+
"F821", # Undefined name
|
|
77
|
+
"F841" # Local variable ... is assigned to but never used
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint.isort]
|
|
81
|
+
section-order = ["future", "standard-library", "third-party", "first-party"]
|
|
61
82
|
|
|
62
83
|
[build-system]
|
|
63
84
|
requires = ["poetry-core"]
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
3
5
|
from .types import (
|
|
6
|
+
AudioData,
|
|
7
|
+
AudioDataEncoding,
|
|
8
|
+
AudioMessage,
|
|
4
9
|
ChatCompletionRequestAssistantMessage,
|
|
5
10
|
ChatCompletionRequestMessage,
|
|
6
11
|
ChatCompletionRequestMessage_Assistant,
|
|
@@ -15,9 +20,12 @@ from .types import (
|
|
|
15
20
|
DiarizedEntry,
|
|
16
21
|
DiarizedTranscript,
|
|
17
22
|
ErrorCode,
|
|
23
|
+
ErrorData,
|
|
18
24
|
ErrorDetails,
|
|
19
25
|
ErrorMessage,
|
|
26
|
+
EventsData,
|
|
20
27
|
FinishReason,
|
|
28
|
+
Format,
|
|
21
29
|
LanguageIdentificationResponse,
|
|
22
30
|
NumeralsFormat,
|
|
23
31
|
ReasoningEffort,
|
|
@@ -27,6 +35,9 @@ from .types import (
|
|
|
27
35
|
SpeechToTextLanguage,
|
|
28
36
|
SpeechToTextModel,
|
|
29
37
|
SpeechToTextResponse,
|
|
38
|
+
SpeechToTextStreamingResponse,
|
|
39
|
+
SpeechToTextStreamingResponseData,
|
|
40
|
+
SpeechToTextStreamingResponseType,
|
|
30
41
|
SpeechToTextTranslateLanguage,
|
|
31
42
|
SpeechToTextTranslateModel,
|
|
32
43
|
SpeechToTextTranslateResponse,
|
|
@@ -37,6 +48,8 @@ from .types import (
|
|
|
37
48
|
TextToSpeechResponse,
|
|
38
49
|
TextToSpeechSpeaker,
|
|
39
50
|
TimestampsModel,
|
|
51
|
+
TranscriptionData,
|
|
52
|
+
TranscriptionMetrics,
|
|
40
53
|
TranslateMode,
|
|
41
54
|
TranslateModel,
|
|
42
55
|
TranslateSourceLanguage,
|
|
@@ -56,10 +69,12 @@ from .errors import (
|
|
|
56
69
|
TooManyRequestsError,
|
|
57
70
|
UnprocessableEntityError,
|
|
58
71
|
)
|
|
59
|
-
from . import chat, speech_to_text, text, text_to_speech
|
|
72
|
+
from . import chat, speech_to_text, speech_to_text_streaming, text, text_to_speech
|
|
60
73
|
from .client import AsyncSarvamAI, SarvamAI
|
|
61
74
|
from .environment import SarvamAIEnvironment
|
|
62
75
|
from .requests import (
|
|
76
|
+
AudioDataParams,
|
|
77
|
+
AudioMessageParams,
|
|
63
78
|
ChatCompletionRequestAssistantMessageParams,
|
|
64
79
|
ChatCompletionRequestMessageParams,
|
|
65
80
|
ChatCompletionRequestMessage_AssistantParams,
|
|
@@ -73,21 +88,33 @@ from .requests import (
|
|
|
73
88
|
CreateChatCompletionResponseParams,
|
|
74
89
|
DiarizedEntryParams,
|
|
75
90
|
DiarizedTranscriptParams,
|
|
91
|
+
ErrorDataParams,
|
|
76
92
|
ErrorDetailsParams,
|
|
77
93
|
ErrorMessageParams,
|
|
94
|
+
EventsDataParams,
|
|
78
95
|
LanguageIdentificationResponseParams,
|
|
79
96
|
SpeechToTextResponseParams,
|
|
97
|
+
SpeechToTextStreamingResponseDataParams,
|
|
98
|
+
SpeechToTextStreamingResponseParams,
|
|
80
99
|
SpeechToTextTranslateResponseParams,
|
|
81
100
|
StopConfigurationParams,
|
|
82
101
|
TextToSpeechResponseParams,
|
|
83
102
|
TimestampsModelParams,
|
|
103
|
+
TranscriptionDataParams,
|
|
104
|
+
TranscriptionMetricsParams,
|
|
84
105
|
TranslationResponseParams,
|
|
85
106
|
TransliterationResponseParams,
|
|
86
107
|
)
|
|
108
|
+
from .speech_to_text_streaming import SpeechToTextStreamingLanguageCode, SpeechToTextStreamingModel
|
|
87
109
|
from .version import __version__
|
|
88
110
|
|
|
89
111
|
__all__ = [
|
|
90
112
|
"AsyncSarvamAI",
|
|
113
|
+
"AudioData",
|
|
114
|
+
"AudioDataEncoding",
|
|
115
|
+
"AudioDataParams",
|
|
116
|
+
"AudioMessage",
|
|
117
|
+
"AudioMessageParams",
|
|
91
118
|
"BadRequestError",
|
|
92
119
|
"ChatCompletionRequestAssistantMessage",
|
|
93
120
|
"ChatCompletionRequestAssistantMessageParams",
|
|
@@ -116,12 +143,17 @@ __all__ = [
|
|
|
116
143
|
"DiarizedTranscript",
|
|
117
144
|
"DiarizedTranscriptParams",
|
|
118
145
|
"ErrorCode",
|
|
146
|
+
"ErrorData",
|
|
147
|
+
"ErrorDataParams",
|
|
119
148
|
"ErrorDetails",
|
|
120
149
|
"ErrorDetailsParams",
|
|
121
150
|
"ErrorMessage",
|
|
122
151
|
"ErrorMessageParams",
|
|
152
|
+
"EventsData",
|
|
153
|
+
"EventsDataParams",
|
|
123
154
|
"FinishReason",
|
|
124
155
|
"ForbiddenError",
|
|
156
|
+
"Format",
|
|
125
157
|
"InternalServerError",
|
|
126
158
|
"LanguageIdentificationResponse",
|
|
127
159
|
"LanguageIdentificationResponseParams",
|
|
@@ -137,6 +169,13 @@ __all__ = [
|
|
|
137
169
|
"SpeechToTextModel",
|
|
138
170
|
"SpeechToTextResponse",
|
|
139
171
|
"SpeechToTextResponseParams",
|
|
172
|
+
"SpeechToTextStreamingLanguageCode",
|
|
173
|
+
"SpeechToTextStreamingModel",
|
|
174
|
+
"SpeechToTextStreamingResponse",
|
|
175
|
+
"SpeechToTextStreamingResponseData",
|
|
176
|
+
"SpeechToTextStreamingResponseDataParams",
|
|
177
|
+
"SpeechToTextStreamingResponseParams",
|
|
178
|
+
"SpeechToTextStreamingResponseType",
|
|
140
179
|
"SpeechToTextTranslateLanguage",
|
|
141
180
|
"SpeechToTextTranslateModel",
|
|
142
181
|
"SpeechToTextTranslateResponse",
|
|
@@ -152,6 +191,10 @@ __all__ = [
|
|
|
152
191
|
"TimestampsModel",
|
|
153
192
|
"TimestampsModelParams",
|
|
154
193
|
"TooManyRequestsError",
|
|
194
|
+
"TranscriptionData",
|
|
195
|
+
"TranscriptionDataParams",
|
|
196
|
+
"TranscriptionMetrics",
|
|
197
|
+
"TranscriptionMetricsParams",
|
|
155
198
|
"TranslateMode",
|
|
156
199
|
"TranslateModel",
|
|
157
200
|
"TranslateSourceLanguage",
|
|
@@ -168,6 +211,7 @@ __all__ = [
|
|
|
168
211
|
"__version__",
|
|
169
212
|
"chat",
|
|
170
213
|
"speech_to_text",
|
|
214
|
+
"speech_to_text_streaming",
|
|
171
215
|
"text",
|
|
172
216
|
"text_to_speech",
|
|
173
217
|
]
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
|
|
5
|
-
from .
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
6
7
|
from ..requests.chat_completion_request_message import ChatCompletionRequestMessageParams
|
|
7
|
-
from ..types.reasoning_effort import ReasoningEffort
|
|
8
8
|
from ..requests.stop_configuration import StopConfigurationParams
|
|
9
|
-
from ..core.request_options import RequestOptions
|
|
10
9
|
from ..types.create_chat_completion_response import CreateChatCompletionResponse
|
|
11
|
-
from ..
|
|
12
|
-
from .raw_client import AsyncRawChatClient
|
|
10
|
+
from ..types.reasoning_effort import ReasoningEffort
|
|
11
|
+
from .raw_client import AsyncRawChatClient, RawChatClient
|
|
13
12
|
|
|
14
13
|
# this is used as the default value for optional parameters
|
|
15
14
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -117,7 +116,7 @@ class ChatClient:
|
|
|
117
116
|
messages=[{"content": "content", "role": "assistant"}],
|
|
118
117
|
)
|
|
119
118
|
"""
|
|
120
|
-
|
|
119
|
+
_response = self._raw_client.completions(
|
|
121
120
|
messages=messages,
|
|
122
121
|
temperature=temperature,
|
|
123
122
|
top_p=top_p,
|
|
@@ -132,7 +131,7 @@ class ChatClient:
|
|
|
132
131
|
wiki_grounding=wiki_grounding,
|
|
133
132
|
request_options=request_options,
|
|
134
133
|
)
|
|
135
|
-
return
|
|
134
|
+
return _response.data
|
|
136
135
|
|
|
137
136
|
|
|
138
137
|
class AsyncChatClient:
|
|
@@ -245,7 +244,7 @@ class AsyncChatClient:
|
|
|
245
244
|
|
|
246
245
|
asyncio.run(main())
|
|
247
246
|
"""
|
|
248
|
-
|
|
247
|
+
_response = await self._raw_client.completions(
|
|
249
248
|
messages=messages,
|
|
250
249
|
temperature=temperature,
|
|
251
250
|
top_p=top_p,
|
|
@@ -260,4 +259,4 @@ class AsyncChatClient:
|
|
|
260
259
|
wiki_grounding=wiki_grounding,
|
|
261
260
|
request_options=request_options,
|
|
262
261
|
)
|
|
263
|
-
return
|
|
262
|
+
return _response.data
|
|
@@ -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 ..
|
|
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
|
|
9
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
10
|
from ..core.request_options import RequestOptions
|
|
9
|
-
from ..core.http_response import HttpResponse
|
|
10
|
-
from ..types.create_chat_completion_response import CreateChatCompletionResponse
|
|
11
11
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
12
|
-
from ..core.pydantic_utilities import parse_obj_as
|
|
13
12
|
from ..errors.bad_request_error import BadRequestError
|
|
14
13
|
from ..errors.forbidden_error import ForbiddenError
|
|
15
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
16
|
-
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
17
14
|
from ..errors.internal_server_error import InternalServerError
|
|
18
|
-
from
|
|
19
|
-
from ..
|
|
20
|
-
from ..
|
|
21
|
-
from ..
|
|
15
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
16
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
17
|
+
from ..requests.chat_completion_request_message import ChatCompletionRequestMessageParams
|
|
18
|
+
from ..requests.stop_configuration import StopConfigurationParams
|
|
19
|
+
from ..types.create_chat_completion_response import CreateChatCompletionResponse
|
|
20
|
+
from ..types.reasoning_effort import ReasoningEffort
|
|
22
21
|
|
|
23
22
|
# this is used as the default value for optional parameters
|
|
24
23
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -106,6 +105,7 @@ class RawChatClient:
|
|
|
106
105
|
"""
|
|
107
106
|
_response = self._client_wrapper.httpx_client.request(
|
|
108
107
|
"v1/chat/completions",
|
|
108
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
109
109
|
method="POST",
|
|
110
110
|
json={
|
|
111
111
|
"messages": convert_and_respect_annotation_metadata(
|
|
@@ -144,58 +144,63 @@ class RawChatClient:
|
|
|
144
144
|
return HttpResponse(response=_response, data=_data)
|
|
145
145
|
if _response.status_code == 400:
|
|
146
146
|
raise BadRequestError(
|
|
147
|
-
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
148
149
|
typing.Optional[typing.Any],
|
|
149
150
|
parse_obj_as(
|
|
150
151
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
151
152
|
object_=_response.json(),
|
|
152
153
|
),
|
|
153
|
-
)
|
|
154
|
+
),
|
|
154
155
|
)
|
|
155
156
|
if _response.status_code == 403:
|
|
156
157
|
raise ForbiddenError(
|
|
157
|
-
|
|
158
|
+
headers=dict(_response.headers),
|
|
159
|
+
body=typing.cast(
|
|
158
160
|
typing.Optional[typing.Any],
|
|
159
161
|
parse_obj_as(
|
|
160
162
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
161
163
|
object_=_response.json(),
|
|
162
164
|
),
|
|
163
|
-
)
|
|
165
|
+
),
|
|
164
166
|
)
|
|
165
167
|
if _response.status_code == 422:
|
|
166
168
|
raise UnprocessableEntityError(
|
|
167
|
-
|
|
169
|
+
headers=dict(_response.headers),
|
|
170
|
+
body=typing.cast(
|
|
168
171
|
typing.Optional[typing.Any],
|
|
169
172
|
parse_obj_as(
|
|
170
173
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
171
174
|
object_=_response.json(),
|
|
172
175
|
),
|
|
173
|
-
)
|
|
176
|
+
),
|
|
174
177
|
)
|
|
175
178
|
if _response.status_code == 429:
|
|
176
179
|
raise TooManyRequestsError(
|
|
177
|
-
|
|
180
|
+
headers=dict(_response.headers),
|
|
181
|
+
body=typing.cast(
|
|
178
182
|
typing.Optional[typing.Any],
|
|
179
183
|
parse_obj_as(
|
|
180
184
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
181
185
|
object_=_response.json(),
|
|
182
186
|
),
|
|
183
|
-
)
|
|
187
|
+
),
|
|
184
188
|
)
|
|
185
189
|
if _response.status_code == 500:
|
|
186
190
|
raise InternalServerError(
|
|
187
|
-
|
|
191
|
+
headers=dict(_response.headers),
|
|
192
|
+
body=typing.cast(
|
|
188
193
|
typing.Optional[typing.Any],
|
|
189
194
|
parse_obj_as(
|
|
190
195
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
191
196
|
object_=_response.json(),
|
|
192
197
|
),
|
|
193
|
-
)
|
|
198
|
+
),
|
|
194
199
|
)
|
|
195
200
|
_response_json = _response.json()
|
|
196
201
|
except JSONDecodeError:
|
|
197
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
198
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
202
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
203
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
199
204
|
|
|
200
205
|
|
|
201
206
|
class AsyncRawChatClient:
|
|
@@ -280,6 +285,7 @@ class AsyncRawChatClient:
|
|
|
280
285
|
"""
|
|
281
286
|
_response = await self._client_wrapper.httpx_client.request(
|
|
282
287
|
"v1/chat/completions",
|
|
288
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
283
289
|
method="POST",
|
|
284
290
|
json={
|
|
285
291
|
"messages": convert_and_respect_annotation_metadata(
|
|
@@ -318,55 +324,60 @@ class AsyncRawChatClient:
|
|
|
318
324
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
319
325
|
if _response.status_code == 400:
|
|
320
326
|
raise BadRequestError(
|
|
321
|
-
|
|
327
|
+
headers=dict(_response.headers),
|
|
328
|
+
body=typing.cast(
|
|
322
329
|
typing.Optional[typing.Any],
|
|
323
330
|
parse_obj_as(
|
|
324
331
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
325
332
|
object_=_response.json(),
|
|
326
333
|
),
|
|
327
|
-
)
|
|
334
|
+
),
|
|
328
335
|
)
|
|
329
336
|
if _response.status_code == 403:
|
|
330
337
|
raise ForbiddenError(
|
|
331
|
-
|
|
338
|
+
headers=dict(_response.headers),
|
|
339
|
+
body=typing.cast(
|
|
332
340
|
typing.Optional[typing.Any],
|
|
333
341
|
parse_obj_as(
|
|
334
342
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
335
343
|
object_=_response.json(),
|
|
336
344
|
),
|
|
337
|
-
)
|
|
345
|
+
),
|
|
338
346
|
)
|
|
339
347
|
if _response.status_code == 422:
|
|
340
348
|
raise UnprocessableEntityError(
|
|
341
|
-
|
|
349
|
+
headers=dict(_response.headers),
|
|
350
|
+
body=typing.cast(
|
|
342
351
|
typing.Optional[typing.Any],
|
|
343
352
|
parse_obj_as(
|
|
344
353
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
345
354
|
object_=_response.json(),
|
|
346
355
|
),
|
|
347
|
-
)
|
|
356
|
+
),
|
|
348
357
|
)
|
|
349
358
|
if _response.status_code == 429:
|
|
350
359
|
raise TooManyRequestsError(
|
|
351
|
-
|
|
360
|
+
headers=dict(_response.headers),
|
|
361
|
+
body=typing.cast(
|
|
352
362
|
typing.Optional[typing.Any],
|
|
353
363
|
parse_obj_as(
|
|
354
364
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
355
365
|
object_=_response.json(),
|
|
356
366
|
),
|
|
357
|
-
)
|
|
367
|
+
),
|
|
358
368
|
)
|
|
359
369
|
if _response.status_code == 500:
|
|
360
370
|
raise InternalServerError(
|
|
361
|
-
|
|
371
|
+
headers=dict(_response.headers),
|
|
372
|
+
body=typing.cast(
|
|
362
373
|
typing.Optional[typing.Any],
|
|
363
374
|
parse_obj_as(
|
|
364
375
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
365
376
|
object_=_response.json(),
|
|
366
377
|
),
|
|
367
|
-
)
|
|
378
|
+
),
|
|
368
379
|
)
|
|
369
380
|
_response_json = _response.json()
|
|
370
381
|
except JSONDecodeError:
|
|
371
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
372
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
382
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
383
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
|
-
from .environment import SarvamAIEnvironment
|
|
5
3
|
import os
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
6
|
import httpx
|
|
7
|
+
from .chat.client import AsyncChatClient, ChatClient
|
|
7
8
|
from .core.api_error import ApiError
|
|
8
|
-
from .core.client_wrapper import SyncClientWrapper
|
|
9
|
-
from .
|
|
10
|
-
from .speech_to_text.client import SpeechToTextClient
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
from .text.client import AsyncTextClient
|
|
15
|
-
from .speech_to_text.client import AsyncSpeechToTextClient
|
|
16
|
-
from .text_to_speech.client import AsyncTextToSpeechClient
|
|
17
|
-
from .chat.client import AsyncChatClient
|
|
9
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
10
|
+
from .environment import SarvamAIEnvironment
|
|
11
|
+
from .speech_to_text.client import AsyncSpeechToTextClient, SpeechToTextClient
|
|
12
|
+
from .speech_to_text_streaming.client import AsyncSpeechToTextStreamingClient, SpeechToTextStreamingClient
|
|
13
|
+
from .text.client import AsyncTextClient, TextClient
|
|
14
|
+
from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient
|
|
18
15
|
|
|
19
16
|
|
|
20
17
|
class SarvamAI:
|
|
@@ -23,9 +20,6 @@ class SarvamAI:
|
|
|
23
20
|
|
|
24
21
|
Parameters
|
|
25
22
|
----------
|
|
26
|
-
base_url : typing.Optional[str]
|
|
27
|
-
The base url to use for requests from the client.
|
|
28
|
-
|
|
29
23
|
environment : SarvamAIEnvironment
|
|
30
24
|
The environment to use for requests from the client. from .environment import SarvamAIEnvironment
|
|
31
25
|
|
|
@@ -57,7 +51,6 @@ class SarvamAI:
|
|
|
57
51
|
def __init__(
|
|
58
52
|
self,
|
|
59
53
|
*,
|
|
60
|
-
base_url: typing.Optional[str] = None,
|
|
61
54
|
environment: SarvamAIEnvironment = SarvamAIEnvironment.PRODUCTION,
|
|
62
55
|
api_subscription_key: typing.Optional[str] = os.getenv("SARVAM_API_KEY"),
|
|
63
56
|
timeout: typing.Optional[float] = None,
|
|
@@ -72,7 +65,7 @@ class SarvamAI:
|
|
|
72
65
|
body="The client must be instantiated be either passing in api_subscription_key or setting SARVAM_API_KEY"
|
|
73
66
|
)
|
|
74
67
|
self._client_wrapper = SyncClientWrapper(
|
|
75
|
-
|
|
68
|
+
environment=environment,
|
|
76
69
|
api_subscription_key=api_subscription_key,
|
|
77
70
|
httpx_client=httpx_client
|
|
78
71
|
if httpx_client is not None
|
|
@@ -85,6 +78,7 @@ class SarvamAI:
|
|
|
85
78
|
self.speech_to_text = SpeechToTextClient(client_wrapper=self._client_wrapper)
|
|
86
79
|
self.text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
87
80
|
self.chat = ChatClient(client_wrapper=self._client_wrapper)
|
|
81
|
+
self.speech_to_text_streaming = SpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
88
82
|
|
|
89
83
|
|
|
90
84
|
class AsyncSarvamAI:
|
|
@@ -93,9 +87,6 @@ class AsyncSarvamAI:
|
|
|
93
87
|
|
|
94
88
|
Parameters
|
|
95
89
|
----------
|
|
96
|
-
base_url : typing.Optional[str]
|
|
97
|
-
The base url to use for requests from the client.
|
|
98
|
-
|
|
99
90
|
environment : SarvamAIEnvironment
|
|
100
91
|
The environment to use for requests from the client. from .environment import SarvamAIEnvironment
|
|
101
92
|
|
|
@@ -127,7 +118,6 @@ class AsyncSarvamAI:
|
|
|
127
118
|
def __init__(
|
|
128
119
|
self,
|
|
129
120
|
*,
|
|
130
|
-
base_url: typing.Optional[str] = None,
|
|
131
121
|
environment: SarvamAIEnvironment = SarvamAIEnvironment.PRODUCTION,
|
|
132
122
|
api_subscription_key: typing.Optional[str] = os.getenv("SARVAM_API_KEY"),
|
|
133
123
|
timeout: typing.Optional[float] = None,
|
|
@@ -142,7 +132,7 @@ class AsyncSarvamAI:
|
|
|
142
132
|
body="The client must be instantiated be either passing in api_subscription_key or setting SARVAM_API_KEY"
|
|
143
133
|
)
|
|
144
134
|
self._client_wrapper = AsyncClientWrapper(
|
|
145
|
-
|
|
135
|
+
environment=environment,
|
|
146
136
|
api_subscription_key=api_subscription_key,
|
|
147
137
|
httpx_client=httpx_client
|
|
148
138
|
if httpx_client is not None
|
|
@@ -155,12 +145,4 @@ class AsyncSarvamAI:
|
|
|
155
145
|
self.speech_to_text = AsyncSpeechToTextClient(client_wrapper=self._client_wrapper)
|
|
156
146
|
self.text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
157
147
|
self.chat = AsyncChatClient(client_wrapper=self._client_wrapper)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SarvamAIEnvironment) -> str:
|
|
161
|
-
if base_url is not None:
|
|
162
|
-
return base_url
|
|
163
|
-
elif environment is not None:
|
|
164
|
-
return environment.value
|
|
165
|
-
else:
|
|
166
|
-
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
148
|
+
self.speech_to_text_streaming = AsyncSpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
3
5
|
from .api_error import ApiError
|
|
4
6
|
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
|
5
7
|
from .datetime_utils import serialize_datetime
|
|
8
|
+
from .events import EventEmitterMixin, EventType
|
|
6
9
|
from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
|
|
7
10
|
from .http_client import AsyncHttpClient, HttpClient
|
|
8
11
|
from .http_response import AsyncHttpResponse, HttpResponse
|
|
@@ -27,6 +30,8 @@ __all__ = [
|
|
|
27
30
|
"AsyncHttpClient",
|
|
28
31
|
"AsyncHttpResponse",
|
|
29
32
|
"BaseClientWrapper",
|
|
33
|
+
"EventEmitterMixin",
|
|
34
|
+
"EventType",
|
|
30
35
|
"FieldMetadata",
|
|
31
36
|
"File",
|
|
32
37
|
"HttpClient",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiError(Exception):
|
|
7
|
+
headers: Optional[Dict[str, str]]
|
|
8
|
+
status_code: Optional[int]
|
|
9
|
+
body: Any
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
headers: Optional[Dict[str, str]] = None,
|
|
15
|
+
status_code: Optional[int] = None,
|
|
16
|
+
body: Any = None,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.headers = headers
|
|
19
|
+
self.status_code = status_code
|
|
20
|
+
self.body = body
|
|
21
|
+
|
|
22
|
+
def __str__(self) -> str:
|
|
23
|
+
return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"
|