Skip to content

Commit 8f5761b

Browse files
feat(api): update via SDK Studio
1 parent f853616 commit 8f5761b

18 files changed

+1255
-3
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 6
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fdigitalocean-genai-sdk-17838dec38ee8475c4bf4695b8dc70fe42a8f4da8ae9ffd415dc895b6628a952.yml
3-
openapi_spec_hash: cfe5453e150989c8a9dbc9d7b4d1f76a
1+
configured_endpoints: 8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fdigitalocean-genai-sdk-2b5d132a76e51849a4fdbb2da2818132d1f8208f137acb86ee71e4a5c130154e.yml
3+
openapi_spec_hash: 6c13968b99ef16b717854a096b6ca506
44
config_hash: 69dc66269416b2e01e8852b5a6788b97

api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ from gradientai.types import (
1111
APIModel,
1212
APIOpenAIAPIKeyInfo,
1313
APIRetrievalMethod,
14+
AgentCreateResponse,
15+
AgentListResponse,
1416
)
1517
```
1618

19+
Methods:
20+
21+
- <code title="post /v2/gen-ai/agents">client.agents.<a href="./src/gradientai/resources/agents/agents.py">create</a>(\*\*<a href="src/gradientai/types/agent_create_params.py">params</a>) -> <a href="./src/gradientai/types/agent_create_response.py">AgentCreateResponse</a></code>
22+
- <code title="get /v2/gen-ai/agents">client.agents.<a href="./src/gradientai/resources/agents/agents.py">list</a>(\*\*<a href="src/gradientai/types/agent_list_params.py">params</a>) -> <a href="./src/gradientai/types/agent_list_response.py">AgentListResponse</a></code>
23+
1724
## Versions
1825

1926
Types:

src/gradientai/resources/agents/agents.py

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
from __future__ import annotations
44

5+
from typing import List
6+
7+
import httpx
8+
9+
from ...types import agent_list_params, agent_create_params
10+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11+
from ..._utils import maybe_transform, async_maybe_transform
512
from .versions import (
613
VersionsResource,
714
AsyncVersionsResource,
@@ -12,6 +19,15 @@
1219
)
1320
from ..._compat import cached_property
1421
from ..._resource import SyncAPIResource, AsyncAPIResource
22+
from ..._response import (
23+
to_raw_response_wrapper,
24+
to_streamed_response_wrapper,
25+
async_to_raw_response_wrapper,
26+
async_to_streamed_response_wrapper,
27+
)
28+
from ..._base_client import make_request_options
29+
from ...types.agent_list_response import AgentListResponse
30+
from ...types.agent_create_response import AgentCreateResponse
1531

1632
__all__ = ["AgentsResource", "AsyncAgentsResource"]
1733

@@ -40,6 +56,120 @@ def with_streaming_response(self) -> AgentsResourceWithStreamingResponse:
4056
"""
4157
return AgentsResourceWithStreamingResponse(self)
4258

59+
def create(
60+
self,
61+
*,
62+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
63+
description: str | NotGiven = NOT_GIVEN,
64+
instruction: str | NotGiven = NOT_GIVEN,
65+
knowledge_base_uuid: List[str] | NotGiven = NOT_GIVEN,
66+
model_uuid: str | NotGiven = NOT_GIVEN,
67+
name: str | NotGiven = NOT_GIVEN,
68+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
69+
project_id: str | NotGiven = NOT_GIVEN,
70+
region: str | NotGiven = NOT_GIVEN,
71+
tags: List[str] | NotGiven = NOT_GIVEN,
72+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
73+
# The extra values given here take precedence over values defined on the client or passed to this method.
74+
extra_headers: Headers | None = None,
75+
extra_query: Query | None = None,
76+
extra_body: Body | None = None,
77+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
78+
) -> AgentCreateResponse:
79+
"""To create a new agent, send a POST request to `/v2/gen-ai/agents`.
80+
81+
The response
82+
body contains a JSON object with the newly created agent object.
83+
84+
Args:
85+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
86+
See
87+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
88+
for best practices.
89+
90+
model_uuid: Identifier for the foundation model.
91+
92+
extra_headers: Send extra headers
93+
94+
extra_query: Add additional query parameters to the request
95+
96+
extra_body: Add additional JSON properties to the request
97+
98+
timeout: Override the client-level default timeout for this request, in seconds
99+
"""
100+
return self._post(
101+
"/v2/gen-ai/agents",
102+
body=maybe_transform(
103+
{
104+
"anthropic_key_uuid": anthropic_key_uuid,
105+
"description": description,
106+
"instruction": instruction,
107+
"knowledge_base_uuid": knowledge_base_uuid,
108+
"model_uuid": model_uuid,
109+
"name": name,
110+
"openai_key_uuid": openai_key_uuid,
111+
"project_id": project_id,
112+
"region": region,
113+
"tags": tags,
114+
},
115+
agent_create_params.AgentCreateParams,
116+
),
117+
options=make_request_options(
118+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
119+
),
120+
cast_to=AgentCreateResponse,
121+
)
122+
123+
def list(
124+
self,
125+
*,
126+
only_deployed: bool | NotGiven = NOT_GIVEN,
127+
page: int | NotGiven = NOT_GIVEN,
128+
per_page: int | NotGiven = NOT_GIVEN,
129+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
130+
# The extra values given here take precedence over values defined on the client or passed to this method.
131+
extra_headers: Headers | None = None,
132+
extra_query: Query | None = None,
133+
extra_body: Body | None = None,
134+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
135+
) -> AgentListResponse:
136+
"""
137+
To list all agents, send a GET request to `/v2/gen-ai/agents`.
138+
139+
Args:
140+
only_deployed: only list agents that are deployed.
141+
142+
page: page number.
143+
144+
per_page: items per page.
145+
146+
extra_headers: Send extra headers
147+
148+
extra_query: Add additional query parameters to the request
149+
150+
extra_body: Add additional JSON properties to the request
151+
152+
timeout: Override the client-level default timeout for this request, in seconds
153+
"""
154+
return self._get(
155+
"/v2/gen-ai/agents",
156+
options=make_request_options(
157+
extra_headers=extra_headers,
158+
extra_query=extra_query,
159+
extra_body=extra_body,
160+
timeout=timeout,
161+
query=maybe_transform(
162+
{
163+
"only_deployed": only_deployed,
164+
"page": page,
165+
"per_page": per_page,
166+
},
167+
agent_list_params.AgentListParams,
168+
),
169+
),
170+
cast_to=AgentListResponse,
171+
)
172+
43173

44174
class AsyncAgentsResource(AsyncAPIResource):
45175
@cached_property
@@ -65,11 +195,132 @@ def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
65195
"""
66196
return AsyncAgentsResourceWithStreamingResponse(self)
67197

198+
async def create(
199+
self,
200+
*,
201+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
202+
description: str | NotGiven = NOT_GIVEN,
203+
instruction: str | NotGiven = NOT_GIVEN,
204+
knowledge_base_uuid: List[str] | NotGiven = NOT_GIVEN,
205+
model_uuid: str | NotGiven = NOT_GIVEN,
206+
name: str | NotGiven = NOT_GIVEN,
207+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
208+
project_id: str | NotGiven = NOT_GIVEN,
209+
region: str | NotGiven = NOT_GIVEN,
210+
tags: List[str] | NotGiven = NOT_GIVEN,
211+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
212+
# The extra values given here take precedence over values defined on the client or passed to this method.
213+
extra_headers: Headers | None = None,
214+
extra_query: Query | None = None,
215+
extra_body: Body | None = None,
216+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
217+
) -> AgentCreateResponse:
218+
"""To create a new agent, send a POST request to `/v2/gen-ai/agents`.
219+
220+
The response
221+
body contains a JSON object with the newly created agent object.
222+
223+
Args:
224+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
225+
See
226+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
227+
for best practices.
228+
229+
model_uuid: Identifier for the foundation model.
230+
231+
extra_headers: Send extra headers
232+
233+
extra_query: Add additional query parameters to the request
234+
235+
extra_body: Add additional JSON properties to the request
236+
237+
timeout: Override the client-level default timeout for this request, in seconds
238+
"""
239+
return await self._post(
240+
"/v2/gen-ai/agents",
241+
body=await async_maybe_transform(
242+
{
243+
"anthropic_key_uuid": anthropic_key_uuid,
244+
"description": description,
245+
"instruction": instruction,
246+
"knowledge_base_uuid": knowledge_base_uuid,
247+
"model_uuid": model_uuid,
248+
"name": name,
249+
"openai_key_uuid": openai_key_uuid,
250+
"project_id": project_id,
251+
"region": region,
252+
"tags": tags,
253+
},
254+
agent_create_params.AgentCreateParams,
255+
),
256+
options=make_request_options(
257+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
258+
),
259+
cast_to=AgentCreateResponse,
260+
)
261+
262+
async def list(
263+
self,
264+
*,
265+
only_deployed: bool | NotGiven = NOT_GIVEN,
266+
page: int | NotGiven = NOT_GIVEN,
267+
per_page: int | NotGiven = NOT_GIVEN,
268+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
269+
# The extra values given here take precedence over values defined on the client or passed to this method.
270+
extra_headers: Headers | None = None,
271+
extra_query: Query | None = None,
272+
extra_body: Body | None = None,
273+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
274+
) -> AgentListResponse:
275+
"""
276+
To list all agents, send a GET request to `/v2/gen-ai/agents`.
277+
278+
Args:
279+
only_deployed: only list agents that are deployed.
280+
281+
page: page number.
282+
283+
per_page: items per page.
284+
285+
extra_headers: Send extra headers
286+
287+
extra_query: Add additional query parameters to the request
288+
289+
extra_body: Add additional JSON properties to the request
290+
291+
timeout: Override the client-level default timeout for this request, in seconds
292+
"""
293+
return await self._get(
294+
"/v2/gen-ai/agents",
295+
options=make_request_options(
296+
extra_headers=extra_headers,
297+
extra_query=extra_query,
298+
extra_body=extra_body,
299+
timeout=timeout,
300+
query=await async_maybe_transform(
301+
{
302+
"only_deployed": only_deployed,
303+
"page": page,
304+
"per_page": per_page,
305+
},
306+
agent_list_params.AgentListParams,
307+
),
308+
),
309+
cast_to=AgentListResponse,
310+
)
311+
68312

69313
class AgentsResourceWithRawResponse:
70314
def __init__(self, agents: AgentsResource) -> None:
71315
self._agents = agents
72316

317+
self.create = to_raw_response_wrapper(
318+
agents.create,
319+
)
320+
self.list = to_raw_response_wrapper(
321+
agents.list,
322+
)
323+
73324
@cached_property
74325
def versions(self) -> VersionsResourceWithRawResponse:
75326
return VersionsResourceWithRawResponse(self._agents.versions)
@@ -79,6 +330,13 @@ class AsyncAgentsResourceWithRawResponse:
79330
def __init__(self, agents: AsyncAgentsResource) -> None:
80331
self._agents = agents
81332

333+
self.create = async_to_raw_response_wrapper(
334+
agents.create,
335+
)
336+
self.list = async_to_raw_response_wrapper(
337+
agents.list,
338+
)
339+
82340
@cached_property
83341
def versions(self) -> AsyncVersionsResourceWithRawResponse:
84342
return AsyncVersionsResourceWithRawResponse(self._agents.versions)
@@ -88,6 +346,13 @@ class AgentsResourceWithStreamingResponse:
88346
def __init__(self, agents: AgentsResource) -> None:
89347
self._agents = agents
90348

349+
self.create = to_streamed_response_wrapper(
350+
agents.create,
351+
)
352+
self.list = to_streamed_response_wrapper(
353+
agents.list,
354+
)
355+
91356
@cached_property
92357
def versions(self) -> VersionsResourceWithStreamingResponse:
93358
return VersionsResourceWithStreamingResponse(self._agents.versions)
@@ -97,6 +362,13 @@ class AsyncAgentsResourceWithStreamingResponse:
97362
def __init__(self, agents: AsyncAgentsResource) -> None:
98363
self._agents = agents
99364

365+
self.create = async_to_streamed_response_wrapper(
366+
agents.create,
367+
)
368+
self.list = async_to_streamed_response_wrapper(
369+
agents.list,
370+
)
371+
100372
@cached_property
101373
def versions(self) -> AsyncVersionsResourceWithStreamingResponse:
102374
return AsyncVersionsResourceWithStreamingResponse(self._agents.versions)

src/gradientai/types/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@
33
from __future__ import annotations
44

55
from .model import Model as Model
6+
from .api_agent import APIAgent as APIAgent
7+
from .api_model import APIModel as APIModel
8+
from .api_agreement import APIAgreement as APIAgreement
9+
from .api_indexing_job import APIIndexingJob as APIIndexingJob
10+
from .agent_list_params import AgentListParams as AgentListParams
11+
from .api_model_version import APIModelVersion as APIModelVersion
12+
from .api_knowledge_base import APIKnowledgeBase as APIKnowledgeBase
13+
from .agent_create_params import AgentCreateParams as AgentCreateParams
14+
from .agent_list_response import AgentListResponse as AgentListResponse
615
from .model_list_response import ModelListResponse as ModelListResponse
716
from .api_retrieval_method import APIRetrievalMethod as APIRetrievalMethod
17+
from .agent_create_response import AgentCreateResponse as AgentCreateResponse
18+
from .api_agent_api_key_info import APIAgentAPIKeyInfo as APIAgentAPIKeyInfo
19+
from .api_openai_api_key_info import APIOpenAIAPIKeyInfo as APIOpenAIAPIKeyInfo
820
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
921
from .api_deployment_visibility import APIDeploymentVisibility as APIDeploymentVisibility
1022
from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse
23+
from .api_anthropic_api_key_info import APIAnthropicAPIKeyInfo as APIAnthropicAPIKeyInfo
1124
from .chat_completion_token_logprob import ChatCompletionTokenLogprob as ChatCompletionTokenLogprob
1225
from .chat_create_completion_params import ChatCreateCompletionParams as ChatCreateCompletionParams
1326
from .chat_create_completion_response import ChatCreateCompletionResponse as ChatCreateCompletionResponse

0 commit comments

Comments
 (0)