Skip to content

Commit 34382c0

Browse files
feat(api): update via SDK Studio
1 parent c33920a commit 34382c0

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 58
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradientai-e40feaac59c85aace6aa42d2749b20e0955dbbae58b06c3a650bc03adafcd7b5.yml
33
openapi_spec_hash: 825c1a4816938e9f594b7a8c06692667
4-
config_hash: bae6be3845572f2dadf83c0aad336142
4+
config_hash: a17cf79d9650def96874dbd8e2416faf

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ import os
2828
from gradientai import GradientAI
2929

3030
client = GradientAI(
31-
api_key=os.environ.get(
32-
"DIGITALOCEAN_GRADIENTAI_API_KEY"
33-
), # This is the default and can be omitted
31+
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
3432
)
3533

3634
versions = client.agents.versions.list(
@@ -41,7 +39,7 @@ print(versions.agent_versions)
4139

4240
While you can provide an `api_key` keyword argument,
4341
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
44-
to add `DIGITALOCEAN_GRADIENTAI_API_KEY="My API Key"` to your `.env` file
42+
to add `GRADIENTAI_API_KEY="My API Key"` to your `.env` file
4543
so that your API Key is not stored in source control.
4644

4745
## Async usage
@@ -54,9 +52,7 @@ import asyncio
5452
from gradientai import AsyncGradientAI
5553

5654
client = AsyncGradientAI(
57-
api_key=os.environ.get(
58-
"DIGITALOCEAN_GRADIENTAI_API_KEY"
59-
), # This is the default and can be omitted
55+
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
6056
)
6157

6258

@@ -94,9 +90,7 @@ from gradientai import AsyncGradientAI
9490

9591
async def main() -> None:
9692
async with AsyncGradientAI(
97-
api_key=os.environ.get(
98-
"DIGITALOCEAN_GRADIENTAI_API_KEY"
99-
), # This is the default and can be omitted
93+
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
10094
http_client=DefaultAioHttpClient(),
10195
) as client:
10296
versions = await client.agents.versions.list(

src/gradientai/_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ def __init__(
8282
) -> None:
8383
"""Construct a new synchronous GradientAI client instance.
8484
85-
This automatically infers the `api_key` argument from the `DIGITALOCEAN_GRADIENTAI_API_KEY` environment variable if it is not provided.
85+
This automatically infers the `api_key` argument from the `GRADIENTAI_API_KEY` environment variable if it is not provided.
8686
"""
8787
if api_key is None:
88-
api_key = os.environ.get("DIGITALOCEAN_GRADIENTAI_API_KEY")
88+
api_key = os.environ.get("GRADIENTAI_API_KEY")
8989
if api_key is None:
9090
raise GradientAIError(
91-
"The api_key client option must be set either by passing api_key to the client or by setting the DIGITALOCEAN_GRADIENTAI_API_KEY environment variable"
91+
"The api_key client option must be set either by passing api_key to the client or by setting the GRADIENTAI_API_KEY environment variable"
9292
)
9393
self.api_key = api_key
9494

@@ -301,13 +301,13 @@ def __init__(
301301
) -> None:
302302
"""Construct a new async AsyncGradientAI client instance.
303303
304-
This automatically infers the `api_key` argument from the `DIGITALOCEAN_GRADIENTAI_API_KEY` environment variable if it is not provided.
304+
This automatically infers the `api_key` argument from the `GRADIENTAI_API_KEY` environment variable if it is not provided.
305305
"""
306306
if api_key is None:
307-
api_key = os.environ.get("DIGITALOCEAN_GRADIENTAI_API_KEY")
307+
api_key = os.environ.get("GRADIENTAI_API_KEY")
308308
if api_key is None:
309309
raise GradientAIError(
310-
"The api_key client option must be set either by passing api_key to the client or by setting the DIGITALOCEAN_GRADIENTAI_API_KEY environment variable"
310+
"The api_key client option must be set either by passing api_key to the client or by setting the GRADIENTAI_API_KEY environment variable"
311311
)
312312
self.api_key = api_key
313313

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def test_validate_headers(self) -> None:
341341
assert request.headers.get("Authorization") == f"Bearer {api_key}"
342342

343343
with pytest.raises(GradientAIError):
344-
with update_env(**{"DIGITALOCEAN_GRADIENTAI_API_KEY": Omit()}):
344+
with update_env(**{"GRADIENTAI_API_KEY": Omit()}):
345345
client2 = GradientAI(base_url=base_url, api_key=None, _strict_response_validation=True)
346346
_ = client2
347347

@@ -1153,7 +1153,7 @@ def test_validate_headers(self) -> None:
11531153
assert request.headers.get("Authorization") == f"Bearer {api_key}"
11541154

11551155
with pytest.raises(GradientAIError):
1156-
with update_env(**{"DIGITALOCEAN_GRADIENTAI_API_KEY": Omit()}):
1156+
with update_env(**{"GRADIENTAI_API_KEY": Omit()}):
11571157
client2 = AsyncGradientAI(base_url=base_url, api_key=None, _strict_response_validation=True)
11581158
_ = client2
11591159

0 commit comments

Comments
 (0)