avartha-python-sdk 0.0.4__py3-none-any.whl → 0.0.5__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.
- avartha/_config.py +25 -10
- avartha/client.py +12 -0
- avartha/elevenlabs.py +1 -0
- avartha/openai.py +1 -0
- avartha/types/realtime/realtime_reasoning_effort.py +3 -1
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/METADATA +6 -5
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/RECORD +11 -11
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/WHEEL +0 -0
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/licenses/LICENSE +0 -0
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/licenses/THIRD_PARTY_NOTICES +0 -0
- {avartha_python_sdk-0.0.4.dist-info → avartha_python_sdk-0.0.5.dist-info}/top_level.txt +0 -0
avartha/_config.py
CHANGED
|
@@ -8,12 +8,28 @@ from urllib.parse import urlsplit, urlunsplit
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
-
Tier = Literal["serverless"
|
|
11
|
+
Tier = Literal["serverless"]
|
|
12
12
|
DEFAULT_BASE_URL = "https://platform.preview.avartha.ai"
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ConfigurationError(ValueError):
|
|
16
|
-
"""Missing credentials or an invalid service URL."""
|
|
16
|
+
"""Missing credentials, an unsupported tier, or an invalid service URL."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def validate_tier(tier: Tier) -> None:
|
|
20
|
+
if tier != "serverless":
|
|
21
|
+
raise ConfigurationError(
|
|
22
|
+
"Only tier='serverless' is supported. Dedicated capacity is unavailable."
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def reject_dedicated_url(value: str) -> str:
|
|
27
|
+
"""Reject the dedicated inference route, including behind a proxy prefix."""
|
|
28
|
+
if re.search(r"(?:^|/)inference/dedicated(?:/|$)", httpx.URL(value).path):
|
|
29
|
+
raise ConfigurationError(
|
|
30
|
+
"Dedicated capacity is unavailable. Use a serverless inference URL."
|
|
31
|
+
)
|
|
32
|
+
return value
|
|
17
33
|
|
|
18
34
|
|
|
19
35
|
def api_key(value: str | None) -> str:
|
|
@@ -41,12 +57,13 @@ def http_url(value: str) -> str:
|
|
|
41
57
|
or (parts.port is not None and not 1 <= parts.port <= 65535)
|
|
42
58
|
):
|
|
43
59
|
raise ValueError("Invalid URL authority")
|
|
44
|
-
|
|
60
|
+
normalized = str(httpx.URL(value)).rstrip("/")
|
|
45
61
|
except (ValueError, httpx.InvalidURL):
|
|
46
62
|
raise ConfigurationError(
|
|
47
63
|
"Use an absolute http(s) base URL without credentials, query, fragment, "
|
|
48
64
|
"whitespace, or backslashes."
|
|
49
65
|
) from None
|
|
66
|
+
return reject_dedicated_url(normalized)
|
|
50
67
|
|
|
51
68
|
|
|
52
69
|
def platform_url(value: str | None = None) -> str:
|
|
@@ -60,20 +77,18 @@ def platform_url(value: str | None = None) -> str:
|
|
|
60
77
|
|
|
61
78
|
|
|
62
79
|
def openai_url(root: str | None = None, tier: Tier = "serverless") -> str:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return f"{platform_url(root)}/inference/{tier}/openai/v1"
|
|
80
|
+
validate_tier(tier)
|
|
81
|
+
return f"{platform_url(root)}/inference/serverless/openai/v1"
|
|
66
82
|
|
|
67
83
|
|
|
68
84
|
def elevenlabs_url(
|
|
69
85
|
value: str | None = None, *, root: str | None = None, tier: Tier = "serverless"
|
|
70
86
|
) -> str:
|
|
87
|
+
validate_tier(tier)
|
|
71
88
|
override = value if value is not None else os.getenv("AVARTHA_ELEVENLABS_BASE_URL")
|
|
72
89
|
if override is not None:
|
|
73
90
|
return http_url(override)
|
|
74
|
-
|
|
75
|
-
raise ConfigurationError("tier must be 'serverless' or 'dedicated'.")
|
|
76
|
-
return f"{platform_url(root)}/inference/{tier}/elevenlabs"
|
|
91
|
+
return f"{platform_url(root)}/inference/serverless/elevenlabs"
|
|
77
92
|
|
|
78
93
|
|
|
79
94
|
def websocket_url(value: str) -> str:
|
|
@@ -147,4 +162,4 @@ def websocket_override(value: str) -> str:
|
|
|
147
162
|
"websocket_base_url must be the service base before /realtime; "
|
|
148
163
|
"the SDK appends /realtime when connecting."
|
|
149
164
|
)
|
|
150
|
-
return not_vendor_host(normalized, field="websocket_base_url")
|
|
165
|
+
return not_vendor_host(reject_dedicated_url(normalized), field="websocket_base_url")
|
avartha/client.py
CHANGED
|
@@ -16,6 +16,12 @@ class Avartha:
|
|
|
16
16
|
|
|
17
17
|
openai_options, elevenlabs_options and control_options are forwarded to
|
|
18
18
|
their respective constructors (for timeouts, transports, retry settings).
|
|
19
|
+
|
|
20
|
+
Live STT through elevenlabs.speech_to_text.realtime remains asynchronous.
|
|
21
|
+
Await connect(), send(), commit(), and the transcription connection's close().
|
|
22
|
+
Register callbacks with on() without awaiting. Use AsyncAvartha for an async
|
|
23
|
+
application.
|
|
24
|
+
Close live sessions separately before closing this client.
|
|
19
25
|
"""
|
|
20
26
|
|
|
21
27
|
def __init__(
|
|
@@ -30,6 +36,9 @@ class Avartha:
|
|
|
30
36
|
elevenlabs_options: dict[str, Any] | None = None,
|
|
31
37
|
control_options: dict[str, Any] | None = None,
|
|
32
38
|
) -> None:
|
|
39
|
+
_config.validate_tier(tier)
|
|
40
|
+
for options in (openai_options, elevenlabs_options):
|
|
41
|
+
_config.validate_tier((options or {}).get("tier", "serverless"))
|
|
33
42
|
key, root = _config.api_key(api_key), _config.platform_url(base_url)
|
|
34
43
|
self._elevenlabs_base_url = _config.elevenlabs_url(
|
|
35
44
|
elevenlabs_base_url, root=root, tier=tier
|
|
@@ -99,6 +108,9 @@ class AsyncAvartha:
|
|
|
99
108
|
elevenlabs_options: dict[str, Any] | None = None,
|
|
100
109
|
control_options: dict[str, Any] | None = None,
|
|
101
110
|
) -> None:
|
|
111
|
+
_config.validate_tier(tier)
|
|
112
|
+
for options in (openai_options, elevenlabs_options):
|
|
113
|
+
_config.validate_tier((options or {}).get("tier", "serverless"))
|
|
102
114
|
key, root = _config.api_key(api_key), _config.platform_url(base_url)
|
|
103
115
|
self._elevenlabs_base_url = _config.elevenlabs_url(
|
|
104
116
|
elevenlabs_base_url, root=root, tier=tier
|
avartha/elevenlabs.py
CHANGED
|
@@ -45,6 +45,7 @@ class _Client:
|
|
|
45
45
|
environment: str | Enum | None = None,
|
|
46
46
|
websocket_limits: WebSocketLimits | None = None,
|
|
47
47
|
) -> None:
|
|
48
|
+
_config.validate_tier(tier)
|
|
48
49
|
self.api_key = _config.api_key(api_key)
|
|
49
50
|
if base_url is None and environment is not None:
|
|
50
51
|
base_url = str(environment.value) if isinstance(environment, Enum) else environment
|
avartha/openai.py
CHANGED
|
@@ -121,6 +121,7 @@ class _Client:
|
|
|
121
121
|
_enforce_credentials: bool = True,
|
|
122
122
|
tier: Tier = "serverless",
|
|
123
123
|
) -> None:
|
|
124
|
+
_config.validate_tier(tier)
|
|
124
125
|
if data_residency is not None:
|
|
125
126
|
raise ConfigurationError(
|
|
126
127
|
"data_residency selects a vendor host; use an Avartha base_url."
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
from typing import Literal, TypeAlias
|
|
4
4
|
|
|
5
5
|
__all__ = ["RealtimeReasoningEffort"]
|
|
6
|
-
RealtimeReasoningEffort: TypeAlias = Literal[
|
|
6
|
+
RealtimeReasoningEffort: TypeAlias = Literal[
|
|
7
|
+
"none", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
8
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: avartha-python-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Python clients for Avartha Realtime text, streaming speech, and platform management
|
|
5
5
|
Author-email: "Avartha Inc." <team@avartha.ai>
|
|
6
6
|
License-Expression: LicenseRef-Avartha-Proprietary
|
|
@@ -47,9 +47,10 @@ export AVARTHA_API_KEY='avk_...'
|
|
|
47
47
|
export AVARTHA_BASE_URL='https://platform.preview.avartha.ai'
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Clients default to the preview platform and
|
|
51
|
-
`AVARTHA_BASE_URL` for another environment
|
|
52
|
-
|
|
50
|
+
Clients default to the preview platform and support only serverless inference.
|
|
51
|
+
Set `AVARTHA_BASE_URL` for another environment. Use model and voice IDs available
|
|
52
|
+
to your workspace. Unsupported tier values and dedicated inference URLs raise
|
|
53
|
+
`ConfigurationError` locally before any request.
|
|
53
54
|
|
|
54
55
|
## Discover models
|
|
55
56
|
|
|
@@ -107,7 +108,7 @@ Inference consumes credits.
|
|
|
107
108
|
| Multi-context TTS | `ElevenLabs` / `AsyncElevenLabs`: `text_to_speech.connect_multi_context` |
|
|
108
109
|
| Realtime ASR | `await client.speech_to_text.realtime.connect(...)` on either speech client |
|
|
109
110
|
| Speech discovery | Speech clients: models, voices, voice settings, ASR languages |
|
|
110
|
-
| Workspaces, members, invitations
|
|
111
|
+
| Workspaces, members, invitations | `Control` / `AsyncControl` |
|
|
111
112
|
| Combined inference and management | `Avartha` / `AsyncAvartha` |
|
|
112
113
|
|
|
113
114
|
Managed inference uses WebSockets; Chat Completions, Responses, HTTP TTS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
avartha/__init__.py,sha256=fusR2DiiRSAaZCIhLrxRdyJWjA8p9uL4PAVGXbArjXM,2821
|
|
2
|
-
avartha/_config.py,sha256=
|
|
2
|
+
avartha/_config.py,sha256=mzaHiqYH_7N4okLijiRbJlCNyxvZn4Ni_A_OAZDtOTA,6314
|
|
3
3
|
avartha/_exceptions.py,sha256=_QY7SEw2nqyOz3pNxDWi40GW1xqB3EZxJ0t4iJ-YBpQ,1588
|
|
4
4
|
avartha/_http_errors.py,sha256=gU8eapqYcI7Q3M8lAxwVH-qwz-TnQf2loBThFKG0ka8,406
|
|
5
5
|
avartha/_models.py,sha256=KB4PeFvktbSOKbT-qMX5tjsExEg9cwufZ3ourx8GcVI,7331
|
|
@@ -17,11 +17,11 @@ avartha/_speech_resources.py,sha256=61DKhTnz_bpOTjY_CpeR0mXs9ui9-XeaYgpSDNk_NpE,
|
|
|
17
17
|
avartha/_unsupported.py,sha256=qrbsxi2SL6co5M2uLs4fTVOoISuUm58khoayeL22gPE,637
|
|
18
18
|
avartha/_websocket.py,sha256=9R05huh1n8spuyg1n_aIJN0Uk_kLG7BbNPD88wogIKY,855
|
|
19
19
|
avartha/_ws_state.py,sha256=Im2W-UJtCBimYU5vlYBbVRL06DGwuw0Q5ufy4sSGIeM,5049
|
|
20
|
-
avartha/client.py,sha256=
|
|
20
|
+
avartha/client.py,sha256=vNZmmWWdGhSxdwb-lqBbioP4DK4MpoUgFWLJfqR5zxo,5677
|
|
21
21
|
avartha/control.py,sha256=jB7I4ccDBaVh2OMLZXhEeAsGNparMLURZQXnh-I__ss,23894
|
|
22
|
-
avartha/elevenlabs.py,sha256=
|
|
22
|
+
avartha/elevenlabs.py,sha256=tFugwzE8XKbQZsK7P6w6fGXGz76Udp5vt039uVwzOi8,5462
|
|
23
23
|
avartha/errors.py,sha256=8HMwf2P4VXwk4tRC5ZwceVOUFkRD0wEu9Bn1gljIj0Y,1333
|
|
24
|
-
avartha/openai.py,sha256=
|
|
24
|
+
avartha/openai.py,sha256=9xlmNdx0E2HWYUf5tEI1UbS82y7XerY1T76Jx7sQv18,11955
|
|
25
25
|
avartha/pagination.py,sha256=_5qt1bAPKQiXjrHcD0J93yNpBKBhbTRzZfnL9WCUwMw,1471
|
|
26
26
|
avartha/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
avartha/conversational_ai/__init__.py,sha256=Pc7h5OczniKnF54UvMYVILdU-pCXyZ9YnxtzggBc294,217
|
|
@@ -122,7 +122,7 @@ avartha/types/realtime/realtime_mcp_tool_execution_error_param.py,sha256=ESoZmAb
|
|
|
122
122
|
avartha/types/realtime/realtime_mcphttp_error.py,sha256=LsYLVdqDZ4jUGvlUTpSdKAdgad73-0ls2tk4Z6M5nX8,269
|
|
123
123
|
avartha/types/realtime/realtime_mcphttp_error_param.py,sha256=X1dGkZnFu8MQqQU78gvOLPHIWR0L7ZJKG_x7hb1zCPQ,370
|
|
124
124
|
avartha/types/realtime/realtime_reasoning.py,sha256=5v3tvYRDDjnJTpT0amG9jLd1dxV2Qy7mAenDnhmDhTc,307
|
|
125
|
-
avartha/types/realtime/realtime_reasoning_effort.py,sha256=
|
|
125
|
+
avartha/types/realtime/realtime_reasoning_effort.py,sha256=LFk2Oyv60GonPWfBI7FM0MFrnTCviZWNWPey6aYcRK8,251
|
|
126
126
|
avartha/types/realtime/realtime_reasoning_param.py,sha256=YIMK-W-iZq3-PqBQFw8nYC4dIrhDbQJtkRqjvmZuwY8,355
|
|
127
127
|
avartha/types/realtime/realtime_response.py,sha256=mCQWWODuBHpEjQfWevtJ8BZ7lYmWxhhc415hWrMjGl8,1493
|
|
128
128
|
avartha/types/realtime/realtime_response_create_audio_output.py,sha256=h7Y4MqXEViQdliq81eLn601kGEnxam5ZCaPWNeO4VHU,741
|
|
@@ -248,9 +248,9 @@ avartha/types/speech/voice_sharing_response.py,sha256=KRO9Rq80wTYV5of2bRrFTVJSDf
|
|
|
248
248
|
avartha/types/speech/voice_sharing_response_category.py,sha256=0yFm6b7R4piHdNTdBWTQYKpNPxW8r2HJvnMdVpT7s5U,241
|
|
249
249
|
avartha/types/speech/voice_sharing_state.py,sha256=8EBRbrRaDhUEap39kDXmt54AYeG172fnuBmRV1TSHP4,201
|
|
250
250
|
avartha/types/speech/voice_verification_response.py,sha256=IL_Z1OTIiR9mvuaWzF9-GsL7pMRZ5fJeV_W3FfjLTTY,770
|
|
251
|
-
avartha_python_sdk-0.0.
|
|
252
|
-
avartha_python_sdk-0.0.
|
|
253
|
-
avartha_python_sdk-0.0.
|
|
254
|
-
avartha_python_sdk-0.0.
|
|
255
|
-
avartha_python_sdk-0.0.
|
|
256
|
-
avartha_python_sdk-0.0.
|
|
251
|
+
avartha_python_sdk-0.0.5.dist-info/licenses/LICENSE,sha256=1ulXrK7aq7kBXX1scK6IiOgnbwqpmK6kWIB3CYznVG8,1135
|
|
252
|
+
avartha_python_sdk-0.0.5.dist-info/licenses/THIRD_PARTY_NOTICES,sha256=R62M0553miTc6E42IVFLUIYkLFim_mf_Abq1lty0IaQ,13081
|
|
253
|
+
avartha_python_sdk-0.0.5.dist-info/METADATA,sha256=H30kDxD_ubuCN9uf6E0sH4jhxeQlFK2g1EHcur57C7o,5633
|
|
254
|
+
avartha_python_sdk-0.0.5.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
255
|
+
avartha_python_sdk-0.0.5.dist-info/top_level.txt,sha256=cj2kDXl33tO2IPWPduSTukcwozPnYKOsVUVE9QZRUr0,8
|
|
256
|
+
avartha_python_sdk-0.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|