Skip to content

Commit c2b96ce

Browse files
feat(api): manual updates
Add GRADIENTAI_AGENT_KEY
1 parent 6d1a924 commit c2b96ce

File tree

4 files changed

+157
-20
lines changed

4 files changed

+157
-20
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: 76
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradientai-e8b3cbc80e18e4f7f277010349f25e1319156704f359911dc464cc21a0d077a6.yml
33
openapi_spec_hash: c773d792724f5647ae25a5ae4ccec208
4-
config_hash: 1c936b3bd798c3fcb25479b19efa999a
4+
config_hash: 9c2e548d86a376bc5f6c458de6944504

src/gradientai/_client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ class GradientAI(SyncAPIClient):
5656
# client options
5757
api_key: str | None
5858
inference_key: str | None
59+
agent_key: str | None
5960
agent_domain: str | None
6061

6162
def __init__(
6263
self,
6364
*,
6465
api_key: str | None = None,
6566
inference_key: str | None = None,
67+
agent_key: str | None = None,
6668
agent_domain: str | None = None,
6769
base_url: str | httpx.URL | None = None,
6870
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -88,6 +90,7 @@ def __init__(
8890
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
8991
- `api_key` from `GRADIENTAI_API_KEY`
9092
- `inference_key` from `GRADIENTAI_INFERENCE_KEY`
93+
- `agent_key` from `GRADIENTAI_AGENT_KEY`
9194
"""
9295
if api_key is None:
9396
api_key = os.environ.get("GRADIENTAI_API_KEY")
@@ -97,6 +100,10 @@ def __init__(
97100
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
98101
self.inference_key = inference_key
99102

103+
if agent_key is None:
104+
agent_key = os.environ.get("GRADIENTAI_AGENT_KEY")
105+
self.agent_key = agent_key
106+
100107
self.agent_domain = agent_domain
101108

102109
if base_url is None:
@@ -200,6 +207,7 @@ def copy(
200207
*,
201208
api_key: str | None = None,
202209
inference_key: str | None = None,
210+
agent_key: str | None = None,
203211
agent_domain: str | None = None,
204212
base_url: str | httpx.URL | None = None,
205213
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -236,6 +244,7 @@ def copy(
236244
client = self.__class__(
237245
api_key=api_key or self.api_key,
238246
inference_key=inference_key or self.inference_key,
247+
agent_key=agent_key or self.agent_key,
239248
agent_domain=agent_domain or self.agent_domain,
240249
base_url=base_url or self.base_url,
241250
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -290,13 +299,15 @@ class AsyncGradientAI(AsyncAPIClient):
290299
# client options
291300
api_key: str | None
292301
inference_key: str | None
302+
agent_key: str | None
293303
agent_domain: str | None
294304

295305
def __init__(
296306
self,
297307
*,
298308
api_key: str | None = None,
299309
inference_key: str | None = None,
310+
agent_key: str | None = None,
300311
agent_domain: str | None = None,
301312
base_url: str | httpx.URL | None = None,
302313
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -322,6 +333,7 @@ def __init__(
322333
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
323334
- `api_key` from `GRADIENTAI_API_KEY`
324335
- `inference_key` from `GRADIENTAI_INFERENCE_KEY`
336+
- `agent_key` from `GRADIENTAI_AGENT_KEY`
325337
"""
326338
if api_key is None:
327339
api_key = os.environ.get("GRADIENTAI_API_KEY")
@@ -331,6 +343,10 @@ def __init__(
331343
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
332344
self.inference_key = inference_key
333345

346+
if agent_key is None:
347+
agent_key = os.environ.get("GRADIENTAI_AGENT_KEY")
348+
self.agent_key = agent_key
349+
334350
self.agent_domain = agent_domain
335351

336352
if base_url is None:
@@ -434,6 +450,7 @@ def copy(
434450
*,
435451
api_key: str | None = None,
436452
inference_key: str | None = None,
453+
agent_key: str | None = None,
437454
agent_domain: str | None = None,
438455
base_url: str | httpx.URL | None = None,
439456
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -470,6 +487,7 @@ def copy(
470487
client = self.__class__(
471488
api_key=api_key or self.api_key,
472489
inference_key=inference_key or self.inference_key,
490+
agent_key=agent_key or self.agent_key,
473491
agent_domain=agent_domain or self.agent_domain,
474492
base_url=base_url or self.base_url,
475493
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,

tests/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
4747

4848
api_key = "My API Key"
4949
inference_key = "My Inference Key"
50+
agent_key = "My Agent Key"
5051

5152

5253
@pytest.fixture(scope="session")
@@ -56,7 +57,11 @@ def client(request: FixtureRequest) -> Iterator[GradientAI]:
5657
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
5758

5859
with GradientAI(
59-
base_url=base_url, api_key=api_key, inference_key=inference_key, _strict_response_validation=strict
60+
base_url=base_url,
61+
api_key=api_key,
62+
inference_key=inference_key,
63+
agent_key=agent_key,
64+
_strict_response_validation=strict,
6065
) as client:
6166
yield client
6267

@@ -85,6 +90,7 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncGradientAI
8590
base_url=base_url,
8691
api_key=api_key,
8792
inference_key=inference_key,
93+
agent_key=agent_key,
8894
_strict_response_validation=strict,
8995
http_client=http_client,
9096
) as client:

0 commit comments

Comments
 (0)