Skip to content

Commit c17086a

Browse files
feat(api): enable typescript
1 parent a3a3e30 commit c17086a

File tree

21 files changed

+1086
-2
lines changed

21 files changed

+1086
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 170
1+
configured_endpoints: 173
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-621c3ebf5011c5ca508f78fccbea17de4ca6b35bfe99578c1ae2265021578d6f.yml
33
openapi_spec_hash: e29d14e3e4679fcf22b3e760e49931b1
4-
config_hash: 6e3aacb34562b5a1ef74bb279f55cbec
4+
config_hash: 3d425c415b7f7ab581418b43eb521cb3

api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ from gradient.types import (
5151
AgentUpdateResponse,
5252
AgentListResponse,
5353
AgentDeleteResponse,
54+
AgentRetrieveUsageResponse,
5455
AgentUpdateStatusResponse,
5556
)
5657
```
@@ -62,6 +63,7 @@ Methods:
6263
- <code title="put /v2/gen-ai/agents/{uuid}">client.agents.<a href="./src/gradient/resources/agents/agents.py">update</a>(path_uuid, \*\*<a href="src/gradient/types/agent_update_params.py">params</a>) -> <a href="./src/gradient/types/agent_update_response.py">AgentUpdateResponse</a></code>
6364
- <code title="get /v2/gen-ai/agents">client.agents.<a href="./src/gradient/resources/agents/agents.py">list</a>(\*\*<a href="src/gradient/types/agent_list_params.py">params</a>) -> <a href="./src/gradient/types/agent_list_response.py">AgentListResponse</a></code>
6465
- <code title="delete /v2/gen-ai/agents/{uuid}">client.agents.<a href="./src/gradient/resources/agents/agents.py">delete</a>(uuid) -> <a href="./src/gradient/types/agent_delete_response.py">AgentDeleteResponse</a></code>
66+
- <code title="get /v2/gen-ai/agents/{uuid}/usage">client.agents.<a href="./src/gradient/resources/agents/agents.py">retrieve_usage</a>(uuid, \*\*<a href="src/gradient/types/agent_retrieve_usage_params.py">params</a>) -> <a href="./src/gradient/types/agent_retrieve_usage_response.py">AgentRetrieveUsageResponse</a></code>
6567
- <code title="put /v2/gen-ai/agents/{uuid}/deployment_visibility">client.agents.<a href="./src/gradient/resources/agents/agents.py">update_status</a>(path_uuid, \*\*<a href="src/gradient/types/agent_update_status_params.py">params</a>) -> <a href="./src/gradient/types/agent_update_status_response.py">AgentUpdateStatusResponse</a></code>
6668

6769
## APIKeys
@@ -214,6 +216,30 @@ Methods:
214216
- <code title="delete /v2/gen-ai/openai/keys/{api_key_uuid}">client.agents.evaluation_metrics.openai.keys.<a href="./src/gradient/resources/agents/evaluation_metrics/openai/keys.py">delete</a>(api_key_uuid) -> <a href="./src/gradient/types/agents/evaluation_metrics/openai/key_delete_response.py">KeyDeleteResponse</a></code>
215217
- <code title="get /v2/gen-ai/openai/keys/{uuid}/agents">client.agents.evaluation_metrics.openai.keys.<a href="./src/gradient/resources/agents/evaluation_metrics/openai/keys.py">list_agents</a>(uuid, \*\*<a href="src/gradient/types/agents/evaluation_metrics/openai/key_list_agents_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/openai/key_list_agents_response.py">KeyListAgentsResponse</a></code>
216218

219+
### Oauth2
220+
221+
Types:
222+
223+
```python
224+
from gradient.types.agents.evaluation_metrics import Oauth2GenerateURLResponse
225+
```
226+
227+
Methods:
228+
229+
- <code title="get /v2/gen-ai/oauth2/url">client.agents.evaluation_metrics.oauth2.<a href="./src/gradient/resources/agents/evaluation_metrics/oauth2/oauth2.py">generate_url</a>(\*\*<a href="src/gradient/types/agents/evaluation_metrics/oauth2_generate_url_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/oauth2_generate_url_response.py">Oauth2GenerateURLResponse</a></code>
230+
231+
#### Dropbox
232+
233+
Types:
234+
235+
```python
236+
from gradient.types.agents.evaluation_metrics.oauth2 import DropboxCreateTokensResponse
237+
```
238+
239+
Methods:
240+
241+
- <code title="post /v2/gen-ai/oauth2/dropbox/tokens">client.agents.evaluation_metrics.oauth2.dropbox.<a href="./src/gradient/resources/agents/evaluation_metrics/oauth2/dropbox.py">create_tokens</a>(\*\*<a href="src/gradient/types/agents/evaluation_metrics/oauth2/dropbox_create_tokens_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/oauth2/dropbox_create_tokens_response.py">DropboxCreateTokensResponse</a></code>
242+
217243
## EvaluationRuns
218244

219245
Types:

src/gradient/resources/agents/agents.py

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
agent_create_params,
2020
agent_update_params,
2121
agent_update_status_params,
22+
agent_retrieve_usage_params,
2223
)
2324
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2425
from ..._utils import maybe_transform, async_maybe_transform
@@ -103,6 +104,7 @@
103104
from ...types.agent_retrieve_response import AgentRetrieveResponse
104105
from ...types.api_deployment_visibility import APIDeploymentVisibility
105106
from ...types.agent_update_status_response import AgentUpdateStatusResponse
107+
from ...types.agent_retrieve_usage_response import AgentRetrieveUsageResponse
106108
from .evaluation_metrics.evaluation_metrics import (
107109
EvaluationMetricsResource,
108110
AsyncEvaluationMetricsResource,
@@ -500,6 +502,59 @@ def delete(
500502
cast_to=AgentDeleteResponse,
501503
)
502504

505+
def retrieve_usage(
506+
self,
507+
uuid: str,
508+
*,
509+
start: str | NotGiven = NOT_GIVEN,
510+
stop: str | NotGiven = NOT_GIVEN,
511+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
512+
# The extra values given here take precedence over values defined on the client or passed to this method.
513+
extra_headers: Headers | None = None,
514+
extra_query: Query | None = None,
515+
extra_body: Body | None = None,
516+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
517+
) -> AgentRetrieveUsageResponse:
518+
"""
519+
To get agent usage, send a GET request to `/v2/gen-ai/agents/{uuid}/usage`.
520+
Returns usage metrics for the specified agent within the provided time range.
521+
522+
Args:
523+
start: Return all usage data from this date.
524+
525+
stop: Return all usage data up to this date, if omitted, will return up to the current
526+
date.
527+
528+
extra_headers: Send extra headers
529+
530+
extra_query: Add additional query parameters to the request
531+
532+
extra_body: Add additional JSON properties to the request
533+
534+
timeout: Override the client-level default timeout for this request, in seconds
535+
"""
536+
if not uuid:
537+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
538+
return self._get(
539+
f"/v2/gen-ai/agents/{uuid}/usage"
540+
if self._client._base_url_overridden
541+
else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage",
542+
options=make_request_options(
543+
extra_headers=extra_headers,
544+
extra_query=extra_query,
545+
extra_body=extra_body,
546+
timeout=timeout,
547+
query=maybe_transform(
548+
{
549+
"start": start,
550+
"stop": stop,
551+
},
552+
agent_retrieve_usage_params.AgentRetrieveUsageParams,
553+
),
554+
),
555+
cast_to=AgentRetrieveUsageResponse,
556+
)
557+
503558
def update_status(
504559
self,
505560
path_uuid: str,
@@ -943,6 +998,59 @@ async def delete(
943998
cast_to=AgentDeleteResponse,
944999
)
9451000

1001+
async def retrieve_usage(
1002+
self,
1003+
uuid: str,
1004+
*,
1005+
start: str | NotGiven = NOT_GIVEN,
1006+
stop: str | NotGiven = NOT_GIVEN,
1007+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1008+
# The extra values given here take precedence over values defined on the client or passed to this method.
1009+
extra_headers: Headers | None = None,
1010+
extra_query: Query | None = None,
1011+
extra_body: Body | None = None,
1012+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1013+
) -> AgentRetrieveUsageResponse:
1014+
"""
1015+
To get agent usage, send a GET request to `/v2/gen-ai/agents/{uuid}/usage`.
1016+
Returns usage metrics for the specified agent within the provided time range.
1017+
1018+
Args:
1019+
start: Return all usage data from this date.
1020+
1021+
stop: Return all usage data up to this date, if omitted, will return up to the current
1022+
date.
1023+
1024+
extra_headers: Send extra headers
1025+
1026+
extra_query: Add additional query parameters to the request
1027+
1028+
extra_body: Add additional JSON properties to the request
1029+
1030+
timeout: Override the client-level default timeout for this request, in seconds
1031+
"""
1032+
if not uuid:
1033+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
1034+
return await self._get(
1035+
f"/v2/gen-ai/agents/{uuid}/usage"
1036+
if self._client._base_url_overridden
1037+
else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage",
1038+
options=make_request_options(
1039+
extra_headers=extra_headers,
1040+
extra_query=extra_query,
1041+
extra_body=extra_body,
1042+
timeout=timeout,
1043+
query=await async_maybe_transform(
1044+
{
1045+
"start": start,
1046+
"stop": stop,
1047+
},
1048+
agent_retrieve_usage_params.AgentRetrieveUsageParams,
1049+
),
1050+
),
1051+
cast_to=AgentRetrieveUsageResponse,
1052+
)
1053+
9461054
async def update_status(
9471055
self,
9481056
path_uuid: str,
@@ -1020,6 +1128,9 @@ def __init__(self, agents: AgentsResource) -> None:
10201128
self.delete = to_raw_response_wrapper(
10211129
agents.delete,
10221130
)
1131+
self.retrieve_usage = to_raw_response_wrapper(
1132+
agents.retrieve_usage,
1133+
)
10231134
self.update_status = to_raw_response_wrapper(
10241135
agents.update_status,
10251136
)
@@ -1084,6 +1195,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
10841195
self.delete = async_to_raw_response_wrapper(
10851196
agents.delete,
10861197
)
1198+
self.retrieve_usage = async_to_raw_response_wrapper(
1199+
agents.retrieve_usage,
1200+
)
10871201
self.update_status = async_to_raw_response_wrapper(
10881202
agents.update_status,
10891203
)
@@ -1148,6 +1262,9 @@ def __init__(self, agents: AgentsResource) -> None:
11481262
self.delete = to_streamed_response_wrapper(
11491263
agents.delete,
11501264
)
1265+
self.retrieve_usage = to_streamed_response_wrapper(
1266+
agents.retrieve_usage,
1267+
)
11511268
self.update_status = to_streamed_response_wrapper(
11521269
agents.update_status,
11531270
)
@@ -1212,6 +1329,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
12121329
self.delete = async_to_streamed_response_wrapper(
12131330
agents.delete,
12141331
)
1332+
self.retrieve_usage = async_to_streamed_response_wrapper(
1333+
agents.retrieve_usage,
1334+
)
12151335
self.update_status = async_to_streamed_response_wrapper(
12161336
agents.update_status,
12171337
)

src/gradient/resources/agents/evaluation_metrics/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
ModelsResourceWithStreamingResponse,
99
AsyncModelsResourceWithStreamingResponse,
1010
)
11+
from .oauth2 import (
12+
Oauth2Resource,
13+
AsyncOauth2Resource,
14+
Oauth2ResourceWithRawResponse,
15+
AsyncOauth2ResourceWithRawResponse,
16+
Oauth2ResourceWithStreamingResponse,
17+
AsyncOauth2ResourceWithStreamingResponse,
18+
)
1119
from .openai import (
1220
OpenAIResource,
1321
AsyncOpenAIResource,
@@ -66,6 +74,12 @@
6674
"AsyncOpenAIResourceWithRawResponse",
6775
"OpenAIResourceWithStreamingResponse",
6876
"AsyncOpenAIResourceWithStreamingResponse",
77+
"Oauth2Resource",
78+
"AsyncOauth2Resource",
79+
"Oauth2ResourceWithRawResponse",
80+
"AsyncOauth2ResourceWithRawResponse",
81+
"Oauth2ResourceWithStreamingResponse",
82+
"AsyncOauth2ResourceWithStreamingResponse",
6983
"EvaluationMetricsResource",
7084
"AsyncEvaluationMetricsResource",
7185
"EvaluationMetricsResourceWithRawResponse",

src/gradient/resources/agents/evaluation_metrics/evaluation_metrics.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
async_to_raw_response_wrapper,
2323
async_to_streamed_response_wrapper,
2424
)
25+
from .oauth2.oauth2 import (
26+
Oauth2Resource,
27+
AsyncOauth2Resource,
28+
Oauth2ResourceWithRawResponse,
29+
AsyncOauth2ResourceWithRawResponse,
30+
Oauth2ResourceWithStreamingResponse,
31+
AsyncOauth2ResourceWithStreamingResponse,
32+
)
2533
from .openai.openai import (
2634
OpenAIResource,
2735
AsyncOpenAIResource,
@@ -71,6 +79,10 @@ def anthropic(self) -> AnthropicResource:
7179
def openai(self) -> OpenAIResource:
7280
return OpenAIResource(self._client)
7381

82+
@cached_property
83+
def oauth2(self) -> Oauth2Resource:
84+
return Oauth2Resource(self._client)
85+
7486
@cached_property
7587
def with_raw_response(self) -> EvaluationMetricsResourceWithRawResponse:
7688
"""
@@ -180,6 +192,10 @@ def anthropic(self) -> AsyncAnthropicResource:
180192
def openai(self) -> AsyncOpenAIResource:
181193
return AsyncOpenAIResource(self._client)
182194

195+
@cached_property
196+
def oauth2(self) -> AsyncOauth2Resource:
197+
return AsyncOauth2Resource(self._client)
198+
183199
@cached_property
184200
def with_raw_response(self) -> AsyncEvaluationMetricsResourceWithRawResponse:
185201
"""
@@ -299,6 +315,10 @@ def anthropic(self) -> AnthropicResourceWithRawResponse:
299315
def openai(self) -> OpenAIResourceWithRawResponse:
300316
return OpenAIResourceWithRawResponse(self._evaluation_metrics.openai)
301317

318+
@cached_property
319+
def oauth2(self) -> Oauth2ResourceWithRawResponse:
320+
return Oauth2ResourceWithRawResponse(self._evaluation_metrics.oauth2)
321+
302322

303323
class AsyncEvaluationMetricsResourceWithRawResponse:
304324
def __init__(self, evaluation_metrics: AsyncEvaluationMetricsResource) -> None:
@@ -327,6 +347,10 @@ def anthropic(self) -> AsyncAnthropicResourceWithRawResponse:
327347
def openai(self) -> AsyncOpenAIResourceWithRawResponse:
328348
return AsyncOpenAIResourceWithRawResponse(self._evaluation_metrics.openai)
329349

350+
@cached_property
351+
def oauth2(self) -> AsyncOauth2ResourceWithRawResponse:
352+
return AsyncOauth2ResourceWithRawResponse(self._evaluation_metrics.oauth2)
353+
330354

331355
class EvaluationMetricsResourceWithStreamingResponse:
332356
def __init__(self, evaluation_metrics: EvaluationMetricsResource) -> None:
@@ -355,6 +379,10 @@ def anthropic(self) -> AnthropicResourceWithStreamingResponse:
355379
def openai(self) -> OpenAIResourceWithStreamingResponse:
356380
return OpenAIResourceWithStreamingResponse(self._evaluation_metrics.openai)
357381

382+
@cached_property
383+
def oauth2(self) -> Oauth2ResourceWithStreamingResponse:
384+
return Oauth2ResourceWithStreamingResponse(self._evaluation_metrics.oauth2)
385+
358386

359387
class AsyncEvaluationMetricsResourceWithStreamingResponse:
360388
def __init__(self, evaluation_metrics: AsyncEvaluationMetricsResource) -> None:
@@ -382,3 +410,7 @@ def anthropic(self) -> AsyncAnthropicResourceWithStreamingResponse:
382410
@cached_property
383411
def openai(self) -> AsyncOpenAIResourceWithStreamingResponse:
384412
return AsyncOpenAIResourceWithStreamingResponse(self._evaluation_metrics.openai)
413+
414+
@cached_property
415+
def oauth2(self) -> AsyncOauth2ResourceWithStreamingResponse:
416+
return AsyncOauth2ResourceWithStreamingResponse(self._evaluation_metrics.oauth2)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .oauth2 import (
4+
Oauth2Resource,
5+
AsyncOauth2Resource,
6+
Oauth2ResourceWithRawResponse,
7+
AsyncOauth2ResourceWithRawResponse,
8+
Oauth2ResourceWithStreamingResponse,
9+
AsyncOauth2ResourceWithStreamingResponse,
10+
)
11+
from .dropbox import (
12+
DropboxResource,
13+
AsyncDropboxResource,
14+
DropboxResourceWithRawResponse,
15+
AsyncDropboxResourceWithRawResponse,
16+
DropboxResourceWithStreamingResponse,
17+
AsyncDropboxResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"DropboxResource",
22+
"AsyncDropboxResource",
23+
"DropboxResourceWithRawResponse",
24+
"AsyncDropboxResourceWithRawResponse",
25+
"DropboxResourceWithStreamingResponse",
26+
"AsyncDropboxResourceWithStreamingResponse",
27+
"Oauth2Resource",
28+
"AsyncOauth2Resource",
29+
"Oauth2ResourceWithRawResponse",
30+
"AsyncOauth2ResourceWithRawResponse",
31+
"Oauth2ResourceWithStreamingResponse",
32+
"AsyncOauth2ResourceWithStreamingResponse",
33+
]

0 commit comments

Comments
 (0)