Skip to content

Commit e5c8d76

Browse files
feat(api): update via SDK Studio
1 parent 5f700dc commit e5c8d76

File tree

13 files changed

+1146
-9
lines changed

13 files changed

+1146
-9
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: 56
1+
configured_endpoints: 57
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fdigitalocean-genai-sdk-e40feaac59c85aace6aa42d2749b20e0955dbbae58b06c3a650bc03adafcd7b5.yml
33
openapi_spec_hash: 825c1a4816938e9f594b7a8c06692667
4-
config_hash: cfd2d18e8dfe7223b15ce9b204cef29e
4+
config_hash: c880014064b4d19b42254d47f1bb2758

api.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,18 @@ Methods:
287287

288288
# Chat
289289

290+
## Completions
291+
290292
Types:
291293

292294
```python
293-
from gradientai.types import ChatCompletionTokenLogprob
295+
from gradientai.types.chat import CompletionCreateResponse
294296
```
295297

298+
Methods:
299+
300+
- <code title="post /chat/completions">client.chat.completions.<a href="./src/gradientai/resources/chat/completions.py">create</a>(\*\*<a href="src/gradientai/types/chat/completion_create_params.py">params</a>) -> <a href="./src/gradientai/types/chat/completion_create_response.py">CompletionCreateResponse</a></code>
301+
296302
# Models
297303

298304
Types:

src/gradientai/_client.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
)
3232

3333
if TYPE_CHECKING:
34-
from .resources import agents, models, regions, api_keys, providers, indexing_jobs, knowledge_bases
34+
from .resources import chat, agents, models, regions, api_keys, providers, indexing_jobs, knowledge_bases
3535
from .resources.models import ModelsResource, AsyncModelsResource
3636
from .resources.regions import RegionsResource, AsyncRegionsResource
37+
from .resources.chat.chat import ChatResource, AsyncChatResource
3738
from .resources.agents.agents import AgentsResource, AsyncAgentsResource
3839
from .resources.indexing_jobs import IndexingJobsResource, AsyncIndexingJobsResource
3940
from .resources.api_keys.api_keys import APIKeysResource, AsyncAPIKeysResource
@@ -144,6 +145,12 @@ def api_keys(self) -> APIKeysResource:
144145

145146
return APIKeysResource(self)
146147

148+
@cached_property
149+
def chat(self) -> ChatResource:
150+
from .resources.chat import ChatResource
151+
152+
return ChatResource(self)
153+
147154
@cached_property
148155
def models(self) -> ModelsResource:
149156
from .resources.models import ModelsResource
@@ -357,6 +364,12 @@ def api_keys(self) -> AsyncAPIKeysResource:
357364

358365
return AsyncAPIKeysResource(self)
359366

367+
@cached_property
368+
def chat(self) -> AsyncChatResource:
369+
from .resources.chat import AsyncChatResource
370+
371+
return AsyncChatResource(self)
372+
360373
@cached_property
361374
def models(self) -> AsyncModelsResource:
362375
from .resources.models import AsyncModelsResource
@@ -520,6 +533,12 @@ def api_keys(self) -> api_keys.APIKeysResourceWithRawResponse:
520533

521534
return APIKeysResourceWithRawResponse(self._client.api_keys)
522535

536+
@cached_property
537+
def chat(self) -> chat.ChatResourceWithRawResponse:
538+
from .resources.chat import ChatResourceWithRawResponse
539+
540+
return ChatResourceWithRawResponse(self._client.chat)
541+
523542
@cached_property
524543
def models(self) -> models.ModelsResourceWithRawResponse:
525544
from .resources.models import ModelsResourceWithRawResponse
@@ -569,6 +588,12 @@ def api_keys(self) -> api_keys.AsyncAPIKeysResourceWithRawResponse:
569588

570589
return AsyncAPIKeysResourceWithRawResponse(self._client.api_keys)
571590

591+
@cached_property
592+
def chat(self) -> chat.AsyncChatResourceWithRawResponse:
593+
from .resources.chat import AsyncChatResourceWithRawResponse
594+
595+
return AsyncChatResourceWithRawResponse(self._client.chat)
596+
572597
@cached_property
573598
def models(self) -> models.AsyncModelsResourceWithRawResponse:
574599
from .resources.models import AsyncModelsResourceWithRawResponse
@@ -618,6 +643,12 @@ def api_keys(self) -> api_keys.APIKeysResourceWithStreamingResponse:
618643

619644
return APIKeysResourceWithStreamingResponse(self._client.api_keys)
620645

646+
@cached_property
647+
def chat(self) -> chat.ChatResourceWithStreamingResponse:
648+
from .resources.chat import ChatResourceWithStreamingResponse
649+
650+
return ChatResourceWithStreamingResponse(self._client.chat)
651+
621652
@cached_property
622653
def models(self) -> models.ModelsResourceWithStreamingResponse:
623654
from .resources.models import ModelsResourceWithStreamingResponse
@@ -667,6 +698,12 @@ def api_keys(self) -> api_keys.AsyncAPIKeysResourceWithStreamingResponse:
667698

668699
return AsyncAPIKeysResourceWithStreamingResponse(self._client.api_keys)
669700

701+
@cached_property
702+
def chat(self) -> chat.AsyncChatResourceWithStreamingResponse:
703+
from .resources.chat import AsyncChatResourceWithStreamingResponse
704+
705+
return AsyncChatResourceWithStreamingResponse(self._client.chat)
706+
670707
@cached_property
671708
def models(self) -> models.AsyncModelsResourceWithStreamingResponse:
672709
from .resources.models import AsyncModelsResourceWithStreamingResponse

src/gradientai/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .chat import (
4+
ChatResource,
5+
AsyncChatResource,
6+
ChatResourceWithRawResponse,
7+
AsyncChatResourceWithRawResponse,
8+
ChatResourceWithStreamingResponse,
9+
AsyncChatResourceWithStreamingResponse,
10+
)
311
from .agents import (
412
AgentsResource,
513
AsyncAgentsResource,
@@ -94,6 +102,12 @@
94102
"AsyncAPIKeysResourceWithRawResponse",
95103
"APIKeysResourceWithStreamingResponse",
96104
"AsyncAPIKeysResourceWithStreamingResponse",
105+
"ChatResource",
106+
"AsyncChatResource",
107+
"ChatResourceWithRawResponse",
108+
"AsyncChatResourceWithRawResponse",
109+
"ChatResourceWithStreamingResponse",
110+
"AsyncChatResourceWithStreamingResponse",
97111
"ModelsResource",
98112
"AsyncModelsResource",
99113
"ModelsResourceWithRawResponse",
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 .chat import (
4+
ChatResource,
5+
AsyncChatResource,
6+
ChatResourceWithRawResponse,
7+
AsyncChatResourceWithRawResponse,
8+
ChatResourceWithStreamingResponse,
9+
AsyncChatResourceWithStreamingResponse,
10+
)
11+
from .completions import (
12+
CompletionsResource,
13+
AsyncCompletionsResource,
14+
CompletionsResourceWithRawResponse,
15+
AsyncCompletionsResourceWithRawResponse,
16+
CompletionsResourceWithStreamingResponse,
17+
AsyncCompletionsResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"CompletionsResource",
22+
"AsyncCompletionsResource",
23+
"CompletionsResourceWithRawResponse",
24+
"AsyncCompletionsResourceWithRawResponse",
25+
"CompletionsResourceWithStreamingResponse",
26+
"AsyncCompletionsResourceWithStreamingResponse",
27+
"ChatResource",
28+
"AsyncChatResource",
29+
"ChatResourceWithRawResponse",
30+
"AsyncChatResourceWithRawResponse",
31+
"ChatResourceWithStreamingResponse",
32+
"AsyncChatResourceWithStreamingResponse",
33+
]
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from ..._compat import cached_property
6+
from ..._resource import SyncAPIResource, AsyncAPIResource
7+
from .completions import (
8+
CompletionsResource,
9+
AsyncCompletionsResource,
10+
CompletionsResourceWithRawResponse,
11+
AsyncCompletionsResourceWithRawResponse,
12+
CompletionsResourceWithStreamingResponse,
13+
AsyncCompletionsResourceWithStreamingResponse,
14+
)
15+
16+
__all__ = ["ChatResource", "AsyncChatResource"]
17+
18+
19+
class ChatResource(SyncAPIResource):
20+
@cached_property
21+
def completions(self) -> CompletionsResource:
22+
return CompletionsResource(self._client)
23+
24+
@cached_property
25+
def with_raw_response(self) -> ChatResourceWithRawResponse:
26+
"""
27+
This property can be used as a prefix for any HTTP method call to return
28+
the raw response object instead of the parsed content.
29+
30+
For more information, see https://www.github.com/digitalocean/genai-python#accessing-raw-response-data-eg-headers
31+
"""
32+
return ChatResourceWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
36+
"""
37+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38+
39+
For more information, see https://www.github.com/digitalocean/genai-python#with_streaming_response
40+
"""
41+
return ChatResourceWithStreamingResponse(self)
42+
43+
44+
class AsyncChatResource(AsyncAPIResource):
45+
@cached_property
46+
def completions(self) -> AsyncCompletionsResource:
47+
return AsyncCompletionsResource(self._client)
48+
49+
@cached_property
50+
def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
51+
"""
52+
This property can be used as a prefix for any HTTP method call to return
53+
the raw response object instead of the parsed content.
54+
55+
For more information, see https://www.github.com/digitalocean/genai-python#accessing-raw-response-data-eg-headers
56+
"""
57+
return AsyncChatResourceWithRawResponse(self)
58+
59+
@cached_property
60+
def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
61+
"""
62+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63+
64+
For more information, see https://www.github.com/digitalocean/genai-python#with_streaming_response
65+
"""
66+
return AsyncChatResourceWithStreamingResponse(self)
67+
68+
69+
class ChatResourceWithRawResponse:
70+
def __init__(self, chat: ChatResource) -> None:
71+
self._chat = chat
72+
73+
@cached_property
74+
def completions(self) -> CompletionsResourceWithRawResponse:
75+
return CompletionsResourceWithRawResponse(self._chat.completions)
76+
77+
78+
class AsyncChatResourceWithRawResponse:
79+
def __init__(self, chat: AsyncChatResource) -> None:
80+
self._chat = chat
81+
82+
@cached_property
83+
def completions(self) -> AsyncCompletionsResourceWithRawResponse:
84+
return AsyncCompletionsResourceWithRawResponse(self._chat.completions)
85+
86+
87+
class ChatResourceWithStreamingResponse:
88+
def __init__(self, chat: ChatResource) -> None:
89+
self._chat = chat
90+
91+
@cached_property
92+
def completions(self) -> CompletionsResourceWithStreamingResponse:
93+
return CompletionsResourceWithStreamingResponse(self._chat.completions)
94+
95+
96+
class AsyncChatResourceWithStreamingResponse:
97+
def __init__(self, chat: AsyncChatResource) -> None:
98+
self._chat = chat
99+
100+
@cached_property
101+
def completions(self) -> AsyncCompletionsResourceWithStreamingResponse:
102+
return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions)

0 commit comments

Comments
 (0)