Skip to content

Commit f4e41b8

Browse files
fix(client): fix verbosity parameter location in Responses
fixes error with unsupported `verbosity` parameter by correctly placing it inside the `text` parameter
1 parent 09f98ac commit f4e41b8

File tree

6 files changed

+37
-53
lines changed

6 files changed

+37
-53
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: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-56d3a72a5caa187aebcf9de169a6a28a9dc3f70a79d7467a03a9e22595936066.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6a1bfd4738fff02ef5becc3fdb2bf0cd6c026f2c924d4147a2a515474477dd9a.yml
33
openapi_spec_hash: 3eb8d86c06f0bb5e1190983e5acfc9ba
4-
config_hash: 7e18239879286d68a48ac5487a649aa6
4+
config_hash: a67c5e195a59855fe8a5db0dc61a3e7f

src/openai/resources/responses/responses.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def create(
102102
top_p: Optional[float] | NotGiven = NOT_GIVEN,
103103
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
104104
user: str | NotGiven = NOT_GIVEN,
105-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
106105
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
107106
# The extra values given here take precedence over values defined on the client or passed to this method.
108107
extra_headers: Headers | None = None,
@@ -291,10 +290,6 @@ def create(
291290
similar requests and to help OpenAI detect and prevent abuse.
292291
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
293292
294-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
295-
more concise responses, while higher values will result in more verbose
296-
responses. Currently supported values are `low`, `medium`, and `high`.
297-
298293
extra_headers: Send extra headers
299294
300295
extra_query: Add additional query parameters to the request
@@ -335,7 +330,6 @@ def create(
335330
top_p: Optional[float] | NotGiven = NOT_GIVEN,
336331
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
337332
user: str | NotGiven = NOT_GIVEN,
338-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
339333
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
340334
# The extra values given here take precedence over values defined on the client or passed to this method.
341335
extra_headers: Headers | None = None,
@@ -524,10 +518,6 @@ def create(
524518
similar requests and to help OpenAI detect and prevent abuse.
525519
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
526520
527-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
528-
more concise responses, while higher values will result in more verbose
529-
responses. Currently supported values are `low`, `medium`, and `high`.
530-
531521
extra_headers: Send extra headers
532522
533523
extra_query: Add additional query parameters to the request
@@ -568,7 +558,6 @@ def create(
568558
top_p: Optional[float] | NotGiven = NOT_GIVEN,
569559
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
570560
user: str | NotGiven = NOT_GIVEN,
571-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
572561
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
573562
# The extra values given here take precedence over values defined on the client or passed to this method.
574563
extra_headers: Headers | None = None,
@@ -757,10 +746,6 @@ def create(
757746
similar requests and to help OpenAI detect and prevent abuse.
758747
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
759748
760-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
761-
more concise responses, while higher values will result in more verbose
762-
responses. Currently supported values are `low`, `medium`, and `high`.
763-
764749
extra_headers: Send extra headers
765750
766751
extra_query: Add additional query parameters to the request
@@ -800,7 +785,6 @@ def create(
800785
top_p: Optional[float] | NotGiven = NOT_GIVEN,
801786
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
802787
user: str | NotGiven = NOT_GIVEN,
803-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
804788
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
805789
# The extra values given here take precedence over values defined on the client or passed to this method.
806790
extra_headers: Headers | None = None,
@@ -838,7 +822,6 @@ def create(
838822
"top_p": top_p,
839823
"truncation": truncation,
840824
"user": user,
841-
"verbosity": verbosity,
842825
},
843826
response_create_params.ResponseCreateParamsStreaming
844827
if stream
@@ -1485,7 +1468,6 @@ async def create(
14851468
top_p: Optional[float] | NotGiven = NOT_GIVEN,
14861469
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
14871470
user: str | NotGiven = NOT_GIVEN,
1488-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
14891471
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14901472
# The extra values given here take precedence over values defined on the client or passed to this method.
14911473
extra_headers: Headers | None = None,
@@ -1674,10 +1656,6 @@ async def create(
16741656
similar requests and to help OpenAI detect and prevent abuse.
16751657
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
16761658
1677-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
1678-
more concise responses, while higher values will result in more verbose
1679-
responses. Currently supported values are `low`, `medium`, and `high`.
1680-
16811659
extra_headers: Send extra headers
16821660
16831661
extra_query: Add additional query parameters to the request
@@ -1718,7 +1696,6 @@ async def create(
17181696
top_p: Optional[float] | NotGiven = NOT_GIVEN,
17191697
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
17201698
user: str | NotGiven = NOT_GIVEN,
1721-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
17221699
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
17231700
# The extra values given here take precedence over values defined on the client or passed to this method.
17241701
extra_headers: Headers | None = None,
@@ -1907,10 +1884,6 @@ async def create(
19071884
similar requests and to help OpenAI detect and prevent abuse.
19081885
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
19091886
1910-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
1911-
more concise responses, while higher values will result in more verbose
1912-
responses. Currently supported values are `low`, `medium`, and `high`.
1913-
19141887
extra_headers: Send extra headers
19151888
19161889
extra_query: Add additional query parameters to the request
@@ -1951,7 +1924,6 @@ async def create(
19511924
top_p: Optional[float] | NotGiven = NOT_GIVEN,
19521925
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
19531926
user: str | NotGiven = NOT_GIVEN,
1954-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
19551927
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
19561928
# The extra values given here take precedence over values defined on the client or passed to this method.
19571929
extra_headers: Headers | None = None,
@@ -2140,10 +2112,6 @@ async def create(
21402112
similar requests and to help OpenAI detect and prevent abuse.
21412113
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
21422114
2143-
verbosity: Constrains the verbosity of the model's response. Lower values will result in
2144-
more concise responses, while higher values will result in more verbose
2145-
responses. Currently supported values are `low`, `medium`, and `high`.
2146-
21472115
extra_headers: Send extra headers
21482116
21492117
extra_query: Add additional query parameters to the request
@@ -2183,7 +2151,6 @@ async def create(
21832151
top_p: Optional[float] | NotGiven = NOT_GIVEN,
21842152
truncation: Optional[Literal["auto", "disabled"]] | NotGiven = NOT_GIVEN,
21852153
user: str | NotGiven = NOT_GIVEN,
2186-
verbosity: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
21872154
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
21882155
# The extra values given here take precedence over values defined on the client or passed to this method.
21892156
extra_headers: Headers | None = None,
@@ -2221,7 +2188,6 @@ async def create(
22212188
"top_p": top_p,
22222189
"truncation": truncation,
22232190
"user": user,
2224-
"verbosity": verbosity,
22252191
},
22262192
response_create_params.ResponseCreateParamsStreaming
22272193
if stream

src/openai/types/responses/response_create_params.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,6 @@ class ResponseCreateParamsBase(TypedDict, total=False):
253253
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
254254
"""
255255

256-
verbosity: Optional[Literal["low", "medium", "high"]]
257-
"""Constrains the verbosity of the model's response.
258-
259-
Lower values will result in more concise responses, while higher values will
260-
result in more verbose responses. Currently supported values are `low`,
261-
`medium`, and `high`.
262-
"""
263-
264256

265257
class StreamOptions(TypedDict, total=False):
266258
include_obfuscation: bool

src/openai/types/responses/response_text_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import Optional
4+
from typing_extensions import Literal
45

56
from ..._models import BaseModel
67
from .response_format_text_config import ResponseFormatTextConfig
@@ -24,3 +25,11 @@ class ResponseTextConfig(BaseModel):
2425
ensures the message the model generates is valid JSON. Using `json_schema` is
2526
preferred for models that support it.
2627
"""
28+
29+
verbosity: Optional[Literal["low", "medium", "high"]] = None
30+
"""Constrains the verbosity of the model's response.
31+
32+
Lower values will result in more concise responses, while higher values will
33+
result in more verbose responses. Currently supported values are `low`,
34+
`medium`, and `high`.
35+
"""

src/openai/types/responses/response_text_config_param.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import TypedDict
5+
from typing import Optional
6+
from typing_extensions import Literal, TypedDict
67

78
from .response_format_text_config_param import ResponseFormatTextConfigParam
89

@@ -25,3 +26,11 @@ class ResponseTextConfigParam(TypedDict, total=False):
2526
ensures the message the model generates is valid JSON. Using `json_schema` is
2627
preferred for models that support it.
2728
"""
29+
30+
verbosity: Optional[Literal["low", "medium", "high"]]
31+
"""Constrains the verbosity of the model's response.
32+
33+
Lower values will result in more concise responses, while higher values will
34+
result in more verbose responses. Currently supported values are `low`,
35+
`medium`, and `high`.
36+
"""

tests/api_resources/test_responses.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
5555
stream=False,
5656
stream_options={"include_obfuscation": True},
5757
temperature=1,
58-
text={"format": {"type": "text"}},
58+
text={
59+
"format": {"type": "text"},
60+
"verbosity": "low",
61+
},
5962
tool_choice="none",
6063
tools=[
6164
{
@@ -70,7 +73,6 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
7073
top_p=1,
7174
truncation="auto",
7275
user="user-1234",
73-
verbosity="low",
7476
)
7577
assert_matches_type(Response, response, path=["response"])
7678

@@ -131,7 +133,10 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
131133
store=True,
132134
stream_options={"include_obfuscation": True},
133135
temperature=1,
134-
text={"format": {"type": "text"}},
136+
text={
137+
"format": {"type": "text"},
138+
"verbosity": "low",
139+
},
135140
tool_choice="none",
136141
tools=[
137142
{
@@ -146,7 +151,6 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
146151
top_p=1,
147152
truncation="auto",
148153
user="user-1234",
149-
verbosity="low",
150154
)
151155
response_stream.response.close()
152156

@@ -402,7 +406,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
402406
stream=False,
403407
stream_options={"include_obfuscation": True},
404408
temperature=1,
405-
text={"format": {"type": "text"}},
409+
text={
410+
"format": {"type": "text"},
411+
"verbosity": "low",
412+
},
406413
tool_choice="none",
407414
tools=[
408415
{
@@ -417,7 +424,6 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
417424
top_p=1,
418425
truncation="auto",
419426
user="user-1234",
420-
verbosity="low",
421427
)
422428
assert_matches_type(Response, response, path=["response"])
423429

@@ -478,7 +484,10 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
478484
store=True,
479485
stream_options={"include_obfuscation": True},
480486
temperature=1,
481-
text={"format": {"type": "text"}},
487+
text={
488+
"format": {"type": "text"},
489+
"verbosity": "low",
490+
},
482491
tool_choice="none",
483492
tools=[
484493
{
@@ -493,7 +502,6 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
493502
top_p=1,
494503
truncation="auto",
495504
user="user-1234",
496-
verbosity="low",
497505
)
498506
await response_stream.response.aclose()
499507

0 commit comments

Comments
 (0)