Skip to content

Commit f853616

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

File tree

244 files changed

+596
-16866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+596
-16866
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create releases
2+
on:
3+
schedule:
4+
- cron: '0 5 * * *' # every day at 5am UTC
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
name: release
12+
if: github.ref == 'refs/heads/main' && github.repository == 'digitalocean/gradientai-python'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: stainless-api/trigger-release-please@v1
19+
id: release
20+
with:
21+
repo: ${{ github.event.repository.full_name }}
22+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
23+
24+
- name: Install Rye
25+
if: ${{ steps.release.outputs.releases_created }}
26+
run: |
27+
curl -sSf https://rye.astral.sh/get | bash
28+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
29+
env:
30+
RYE_VERSION: '0.44.0'
31+
RYE_INSTALL_OPTION: '--yes'
32+
33+
- name: Publish to PyPI
34+
if: ${{ steps.release.outputs.releases_created }}
35+
run: |
36+
bash ./bin/publish-pypi
37+
env:
38+
PYPI_TOKEN: ${{ secrets.GRADIENT_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/publish-pypi.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# This workflow is triggered when a GitHub release is created.
2-
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3-
# You can run this workflow by navigating to https://www.github.com/digitalocean/genai-python/actions/workflows/publish-pypi.yml
1+
# workflow for re-running publishing to PyPI in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/digitalocean/gradientai-python/actions/workflows/publish-pypi.yml
43
name: Publish PyPI
54
on:
65
workflow_dispatch:
76

8-
release:
9-
types: [published]
10-
117
jobs:
128
publish:
139
name: publish
@@ -28,4 +24,4 @@ jobs:
2824
run: |
2925
bash ./bin/publish-pypi
3026
env:
31-
PYPI_TOKEN: ${{ secrets.DIGITALOCEAN_GENAI_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }}
27+
PYPI_TOKEN: ${{ secrets.GRADIENT_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
release_doctor:
1010
name: release doctor
1111
runs-on: ubuntu-latest
12-
if: github.repository == 'digitalocean/genai-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
12+
if: github.repository == 'digitalocean/gradientai-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
1515
- uses: actions/checkout@v4
@@ -18,4 +18,5 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
PYPI_TOKEN: ${{ secrets.DIGITALOCEAN_GENAI_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21+
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
22+
PYPI_TOKEN: ${{ secrets.GRADIENT_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.stats.yml

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

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock
3636

3737
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
3838
result in merge conflicts between manual patches and changes from the generator. The generator will never
39-
modify the contents of the `src/digitalocean_genai_sdk/lib/` and `examples/` directories.
39+
modify the contents of the `src/gradientai/lib/` and `examples/` directories.
4040

4141
## Adding and running examples
4242

@@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
6262
To install via git:
6363

6464
```sh
65-
$ pip install git+ssh://git@github.com/digitalocean/genai-python.git
65+
$ pip install git+ssh://git@github.com/digitalocean/gradientai-python.git
6666
```
6767

6868
Alternatively, you can build from source and install the wheel file:
@@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
120120

121121
### Publish with a GitHub workflow
122122

123-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/digitalocean/genai-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
123+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/digitalocean/gradientai-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
124124

125125
### Publish manually
126126

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Digitalocean Genai SDK
189+
Copyright 2025 Gradient AI
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Digitalocean Genai SDK Python API library
1+
# Gradient AI Python API library
22

33
[![PyPI version](https://img.shields.io/pypi/v/c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python.svg)](https://pypi.org/project/c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python/)
44

5-
The Digitalocean Genai SDK Python library provides convenient access to the Digitalocean Genai SDK REST API from any Python 3.8+
5+
The Gradient AI Python library provides convenient access to the Gradient AI REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
77
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
88

@@ -25,9 +25,9 @@ The full API of this library can be found in [api.md](api.md).
2525

2626
```python
2727
import os
28-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
28+
from gradientai import GradientAI
2929

30-
client = DigitaloceanGenaiSDK(
30+
client = GradientAI(
3131
api_key=os.environ.get(
3232
"DIGITALOCEAN_GENAI_SDK_API_KEY"
3333
), # This is the default and can be omitted
@@ -46,14 +46,14 @@ so that your API Key is not stored in source control.
4646

4747
## Async usage
4848

49-
Simply import `AsyncDigitaloceanGenaiSDK` instead of `DigitaloceanGenaiSDK` and use `await` with each API call:
49+
Simply import `AsyncGradientAI` instead of `GradientAI` and use `await` with each API call:
5050

5151
```python
5252
import os
5353
import asyncio
54-
from digitalocean_genai_sdk import AsyncDigitaloceanGenaiSDK
54+
from gradientai import AsyncGradientAI
5555

56-
client = AsyncDigitaloceanGenaiSDK(
56+
client = AsyncGradientAI(
5757
api_key=os.environ.get(
5858
"DIGITALOCEAN_GENAI_SDK_API_KEY"
5959
), # This is the default and can be omitted
@@ -86,42 +86,48 @@ Typed requests and responses provide autocomplete and documentation within your
8686
Nested parameters are dictionaries, typed using `TypedDict`, for example:
8787

8888
```python
89-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
90-
91-
client = DigitaloceanGenaiSDK()
92-
93-
data_source = client.knowledge_bases.data_sources.create(
94-
path_knowledge_base_uuid="knowledge_base_uuid",
95-
aws_data_source={},
89+
from gradientai import GradientAI
90+
91+
client = GradientAI()
92+
93+
response = client.chat.create_completion(
94+
messages=[
95+
{
96+
"content": "string",
97+
"role": "system",
98+
}
99+
],
100+
model="llama3-8b-instruct",
101+
stream_options={},
96102
)
97-
print(data_source.aws_data_source)
103+
print(response.stream_options)
98104
```
99105

100106
## Handling errors
101107

102-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `digitalocean_genai_sdk.APIConnectionError` is raised.
108+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gradientai.APIConnectionError` is raised.
103109

104110
When the API returns a non-success status code (that is, 4xx or 5xx
105-
response), a subclass of `digitalocean_genai_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
111+
response), a subclass of `gradientai.APIStatusError` is raised, containing `status_code` and `response` properties.
106112

107-
All errors inherit from `digitalocean_genai_sdk.APIError`.
113+
All errors inherit from `gradientai.APIError`.
108114

109115
```python
110-
import digitalocean_genai_sdk
111-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
116+
import gradientai
117+
from gradientai import GradientAI
112118

113-
client = DigitaloceanGenaiSDK()
119+
client = GradientAI()
114120

115121
try:
116122
client.agents.versions.list(
117123
uuid="REPLACE_ME",
118124
)
119-
except digitalocean_genai_sdk.APIConnectionError as e:
125+
except gradientai.APIConnectionError as e:
120126
print("The server could not be reached")
121127
print(e.__cause__) # an underlying Exception, likely raised within httpx.
122-
except digitalocean_genai_sdk.RateLimitError as e:
128+
except gradientai.RateLimitError as e:
123129
print("A 429 status code was received; we should back off a bit.")
124-
except digitalocean_genai_sdk.APIStatusError as e:
130+
except gradientai.APIStatusError as e:
125131
print("Another non-200-range status code was received")
126132
print(e.status_code)
127133
print(e.response)
@@ -149,10 +155,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
149155
You can use the `max_retries` option to configure or disable retry settings:
150156

151157
```python
152-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
158+
from gradientai import GradientAI
153159

154160
# Configure the default for all requests:
155-
client = DigitaloceanGenaiSDK(
161+
client = GradientAI(
156162
# default is 2
157163
max_retries=0,
158164
)
@@ -169,16 +175,16 @@ By default requests time out after 1 minute. You can configure this with a `time
169175
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
170176

171177
```python
172-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
178+
from gradientai import GradientAI
173179

174180
# Configure the default for all requests:
175-
client = DigitaloceanGenaiSDK(
181+
client = GradientAI(
176182
# 20 seconds (default is 1 minute)
177183
timeout=20.0,
178184
)
179185

180186
# More granular control:
181-
client = DigitaloceanGenaiSDK(
187+
client = GradientAI(
182188
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
183189
)
184190

@@ -198,10 +204,10 @@ Note that requests that time out are [retried twice by default](#retries).
198204

199205
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
200206

201-
You can enable logging by setting the environment variable `DIGITALOCEAN_GENAI_SDK_LOG` to `info`.
207+
You can enable logging by setting the environment variable `GRADIENT_AI_LOG` to `info`.
202208

203209
```shell
204-
$ export DIGITALOCEAN_GENAI_SDK_LOG=info
210+
$ export GRADIENT_AI_LOG=info
205211
```
206212

207213
Or to `debug` for more verbose logging.
@@ -223,9 +229,9 @@ if response.my_field is None:
223229
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
224230

225231
```py
226-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
232+
from gradientai import GradientAI
227233

228-
client = DigitaloceanGenaiSDK()
234+
client = GradientAI()
229235
response = client.agents.versions.with_raw_response.list(
230236
uuid="REPLACE_ME",
231237
)
@@ -235,9 +241,9 @@ version = response.parse() # get the object that `agents.versions.list()` would
235241
print(version.agent_versions)
236242
```
237243

238-
These methods return an [`APIResponse`](https://github.com/digitalocean/genai-python/tree/main/src/digitalocean_genai_sdk/_response.py) object.
244+
These methods return an [`APIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/gradientai/_response.py) object.
239245

240-
The async client returns an [`AsyncAPIResponse`](https://github.com/digitalocean/genai-python/tree/main/src/digitalocean_genai_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
246+
The async client returns an [`AsyncAPIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/gradientai/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
241247

242248
#### `.with_streaming_response`
243249

@@ -301,10 +307,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
301307

302308
```python
303309
import httpx
304-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK, DefaultHttpxClient
310+
from gradientai import GradientAI, DefaultHttpxClient
305311

306-
client = DigitaloceanGenaiSDK(
307-
# Or use the `DIGITALOCEAN_GENAI_SDK_BASE_URL` env var
312+
client = GradientAI(
313+
# Or use the `GRADIENT_AI_BASE_URL` env var
308314
base_url="http://my.test.server.example.com:8083",
309315
http_client=DefaultHttpxClient(
310316
proxy="http://my.test.proxy.example.com",
@@ -324,9 +330,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
324330
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
325331

326332
```py
327-
from digitalocean_genai_sdk import DigitaloceanGenaiSDK
333+
from gradientai import GradientAI
328334

329-
with DigitaloceanGenaiSDK() as client:
335+
with GradientAI() as client:
330336
# make requests here
331337
...
332338

@@ -343,7 +349,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
343349

344350
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
345351

346-
We are keen for your feedback; please open an [issue](https://www.github.com/digitalocean/genai-python/issues) with questions, bugs, or suggestions.
352+
We are keen for your feedback; please open an [issue](https://www.github.com/digitalocean/gradientai-python/issues) with questions, bugs, or suggestions.
347353

348354
### Determining the installed version
349355

@@ -352,8 +358,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
352358
You can determine the version that is being used at runtime with:
353359

354360
```py
355-
import digitalocean_genai_sdk
356-
print(digitalocean_genai_sdk.__version__)
361+
import gradientai
362+
print(gradientai.__version__)
357363
```
358364

359365
## Requirements

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Digitalocean Genai SDK, please follow the respective company's security reporting guidelines.
19+
or products provided by Gradient AI, please follow the respective company's security reporting guidelines.
2020

2121
---
2222

0 commit comments

Comments
 (0)