Skip to content

Commit d01b51d

Browse files
authored
Merge pull request #30 from digitalocean/release-please--branches--main--changes--next
release: 3.0.0-beta.1
2 parents c0e30a3 + 13c9311 commit d01b51d

File tree

561 files changed

+2794
-2944
lines changed

Some content is hidden

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

561 files changed

+2794
-2944
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
lint:
1717
timeout-minutes: 10
1818
name: lint
19-
runs-on: ${{ github.repository == 'stainless-sdks/gradientai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
19+
runs-on: ${{ github.repository == 'stainless-sdks/gradient-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121
steps:
2222
- uses: actions/checkout@v4
@@ -36,7 +36,7 @@ jobs:
3636
run: ./scripts/lint
3737

3838
build:
39-
if: github.repository == 'stainless-sdks/gradientai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
39+
if: github.repository == 'stainless-sdks/gradient-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
4040
timeout-minutes: 10
4141
name: build
4242
permissions:
@@ -76,7 +76,7 @@ jobs:
7676
test:
7777
timeout-minutes: 10
7878
name: test
79-
runs-on: ${{ github.repository == 'stainless-sdks/gradientai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
79+
runs-on: ${{ github.repository == 'stainless-sdks/gradient-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
8080
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
8181
steps:
8282
- uses: actions/checkout@v4

.github/workflows/publish-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is triggered when a GitHub release is created.
22
# 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/gradientai-python/actions/workflows/publish-pypi.yml
3+
# You can run this workflow by navigating to https://www.github.com/digitalocean/gradient-python/actions/workflows/publish-pypi.yml
44
name: Publish PyPI
55
on:
66
workflow_dispatch:
@@ -28,4 +28,4 @@ jobs:
2828
run: |
2929
bash ./bin/publish-pypi
3030
env:
31-
PYPI_TOKEN: ${{ secrets.GRADIENT_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
31+
PYPI_TOKEN: ${{ secrets.GRADIENT_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 2 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/gradientai-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/gradient-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,4 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
PYPI_TOKEN: ${{ secrets.GRADIENT_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21+
PYPI_TOKEN: ${{ secrets.GRADIENT_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-beta.4"
2+
".": "3.0.0-beta.1"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 170
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradientai-015417b36365dfcb32166e67379c38de8bf5127c33dff646097a819a7b4dc588.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-015417b36365dfcb32166e67379c38de8bf5127c33dff646097a819a7b4dc588.yml
33
openapi_spec_hash: d7d811c13cc79f15d82fe680cf425859
4-
config_hash: 3ad1734779befb065101197f2f35568c
4+
config_hash: 77ddef130940a6ad8ea6c6f66aee8757

CHANGELOG.md

Lines changed: 169 additions & 149 deletions
Large diffs are not rendered by default.

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/do_gradientai/lib/` and `examples/` directories.
39+
modify the contents of the `src/gradient/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://[email protected]/digitalocean/gradientai-python.git
65+
$ pip install git+ssh://[email protected]/digitalocean/gradient-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/gradientai-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/gradient-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 Gradient AI
189+
Copyright 2025 Gradient
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: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
> Use with care in production environments and keep an eye on releases for updates or breaking changes.
77
88
<!-- prettier-ignore -->
9-
[![PyPI version](https://img.shields.io/pypi/v/do_gradientai.svg?label=pypi%20(stable))](https://pypi.org/project/do_gradientai/)
9+
[![PyPI version](https://img.shields.io/pypi/v/gradient.svg?label=pypi%20(stable))](https://pypi.org/project/gradient/)
1010
[![Docs](https://img.shields.io/badge/Docs-8A2BE2)](https://gradientai.digitalocean.com/getting-started/overview/)
1111

1212
The Gradient Python library provides convenient access to the Gradient REST API from any Python 3.8+
@@ -25,7 +25,7 @@ The full API of this library can be found in [api.md](api.md).
2525

2626
```sh
2727
# install from PyPI
28-
pip install --pre do_gradientai
28+
pip install --pre gradient
2929
```
3030

3131
## Usage
@@ -39,18 +39,18 @@ The full API of this library can be found in [api.md](api.md).
3939

4040
```python
4141
import os
42-
from do_gradientai import GradientAI
42+
from gradient import Gradient
4343

44-
api_client = GradientAI(
45-
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
44+
client = Gradient(
45+
api_key=os.environ.get("GRADIENT_API_KEY"), # This is the default and can be omitted
4646
)
47-
inference_client = GradientAI(
47+
inference_client = Gradient(
4848
inference_key=os.environ.get(
49-
"GRADIENTAI_INFERENCE_KEY"
49+
"GRADIENT_INFERENCE_KEY"
5050
), # This is the default and can be omitted
5151
)
52-
agent_client = GradientAI(
53-
agent_key=os.environ.get("GRADIENTAI_AGENT_KEY"), # This is the default and can be omitted
52+
agent_client = Gradient(
53+
agent_key=os.environ.get("GRADIENT_AGENT_KEY"), # This is the default and can be omitted
5454
agent_endpoint="https://my-agent.agents.do-ai.run",
5555
)
5656

@@ -92,20 +92,20 @@ print(agent_response.choices[0].message.content)
9292

9393
While you can provide an `api_key`, `inference_key` keyword argument,
9494
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
95-
to add `GRADIENTAI_API_KEY="My API Key"`, `GRADIENTAI_INFERENCE_KEY="My INFERENCE Key"` to your `.env` file
95+
to add `GRADIENT_API_KEY="My API Key"`, `GRADIENT_INFERENCE_KEY="My INFERENCE Key"` to your `.env` file
9696
so that your keys are not stored in source control.
9797

9898
## Async usage
9999

100-
Simply import `AsyncGradientAI` instead of `GradientAI` and use `await` with each API call:
100+
Simply import `AsyncGradient` instead of `Gradient` and use `await` with each API call:
101101

102102
```python
103103
import os
104104
import asyncio
105-
from do_gradientai import AsyncGradientAI
105+
from gradient import AsyncGradient
106106

107-
client = AsyncGradientAI(
108-
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
107+
client = AsyncGradient(
108+
api_key=os.environ.get("GRADIENT_API_KEY"), # This is the default and can be omitted
109109
)
110110

111111

@@ -135,19 +135,19 @@ You can enable this by installing `aiohttp`:
135135

136136
```sh
137137
# install from PyPI
138-
pip install --pre do_gradientai[aiohttp]
138+
pip install --pre gradient[aiohttp]
139139
```
140140

141141
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
142142

143143
```python
144144
import asyncio
145-
from do_gradientai import DefaultAioHttpClient
146-
from do_gradientai import AsyncGradientAI
145+
from gradient import DefaultAioHttpClient
146+
from gradient import AsyncGradient
147147

148148

149149
async def main() -> None:
150-
async with AsyncGradientAI(
150+
async with AsyncGradient(
151151
api_key="My API Key",
152152
http_client=DefaultAioHttpClient(),
153153
) as client:
@@ -171,9 +171,9 @@ asyncio.run(main())
171171
We provide support for streaming responses using Server Side Events (SSE).
172172

173173
```python
174-
from do_gradientai import GradientAI
174+
from gradient import Gradient
175175

176-
client = GradientAI()
176+
client = Gradient()
177177

178178
stream = client.chat.completions.create(
179179
messages=[
@@ -192,9 +192,9 @@ for completion in stream:
192192
The async client uses the exact same interface.
193193

194194
```python
195-
from do_gradientai import AsyncGradientAI
195+
from gradient import AsyncGradient
196196

197-
client = AsyncGradientAI()
197+
client = AsyncGradient()
198198

199199
stream = await client.chat.completions.create(
200200
messages=[
@@ -224,9 +224,9 @@ Typed requests and responses provide autocomplete and documentation within your
224224
Nested parameters are dictionaries, typed using `TypedDict`, for example:
225225

226226
```python
227-
from do_gradientai import GradientAI
227+
from gradient import Gradient
228228

229-
client = GradientAI()
229+
client = Gradient()
230230

231231
completion = client.chat.completions.create(
232232
messages=[
@@ -243,18 +243,18 @@ print(completion.stream_options)
243243

244244
## Handling errors
245245

246-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `do_gradientai.APIConnectionError` is raised.
246+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gradient.APIConnectionError` is raised.
247247

248248
When the API returns a non-success status code (that is, 4xx or 5xx
249-
response), a subclass of `do_gradientai.APIStatusError` is raised, containing `status_code` and `response` properties.
249+
response), a subclass of `gradient.APIStatusError` is raised, containing `status_code` and `response` properties.
250250

251-
All errors inherit from `do_gradientai.APIError`.
251+
All errors inherit from `gradient.APIError`.
252252

253253
```python
254-
import do_gradientai
255-
from do_gradientai import GradientAI
254+
import gradient
255+
from gradient import Gradient
256256

257-
client = GradientAI()
257+
client = Gradient()
258258

259259
try:
260260
client.chat.completions.create(
@@ -266,12 +266,12 @@ try:
266266
],
267267
model="llama3.3-70b-instruct",
268268
)
269-
except do_gradientai.APIConnectionError as e:
269+
except gradient.APIConnectionError as e:
270270
print("The server could not be reached")
271271
print(e.__cause__) # an underlying Exception, likely raised within httpx.
272-
except do_gradientai.RateLimitError as e:
272+
except gradient.RateLimitError as e:
273273
print("A 429 status code was received; we should back off a bit.")
274-
except do_gradientai.APIStatusError as e:
274+
except gradient.APIStatusError as e:
275275
print("Another non-200-range status code was received")
276276
print(e.status_code)
277277
print(e.response)
@@ -299,10 +299,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
299299
You can use the `max_retries` option to configure or disable retry settings:
300300

301301
```python
302-
from do_gradientai import GradientAI
302+
from gradient import Gradient
303303

304304
# Configure the default for all requests:
305-
client = GradientAI(
305+
client = Gradient(
306306
# default is 2
307307
max_retries=0,
308308
)
@@ -325,16 +325,16 @@ By default requests time out after 1 minute. You can configure this with a `time
325325
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
326326

327327
```python
328-
from do_gradientai import GradientAI
328+
from gradient import Gradient
329329

330330
# Configure the default for all requests:
331-
client = GradientAI(
331+
client = Gradient(
332332
# 20 seconds (default is 1 minute)
333333
timeout=20.0,
334334
)
335335

336336
# More granular control:
337-
client = GradientAI(
337+
client = Gradient(
338338
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
339339
)
340340

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

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

363-
You can enable logging by setting the environment variable `GRADIENT_AI_LOG` to `info`.
363+
You can enable logging by setting the environment variable `GRADIENT_LOG` to `info`.
364364

365365
```shell
366-
$ export GRADIENT_AI_LOG=info
366+
$ export GRADIENT_LOG=info
367367
```
368368

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

387387
```py
388-
from do_gradientai import GradientAI
388+
from gradient import Gradient
389389

390-
client = GradientAI()
390+
client = Gradient()
391391
response = client.chat.completions.with_raw_response.create(
392392
messages=[{
393393
"role": "user",
@@ -401,9 +401,9 @@ completion = response.parse() # get the object that `chat.completions.create()`
401401
print(completion.choices)
402402
```
403403

404-
These methods return an [`APIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/do_gradientai/_response.py) object.
404+
These methods return an [`APIResponse`](https://github.com/digitalocean/gradient-python/tree/main/src/gradient/_response.py) object.
405405

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

408408
#### `.with_streaming_response`
409409

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

474474
```python
475475
import httpx
476-
from do_gradientai import GradientAI, DefaultHttpxClient
476+
from gradient import Gradient, DefaultHttpxClient
477477

478-
client = GradientAI(
479-
# Or use the `GRADIENT_AI_BASE_URL` env var
478+
client = Gradient(
479+
# Or use the `GRADIENT_BASE_URL` env var
480480
base_url="http://my.test.server.example.com:8083",
481481
http_client=DefaultHttpxClient(
482482
proxy="http://my.test.proxy.example.com",
@@ -496,9 +496,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
496496
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.
497497

498498
```py
499-
from do_gradientai import GradientAI
499+
from gradient import Gradient
500500

501-
with GradientAI() as client:
501+
with Gradient() as client:
502502
# make requests here
503503
...
504504

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

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

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

520520
### Determining the installed version
521521

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

526526
```py
527-
import do_gradientai
528-
print(do_gradientai.__version__)
527+
import gradient
528+
print(gradient.__version__)
529529
```
530530

531531
## Requirements

0 commit comments

Comments
 (0)