Commit ece795f0
Changed files (32)
src
openai
resources
types
audio
beta
fine_tuning
src/openai/resources/audio/speech.py
@@ -22,9 +22,8 @@ from ..._response import (
async_to_custom_streamed_response_wrapper,
)
from ...types.audio import speech_create_params
-from ..._base_client import (
- make_request_options,
-)
+from ..._base_client import make_request_options
+from ...types.audio.speech_model import SpeechModel
__all__ = ["Speech", "AsyncSpeech"]
@@ -42,7 +41,7 @@ class Speech(SyncAPIResource):
self,
*,
input: str,
- model: Union[str, Literal["tts-1", "tts-1-hd"]],
+ model: Union[str, SpeechModel],
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
@@ -115,7 +114,7 @@ class AsyncSpeech(AsyncAPIResource):
self,
*,
input: str,
- model: Union[str, Literal["tts-1", "tts-1-hd"]],
+ model: Union[str, SpeechModel],
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
src/openai/resources/audio/transcriptions.py
@@ -19,9 +19,8 @@ from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...types.audio import transcription_create_params
-from ..._base_client import (
- make_request_options,
-)
+from ..._base_client import make_request_options
+from ...types.audio_model import AudioModel
from ...types.audio.transcription import Transcription
__all__ = ["Transcriptions", "AsyncTranscriptions"]
@@ -40,7 +39,7 @@ class Transcriptions(SyncAPIResource):
self,
*,
file: FileTypes,
- model: Union[str, Literal["whisper-1"]],
+ model: Union[str, AudioModel],
language: str | NotGiven = NOT_GIVEN,
prompt: str | NotGiven = NOT_GIVEN,
response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN,
@@ -136,7 +135,7 @@ class AsyncTranscriptions(AsyncAPIResource):
self,
*,
file: FileTypes,
- model: Union[str, Literal["whisper-1"]],
+ model: Union[str, AudioModel],
language: str | NotGiven = NOT_GIVEN,
prompt: str | NotGiven = NOT_GIVEN,
response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN,
src/openai/resources/audio/translations.py
@@ -3,7 +3,6 @@
from __future__ import annotations
from typing import Union, Mapping, cast
-from typing_extensions import Literal
import httpx
@@ -19,9 +18,8 @@ from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...types.audio import translation_create_params
-from ..._base_client import (
- make_request_options,
-)
+from ..._base_client import make_request_options
+from ...types.audio_model import AudioModel
from ...types.audio.translation import Translation
__all__ = ["Translations", "AsyncTranslations"]
@@ -40,7 +38,7 @@ class Translations(SyncAPIResource):
self,
*,
file: FileTypes,
- model: Union[str, Literal["whisper-1"]],
+ model: Union[str, AudioModel],
prompt: str | NotGiven = NOT_GIVEN,
response_format: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
@@ -121,7 +119,7 @@ class AsyncTranslations(AsyncAPIResource):
self,
*,
file: FileTypes,
- model: Union[str, Literal["whisper-1"]],
+ model: Union[str, AudioModel],
prompt: str | NotGiven = NOT_GIVEN,
response_format: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
src/openai/resources/beta/threads/runs/runs.py
@@ -30,10 +30,7 @@ from ....._resource import SyncAPIResource, AsyncAPIResource
from ....._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....._streaming import Stream, AsyncStream
from .....pagination import SyncCursorPage, AsyncCursorPage
-from ....._base_client import (
- AsyncPaginator,
- make_request_options,
-)
+from ....._base_client import AsyncPaginator, make_request_options
from .....lib.streaming import (
AssistantEventHandler,
AssistantEventHandlerT,
@@ -42,6 +39,7 @@ from .....lib.streaming import (
AsyncAssistantEventHandlerT,
AsyncAssistantStreamManager,
)
+from .....types.chat_model import ChatModel
from .....types.beta.threads import (
run_list_params,
run_create_params,
@@ -82,35 +80,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
@@ -237,35 +207,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -391,35 +333,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -544,35 +458,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
@@ -817,35 +703,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -913,33 +771,8 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -969,33 +802,8 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1025,33 +833,8 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1096,6 +879,7 @@ class Runs(SyncAPIResource):
"stream": True,
"tools": tools,
"truncation_strategy": truncation_strategy,
+ "parallel_tool_calls": parallel_tool_calls,
"top_p": top_p,
},
run_create_params.RunCreateParams,
@@ -1165,33 +949,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1220,33 +978,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1275,33 +1007,7 @@ class Runs(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1668,35 +1374,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
@@ -1823,35 +1501,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1977,35 +1627,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -2130,35 +1752,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
@@ -2403,35 +1997,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -2499,33 +2065,8 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2555,33 +2096,8 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2611,33 +2127,8 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2685,6 +2176,7 @@ class AsyncRuns(AsyncAPIResource):
"tools": tools,
"truncation_strategy": truncation_strategy,
"top_p": top_p,
+ "parallel_tool_calls": parallel_tool_calls,
},
run_create_params.RunCreateParams,
),
@@ -2753,33 +2245,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2808,33 +2274,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2863,33 +2303,7 @@ class AsyncRuns(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
src/openai/resources/beta/threads/threads.py
@@ -41,9 +41,7 @@ from ....types.beta import (
thread_update_params,
thread_create_and_run_params,
)
-from ...._base_client import (
- make_request_options,
-)
+from ...._base_client import make_request_options
from ....lib.streaming import (
AssistantEventHandler,
AssistantEventHandlerT,
@@ -52,6 +50,7 @@ from ....lib.streaming import (
AsyncAssistantEventHandlerT,
AsyncAssistantStreamManager,
)
+from ....types.chat_model import ChatModel
from ....types.beta.thread import Thread
from ....types.beta.threads.run import Run
from ....types.beta.thread_deleted import ThreadDeleted
@@ -264,35 +263,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
@@ -418,35 +389,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -571,35 +514,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -723,35 +638,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
@@ -809,35 +696,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -893,35 +752,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -950,35 +781,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1007,35 +810,7 @@ class Threads(SyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1296,35 +1071,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
@@ -1450,35 +1197,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1603,35 +1322,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1755,35 +1446,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
@@ -1841,35 +1504,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1927,35 +1562,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1984,35 +1591,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -2041,35 +1620,7 @@ class AsyncThreads(AsyncAPIResource):
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
max_prompt_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
- | NotGiven = NOT_GIVEN,
+ model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
src/openai/resources/beta/assistants.py
@@ -22,10 +22,8 @@ from ...types.beta import (
assistant_create_params,
assistant_update_params,
)
-from ..._base_client import (
- AsyncPaginator,
- make_request_options,
-)
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.chat_model import ChatModel
from ...types.beta.assistant import Assistant
from ...types.beta.assistant_deleted import AssistantDeleted
from ...types.beta.assistant_tool_param import AssistantToolParam
@@ -46,33 +44,7 @@ class Assistants(SyncAPIResource):
def create(
self,
*,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- ],
+ model: Union[str, ChatModel],
description: Optional[str] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
@@ -437,33 +409,7 @@ class AsyncAssistants(AsyncAPIResource):
async def create(
self,
*,
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- ],
+ model: Union[str, ChatModel],
description: Optional[str] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
src/openai/resources/images.py
@@ -19,9 +19,8 @@ from .._utils import (
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
-from .._base_client import (
- make_request_options,
-)
+from .._base_client import make_request_options
+from ..types.image_model import ImageModel
from ..types.images_response import ImagesResponse
__all__ = ["Images", "AsyncImages"]
@@ -40,7 +39,7 @@ class Images(SyncAPIResource):
self,
*,
image: FileTypes,
- model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
@@ -115,7 +114,7 @@ class Images(SyncAPIResource):
image: FileTypes,
prompt: str,
mask: FileTypes | NotGiven = NOT_GIVEN,
- model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
@@ -196,7 +195,7 @@ class Images(SyncAPIResource):
self,
*,
prompt: str,
- model: Union[str, Literal["dall-e-2", "dall-e-3"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
quality: Literal["standard", "hd"] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
@@ -286,7 +285,7 @@ class AsyncImages(AsyncAPIResource):
self,
*,
image: FileTypes,
- model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
@@ -361,7 +360,7 @@ class AsyncImages(AsyncAPIResource):
image: FileTypes,
prompt: str,
mask: FileTypes | NotGiven = NOT_GIVEN,
- model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
@@ -442,7 +441,7 @@ class AsyncImages(AsyncAPIResource):
self,
*,
prompt: str,
- model: Union[str, Literal["dall-e-2", "dall-e-3"], None] | NotGiven = NOT_GIVEN,
+ model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
quality: Literal["standard", "hd"] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
src/openai/resources/moderations.py
@@ -3,7 +3,6 @@
from __future__ import annotations
from typing import List, Union
-from typing_extensions import Literal
import httpx
@@ -17,9 +16,8 @@ from .._utils import (
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
-from .._base_client import (
- make_request_options,
-)
+from .._base_client import make_request_options
+from ..types.moderation_model import ModerationModel
from ..types.moderation_create_response import ModerationCreateResponse
__all__ = ["Moderations", "AsyncModerations"]
@@ -38,7 +36,7 @@ class Moderations(SyncAPIResource):
self,
*,
input: Union[str, List[str]],
- model: Union[str, Literal["text-moderation-latest", "text-moderation-stable"]] | NotGiven = NOT_GIVEN,
+ model: Union[str, ModerationModel] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -98,7 +96,7 @@ class AsyncModerations(AsyncAPIResource):
self,
*,
input: Union[str, List[str]],
- model: Union[str, Literal["text-moderation-latest", "text-moderation-stable"]] | NotGiven = NOT_GIVEN,
+ model: Union[str, ModerationModel] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
src/openai/types/audio/__init__.py
@@ -3,6 +3,7 @@
from __future__ import annotations
from .translation import Translation as Translation
+from .speech_model import SpeechModel as SpeechModel
from .transcription import Transcription as Transcription
from .speech_create_params import SpeechCreateParams as SpeechCreateParams
from .translation_create_params import TranslationCreateParams as TranslationCreateParams
src/openai/types/audio/speech_create_params.py
@@ -5,6 +5,8 @@ from __future__ import annotations
from typing import Union
from typing_extensions import Literal, Required, TypedDict
+from .speech_model import SpeechModel
+
__all__ = ["SpeechCreateParams"]
@@ -12,7 +14,7 @@ class SpeechCreateParams(TypedDict, total=False):
input: Required[str]
"""The text to generate audio for. The maximum length is 4096 characters."""
- model: Required[Union[str, Literal["tts-1", "tts-1-hd"]]]
+ model: Required[Union[str, SpeechModel]]
"""
One of the available [TTS models](https://platform.openai.com/docs/models/tts):
`tts-1` or `tts-1-hd`
src/openai/types/audio/speech_model.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+__all__ = ["SpeechModel"]
+
+SpeechModel = Literal["tts-1", "tts-1-hd"]
src/openai/types/audio/transcription.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from ..._models import BaseModel
__all__ = ["Transcription"]
src/openai/types/audio/transcription_create_params.py
@@ -6,6 +6,7 @@ from typing import List, Union
from typing_extensions import Literal, Required, TypedDict
from ..._types import FileTypes
+from ..audio_model import AudioModel
__all__ = ["TranscriptionCreateParams"]
@@ -17,7 +18,7 @@ class TranscriptionCreateParams(TypedDict, total=False):
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
"""
- model: Required[Union[str, Literal["whisper-1"]]]
+ model: Required[Union[str, AudioModel]]
"""ID of the model to use.
Only `whisper-1` (which is powered by our open source Whisper V2 model) is
src/openai/types/audio/translation.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from ..._models import BaseModel
__all__ = ["Translation"]
src/openai/types/audio/translation_create_params.py
@@ -3,9 +3,10 @@
from __future__ import annotations
from typing import Union
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Required, TypedDict
from ..._types import FileTypes
+from ..audio_model import AudioModel
__all__ = ["TranslationCreateParams"]
@@ -17,7 +18,7 @@ class TranslationCreateParams(TypedDict, total=False):
mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
"""
- model: Required[Union[str, Literal["whisper-1"]]]
+ model: Required[Union[str, AudioModel]]
"""ID of the model to use.
Only `whisper-1` (which is powered by our open source Whisper V2 model) is
src/openai/types/beta/threads/run_create_params.py
@@ -5,6 +5,7 @@ from __future__ import annotations
from typing import Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
+from ...chat_model import ChatModel
from ..assistant_tool_param import AssistantToolParam
from .message_content_part_param import MessageContentPartParam
from ..code_interpreter_tool_param import CodeInterpreterToolParam
@@ -74,34 +75,7 @@ class RunCreateParamsBase(TypedDict, total=False):
a maxium of 512 characters long.
"""
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
+ model: Union[str, ChatModel, None]
"""
The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
be used to execute this run. If a value is provided here, it will override the
src/openai/types/beta/assistant_create_params.py
@@ -5,6 +5,7 @@ from __future__ import annotations
from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
+from ..chat_model import ChatModel
from .assistant_tool_param import AssistantToolParam
from .assistant_response_format_option_param import AssistantResponseFormatOptionParam
@@ -22,35 +23,7 @@ __all__ = [
class AssistantCreateParams(TypedDict, total=False):
- model: Required[
- Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- ]
- ]
+ model: Required[Union[str, ChatModel]]
"""ID of the model to use.
You can use the
src/openai/types/beta/assistant_tool_choice_function.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from ..._models import BaseModel
__all__ = ["AssistantToolChoiceFunction"]
src/openai/types/beta/thread_create_and_run_params.py
@@ -5,6 +5,7 @@ from __future__ import annotations
from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
+from ..chat_model import ChatModel
from .function_tool_param import FunctionToolParam
from .file_search_tool_param import FileSearchToolParam
from .code_interpreter_tool_param import CodeInterpreterToolParam
@@ -77,34 +78,7 @@ class ThreadCreateAndRunParamsBase(TypedDict, total=False):
a maxium of 512 characters long.
"""
- model: Union[
- str,
- Literal[
- "gpt-4o",
- "gpt-4o-2024-05-13",
- "gpt-4o-mini",
- "gpt-4o-mini-2024-07-18",
- "gpt-4-turbo",
- "gpt-4-turbo-2024-04-09",
- "gpt-4-0125-preview",
- "gpt-4-turbo-preview",
- "gpt-4-1106-preview",
- "gpt-4-vision-preview",
- "gpt-4",
- "gpt-4-0314",
- "gpt-4-0613",
- "gpt-4-32k",
- "gpt-4-32k-0314",
- "gpt-4-32k-0613",
- "gpt-3.5-turbo",
- "gpt-3.5-turbo-16k",
- "gpt-3.5-turbo-0613",
- "gpt-3.5-turbo-1106",
- "gpt-3.5-turbo-0125",
- "gpt-3.5-turbo-16k-0613",
- ],
- None,
- ]
+ model: Union[str, ChatModel, None]
"""
The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
be used to execute this run. If a value is provided here, it will override the
src/openai/types/fine_tuning/fine_tuning_job_integration.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from .fine_tuning_job_wandb_integration_object import FineTuningJobWandbIntegrationObject
FineTuningJobIntegration = FineTuningJobWandbIntegrationObject
src/openai/types/__init__.py
@@ -15,14 +15,17 @@ from .embedding import Embedding as Embedding
from .chat_model import ChatModel as ChatModel
from .completion import Completion as Completion
from .moderation import Moderation as Moderation
+from .audio_model import AudioModel as AudioModel
from .batch_error import BatchError as BatchError
from .file_object import FileObject as FileObject
+from .image_model import ImageModel as ImageModel
from .file_content import FileContent as FileContent
from .file_deleted import FileDeleted as FileDeleted
from .model_deleted import ModelDeleted as ModelDeleted
from .images_response import ImagesResponse as ImagesResponse
from .completion_usage import CompletionUsage as CompletionUsage
from .file_list_params import FileListParams as FileListParams
+from .moderation_model import ModerationModel as ModerationModel
from .batch_list_params import BatchListParams as BatchListParams
from .completion_choice import CompletionChoice as CompletionChoice
from .image_edit_params import ImageEditParams as ImageEditParams
src/openai/types/audio_model.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+__all__ = ["AudioModel"]
+
+AudioModel = Literal["whisper-1"]
src/openai/types/batch_request_counts.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from .._models import BaseModel
__all__ = ["BatchRequestCounts"]
src/openai/types/completion_usage.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from .._models import BaseModel
__all__ = ["CompletionUsage"]
src/openai/types/image_create_variation_params.py
@@ -6,6 +6,7 @@ from typing import Union, Optional
from typing_extensions import Literal, Required, TypedDict
from .._types import FileTypes
+from .image_model import ImageModel
__all__ = ["ImageCreateVariationParams"]
@@ -17,7 +18,7 @@ class ImageCreateVariationParams(TypedDict, total=False):
Must be a valid PNG file, less than 4MB, and square.
"""
- model: Union[str, Literal["dall-e-2"], None]
+ model: Union[str, ImageModel, None]
"""The model to use for image generation.
Only `dall-e-2` is supported at this time.
src/openai/types/image_edit_params.py
@@ -6,6 +6,7 @@ from typing import Union, Optional
from typing_extensions import Literal, Required, TypedDict
from .._types import FileTypes
+from .image_model import ImageModel
__all__ = ["ImageEditParams"]
@@ -31,7 +32,7 @@ class ImageEditParams(TypedDict, total=False):
PNG file, less than 4MB, and have the same dimensions as `image`.
"""
- model: Union[str, Literal["dall-e-2"], None]
+ model: Union[str, ImageModel, None]
"""The model to use for image generation.
Only `dall-e-2` is supported at this time.
src/openai/types/image_generate_params.py
@@ -5,6 +5,8 @@ from __future__ import annotations
from typing import Union, Optional
from typing_extensions import Literal, Required, TypedDict
+from .image_model import ImageModel
+
__all__ = ["ImageGenerateParams"]
@@ -16,7 +18,7 @@ class ImageGenerateParams(TypedDict, total=False):
`dall-e-3`.
"""
- model: Union[str, Literal["dall-e-2", "dall-e-3"], None]
+ model: Union[str, ImageModel, None]
"""The model to use for image generation."""
n: Optional[int]
src/openai/types/image_model.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+__all__ = ["ImageModel"]
+
+ImageModel = Literal["dall-e-2", "dall-e-3"]
src/openai/types/model_deleted.py
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
from .._models import BaseModel
__all__ = ["ModelDeleted"]
src/openai/types/moderation_create_params.py
@@ -3,7 +3,9 @@
from __future__ import annotations
from typing import List, Union
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Required, TypedDict
+
+from .moderation_model import ModerationModel
__all__ = ["ModerationCreateParams"]
@@ -12,7 +14,7 @@ class ModerationCreateParams(TypedDict, total=False):
input: Required[Union[str, List[str]]]
"""The input text to classify"""
- model: Union[str, Literal["text-moderation-latest", "text-moderation-stable"]]
+ model: Union[str, ModerationModel]
"""
Two content moderations models are available: `text-moderation-stable` and
`text-moderation-latest`.
src/openai/types/moderation_model.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+__all__ = ["ModerationModel"]
+
+ModerationModel = Literal["text-moderation-latest", "text-moderation-stable"]
api.md
@@ -92,7 +92,7 @@ Methods:
Types:
```python
-from openai.types import Image, ImagesResponse
+from openai.types import Image, ImageModel, ImagesResponse
```
Methods:
@@ -103,6 +103,12 @@ Methods:
# Audio
+Types:
+
+```python
+from openai.types import AudioModel
+```
+
## Transcriptions
Types:
@@ -129,6 +135,12 @@ Methods:
## Speech
+Types:
+
+```python
+from openai.types.audio import SpeechModel
+```
+
Methods:
- <code title="post /audio/speech">client.audio.speech.<a href="./src/openai/resources/audio/speech.py">create</a>(\*\*<a href="src/openai/types/audio/speech_create_params.py">params</a>) -> HttpxBinaryResponseContent</code>
@@ -138,7 +150,7 @@ Methods:
Types:
```python
-from openai.types import Moderation, ModerationCreateResponse
+from openai.types import Moderation, ModerationModel, ModerationCreateResponse
```
Methods: