Skip to content

Commit 03c289d

Browse files
committed
Release 0.8.1
1 parent 29a306d commit 03c289d

File tree

7 files changed

+202
-13
lines changed

7 files changed

+202
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "vapi_server_sdk"
33

44
[tool.poetry]
55
name = "vapi_server_sdk"
6-
version = "1.5.0"
6+
version = "0.8.1"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11
# Reference
2+
<details><summary><code>client.<a href="src/vapi/client.py">prometheus_controller_index</a>()</code></summary>
3+
<dl>
4+
<dd>
5+
6+
#### 🔌 Usage
7+
8+
<dl>
9+
<dd>
10+
11+
<dl>
12+
<dd>
13+
14+
```python
15+
from vapi import Vapi
16+
client = Vapi(token="YOUR_TOKEN", )
17+
client.prometheus_controller_index()
18+
19+
```
20+
</dd>
21+
</dl>
22+
</dd>
23+
</dl>
24+
25+
#### ⚙️ Parameters
26+
27+
<dl>
28+
<dd>
29+
30+
<dl>
31+
<dd>
32+
33+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
34+
35+
</dd>
36+
</dl>
37+
</dd>
38+
</dl>
39+
40+
41+
</dd>
42+
</dl>
43+
</details>
44+
245
## Calls
346
<details><summary><code>client.calls.<a href="src/vapi/calls/client.py">list</a>(...)</code></summary>
447
<dl>

src/vapi/client.py

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
from .assistants.client import AssistantsClient, AsyncAssistantsClient
88
from .calls.client import AsyncCallsClient, CallsClient
99
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10+
from .core.request_options import RequestOptions
1011
from .environment import VapiEnvironment
1112
from .files.client import AsyncFilesClient, FilesClient
1213
from .knowledge_bases.client import AsyncKnowledgeBasesClient, KnowledgeBasesClient
1314
from .logs.client import AsyncLogsClient, LogsClient
1415
from .phone_numbers.client import AsyncPhoneNumbersClient, PhoneNumbersClient
16+
from .raw_client import AsyncRawVapi, RawVapi
1517
from .squads.client import AsyncSquadsClient, SquadsClient
1618
from .test_suite_runs.client import AsyncTestSuiteRunsClient, TestSuiteRunsClient
1719
from .test_suite_tests.client import AsyncTestSuiteTestsClient, TestSuiteTestsClient
@@ -36,7 +38,7 @@ class Vapi:
3638
3739
3840
39-
token : typing.Union[str, typing.Callable[[], str]]
41+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
4042
timeout : typing.Optional[float]
4143
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
4244
@@ -57,7 +59,7 @@ def __init__(
5759
*,
5860
base_url: typing.Optional[str] = None,
5961
environment: VapiEnvironment = VapiEnvironment.DEFAULT,
60-
token: typing.Union[str, typing.Callable[[], str]],
62+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
6163
timeout: typing.Optional[float] = None,
6264
follow_redirects: typing.Optional[bool] = True,
6365
httpx_client: typing.Optional[httpx.Client] = None,
@@ -75,6 +77,7 @@ def __init__(
7577
else httpx.Client(timeout=_defaulted_timeout),
7678
timeout=_defaulted_timeout,
7779
)
80+
self._raw_client = RawVapi(client_wrapper=self._client_wrapper)
7881
self.calls = CallsClient(client_wrapper=self._client_wrapper)
7982
self.assistants = AssistantsClient(client_wrapper=self._client_wrapper)
8083
self.phone_numbers = PhoneNumbersClient(client_wrapper=self._client_wrapper)
@@ -89,6 +92,37 @@ def __init__(
8992
self.analytics = AnalyticsClient(client_wrapper=self._client_wrapper)
9093
self.logs = LogsClient(client_wrapper=self._client_wrapper)
9194

95+
@property
96+
def with_raw_response(self) -> RawVapi:
97+
"""
98+
Retrieves a raw implementation of this client that returns raw responses.
99+
100+
Returns
101+
-------
102+
RawVapi
103+
"""
104+
return self._raw_client
105+
106+
def prometheus_controller_index(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
107+
"""
108+
Parameters
109+
----------
110+
request_options : typing.Optional[RequestOptions]
111+
Request-specific configuration.
112+
113+
Returns
114+
-------
115+
None
116+
117+
Examples
118+
--------
119+
from vapi import Vapi
120+
client = Vapi(token="YOUR_TOKEN", )
121+
client.prometheus_controller_index()
122+
"""
123+
_response = self._raw_client.prometheus_controller_index(request_options=request_options)
124+
return _response.data
125+
92126

93127
class AsyncVapi:
94128
"""
@@ -106,7 +140,7 @@ class AsyncVapi:
106140
107141
108142
109-
token : typing.Union[str, typing.Callable[[], str]]
143+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
110144
timeout : typing.Optional[float]
111145
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
112146
@@ -127,7 +161,7 @@ def __init__(
127161
*,
128162
base_url: typing.Optional[str] = None,
129163
environment: VapiEnvironment = VapiEnvironment.DEFAULT,
130-
token: typing.Union[str, typing.Callable[[], str]],
164+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
131165
timeout: typing.Optional[float] = None,
132166
follow_redirects: typing.Optional[bool] = True,
133167
httpx_client: typing.Optional[httpx.AsyncClient] = None,
@@ -145,6 +179,7 @@ def __init__(
145179
else httpx.AsyncClient(timeout=_defaulted_timeout),
146180
timeout=_defaulted_timeout,
147181
)
182+
self._raw_client = AsyncRawVapi(client_wrapper=self._client_wrapper)
148183
self.calls = AsyncCallsClient(client_wrapper=self._client_wrapper)
149184
self.assistants = AsyncAssistantsClient(client_wrapper=self._client_wrapper)
150185
self.phone_numbers = AsyncPhoneNumbersClient(client_wrapper=self._client_wrapper)
@@ -159,6 +194,40 @@ def __init__(
159194
self.analytics = AsyncAnalyticsClient(client_wrapper=self._client_wrapper)
160195
self.logs = AsyncLogsClient(client_wrapper=self._client_wrapper)
161196

197+
@property
198+
def with_raw_response(self) -> AsyncRawVapi:
199+
"""
200+
Retrieves a raw implementation of this client that returns raw responses.
201+
202+
Returns
203+
-------
204+
AsyncRawVapi
205+
"""
206+
return self._raw_client
207+
208+
async def prometheus_controller_index(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
209+
"""
210+
Parameters
211+
----------
212+
request_options : typing.Optional[RequestOptions]
213+
Request-specific configuration.
214+
215+
Returns
216+
-------
217+
None
218+
219+
Examples
220+
--------
221+
from vapi import AsyncVapi
222+
import asyncio
223+
client = AsyncVapi(token="YOUR_TOKEN", )
224+
async def main() -> None:
225+
await client.prometheus_controller_index()
226+
asyncio.run(main())
227+
"""
228+
_response = await self._raw_client.prometheus_controller_index(request_options=request_options)
229+
return _response.data
230+
162231

163232
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: VapiEnvironment) -> str:
164233
if base_url is not None:

src/vapi/core/client_wrapper.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class BaseClientWrapper:
1010
def __init__(
1111
self,
1212
*,
13-
token: typing.Union[str, typing.Callable[[], str]],
13+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
1414
base_url: str,
1515
timeout: typing.Optional[float] = None,
1616
):
@@ -20,16 +20,18 @@ def __init__(
2020

2121
def get_headers(self) -> typing.Dict[str, str]:
2222
headers: typing.Dict[str, str] = {
23-
"User-Agent": "vapi_server_sdk/1.5.0",
23+
"User-Agent": "vapi_server_sdk/0.8.1",
2424
"X-Fern-Language": "Python",
2525
"X-Fern-SDK-Name": "vapi_server_sdk",
26-
"X-Fern-SDK-Version": "1.5.0",
26+
"X-Fern-SDK-Version": "0.8.1",
2727
}
28-
headers["Authorization"] = f"Bearer {self._get_token()}"
28+
token = self._get_token()
29+
if token is not None:
30+
headers["Authorization"] = f"Bearer {token}"
2931
return headers
3032

31-
def _get_token(self) -> str:
32-
if isinstance(self._token, str):
33+
def _get_token(self) -> typing.Optional[str]:
34+
if isinstance(self._token, str) or self._token is None:
3335
return self._token
3436
else:
3537
return self._token()
@@ -45,7 +47,7 @@ class SyncClientWrapper(BaseClientWrapper):
4547
def __init__(
4648
self,
4749
*,
48-
token: typing.Union[str, typing.Callable[[], str]],
50+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
4951
base_url: str,
5052
timeout: typing.Optional[float] = None,
5153
httpx_client: httpx.Client,
@@ -63,7 +65,7 @@ class AsyncClientWrapper(BaseClientWrapper):
6365
def __init__(
6466
self,
6567
*,
66-
token: typing.Union[str, typing.Callable[[], str]],
68+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
6769
base_url: str,
6870
timeout: typing.Optional[float] = None,
6971
httpx_client: httpx.AsyncClient,

src/vapi/raw_client.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
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.request_options import RequestOptions
10+
11+
12+
class RawVapi:
13+
def __init__(self, *, client_wrapper: SyncClientWrapper):
14+
self._client_wrapper = client_wrapper
15+
16+
def prometheus_controller_index(
17+
self, *, request_options: typing.Optional[RequestOptions] = None
18+
) -> HttpResponse[None]:
19+
"""
20+
Parameters
21+
----------
22+
request_options : typing.Optional[RequestOptions]
23+
Request-specific configuration.
24+
25+
Returns
26+
-------
27+
HttpResponse[None]
28+
"""
29+
_response = self._client_wrapper.httpx_client.request(
30+
"prometheus_metrics",
31+
method="GET",
32+
request_options=request_options,
33+
)
34+
try:
35+
if 200 <= _response.status_code < 300:
36+
return HttpResponse(response=_response, data=None)
37+
_response_json = _response.json()
38+
except JSONDecodeError:
39+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
40+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
41+
42+
43+
class AsyncRawVapi:
44+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
45+
self._client_wrapper = client_wrapper
46+
47+
async def prometheus_controller_index(
48+
self, *, request_options: typing.Optional[RequestOptions] = None
49+
) -> AsyncHttpResponse[None]:
50+
"""
51+
Parameters
52+
----------
53+
request_options : typing.Optional[RequestOptions]
54+
Request-specific configuration.
55+
56+
Returns
57+
-------
58+
AsyncHttpResponse[None]
59+
"""
60+
_response = await self._client_wrapper.httpx_client.request(
61+
"prometheus_metrics",
62+
method="GET",
63+
request_options=request_options,
64+
)
65+
try:
66+
if 200 <= _response.status_code < 300:
67+
return AsyncHttpResponse(response=_response, data=None)
68+
_response_json = _response.json()
69+
except JSONDecodeError:
70+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
71+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

src/vapi/types/anthropic_model_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"claude-3-5-sonnet-20241022",
1212
"claude-3-5-haiku-20241022",
1313
"claude-3-7-sonnet-20250219",
14+
"claude-opus-4-20250514",
15+
"claude-sonnet-4-20250514",
1416
],
1517
typing.Any,
1618
]

src/vapi/types/workflow_anthropic_model_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"claude-3-5-sonnet-20241022",
1212
"claude-3-5-haiku-20241022",
1313
"claude-3-7-sonnet-20250219",
14+
"claude-opus-4-20250514",
15+
"claude-sonnet-4-20250514",
1416
],
1517
typing.Any,
1618
]

0 commit comments

Comments
 (0)