Skip to content

Commit c33d925

Browse files
feat(api): update urls for endpoints
1 parent 0f892ab commit c33d925

21 files changed

Lines changed: 781 additions & 218 deletions

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-2344b44246a44d39ad5b74d3077bd2958745aad67feb15970756532fa0b3f9d6.yml
3-
openapi_spec_hash: a1913979235ce152a8dc380fabe5362e
4-
config_hash: 13e570f98198e8fd1dfcb7ca59d73e0d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-93df5cb3d61c1bbcab2a4bbf3f0775454bd185a400bc140c61dbf36e108dbf89.yml
3+
openapi_spec_hash: 0126adf782c5feac3d8e682e466c3cf7
4+
config_hash: 3f968a57adb20643373c134efc9af01a

src/gradient/resources/agents/chat/completions.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def create(
6464
metadata: Optional[Dict[str, str]] | Omit = omit,
6565
n: Optional[int] | Omit = omit,
6666
presence_penalty: Optional[float] | Omit = omit,
67+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
6768
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
6869
stream: Optional[Literal[False]] | Omit = omit,
6970
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -129,6 +130,9 @@ def create(
129130
whether they appear in the text so far, increasing the model's likelihood to
130131
talk about new topics.
131132
133+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
134+
can result in faster responses and fewer tokens used on reasoning in a response.
135+
132136
stop: Up to 4 sequences where the API will stop generating further tokens. The
133137
returned text will not contain the stop sequence.
134138
@@ -193,6 +197,7 @@ def create(
193197
metadata: Optional[Dict[str, str]] | Omit = omit,
194198
n: Optional[int] | Omit = omit,
195199
presence_penalty: Optional[float] | Omit = omit,
200+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
196201
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
197202
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
198203
temperature: Optional[float] | Omit = omit,
@@ -260,6 +265,9 @@ def create(
260265
whether they appear in the text so far, increasing the model's likelihood to
261266
talk about new topics.
262267
268+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
269+
can result in faster responses and fewer tokens used on reasoning in a response.
270+
263271
stop: Up to 4 sequences where the API will stop generating further tokens. The
264272
returned text will not contain the stop sequence.
265273
@@ -321,6 +329,7 @@ def create(
321329
metadata: Optional[Dict[str, str]] | Omit = omit,
322330
n: Optional[int] | Omit = omit,
323331
presence_penalty: Optional[float] | Omit = omit,
332+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
324333
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
325334
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
326335
temperature: Optional[float] | Omit = omit,
@@ -388,6 +397,9 @@ def create(
388397
whether they appear in the text so far, increasing the model's likelihood to
389398
talk about new topics.
390399
400+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
401+
can result in faster responses and fewer tokens used on reasoning in a response.
402+
391403
stop: Up to 4 sequences where the API will stop generating further tokens. The
392404
returned text will not contain the stop sequence.
393405
@@ -448,6 +460,7 @@ def create(
448460
metadata: Optional[Dict[str, str]] | Omit = omit,
449461
n: Optional[int] | Omit = omit,
450462
presence_penalty: Optional[float] | Omit = omit,
463+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
451464
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
452465
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
453466
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -465,7 +478,9 @@ def create(
465478
timeout: float | httpx.Timeout | None | NotGiven = not_given,
466479
) -> CompletionCreateResponse | Stream[ChatCompletionChunk]:
467480
return self._post(
468-
"/chat/completions?agent=true",
481+
"/chat/completions?agent=true"
482+
if self._client._base_url_overridden
483+
else f"{self._client.agent_endpoint}/api/v1/chat/completions?agent=true",
469484
body=maybe_transform(
470485
{
471486
"messages": messages,
@@ -478,6 +493,7 @@ def create(
478493
"metadata": metadata,
479494
"n": n,
480495
"presence_penalty": presence_penalty,
496+
"reasoning_effort": reasoning_effort,
481497
"stop": stop,
482498
"stream": stream,
483499
"stream_options": stream_options,
@@ -539,6 +555,7 @@ async def create(
539555
metadata: Optional[Dict[str, str]] | Omit = omit,
540556
n: Optional[int] | Omit = omit,
541557
presence_penalty: Optional[float] | Omit = omit,
558+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
542559
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
543560
stream: Optional[Literal[False]] | Omit = omit,
544561
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -604,6 +621,9 @@ async def create(
604621
whether they appear in the text so far, increasing the model's likelihood to
605622
talk about new topics.
606623
624+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
625+
can result in faster responses and fewer tokens used on reasoning in a response.
626+
607627
stop: Up to 4 sequences where the API will stop generating further tokens. The
608628
returned text will not contain the stop sequence.
609629
@@ -668,6 +688,7 @@ async def create(
668688
metadata: Optional[Dict[str, str]] | Omit = omit,
669689
n: Optional[int] | Omit = omit,
670690
presence_penalty: Optional[float] | Omit = omit,
691+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
671692
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
672693
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
673694
temperature: Optional[float] | Omit = omit,
@@ -735,6 +756,9 @@ async def create(
735756
whether they appear in the text so far, increasing the model's likelihood to
736757
talk about new topics.
737758
759+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
760+
can result in faster responses and fewer tokens used on reasoning in a response.
761+
738762
stop: Up to 4 sequences where the API will stop generating further tokens. The
739763
returned text will not contain the stop sequence.
740764
@@ -796,6 +820,7 @@ async def create(
796820
metadata: Optional[Dict[str, str]] | Omit = omit,
797821
n: Optional[int] | Omit = omit,
798822
presence_penalty: Optional[float] | Omit = omit,
823+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
799824
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
800825
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
801826
temperature: Optional[float] | Omit = omit,
@@ -863,6 +888,9 @@ async def create(
863888
whether they appear in the text so far, increasing the model's likelihood to
864889
talk about new topics.
865890
891+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
892+
can result in faster responses and fewer tokens used on reasoning in a response.
893+
866894
stop: Up to 4 sequences where the API will stop generating further tokens. The
867895
returned text will not contain the stop sequence.
868896
@@ -923,6 +951,7 @@ async def create(
923951
metadata: Optional[Dict[str, str]] | Omit = omit,
924952
n: Optional[int] | Omit = omit,
925953
presence_penalty: Optional[float] | Omit = omit,
954+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
926955
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
927956
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
928957
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -940,7 +969,9 @@ async def create(
940969
timeout: float | httpx.Timeout | None | NotGiven = not_given,
941970
) -> CompletionCreateResponse | AsyncStream[ChatCompletionChunk]:
942971
return await self._post(
943-
"/chat/completions?agent=true",
972+
"/chat/completions?agent=true"
973+
if self._client._base_url_overridden
974+
else f"{self._client.agent_endpoint}/api/v1/chat/completions?agent=true",
944975
body=await async_maybe_transform(
945976
{
946977
"messages": messages,
@@ -953,6 +984,7 @@ async def create(
953984
"metadata": metadata,
954985
"n": n,
955986
"presence_penalty": presence_penalty,
987+
"reasoning_effort": reasoning_effort,
956988
"stop": stop,
957989
"stream": stream,
958990
"stream_options": stream_options,

src/gradient/resources/chat/completions.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def create(
6464
metadata: Optional[Dict[str, str]] | Omit = omit,
6565
n: Optional[int] | Omit = omit,
6666
presence_penalty: Optional[float] | Omit = omit,
67+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
6768
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
6869
stream: Optional[Literal[False]] | Omit = omit,
6970
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -129,6 +130,9 @@ def create(
129130
whether they appear in the text so far, increasing the model's likelihood to
130131
talk about new topics.
131132
133+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
134+
can result in faster responses and fewer tokens used on reasoning in a response.
135+
132136
stop: Up to 4 sequences where the API will stop generating further tokens. The
133137
returned text will not contain the stop sequence.
134138
@@ -193,6 +197,7 @@ def create(
193197
metadata: Optional[Dict[str, str]] | Omit = omit,
194198
n: Optional[int] | Omit = omit,
195199
presence_penalty: Optional[float] | Omit = omit,
200+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
196201
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
197202
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
198203
temperature: Optional[float] | Omit = omit,
@@ -260,6 +265,9 @@ def create(
260265
whether they appear in the text so far, increasing the model's likelihood to
261266
talk about new topics.
262267
268+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
269+
can result in faster responses and fewer tokens used on reasoning in a response.
270+
263271
stop: Up to 4 sequences where the API will stop generating further tokens. The
264272
returned text will not contain the stop sequence.
265273
@@ -321,6 +329,7 @@ def create(
321329
metadata: Optional[Dict[str, str]] | Omit = omit,
322330
n: Optional[int] | Omit = omit,
323331
presence_penalty: Optional[float] | Omit = omit,
332+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
324333
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
325334
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
326335
temperature: Optional[float] | Omit = omit,
@@ -388,6 +397,9 @@ def create(
388397
whether they appear in the text so far, increasing the model's likelihood to
389398
talk about new topics.
390399
400+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
401+
can result in faster responses and fewer tokens used on reasoning in a response.
402+
391403
stop: Up to 4 sequences where the API will stop generating further tokens. The
392404
returned text will not contain the stop sequence.
393405
@@ -448,6 +460,7 @@ def create(
448460
metadata: Optional[Dict[str, str]] | Omit = omit,
449461
n: Optional[int] | Omit = omit,
450462
presence_penalty: Optional[float] | Omit = omit,
463+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
451464
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
452465
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
453466
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -465,7 +478,9 @@ def create(
465478
timeout: float | httpx.Timeout | None | NotGiven = not_given,
466479
) -> CompletionCreateResponse | Stream[ChatCompletionChunk]:
467480
return self._post(
468-
"/chat/completions",
481+
"/chat/completions"
482+
if self._client._base_url_overridden
483+
else f"{self._client.inference_endpoint}/v1/chat/completions",
469484
body=maybe_transform(
470485
{
471486
"messages": messages,
@@ -478,6 +493,7 @@ def create(
478493
"metadata": metadata,
479494
"n": n,
480495
"presence_penalty": presence_penalty,
496+
"reasoning_effort": reasoning_effort,
481497
"stop": stop,
482498
"stream": stream,
483499
"stream_options": stream_options,
@@ -539,6 +555,7 @@ async def create(
539555
metadata: Optional[Dict[str, str]] | Omit = omit,
540556
n: Optional[int] | Omit = omit,
541557
presence_penalty: Optional[float] | Omit = omit,
558+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
542559
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
543560
stream: Optional[Literal[False]] | Omit = omit,
544561
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -604,6 +621,9 @@ async def create(
604621
whether they appear in the text so far, increasing the model's likelihood to
605622
talk about new topics.
606623
624+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
625+
can result in faster responses and fewer tokens used on reasoning in a response.
626+
607627
stop: Up to 4 sequences where the API will stop generating further tokens. The
608628
returned text will not contain the stop sequence.
609629
@@ -668,6 +688,7 @@ async def create(
668688
metadata: Optional[Dict[str, str]] | Omit = omit,
669689
n: Optional[int] | Omit = omit,
670690
presence_penalty: Optional[float] | Omit = omit,
691+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
671692
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
672693
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
673694
temperature: Optional[float] | Omit = omit,
@@ -735,6 +756,9 @@ async def create(
735756
whether they appear in the text so far, increasing the model's likelihood to
736757
talk about new topics.
737758
759+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
760+
can result in faster responses and fewer tokens used on reasoning in a response.
761+
738762
stop: Up to 4 sequences where the API will stop generating further tokens. The
739763
returned text will not contain the stop sequence.
740764
@@ -796,6 +820,7 @@ async def create(
796820
metadata: Optional[Dict[str, str]] | Omit = omit,
797821
n: Optional[int] | Omit = omit,
798822
presence_penalty: Optional[float] | Omit = omit,
823+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
799824
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
800825
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
801826
temperature: Optional[float] | Omit = omit,
@@ -863,6 +888,9 @@ async def create(
863888
whether they appear in the text so far, increasing the model's likelihood to
864889
talk about new topics.
865890
891+
reasoning_effort: Constrains effort on reasoning for reasoning models. Reducing reasoning effort
892+
can result in faster responses and fewer tokens used on reasoning in a response.
893+
866894
stop: Up to 4 sequences where the API will stop generating further tokens. The
867895
returned text will not contain the stop sequence.
868896
@@ -923,6 +951,7 @@ async def create(
923951
metadata: Optional[Dict[str, str]] | Omit = omit,
924952
n: Optional[int] | Omit = omit,
925953
presence_penalty: Optional[float] | Omit = omit,
954+
reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] | Omit = omit,
926955
stop: Union[Optional[str], SequenceNotStr[str], None] | Omit = omit,
927956
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
928957
stream_options: Optional[completion_create_params.StreamOptions] | Omit = omit,
@@ -940,7 +969,9 @@ async def create(
940969
timeout: float | httpx.Timeout | None | NotGiven = not_given,
941970
) -> CompletionCreateResponse | AsyncStream[ChatCompletionChunk]:
942971
return await self._post(
943-
"/chat/completions",
972+
"/chat/completions"
973+
if self._client._base_url_overridden
974+
else f"{self._client.inference_endpoint}/v1/chat/completions",
944975
body=await async_maybe_transform(
945976
{
946977
"messages": messages,
@@ -953,6 +984,7 @@ async def create(
953984
"metadata": metadata,
954985
"n": n,
955986
"presence_penalty": presence_penalty,
987+
"reasoning_effort": reasoning_effort,
956988
"stop": stop,
957989
"stream": stream,
958990
"stream_options": stream_options,

src/gradient/resources/images.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ def generate(
309309
timeout: float | httpx.Timeout | None | NotGiven = not_given,
310310
) -> ImageGenerateResponse | Stream[ImageGenStreamEvent]:
311311
return self._post(
312-
"/images/generations",
312+
"/images/generations"
313+
if self._client._base_url_overridden
314+
else f"{self._client.inference_endpoint}/v1/images/generations",
313315
body=maybe_transform(
314316
{
315317
"prompt": prompt,
@@ -621,7 +623,9 @@ async def generate(
621623
timeout: float | httpx.Timeout | None | NotGiven = not_given,
622624
) -> ImageGenerateResponse | AsyncStream[ImageGenStreamEvent]:
623625
return await self._post(
624-
"/images/generations",
626+
"/images/generations"
627+
if self._client._base_url_overridden
628+
else f"{self._client.inference_endpoint}/v1/images/generations",
625629
body=await async_maybe_transform(
626630
{
627631
"prompt": prompt,

0 commit comments

Comments
 (0)