Skip to content

Commit f3a9a92

Browse files
chore(api): event shapes more accurate
1 parent 58c359f commit f3a9a92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+186
-166
lines changed

.stats.yml

Lines changed: 3 additions & 3 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-670ea0d2cc44f52a87dd3cadea45632953283e0636ba30788fdbdb22a232ccac.yml
3-
openapi_spec_hash: d8b7d38911fead545adf3e4297956410
4-
config_hash: b2a4028fdbb27a08de89831ed310e244
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b2a451656ca64d30d174391ebfd94806b4de3ab76dc55b92843cfb7f1a54ecb6.yml
3+
openapi_spec_hash: 27d9691b400f28c17ef063a1374048b0
4+
config_hash: e822d0c9082c8b312264403949243179

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,6 @@ from openai.types.responses import (
791791
ResponseOutputTextAnnotationAddedEvent,
792792
ResponsePrompt,
793793
ResponseQueuedEvent,
794-
ResponseReasoningDeltaEvent,
795-
ResponseReasoningDoneEvent,
796794
ResponseReasoningItem,
797795
ResponseReasoningSummaryDeltaEvent,
798796
ResponseReasoningSummaryDoneEvent,

src/openai/lib/streaming/responses/_events.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
ResponseRefusalDoneEvent,
2222
ResponseRefusalDeltaEvent,
2323
ResponseMcpCallFailedEvent,
24-
ResponseReasoningDoneEvent,
2524
ResponseOutputItemDoneEvent,
26-
ResponseReasoningDeltaEvent,
2725
ResponseContentPartDoneEvent,
2826
ResponseOutputItemAddedEvent,
2927
ResponseContentPartAddedEvent,
@@ -139,10 +137,8 @@ class ResponseCompletedEvent(RawResponseCompletedEvent, GenericModel, Generic[Te
139137
ResponseMcpListToolsInProgressEvent,
140138
ResponseOutputTextAnnotationAddedEvent,
141139
ResponseQueuedEvent,
142-
ResponseReasoningDeltaEvent,
143140
ResponseReasoningSummaryDeltaEvent,
144141
ResponseReasoningSummaryDoneEvent,
145-
ResponseReasoningDoneEvent,
146142
],
147143
PropertyInfo(discriminator="type"),
148144
]

src/openai/lib/streaming/responses/_responses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def handle_event(self, event: RawResponseStreamEvent) -> List[ResponseStreamEven
264264
item_id=event.item_id,
265265
output_index=event.output_index,
266266
sequence_number=event.sequence_number,
267+
logprobs=event.logprobs,
267268
type="response.output_text.delta",
268269
snapshot=content.text,
269270
)
@@ -282,6 +283,7 @@ def handle_event(self, event: RawResponseStreamEvent) -> List[ResponseStreamEven
282283
item_id=event.item_id,
283284
output_index=event.output_index,
284285
sequence_number=event.sequence_number,
286+
logprobs=event.logprobs,
285287
type="response.output_text.done",
286288
text=event.text,
287289
parsed=parse_text(event.text, text_format=self._text_format),

src/openai/resources/audio/speech.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def create(
5050
*,
5151
input: str,
5252
model: Union[str, SpeechModel],
53-
voice: Union[
54-
str, Literal["alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"]
55-
],
53+
voice: Union[str, Literal["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"]],
5654
instructions: str | NotGiven = NOT_GIVEN,
5755
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
5856
speed: float | NotGiven = NOT_GIVEN,
@@ -146,9 +144,7 @@ async def create(
146144
*,
147145
input: str,
148146
model: Union[str, SpeechModel],
149-
voice: Union[
150-
str, Literal["alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"]
151-
],
147+
voice: Union[str, Literal["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"]],
152148
instructions: str | NotGiven = NOT_GIVEN,
153149
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
154150
speed: float | NotGiven = NOT_GIVEN,

src/openai/resources/beta/realtime/sessions.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ def create(
6666
tools: Iterable[session_create_params.Tool] | NotGiven = NOT_GIVEN,
6767
tracing: session_create_params.Tracing | NotGiven = NOT_GIVEN,
6868
turn_detection: session_create_params.TurnDetection | NotGiven = NOT_GIVEN,
69-
voice: Union[
70-
str, Literal["alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"]
71-
]
69+
voice: Union[str, Literal["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"]]
7270
| NotGiven = NOT_GIVEN,
7371
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7472
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -163,8 +161,7 @@ def create(
163161
164162
voice: The voice the model uses to respond. Voice cannot be changed during the session
165163
once the model has responded with audio at least once. Current voice options are
166-
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
167-
`shimmer`, and `verse`.
164+
`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
168165
169166
extra_headers: Send extra headers
170167
@@ -251,9 +248,7 @@ async def create(
251248
tools: Iterable[session_create_params.Tool] | NotGiven = NOT_GIVEN,
252249
tracing: session_create_params.Tracing | NotGiven = NOT_GIVEN,
253250
turn_detection: session_create_params.TurnDetection | NotGiven = NOT_GIVEN,
254-
voice: Union[
255-
str, Literal["alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"]
256-
]
251+
voice: Union[str, Literal["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"]]
257252
| NotGiven = NOT_GIVEN,
258253
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
259254
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -348,8 +343,7 @@ async def create(
348343
349344
voice: The voice the model uses to respond. Voice cannot be changed during the session
350345
once the model has responded with audio at least once. Current voice options are
351-
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
352-
`shimmer`, and `verse`.
346+
`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
353347
354348
extra_headers: Send extra headers
355349

src/openai/resources/chat/completions/completions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def create(
417417
- If set to 'auto', then the request will be processed with the service tier
418418
configured in the Project settings. Unless otherwise configured, the Project
419419
will use 'default'.
420-
- If set to 'default', then the requset will be processed with the standard
420+
- If set to 'default', then the request will be processed with the standard
421421
pricing and performance for the selected model.
422422
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
423423
'priority', then the request will be processed with the corresponding service
@@ -697,7 +697,7 @@ def create(
697697
- If set to 'auto', then the request will be processed with the service tier
698698
configured in the Project settings. Unless otherwise configured, the Project
699699
will use 'default'.
700-
- If set to 'default', then the requset will be processed with the standard
700+
- If set to 'default', then the request will be processed with the standard
701701
pricing and performance for the selected model.
702702
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
703703
'priority', then the request will be processed with the corresponding service
@@ -968,7 +968,7 @@ def create(
968968
- If set to 'auto', then the request will be processed with the service tier
969969
configured in the Project settings. Unless otherwise configured, the Project
970970
will use 'default'.
971-
- If set to 'default', then the requset will be processed with the standard
971+
- If set to 'default', then the request will be processed with the standard
972972
pricing and performance for the selected model.
973973
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
974974
'priority', then the request will be processed with the corresponding service
@@ -1784,7 +1784,7 @@ async def create(
17841784
- If set to 'auto', then the request will be processed with the service tier
17851785
configured in the Project settings. Unless otherwise configured, the Project
17861786
will use 'default'.
1787-
- If set to 'default', then the requset will be processed with the standard
1787+
- If set to 'default', then the request will be processed with the standard
17881788
pricing and performance for the selected model.
17891789
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
17901790
'priority', then the request will be processed with the corresponding service
@@ -2064,7 +2064,7 @@ async def create(
20642064
- If set to 'auto', then the request will be processed with the service tier
20652065
configured in the Project settings. Unless otherwise configured, the Project
20662066
will use 'default'.
2067-
- If set to 'default', then the requset will be processed with the standard
2067+
- If set to 'default', then the request will be processed with the standard
20682068
pricing and performance for the selected model.
20692069
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
20702070
'priority', then the request will be processed with the corresponding service
@@ -2335,7 +2335,7 @@ async def create(
23352335
- If set to 'auto', then the request will be processed with the service tier
23362336
configured in the Project settings. Unless otherwise configured, the Project
23372337
will use 'default'.
2338-
- If set to 'default', then the requset will be processed with the standard
2338+
- If set to 'default', then the request will be processed with the standard
23392339
pricing and performance for the selected model.
23402340
- If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
23412341
'priority', then the request will be processed with the corresponding service

src/openai/resources/images.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ def edit(
196196
responses that return partial images. Value must be between 0 and 3. When set to
197197
0, the response will be a single image sent in one streaming event.
198198
199+
Note that the final image may be sent before the full number of partial images
200+
are generated if the full image is generated more quickly.
201+
199202
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
200203
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
201204
Defaults to `auto`.
@@ -310,6 +313,9 @@ def edit(
310313
responses that return partial images. Value must be between 0 and 3. When set to
311314
0, the response will be a single image sent in one streaming event.
312315
316+
Note that the final image may be sent before the full number of partial images
317+
are generated if the full image is generated more quickly.
318+
313319
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
314320
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
315321
Defaults to `auto`.
@@ -420,6 +426,9 @@ def edit(
420426
responses that return partial images. Value must be between 0 and 3. When set to
421427
0, the response will be a single image sent in one streaming event.
422428
429+
Note that the final image may be sent before the full number of partial images
430+
are generated if the full image is generated more quickly.
431+
423432
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
424433
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
425434
Defaults to `auto`.
@@ -579,6 +588,9 @@ def generate(
579588
responses that return partial images. Value must be between 0 and 3. When set to
580589
0, the response will be a single image sent in one streaming event.
581590
591+
Note that the final image may be sent before the full number of partial images
592+
are generated if the full image is generated more quickly.
593+
582594
quality: The quality of the image that will be generated.
583595
584596
- `auto` (default value) will automatically select the best quality for the
@@ -690,6 +702,9 @@ def generate(
690702
responses that return partial images. Value must be between 0 and 3. When set to
691703
0, the response will be a single image sent in one streaming event.
692704
705+
Note that the final image may be sent before the full number of partial images
706+
are generated if the full image is generated more quickly.
707+
693708
quality: The quality of the image that will be generated.
694709
695710
- `auto` (default value) will automatically select the best quality for the
@@ -797,6 +812,9 @@ def generate(
797812
responses that return partial images. Value must be between 0 and 3. When set to
798813
0, the response will be a single image sent in one streaming event.
799814
815+
Note that the final image may be sent before the full number of partial images
816+
are generated if the full image is generated more quickly.
817+
800818
quality: The quality of the image that will be generated.
801819
802820
- `auto` (default value) will automatically select the best quality for the
@@ -1066,6 +1084,9 @@ async def edit(
10661084
responses that return partial images. Value must be between 0 and 3. When set to
10671085
0, the response will be a single image sent in one streaming event.
10681086
1087+
Note that the final image may be sent before the full number of partial images
1088+
are generated if the full image is generated more quickly.
1089+
10691090
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
10701091
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
10711092
Defaults to `auto`.
@@ -1180,6 +1201,9 @@ async def edit(
11801201
responses that return partial images. Value must be between 0 and 3. When set to
11811202
0, the response will be a single image sent in one streaming event.
11821203
1204+
Note that the final image may be sent before the full number of partial images
1205+
are generated if the full image is generated more quickly.
1206+
11831207
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
11841208
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
11851209
Defaults to `auto`.
@@ -1290,6 +1314,9 @@ async def edit(
12901314
responses that return partial images. Value must be between 0 and 3. When set to
12911315
0, the response will be a single image sent in one streaming event.
12921316
1317+
Note that the final image may be sent before the full number of partial images
1318+
are generated if the full image is generated more quickly.
1319+
12931320
quality: The quality of the image that will be generated. `high`, `medium` and `low` are
12941321
only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
12951322
Defaults to `auto`.
@@ -1449,6 +1476,9 @@ async def generate(
14491476
responses that return partial images. Value must be between 0 and 3. When set to
14501477
0, the response will be a single image sent in one streaming event.
14511478
1479+
Note that the final image may be sent before the full number of partial images
1480+
are generated if the full image is generated more quickly.
1481+
14521482
quality: The quality of the image that will be generated.
14531483
14541484
- `auto` (default value) will automatically select the best quality for the
@@ -1560,6 +1590,9 @@ async def generate(
15601590
responses that return partial images. Value must be between 0 and 3. When set to
15611591
0, the response will be a single image sent in one streaming event.
15621592
1593+
Note that the final image may be sent before the full number of partial images
1594+
are generated if the full image is generated more quickly.
1595+
15631596
quality: The quality of the image that will be generated.
15641597
15651598
- `auto` (default value) will automatically select the best quality for the
@@ -1667,6 +1700,9 @@ async def generate(
16671700
responses that return partial images. Value must be between 0 and 3. When set to
16681701
0, the response will be a single image sent in one streaming event.
16691702
1703+
Note that the final image may be sent before the full number of partial images
1704+
are generated if the full image is generated more quickly.
1705+
16701706
quality: The quality of the image that will be generated.
16711707
16721708
- `auto` (default value) will automatically select the best quality for the

0 commit comments

Comments
 (0)