Skip to content

Commit

Permalink
chore(internal): restructure imports (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Apr 23, 2024
1 parent c117779 commit 4e5eb37
Show file tree
Hide file tree
Showing 42 changed files with 95 additions and 109 deletions.
3 changes: 2 additions & 1 deletion src/openai/resources/audio/transcriptions.py
Expand Up @@ -18,10 +18,11 @@
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, transcription_create_params
from ...types.audio import transcription_create_params
from ..._base_client import (
make_request_options,
)
from ...types.audio.transcription import Transcription

__all__ = ["Transcriptions", "AsyncTranscriptions"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/audio/translations.py
Expand Up @@ -18,10 +18,11 @@
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, translation_create_params
from ...types.audio import translation_create_params
from ..._base_client import (
make_request_options,
)
from ...types.audio.translation import Translation

__all__ = ["Translations", "AsyncTranslations"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/batches.py
Expand Up @@ -8,7 +8,7 @@
import httpx

from .. import _legacy_response
from ..types import Batch, batch_list_params, batch_create_params
from ..types import batch_list_params, batch_create_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
Expand All @@ -18,6 +18,7 @@
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ..pagination import SyncCursorPage, AsyncCursorPage
from ..types.batch import Batch
from .._base_client import (
AsyncPaginator,
make_request_options,
Expand Down
8 changes: 4 additions & 4 deletions src/openai/resources/beta/assistants.py
Expand Up @@ -18,10 +18,6 @@
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...pagination import SyncCursorPage, AsyncCursorPage
from ...types.beta import (
Assistant,
AssistantDeleted,
AssistantToolParam,
AssistantResponseFormatOptionParam,
assistant_list_params,
assistant_create_params,
assistant_update_params,
Expand All @@ -30,6 +26,10 @@
AsyncPaginator,
make_request_options,
)
from ...types.beta.assistant import Assistant
from ...types.beta.assistant_deleted import AssistantDeleted
from ...types.beta.assistant_tool_param import AssistantToolParam
from ...types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam

__all__ = ["Assistants", "AsyncAssistants"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/beta/threads/messages.py
Expand Up @@ -21,7 +21,8 @@
AsyncPaginator,
make_request_options,
)
from ....types.beta.threads import Message, message_list_params, message_create_params, message_update_params
from ....types.beta.threads import message_list_params, message_create_params, message_update_params
from ....types.beta.threads.message import Message

__all__ = ["Messages", "AsyncMessages"]

Expand Down
12 changes: 5 additions & 7 deletions src/openai/resources/beta/threads/runs/runs.py
Expand Up @@ -31,12 +31,6 @@
from ....._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....._streaming import Stream, AsyncStream
from .....pagination import SyncCursorPage, AsyncCursorPage
from .....types.beta import (
AssistantToolParam,
AssistantStreamEvent,
AssistantToolChoiceOptionParam,
AssistantResponseFormatOptionParam,
)
from ....._base_client import (
AsyncPaginator,
make_request_options,
Expand All @@ -50,12 +44,16 @@
AsyncAssistantStreamManager,
)
from .....types.beta.threads import (
Run,
run_list_params,
run_create_params,
run_update_params,
run_submit_tool_outputs_params,
)
from .....types.beta.threads.run import Run
from .....types.beta.assistant_tool_param import AssistantToolParam
from .....types.beta.assistant_stream_event import AssistantStreamEvent
from .....types.beta.assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
from .....types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam

__all__ = ["Runs", "AsyncRuns"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/beta/threads/runs/steps.py
Expand Up @@ -17,7 +17,8 @@
AsyncPaginator,
make_request_options,
)
from .....types.beta.threads.runs import RunStep, step_list_params
from .....types.beta.threads.runs import step_list_params
from .....types.beta.threads.runs.run_step import RunStep

__all__ = ["Steps", "AsyncSteps"]

Expand Down
12 changes: 6 additions & 6 deletions src/openai/resources/beta/threads/threads.py
Expand Up @@ -37,11 +37,6 @@
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...._streaming import Stream, AsyncStream
from ....types.beta import (
Thread,
ThreadDeleted,
AssistantStreamEvent,
AssistantToolChoiceOptionParam,
AssistantResponseFormatOptionParam,
thread_create_params,
thread_update_params,
thread_create_and_run_params,
Expand All @@ -57,7 +52,12 @@
AsyncAssistantEventHandlerT,
AsyncAssistantStreamManager,
)
from ....types.beta.threads import Run
from ....types.beta.thread import Thread
from ....types.beta.threads.run import Run
from ....types.beta.thread_deleted import ThreadDeleted
from ....types.beta.assistant_stream_event import AssistantStreamEvent
from ....types.beta.assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
from ....types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam

__all__ = ["Threads", "AsyncThreads"]

Expand Down
9 changes: 3 additions & 6 deletions src/openai/resources/beta/vector_stores/file_batches.py
Expand Up @@ -26,12 +26,9 @@
AsyncPaginator,
make_request_options,
)
from ....types.beta.vector_stores import (
VectorStoreFile,
VectorStoreFileBatch,
file_batch_create_params,
file_batch_list_files_params,
)
from ....types.beta.vector_stores import file_batch_create_params, file_batch_list_files_params
from ....types.beta.vector_stores.vector_store_file import VectorStoreFile
from ....types.beta.vector_stores.vector_store_file_batch import VectorStoreFileBatch

__all__ = ["FileBatches", "AsyncFileBatches"]

Expand Down
4 changes: 3 additions & 1 deletion src/openai/resources/beta/vector_stores/files.py
Expand Up @@ -22,7 +22,9 @@
AsyncPaginator,
make_request_options,
)
from ....types.beta.vector_stores import VectorStoreFile, VectorStoreFileDeleted, file_list_params, file_create_params
from ....types.beta.vector_stores import file_list_params, file_create_params
from ....types.beta.vector_stores.vector_store_file import VectorStoreFile
from ....types.beta.vector_stores.vector_store_file_deleted import VectorStoreFileDeleted

__all__ = ["Files", "AsyncFiles"]

Expand Down
10 changes: 3 additions & 7 deletions src/openai/resources/beta/vector_stores/vector_stores.py
Expand Up @@ -33,17 +33,13 @@
AsyncFileBatchesWithStreamingResponse,
)
from ....pagination import SyncCursorPage, AsyncCursorPage
from ....types.beta import (
VectorStore,
VectorStoreDeleted,
vector_store_list_params,
vector_store_create_params,
vector_store_update_params,
)
from ....types.beta import vector_store_list_params, vector_store_create_params, vector_store_update_params
from ...._base_client import (
AsyncPaginator,
make_request_options,
)
from ....types.beta.vector_store import VectorStore
from ....types.beta.vector_store_deleted import VectorStoreDeleted

__all__ = ["VectorStores", "AsyncVectorStores"]

Expand Down
16 changes: 7 additions & 9 deletions src/openai/resources/chat/completions.py
Expand Up @@ -8,7 +8,6 @@
import httpx

from ... import _legacy_response
from ...types import ChatModel
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
required_args,
Expand All @@ -19,17 +18,16 @@
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ..._streaming import Stream, AsyncStream
from ...types.chat import (
ChatCompletion,
ChatCompletionChunk,
ChatCompletionToolParam,
ChatCompletionMessageParam,
ChatCompletionToolChoiceOptionParam,
completion_create_params,
)
from ...types.chat import completion_create_params
from ..._base_client import (
make_request_options,
)
from ...types.chat_model import ChatModel
from ...types.chat.chat_completion import ChatCompletion
from ...types.chat.chat_completion_chunk import ChatCompletionChunk
from ...types.chat.chat_completion_tool_param import ChatCompletionToolParam
from ...types.chat.chat_completion_message_param import ChatCompletionMessageParam
from ...types.chat.chat_completion_tool_choice_option_param import ChatCompletionToolChoiceOptionParam

__all__ = ["Completions", "AsyncCompletions"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/completions.py
Expand Up @@ -8,7 +8,7 @@
import httpx

from .. import _legacy_response
from ..types import Completion, completion_create_params
from ..types import completion_create_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
required_args,
Expand All @@ -22,6 +22,7 @@
from .._base_client import (
make_request_options,
)
from ..types.completion import Completion

__all__ = ["Completions", "AsyncCompletions"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/embeddings.py
Expand Up @@ -9,7 +9,7 @@
import httpx

from .. import _legacy_response
from ..types import CreateEmbeddingResponse, embedding_create_params
from ..types import embedding_create_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import is_given, maybe_transform
from .._compat import cached_property
Expand All @@ -19,6 +19,7 @@
from .._base_client import (
make_request_options,
)
from ..types.create_embedding_response import CreateEmbeddingResponse

__all__ = ["Embeddings", "AsyncEmbeddings"]

Expand Down
4 changes: 3 additions & 1 deletion src/openai/resources/files.py
Expand Up @@ -10,7 +10,7 @@
import httpx

from .. import _legacy_response
from ..types import FileObject, FileDeleted, file_list_params, file_create_params
from ..types import file_list_params, file_create_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
from .._utils import (
extract_files,
Expand All @@ -33,6 +33,8 @@
AsyncPaginator,
make_request_options,
)
from ..types.file_object import FileObject
from ..types.file_deleted import FileDeleted

__all__ = ["Files", "AsyncFiles"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/fine_tuning/jobs/checkpoints.py
Expand Up @@ -15,7 +15,8 @@
AsyncPaginator,
make_request_options,
)
from ....types.fine_tuning.jobs import FineTuningJobCheckpoint, checkpoint_list_params
from ....types.fine_tuning.jobs import checkpoint_list_params
from ....types.fine_tuning.jobs.fine_tuning_job_checkpoint import FineTuningJobCheckpoint

__all__ = ["Checkpoints", "AsyncCheckpoints"]

Expand Down
10 changes: 3 additions & 7 deletions src/openai/resources/fine_tuning/jobs/jobs.py
Expand Up @@ -29,13 +29,9 @@
AsyncPaginator,
make_request_options,
)
from ....types.fine_tuning import (
FineTuningJob,
FineTuningJobEvent,
job_list_params,
job_create_params,
job_list_events_params,
)
from ....types.fine_tuning import job_list_params, job_create_params, job_list_events_params
from ....types.fine_tuning.fine_tuning_job import FineTuningJob
from ....types.fine_tuning.fine_tuning_job_event import FineTuningJobEvent

__all__ = ["Jobs", "AsyncJobs"]

Expand Down
8 changes: 2 additions & 6 deletions src/openai/resources/images.py
Expand Up @@ -8,12 +8,7 @@
import httpx

from .. import _legacy_response
from ..types import (
ImagesResponse,
image_edit_params,
image_generate_params,
image_create_variation_params,
)
from ..types import image_edit_params, image_generate_params, image_create_variation_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
from .._utils import (
extract_files,
Expand All @@ -27,6 +22,7 @@
from .._base_client import (
make_request_options,
)
from ..types.images_response import ImagesResponse

__all__ = ["Images", "AsyncImages"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/models.py
Expand Up @@ -5,16 +5,17 @@
import httpx

from .. import _legacy_response
from ..types import Model, ModelDeleted
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ..pagination import SyncPage, AsyncPage
from ..types.model import Model
from .._base_client import (
AsyncPaginator,
make_request_options,
)
from ..types.model_deleted import ModelDeleted

__all__ = ["Models", "AsyncModels"]

Expand Down
3 changes: 2 additions & 1 deletion src/openai/resources/moderations.py
Expand Up @@ -8,7 +8,7 @@
import httpx

from .. import _legacy_response
from ..types import ModerationCreateResponse, moderation_create_params
from ..types import moderation_create_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
Expand All @@ -20,6 +20,7 @@
from .._base_client import (
make_request_options,
)
from ..types.moderation_create_response import ModerationCreateResponse

__all__ = ["Moderations", "AsyncModerations"]

Expand Down
9 changes: 6 additions & 3 deletions src/openai/types/beta/assistant_stream_event.py
Expand Up @@ -4,11 +4,14 @@
from typing_extensions import Literal, Annotated

from .thread import Thread
from ..shared import ErrorObject
from .threads import Run, Message, MessageDeltaEvent
from ..._utils import PropertyInfo
from ..._models import BaseModel
from .threads.runs import RunStep, RunStepDeltaEvent
from .threads.run import Run
from .threads.message import Message
from ..shared.error_object import ErrorObject
from .threads.runs.run_step import RunStep
from .threads.message_delta_event import MessageDeltaEvent
from .threads.runs.run_step_delta_event import RunStepDeltaEvent

__all__ = [
"AssistantStreamEvent",
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/beta/function_tool.py
Expand Up @@ -2,8 +2,8 @@

from typing_extensions import Literal

from ..shared import FunctionDefinition
from ..._models import BaseModel
from ..shared.function_definition import FunctionDefinition

__all__ = ["FunctionTool"]

Expand Down
2 changes: 1 addition & 1 deletion tests/api_resources/audio/test_transcriptions.py
Expand Up @@ -9,7 +9,7 @@

from openai import OpenAI, AsyncOpenAI
from tests.utils import assert_matches_type
from openai.types.audio import Transcription
from openai.types.audio.transcription import Transcription

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand Down

0 comments on commit 4e5eb37

Please sign in to comment.