sarvamai 0.1.5a1__tar.gz → 0.1.5a3__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.5a3/PKG-INFO +27 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/pyproject.toml +24 -4
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/chat/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/chat/client.py +9 -22
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/chat/raw_client.py +46 -47
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/client.py +8 -12
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/__init__.py +2 -0
- sarvamai-0.1.5a3/src/sarvamai/core/api_error.py +23 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/client_wrapper.py +5 -5
- sarvamai-0.1.5a3/src/sarvamai/core/force_multipart.py +16 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/http_client.py +70 -24
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/http_response.py +19 -11
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/pydantic_utilities.py +69 -108
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/errors/__init__.py +2 -0
- sarvamai-0.1.5a3/src/sarvamai/errors/bad_request_error.py +10 -0
- sarvamai-0.1.5a3/src/sarvamai/errors/forbidden_error.py +10 -0
- sarvamai-0.1.5a3/src/sarvamai/errors/internal_server_error.py +10 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/errors/service_unavailable_error.py +4 -2
- sarvamai-0.1.5a3/src/sarvamai/errors/too_many_requests_error.py +10 -0
- sarvamai-0.1.5a3/src/sarvamai/errors/unprocessable_entity_error.py +10 -0
- sarvamai-0.1.5a3/src/sarvamai/py.typed +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/chat_completion_request_message.py +3 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/create_chat_completion_response.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/diarized_transcript.py +2 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/error_details.py +0 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/language_identification_response.py +0 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/speech_to_text_response.py +1 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/speech_to_text_translate_response.py +0 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/text_to_speech_response.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/timestamps_model.py +2 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/translation_response.py +0 -1
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/transliteration_response.py +0 -1
- {sarvamai-0.1.5a1/src/sarvamai/text_to_speech → sarvamai-0.1.5a3/src/sarvamai/speech_to_text}/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/speech_to_text/client.py +13 -14
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/speech_to_text/raw_client.py +95 -68
- {sarvamai-0.1.5a1/src/sarvamai/speech_to_text → sarvamai-0.1.5a3/src/sarvamai/text}/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/text/client.py +23 -24
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/text/raw_client.py +120 -91
- {sarvamai-0.1.5a1/src/sarvamai/text → sarvamai-0.1.5a3/src/sarvamai/text_to_speech}/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/text_to_speech/client.py +10 -11
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/text_to_speech/raw_client.py +47 -38
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/__init__.py +2 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/chat_completion_request_assistant_message.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/chat_completion_request_message.py +3 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/chat_completion_request_system_message.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/chat_completion_request_user_message.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/chat_completion_response_message.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/choice.py +4 -4
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/completion_usage.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/create_chat_completion_response.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/diarized_entry.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/diarized_transcript.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/error_details.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/error_message.py +4 -4
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/language_identification_response.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_response.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_translate_response.py +3 -3
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/text_to_speech_response.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/timestamps_model.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translation_response.py +2 -2
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/transliteration_response.py +2 -2
- sarvamai-0.1.5a1/PKG-INFO +0 -174
- sarvamai-0.1.5a1/README.md +0 -147
- sarvamai-0.1.5a1/src/sarvamai/core/api_error.py +0 -15
- sarvamai-0.1.5a1/src/sarvamai/errors/bad_request_error.py +0 -9
- sarvamai-0.1.5a1/src/sarvamai/errors/forbidden_error.py +0 -9
- sarvamai-0.1.5a1/src/sarvamai/errors/internal_server_error.py +0 -9
- sarvamai-0.1.5a1/src/sarvamai/errors/too_many_requests_error.py +0 -9
- sarvamai-0.1.5a1/src/sarvamai/errors/unprocessable_entity_error.py +0 -9
- /sarvamai-0.1.5a1/src/sarvamai/py.typed → /sarvamai-0.1.5a3/README.md +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/datetime_utils.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/events.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/file.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/jsonable_encoder.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/query_encoder.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/remove_none_from_dict.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/request_options.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/core/serialization.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/environment.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/play.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/choice.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/completion_usage.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/diarized_entry.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/error_message.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/requests/stop_configuration.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/error_code.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/finish_reason.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/numerals_format.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/reasoning_effort.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/role.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/sarvam_model_ids.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_sample_rate.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_model.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_translate_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/speech_to_text_translate_model.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/spoken_form_numerals_format.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/stop_configuration.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/text_to_speech_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/text_to_speech_model.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/text_to_speech_speaker.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_mode.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_model.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_postprocessing.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_source_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_speaker_gender.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translate_target_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/translatiterate_target_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/types/transliterate_source_language.py +0 -0
- {sarvamai-0.1.5a1 → sarvamai-0.1.5a3}/src/sarvamai/version.py +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sarvamai
|
|
3
|
+
Version: 0.1.5a3
|
|
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
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
|
|
@@ -3,7 +3,7 @@ name = "sarvamai"
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "sarvamai"
|
|
6
|
-
version = "0.1.
|
|
6
|
+
version = "0.1.5a3"
|
|
7
7
|
description = ""
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
authors = []
|
|
@@ -40,13 +40,13 @@ pydantic = ">= 1.9.2"
|
|
|
40
40
|
pydantic-core = "^2.18.2"
|
|
41
41
|
typing_extensions = ">= 4.0.0"
|
|
42
42
|
|
|
43
|
-
[tool.poetry.dev
|
|
44
|
-
mypy = "1.0
|
|
43
|
+
[tool.poetry.group.dev.dependencies]
|
|
44
|
+
mypy = "==1.13.0"
|
|
45
45
|
pytest = "^7.4.0"
|
|
46
46
|
pytest-asyncio = "^0.23.5"
|
|
47
47
|
python-dateutil = "^2.9.0"
|
|
48
48
|
types-python-dateutil = "^2.9.0.20240316"
|
|
49
|
-
ruff = "
|
|
49
|
+
ruff = "==0.11.5"
|
|
50
50
|
|
|
51
51
|
[tool.pytest.ini_options]
|
|
52
52
|
testpaths = [ "tests" ]
|
|
@@ -58,6 +58,26 @@ plugins = ["pydantic.mypy"]
|
|
|
58
58
|
[tool.ruff]
|
|
59
59
|
line-length = 120
|
|
60
60
|
|
|
61
|
+
[tool.ruff.lint]
|
|
62
|
+
select = [
|
|
63
|
+
"E", # pycodestyle errors
|
|
64
|
+
"F", # pyflakes
|
|
65
|
+
"I", # isort
|
|
66
|
+
]
|
|
67
|
+
ignore = [
|
|
68
|
+
"E402", # Module level import not at top of file
|
|
69
|
+
"E501", # Line too long
|
|
70
|
+
"E711", # Comparison to `None` should be `cond is not None`
|
|
71
|
+
"E712", # Avoid equality comparisons to `True`; use `if ...:` checks
|
|
72
|
+
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
|
|
73
|
+
"E722", # Do not use bare `except`
|
|
74
|
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
|
75
|
+
"F821", # Undefined name
|
|
76
|
+
"F841" # Local variable ... is assigned to but never used
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint.isort]
|
|
80
|
+
section-order = ["future", "standard-library", "third-party", "first-party"]
|
|
61
81
|
|
|
62
82
|
[build-system]
|
|
63
83
|
requires = ["poetry-core"]
|
|
@@ -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, ...)
|
|
@@ -33,7 +32,6 @@ class ChatClient:
|
|
|
33
32
|
def completions(
|
|
34
33
|
self,
|
|
35
34
|
*,
|
|
36
|
-
authorization: str,
|
|
37
35
|
messages: typing.Sequence[ChatCompletionRequestMessageParams],
|
|
38
36
|
temperature: typing.Optional[float] = OMIT,
|
|
39
37
|
top_p: typing.Optional[float] = OMIT,
|
|
@@ -53,9 +51,6 @@ class ChatClient:
|
|
|
53
51
|
|
|
54
52
|
Parameters
|
|
55
53
|
----------
|
|
56
|
-
authorization : str
|
|
57
|
-
Bearer token for authentication. Format: "Bearer <token>"
|
|
58
|
-
|
|
59
54
|
messages : typing.Sequence[ChatCompletionRequestMessageParams]
|
|
60
55
|
A list of messages comprising the conversation so far.
|
|
61
56
|
|
|
@@ -119,12 +114,10 @@ class ChatClient:
|
|
|
119
114
|
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
120
115
|
)
|
|
121
116
|
client.chat.completions(
|
|
122
|
-
authorization="Authorization",
|
|
123
117
|
messages=[{"content": "content", "role": "assistant"}],
|
|
124
118
|
)
|
|
125
119
|
"""
|
|
126
|
-
|
|
127
|
-
authorization=authorization,
|
|
120
|
+
_response = self._raw_client.completions(
|
|
128
121
|
messages=messages,
|
|
129
122
|
temperature=temperature,
|
|
130
123
|
top_p=top_p,
|
|
@@ -139,7 +132,7 @@ class ChatClient:
|
|
|
139
132
|
wiki_grounding=wiki_grounding,
|
|
140
133
|
request_options=request_options,
|
|
141
134
|
)
|
|
142
|
-
return
|
|
135
|
+
return _response.data
|
|
143
136
|
|
|
144
137
|
|
|
145
138
|
class AsyncChatClient:
|
|
@@ -160,7 +153,6 @@ class AsyncChatClient:
|
|
|
160
153
|
async def completions(
|
|
161
154
|
self,
|
|
162
155
|
*,
|
|
163
|
-
authorization: str,
|
|
164
156
|
messages: typing.Sequence[ChatCompletionRequestMessageParams],
|
|
165
157
|
temperature: typing.Optional[float] = OMIT,
|
|
166
158
|
top_p: typing.Optional[float] = OMIT,
|
|
@@ -180,9 +172,6 @@ class AsyncChatClient:
|
|
|
180
172
|
|
|
181
173
|
Parameters
|
|
182
174
|
----------
|
|
183
|
-
authorization : str
|
|
184
|
-
Bearer token for authentication. Format: "Bearer <token>"
|
|
185
|
-
|
|
186
175
|
messages : typing.Sequence[ChatCompletionRequestMessageParams]
|
|
187
176
|
A list of messages comprising the conversation so far.
|
|
188
177
|
|
|
@@ -251,15 +240,13 @@ class AsyncChatClient:
|
|
|
251
240
|
|
|
252
241
|
async def main() -> None:
|
|
253
242
|
await client.chat.completions(
|
|
254
|
-
authorization="Authorization",
|
|
255
243
|
messages=[{"content": "content", "role": "assistant"}],
|
|
256
244
|
)
|
|
257
245
|
|
|
258
246
|
|
|
259
247
|
asyncio.run(main())
|
|
260
248
|
"""
|
|
261
|
-
|
|
262
|
-
authorization=authorization,
|
|
249
|
+
_response = await self._raw_client.completions(
|
|
263
250
|
messages=messages,
|
|
264
251
|
temperature=temperature,
|
|
265
252
|
top_p=top_p,
|
|
@@ -274,4 +261,4 @@ class AsyncChatClient:
|
|
|
274
261
|
wiki_grounding=wiki_grounding,
|
|
275
262
|
request_options=request_options,
|
|
276
263
|
)
|
|
277
|
-
return
|
|
264
|
+
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, ...)
|
|
@@ -31,7 +30,6 @@ class RawChatClient:
|
|
|
31
30
|
def completions(
|
|
32
31
|
self,
|
|
33
32
|
*,
|
|
34
|
-
authorization: str,
|
|
35
33
|
messages: typing.Sequence[ChatCompletionRequestMessageParams],
|
|
36
34
|
temperature: typing.Optional[float] = OMIT,
|
|
37
35
|
top_p: typing.Optional[float] = OMIT,
|
|
@@ -51,9 +49,6 @@ class RawChatClient:
|
|
|
51
49
|
|
|
52
50
|
Parameters
|
|
53
51
|
----------
|
|
54
|
-
authorization : str
|
|
55
|
-
Bearer token for authentication. Format: "Bearer <token>"
|
|
56
|
-
|
|
57
52
|
messages : typing.Sequence[ChatCompletionRequestMessageParams]
|
|
58
53
|
A list of messages comprising the conversation so far.
|
|
59
54
|
|
|
@@ -134,7 +129,6 @@ class RawChatClient:
|
|
|
134
129
|
},
|
|
135
130
|
headers={
|
|
136
131
|
"content-type": "application/json",
|
|
137
|
-
"Authorization": str(authorization) if authorization is not None else None,
|
|
138
132
|
},
|
|
139
133
|
request_options=request_options,
|
|
140
134
|
omit=OMIT,
|
|
@@ -151,58 +145,63 @@ class RawChatClient:
|
|
|
151
145
|
return HttpResponse(response=_response, data=_data)
|
|
152
146
|
if _response.status_code == 400:
|
|
153
147
|
raise BadRequestError(
|
|
154
|
-
|
|
148
|
+
headers=dict(_response.headers),
|
|
149
|
+
body=typing.cast(
|
|
155
150
|
typing.Optional[typing.Any],
|
|
156
151
|
parse_obj_as(
|
|
157
152
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
158
153
|
object_=_response.json(),
|
|
159
154
|
),
|
|
160
|
-
)
|
|
155
|
+
),
|
|
161
156
|
)
|
|
162
157
|
if _response.status_code == 403:
|
|
163
158
|
raise ForbiddenError(
|
|
164
|
-
|
|
159
|
+
headers=dict(_response.headers),
|
|
160
|
+
body=typing.cast(
|
|
165
161
|
typing.Optional[typing.Any],
|
|
166
162
|
parse_obj_as(
|
|
167
163
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
168
164
|
object_=_response.json(),
|
|
169
165
|
),
|
|
170
|
-
)
|
|
166
|
+
),
|
|
171
167
|
)
|
|
172
168
|
if _response.status_code == 422:
|
|
173
169
|
raise UnprocessableEntityError(
|
|
174
|
-
|
|
170
|
+
headers=dict(_response.headers),
|
|
171
|
+
body=typing.cast(
|
|
175
172
|
typing.Optional[typing.Any],
|
|
176
173
|
parse_obj_as(
|
|
177
174
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
178
175
|
object_=_response.json(),
|
|
179
176
|
),
|
|
180
|
-
)
|
|
177
|
+
),
|
|
181
178
|
)
|
|
182
179
|
if _response.status_code == 429:
|
|
183
180
|
raise TooManyRequestsError(
|
|
184
|
-
|
|
181
|
+
headers=dict(_response.headers),
|
|
182
|
+
body=typing.cast(
|
|
185
183
|
typing.Optional[typing.Any],
|
|
186
184
|
parse_obj_as(
|
|
187
185
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
188
186
|
object_=_response.json(),
|
|
189
187
|
),
|
|
190
|
-
)
|
|
188
|
+
),
|
|
191
189
|
)
|
|
192
190
|
if _response.status_code == 500:
|
|
193
191
|
raise InternalServerError(
|
|
194
|
-
|
|
192
|
+
headers=dict(_response.headers),
|
|
193
|
+
body=typing.cast(
|
|
195
194
|
typing.Optional[typing.Any],
|
|
196
195
|
parse_obj_as(
|
|
197
196
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
198
197
|
object_=_response.json(),
|
|
199
198
|
),
|
|
200
|
-
)
|
|
199
|
+
),
|
|
201
200
|
)
|
|
202
201
|
_response_json = _response.json()
|
|
203
202
|
except JSONDecodeError:
|
|
204
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
205
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
203
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
204
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
206
205
|
|
|
207
206
|
|
|
208
207
|
class AsyncRawChatClient:
|
|
@@ -212,7 +211,6 @@ class AsyncRawChatClient:
|
|
|
212
211
|
async def completions(
|
|
213
212
|
self,
|
|
214
213
|
*,
|
|
215
|
-
authorization: str,
|
|
216
214
|
messages: typing.Sequence[ChatCompletionRequestMessageParams],
|
|
217
215
|
temperature: typing.Optional[float] = OMIT,
|
|
218
216
|
top_p: typing.Optional[float] = OMIT,
|
|
@@ -232,9 +230,6 @@ class AsyncRawChatClient:
|
|
|
232
230
|
|
|
233
231
|
Parameters
|
|
234
232
|
----------
|
|
235
|
-
authorization : str
|
|
236
|
-
Bearer token for authentication. Format: "Bearer <token>"
|
|
237
|
-
|
|
238
233
|
messages : typing.Sequence[ChatCompletionRequestMessageParams]
|
|
239
234
|
A list of messages comprising the conversation so far.
|
|
240
235
|
|
|
@@ -315,7 +310,6 @@ class AsyncRawChatClient:
|
|
|
315
310
|
},
|
|
316
311
|
headers={
|
|
317
312
|
"content-type": "application/json",
|
|
318
|
-
"Authorization": str(authorization) if authorization is not None else None,
|
|
319
313
|
},
|
|
320
314
|
request_options=request_options,
|
|
321
315
|
omit=OMIT,
|
|
@@ -332,55 +326,60 @@ class AsyncRawChatClient:
|
|
|
332
326
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
333
327
|
if _response.status_code == 400:
|
|
334
328
|
raise BadRequestError(
|
|
335
|
-
|
|
329
|
+
headers=dict(_response.headers),
|
|
330
|
+
body=typing.cast(
|
|
336
331
|
typing.Optional[typing.Any],
|
|
337
332
|
parse_obj_as(
|
|
338
333
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
339
334
|
object_=_response.json(),
|
|
340
335
|
),
|
|
341
|
-
)
|
|
336
|
+
),
|
|
342
337
|
)
|
|
343
338
|
if _response.status_code == 403:
|
|
344
339
|
raise ForbiddenError(
|
|
345
|
-
|
|
340
|
+
headers=dict(_response.headers),
|
|
341
|
+
body=typing.cast(
|
|
346
342
|
typing.Optional[typing.Any],
|
|
347
343
|
parse_obj_as(
|
|
348
344
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
349
345
|
object_=_response.json(),
|
|
350
346
|
),
|
|
351
|
-
)
|
|
347
|
+
),
|
|
352
348
|
)
|
|
353
349
|
if _response.status_code == 422:
|
|
354
350
|
raise UnprocessableEntityError(
|
|
355
|
-
|
|
351
|
+
headers=dict(_response.headers),
|
|
352
|
+
body=typing.cast(
|
|
356
353
|
typing.Optional[typing.Any],
|
|
357
354
|
parse_obj_as(
|
|
358
355
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
359
356
|
object_=_response.json(),
|
|
360
357
|
),
|
|
361
|
-
)
|
|
358
|
+
),
|
|
362
359
|
)
|
|
363
360
|
if _response.status_code == 429:
|
|
364
361
|
raise TooManyRequestsError(
|
|
365
|
-
|
|
362
|
+
headers=dict(_response.headers),
|
|
363
|
+
body=typing.cast(
|
|
366
364
|
typing.Optional[typing.Any],
|
|
367
365
|
parse_obj_as(
|
|
368
366
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
369
367
|
object_=_response.json(),
|
|
370
368
|
),
|
|
371
|
-
)
|
|
369
|
+
),
|
|
372
370
|
)
|
|
373
371
|
if _response.status_code == 500:
|
|
374
372
|
raise InternalServerError(
|
|
375
|
-
|
|
373
|
+
headers=dict(_response.headers),
|
|
374
|
+
body=typing.cast(
|
|
376
375
|
typing.Optional[typing.Any],
|
|
377
376
|
parse_obj_as(
|
|
378
377
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
379
378
|
object_=_response.json(),
|
|
380
379
|
),
|
|
381
|
-
)
|
|
380
|
+
),
|
|
382
381
|
)
|
|
383
382
|
_response_json = _response.json()
|
|
384
383
|
except JSONDecodeError:
|
|
385
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
386
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
384
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
385
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .environment import SarvamAIEnvironment
|
|
4
|
-
import typing
|
|
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 .core.client_wrapper import AsyncClientWrapper
|
|
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 .text.client import AsyncTextClient, TextClient
|
|
13
|
+
from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient
|
|
18
14
|
|
|
19
15
|
|
|
20
16
|
class SarvamAI:
|
|
@@ -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}"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..environment import SarvamAIEnvironment
|
|
4
3
|
import typing
|
|
4
|
+
|
|
5
5
|
import httpx
|
|
6
|
-
from
|
|
7
|
-
from .http_client import AsyncHttpClient
|
|
6
|
+
from ..environment import SarvamAIEnvironment
|
|
7
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class BaseClientWrapper:
|
|
@@ -17,10 +17,10 @@ class BaseClientWrapper:
|
|
|
17
17
|
|
|
18
18
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
19
19
|
headers: typing.Dict[str, str] = {
|
|
20
|
-
"User-Agent": "sarvamai/0.1.
|
|
20
|
+
"User-Agent": "sarvamai/0.1.5a3",
|
|
21
21
|
"X-Fern-Language": "Python",
|
|
22
22
|
"X-Fern-SDK-Name": "sarvamai",
|
|
23
|
-
"X-Fern-SDK-Version": "0.1.
|
|
23
|
+
"X-Fern-SDK-Version": "0.1.5a3",
|
|
24
24
|
}
|
|
25
25
|
headers["api-subscription-key"] = self.api_subscription_key
|
|
26
26
|
return headers
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ForceMultipartDict(dict):
|
|
5
|
+
"""
|
|
6
|
+
A dictionary subclass that always evaluates to True in boolean contexts.
|
|
7
|
+
|
|
8
|
+
This is used to force multipart/form-data encoding in HTTP requests even when
|
|
9
|
+
the dictionary is empty, which would normally evaluate to False.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __bool__(self):
|
|
13
|
+
return True
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
FORCE_MULTIPART = ForceMultipartDict()
|