Skip to content

chore(internal): restructure imports #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/openai/resources/audio/transcriptions.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading