Skip to content

Commit 6321004

Browse files
feat(api): adding new image model support
1 parent 1c1d144 commit 6321004

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

+2367
-515
lines changed

.stats.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5633633cc38734869cf7d993f7b549bb8e4d10e0ec45381ec2cd91507cd8eb8f.yml
3-
openapi_spec_hash: c855121b2b2324b99499c9244c21d24d
4-
config_hash: d20837393b73efdb19cd08e04c1cc9a1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3+
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4+
config_hash: b597cd9a31e9e5ec709e2eefb4c54122

api.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Methods:
277277

278278
- <code title="post /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">create</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_create_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_create_response.py">SyncPage[PermissionCreateResponse]</a></code>
279279
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">retrieve</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_retrieve_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_retrieve_response.py">PermissionRetrieveResponse</a></code>
280-
- <code title="delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">delete</a>(fine_tuned_model_checkpoint) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_delete_response.py">PermissionDeleteResponse</a></code>
280+
- <code title="delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">delete</a>(permission_id, \*, fine_tuned_model_checkpoint) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_delete_response.py">PermissionDeleteResponse</a></code>
281281

282282
# VectorStores
283283

@@ -689,6 +689,10 @@ from openai.types.responses import (
689689
ResponseOutputRefusal,
690690
ResponseOutputText,
691691
ResponseReasoningItem,
692+
ResponseReasoningSummaryPartAddedEvent,
693+
ResponseReasoningSummaryPartDoneEvent,
694+
ResponseReasoningSummaryTextDeltaEvent,
695+
ResponseReasoningSummaryTextDoneEvent,
692696
ResponseRefusalDeltaEvent,
693697
ResponseRefusalDoneEvent,
694698
ResponseStatus,

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

+34
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class AsyncRealtimeConnection:
233233
response: AsyncRealtimeResponseResource
234234
input_audio_buffer: AsyncRealtimeInputAudioBufferResource
235235
conversation: AsyncRealtimeConversationResource
236+
output_audio_buffer: AsyncRealtimeOutputAudioBufferResource
236237
transcription_session: AsyncRealtimeTranscriptionSessionResource
237238

238239
_connection: AsyncWebsocketConnection
@@ -244,6 +245,7 @@ def __init__(self, connection: AsyncWebsocketConnection) -> None:
244245
self.response = AsyncRealtimeResponseResource(self)
245246
self.input_audio_buffer = AsyncRealtimeInputAudioBufferResource(self)
246247
self.conversation = AsyncRealtimeConversationResource(self)
248+
self.output_audio_buffer = AsyncRealtimeOutputAudioBufferResource(self)
247249
self.transcription_session = AsyncRealtimeTranscriptionSessionResource(self)
248250

249251
async def __aiter__(self) -> AsyncIterator[RealtimeServerEvent]:
@@ -413,6 +415,7 @@ class RealtimeConnection:
413415
response: RealtimeResponseResource
414416
input_audio_buffer: RealtimeInputAudioBufferResource
415417
conversation: RealtimeConversationResource
418+
output_audio_buffer: RealtimeOutputAudioBufferResource
416419
transcription_session: RealtimeTranscriptionSessionResource
417420

418421
_connection: WebsocketConnection
@@ -424,6 +427,7 @@ def __init__(self, connection: WebsocketConnection) -> None:
424427
self.response = RealtimeResponseResource(self)
425428
self.input_audio_buffer = RealtimeInputAudioBufferResource(self)
426429
self.conversation = RealtimeConversationResource(self)
430+
self.output_audio_buffer = RealtimeOutputAudioBufferResource(self)
427431
self.transcription_session = RealtimeTranscriptionSessionResource(self)
428432

429433
def __iter__(self) -> Iterator[RealtimeServerEvent]:
@@ -808,6 +812,21 @@ def retrieve(self, *, item_id: str, event_id: str | NotGiven = NOT_GIVEN) -> Non
808812
)
809813

810814

815+
class RealtimeOutputAudioBufferResource(BaseRealtimeConnectionResource):
816+
def clear(self, *, event_id: str | NotGiven = NOT_GIVEN) -> None:
817+
"""**WebRTC Only:** Emit to cut off the current audio response.
818+
819+
This will trigger the server to
820+
stop generating audio and emit a `output_audio_buffer.cleared` event. This
821+
event should be preceded by a `response.cancel` client event to stop the
822+
generation of the current response.
823+
[Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc).
824+
"""
825+
self._connection.send(
826+
cast(RealtimeClientEventParam, strip_not_given({"type": "output_audio_buffer.clear", "event_id": event_id}))
827+
)
828+
829+
811830
class RealtimeTranscriptionSessionResource(BaseRealtimeConnectionResource):
812831
def update(
813832
self, *, session: transcription_session_update_param.Session, event_id: str | NotGiven = NOT_GIVEN
@@ -1045,6 +1064,21 @@ async def retrieve(self, *, item_id: str, event_id: str | NotGiven = NOT_GIVEN)
10451064
)
10461065

10471066

1067+
class AsyncRealtimeOutputAudioBufferResource(BaseAsyncRealtimeConnectionResource):
1068+
async def clear(self, *, event_id: str | NotGiven = NOT_GIVEN) -> None:
1069+
"""**WebRTC Only:** Emit to cut off the current audio response.
1070+
1071+
This will trigger the server to
1072+
stop generating audio and emit a `output_audio_buffer.cleared` event. This
1073+
event should be preceded by a `response.cancel` client event to stop the
1074+
generation of the current response.
1075+
[Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc).
1076+
"""
1077+
await self._connection.send(
1078+
cast(RealtimeClientEventParam, strip_not_given({"type": "output_audio_buffer.clear", "event_id": event_id}))
1079+
)
1080+
1081+
10481082
class AsyncRealtimeTranscriptionSessionResource(BaseAsyncRealtimeConnectionResource):
10491083
async def update(
10501084
self, *, session: transcription_session_update_param.Session, event_id: str | NotGiven = NOT_GIVEN

src/openai/resources/beta/threads/threads.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from ....types.shared.chat_model import ChatModel
5151
from ....types.beta.thread_deleted import ThreadDeleted
5252
from ....types.shared_params.metadata import Metadata
53+
from ....types.beta.assistant_tool_param import AssistantToolParam
5354
from ....types.beta.assistant_stream_event import AssistantStreamEvent
5455
from ....types.beta.assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
5556
from ....types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam
@@ -282,7 +283,7 @@ def create_and_run(
282283
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
283284
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
284285
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
285-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
286+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
286287
top_p: Optional[float] | NotGiven = NOT_GIVEN,
287288
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
288289
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -415,7 +416,7 @@ def create_and_run(
415416
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
416417
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
417418
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
418-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
419+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
419420
top_p: Optional[float] | NotGiven = NOT_GIVEN,
420421
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
421422
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -548,7 +549,7 @@ def create_and_run(
548549
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
549550
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
550551
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
551-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
552+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
552553
top_p: Optional[float] | NotGiven = NOT_GIVEN,
553554
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
554555
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -681,7 +682,7 @@ def create_and_run(
681682
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
682683
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
683684
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
684-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
685+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
685686
top_p: Optional[float] | NotGiven = NOT_GIVEN,
686687
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
687688
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1131,7 +1132,7 @@ async def create_and_run(
11311132
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
11321133
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
11331134
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
1134-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
1135+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
11351136
top_p: Optional[float] | NotGiven = NOT_GIVEN,
11361137
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
11371138
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1264,7 +1265,7 @@ async def create_and_run(
12641265
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
12651266
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
12661267
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
1267-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
1268+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
12681269
top_p: Optional[float] | NotGiven = NOT_GIVEN,
12691270
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
12701271
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1397,7 +1398,7 @@ async def create_and_run(
13971398
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
13981399
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
13991400
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
1400-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
1401+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
14011402
top_p: Optional[float] | NotGiven = NOT_GIVEN,
14021403
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
14031404
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1530,7 +1531,7 @@ async def create_and_run(
15301531
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
15311532
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
15321533
tool_resources: Optional[thread_create_and_run_params.ToolResources] | NotGiven = NOT_GIVEN,
1533-
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
1534+
tools: Optional[Iterable[AssistantToolParam]] | NotGiven = NOT_GIVEN,
15341535
top_p: Optional[float] | NotGiven = NOT_GIVEN,
15351536
truncation_strategy: Optional[thread_create_and_run_params.TruncationStrategy] | NotGiven = NOT_GIVEN,
15361537
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.

src/openai/resources/evals/evals.py

-8
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def create(
6565
testing_criteria: Iterable[eval_create_params.TestingCriterion],
6666
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
6767
name: str | NotGiven = NOT_GIVEN,
68-
share_with_openai: bool | NotGiven = NOT_GIVEN,
6968
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7069
# The extra values given here take precedence over values defined on the client or passed to this method.
7170
extra_headers: Headers | None = None,
@@ -94,8 +93,6 @@ def create(
9493
9594
name: The name of the evaluation.
9695
97-
share_with_openai: Indicates whether the evaluation is shared with OpenAI.
98-
9996
extra_headers: Send extra headers
10097
10198
extra_query: Add additional query parameters to the request
@@ -112,7 +109,6 @@ def create(
112109
"testing_criteria": testing_criteria,
113110
"metadata": metadata,
114111
"name": name,
115-
"share_with_openai": share_with_openai,
116112
},
117113
eval_create_params.EvalCreateParams,
118114
),
@@ -328,7 +324,6 @@ async def create(
328324
testing_criteria: Iterable[eval_create_params.TestingCriterion],
329325
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
330326
name: str | NotGiven = NOT_GIVEN,
331-
share_with_openai: bool | NotGiven = NOT_GIVEN,
332327
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
333328
# The extra values given here take precedence over values defined on the client or passed to this method.
334329
extra_headers: Headers | None = None,
@@ -357,8 +352,6 @@ async def create(
357352
358353
name: The name of the evaluation.
359354
360-
share_with_openai: Indicates whether the evaluation is shared with OpenAI.
361-
362355
extra_headers: Send extra headers
363356
364357
extra_query: Add additional query parameters to the request
@@ -375,7 +368,6 @@ async def create(
375368
"testing_criteria": testing_criteria,
376369
"metadata": metadata,
377370
"name": name,
378-
"share_with_openai": share_with_openai,
379371
},
380372
eval_create_params.EvalCreateParams,
381373
),

src/openai/resources/evals/runs/runs.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def list(
176176
order: Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for
177177
descending order. Defaults to `asc`.
178178
179-
status: Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" |
180-
"canceled".
179+
status: Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed`
180+
| `canceled`.
181181
182182
extra_headers: Send extra headers
183183
@@ -425,8 +425,8 @@ def list(
425425
order: Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for
426426
descending order. Defaults to `asc`.
427427
428-
status: Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" |
429-
"canceled".
428+
status: Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed`
429+
| `canceled`.
430430
431431
extra_headers: Send extra headers
432432

src/openai/resources/fine_tuning/checkpoints/permissions.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ def retrieve(
151151

152152
def delete(
153153
self,
154-
fine_tuned_model_checkpoint: str,
154+
permission_id: str,
155155
*,
156+
fine_tuned_model_checkpoint: str,
156157
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157158
# The extra values given here take precedence over values defined on the client or passed to this method.
158159
extra_headers: Headers | None = None,
@@ -179,8 +180,10 @@ def delete(
179180
raise ValueError(
180181
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
181182
)
183+
if not permission_id:
184+
raise ValueError(f"Expected a non-empty value for `permission_id` but received {permission_id!r}")
182185
return self._delete(
183-
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
186+
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}",
184187
options=make_request_options(
185188
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
186189
),
@@ -316,8 +319,9 @@ async def retrieve(
316319

317320
async def delete(
318321
self,
319-
fine_tuned_model_checkpoint: str,
322+
permission_id: str,
320323
*,
324+
fine_tuned_model_checkpoint: str,
321325
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
322326
# The extra values given here take precedence over values defined on the client or passed to this method.
323327
extra_headers: Headers | None = None,
@@ -344,8 +348,10 @@ async def delete(
344348
raise ValueError(
345349
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
346350
)
351+
if not permission_id:
352+
raise ValueError(f"Expected a non-empty value for `permission_id` but received {permission_id!r}")
347353
return await self._delete(
348-
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
354+
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}",
349355
options=make_request_options(
350356
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
351357
),

0 commit comments

Comments
 (0)