Skip to content

Commit 044a233

Browse files
feat(api): manual updates
1 parent 0e8fd1b commit 044a233

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

.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%2Fgradient-9ecd7b6ec2c5f4b9dddde78a975eba587128529bcd7cea1fc82e041ad9450420.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-621c3ebf5011c5ca508f78fccbea17de4ca6b35bfe99578c1ae2265021578d6f.yml
33
openapi_spec_hash: e29d14e3e4679fcf22b3e760e49931b1
4-
config_hash: 868a2e440ec27146f18b1327daa1cd63
4+
config_hash: 6c8d569b60ae6536708a165b72ff838f

src/gradient/_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def __init__(
114114
- `model_access_key` from `GRADIENT_MODEL_ACCESS_KEY`
115115
- `agent_access_key` from `GRADIENT_AGENT_ACCESS_KEY`
116116
- `agent_endpoint` from `GRADIENT_AGENT_ENDPOINT`
117+
- `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT`
117118
"""
118119
if access_token is None:
119120
if api_key is not None:
@@ -150,10 +151,7 @@ def __init__(
150151
self._agent_endpoint = agent_endpoint
151152

152153
if inference_endpoint is None:
153-
inference_endpoint = os.environ.get("GRADIENT_INFERENCE_ENDPOINT")
154-
if inference_endpoint is None:
155-
inference_endpoint = "https://inference.do-ai.run"
156-
154+
inference_endpoint = os.environ.get("GRADIENT_INFERENCE_ENDPOINT") or "inference.do-ai.run"
157155
self.inference_endpoint = inference_endpoint
158156

159157
if base_url is None:
@@ -420,6 +418,7 @@ def __init__(
420418
- `model_access_key` from `GRADIENT_MODEL_ACCESS_KEY`
421419
- `agent_access_key` from `GRADIENT_AGENT_ACCESS_KEY`
422420
- `agent_endpoint` from `GRADIENT_AGENT_ENDPOINT`
421+
- `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT`
423422
"""
424423
if access_token is None:
425424
if api_key is not None:
@@ -455,6 +454,8 @@ def __init__(
455454
agent_endpoint = os.environ.get("GRADIENT_AGENT_ENDPOINT")
456455
self._agent_endpoint = agent_endpoint
457456

457+
if inference_endpoint is None:
458+
inference_endpoint = os.environ.get("GRADIENT_INFERENCE_ENDPOINT") or "inference.do-ai.run"
458459
self.inference_endpoint = inference_endpoint
459460

460461
if base_url is None:

src/gradient/resources/chat/completions.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,9 @@ def create(
473473
}
474474

475475
return self._post(
476-
(
477-
"/chat/completions"
478-
if self._client._base_url_overridden
479-
else f"{self._client.inference_endpoint}/v1/chat/completions"
480-
),
476+
"/chat/completions"
477+
if self._client._base_url_overridden
478+
else f"{self._client.inference_endpoint}/v1/chat/completions",
481479
body=maybe_transform(
482480
{
483481
"messages": messages,
@@ -965,11 +963,9 @@ async def create(
965963
}
966964

967965
return await self._post(
968-
(
969-
"/chat/completions"
970-
if self._client._base_url_overridden
971-
else f"{self._client.inference_endpoint}/chat/completions"
972-
),
966+
"/chat/completions"
967+
if self._client._base_url_overridden
968+
else f"{self._client.inference_endpoint}/v1/chat/completions",
973969
body=await async_maybe_transform(
974970
{
975971
"messages": messages,

0 commit comments

Comments
 (0)