repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_models.py
tests/test_models.py
import json from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone from typing_extensions import Literal, Annotated, TypeAliasType import pytest import pydantic from pydantic import Field from openai._utils import PropertyInfo from openai._compat import PYDANT...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/conftest.py
tests/conftest.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator import httpx import pytest from pytest_asyncio import is_async_test from openai import OpenAI, AsyncOpenAI, Defa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/utils.py
tests/utils.py
from __future__ import annotations import io import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, Sequence, ForwardRef, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type import rich from openai._types im...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_response.py
tests/test_response.py
import json from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from openai import OpenAI, BaseModel, AsyncOpenAI from openai._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, BinaryAPIResponse, AsyncBinaryAP...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_transform.py
tests/test_transform.py
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from openai._types import Base64FileInput, omit, not_given from opena...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/__init__.py
tests/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_client.py
tests/test_client.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import gc import os import sys import json import asyncio import inspect import tracemalloc from typing import Any, Union, Protocol, cast from unittest import mock from typing_extensions import Lit...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/compat/test_tool_param.py
tests/compat/test_tool_param.py
from openai.types.chat import ChatCompletionToolParam def test_tool_param_can_be_instantiated() -> None: assert ChatCompletionToolParam(type="function", function={"name": "test"}) == { "function": {"name": "test"}, "type": "function", }
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_moderations.py
tests/api_resources/test_moderations.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import ModerationCreateResponse base_url...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_completions.py
tests/api_resources/test_completions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import Completion base_url = os.environ....
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_evals.py
tests/api_resources/test_evals.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import ( EvalListResponse, EvalCr...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_batches.py
tests/api_resources/test_batches.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import Batch from openai.pagination impor...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_files.py
tests/api_resources/test_files.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import httpx import pytest from respx import MockRouter import openai._legacy_response as _legacy_response from openai import OpenAI, AsyncOpenAI from tests...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_responses.py
tests/api_resources/test_responses.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai._utils import assert_signatures_in_sync from op...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_uploads.py
tests/api_resources/test_uploads.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import Upload base_url = os.environ.get(...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_realtime.py
tests/api_resources/test_realtime.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os import pytest base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestRealtime: parametrize = pytest.mark.parametrize("client", [False, True], indirect=T...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_containers.py
tests/api_resources/test_containers.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import ( ContainerListResponse, C...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_webhooks.py
tests/api_resources/test_webhooks.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from unittest import mock import pytest import openai from openai._exceptions import InvalidWebhookSignatureError base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010"...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_models.py
tests/api_resources/test_models.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import Model, ModelDeleted from openai.pa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/__init__.py
tests/api_resources/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_conversations.py
tests/api_resources/test_conversations.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.conversations import ( Conversation, ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_videos.py
tests/api_resources/test_videos.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import httpx import pytest from respx import MockRouter import openai._legacy_response as _legacy_response from openai import OpenAI, AsyncOpenAI from tests...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_vector_stores.py
tests/api_resources/test_vector_stores.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import ( VectorStore, VectorStore...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_images.py
tests/api_resources/test_images.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import ImagesResponse base_url = os.envi...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/test_embeddings.py
tests/api_resources/test_embeddings.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types import CreateEmbeddingResponse base_url ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/chat/test_completions.py
tests/api_resources/chat/test_completions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest import pydantic from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPag...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/chat/__init__.py
tests/api_resources/chat/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/chat/completions/__init__.py
tests/api_resources/chat/completions/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/chat/completions/test_messages.py
tests/api_resources/chat/completions/test_messages.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/evals/__init__.py
tests/api_resources/evals/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/evals/test_runs.py
tests/api_resources/evals/test_runs.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/evals/runs/test_output_items.py
tests/api_resources/evals/runs/test_output_items.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/evals/runs/__init__.py
tests/api_resources/evals/runs/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/test_realtime.py
tests/api_resources/beta/test_realtime.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os import pytest # pyright: reportDeprecated=false base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestRealtime: parametrize = pytest.mark.parametrize(...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/test_assistants.py
tests/api_resources/beta/test_assistants.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/test_threads.py
tests/api_resources/beta/test_threads.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.beta import ( Thread, ThreadDelet...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/__init__.py
tests/api_resources/beta/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/threads/__init__.py
tests/api_resources/beta/threads/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/threads/test_runs.py
tests/api_resources/beta/threads/test_runs.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/threads/test_messages.py
tests/api_resources/beta/threads/test_messages.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/threads/runs/__init__.py
tests/api_resources/beta/threads/runs/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/threads/runs/test_steps.py
tests/api_resources/beta/threads/runs/test_steps.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/chatkit/test_sessions.py
tests/api_resources/beta/chatkit/test_sessions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.beta.chatkit import ( ChatSession, ) ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/chatkit/test_threads.py
tests/api_resources/beta/chatkit/test_threads.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncConversationCursorPage, A...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/beta/chatkit/__init__.py
tests/api_resources/beta/chatkit/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/audio/test_transcriptions.py
tests/api_resources/audio/test_transcriptions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.audio import TranscriptionCreateResponse ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/audio/test_speech.py
tests/api_resources/audio/test_speech.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import httpx import pytest from respx import MockRouter import openai._legacy_response as _legacy_response from openai import OpenAI, AsyncOpenAI from tests...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/audio/test_translations.py
tests/api_resources/audio/test_translations.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.audio import TranslationCreateResponse b...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/audio/__init__.py
tests/api_resources/audio/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/uploads/test_parts.py
tests/api_resources/uploads/test_parts.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.uploads import UploadPart base_url = os....
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/uploads/__init__.py
tests/api_resources/uploads/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/test_jobs.py
tests/api_resources/fine_tuning/test_jobs.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/__init__.py
tests/api_resources/fine_tuning/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/jobs/test_checkpoints.py
tests/api_resources/fine_tuning/jobs/test_checkpoints.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/jobs/__init__.py
tests/api_resources/fine_tuning/jobs/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/checkpoints/__init__.py
tests/api_resources/fine_tuning/checkpoints/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/checkpoints/test_permissions.py
tests/api_resources/fine_tuning/checkpoints/test_permissions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncPage, AsyncPage from open...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/alpha/__init__.py
tests/api_resources/fine_tuning/alpha/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/fine_tuning/alpha/test_graders.py
tests/api_resources/fine_tuning/alpha/test_graders.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.fine_tuning.alpha import ( GraderRunR...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/conversations/test_items.py
tests/api_resources/conversations/test_items.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncConversationCursorPage, A...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/conversations/__init__.py
tests/api_resources/conversations/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/vector_stores/test_files.py
tests/api_resources/vector_stores/test_files.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai._utils import assert_signatures_in_sync from op...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/vector_stores/test_file_batches.py
tests/api_resources/vector_stores/test_file_batches.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/vector_stores/__init__.py
tests/api_resources/vector_stores/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/containers/test_files.py
tests/api_resources/containers/test_files.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/containers/__init__.py
tests/api_resources/containers/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/containers/files/test_content.py
tests/api_resources/containers/files/test_content.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import httpx import pytest from respx import MockRouter import openai._legacy_response as _legacy_response from openai import OpenAI, AsyncOpenAI from tests...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/containers/files/__init__.py
tests/api_resources/containers/files/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/realtime/test_client_secrets.py
tests/api_resources/realtime/test_client_secrets.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.realtime import ClientSecretCreateRespons...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/realtime/test_calls.py
tests/api_resources/realtime/test_calls.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import httpx import pytest from respx import MockRouter import openai._legacy_response as _legacy_response from openai import OpenAI, AsyncOpenAI from tests...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/realtime/__init__.py
tests/api_resources/realtime/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/responses/test_input_items.py
tests/api_resources/responses/test_input_items.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.pagination import SyncCursorPage, AsyncCursorPa...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/responses/test_input_tokens.py
tests/api_resources/responses/test_input_tokens.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import os from typing import Any, cast import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type from openai.types.responses import InputTokenCountResponse ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/api_resources/responses/__init__.py
tests/api_resources/responses/__init__.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/test_pydantic.py
tests/lib/test_pydantic.py
from __future__ import annotations from enum import Enum from pydantic import Field, BaseModel from inline_snapshot import snapshot import openai from openai._compat import PYDANTIC_V1 from openai.lib._pydantic import to_strict_json_schema from .schema_types.query import Query def test_most_types() -> None: i...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/test_assistants.py
tests/lib/test_assistants.py
from __future__ import annotations import pytest from openai import OpenAI, AsyncOpenAI from openai._utils import assert_signatures_in_sync @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) def test_create_and_run_poll_method_definition_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpe...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/test_azure.py
tests/lib/test_azure.py
from __future__ import annotations import logging from typing import Union, cast from typing_extensions import Literal, Protocol import httpx import pytest from respx import MockRouter from openai._utils import SensitiveHeadersFilter, is_dict from openai._models import FinalRequestOptions from openai.lib.azure impor...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/test_audio.py
tests/lib/test_audio.py
from __future__ import annotations import sys import inspect import typing_extensions from typing import get_args import pytest from openai import OpenAI, AsyncOpenAI from tests.utils import evaluate_forwardref from openai._utils import assert_signatures_in_sync from openai._compat import is_literal_type from openai...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/utils.py
tests/lib/utils.py
from __future__ import annotations import inspect from typing import Any, Iterable from typing_extensions import TypeAlias import pytest import pydantic from ..utils import rich_print_str ReprArgs: TypeAlias = "Iterable[tuple[str | None, Any]]" def print_obj(obj: object, monkeypatch: pytest.MonkeyPatch) -> str: ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/__init__.py
tests/lib/__init__.py
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/test_old_api.py
tests/lib/test_old_api.py
import pytest import openai from openai.lib._old_api import APIRemovedInV1 def test_basic_attribute_access_works() -> None: for attr in dir(openai): getattr(openai, attr) def test_helpful_error_is_raised() -> None: with pytest.raises(APIRemovedInV1): openai.Completion.create() # type: igno...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/snapshots.py
tests/lib/snapshots.py
from __future__ import annotations import os import json from typing import Any, Callable, Awaitable from typing_extensions import TypeVar import httpx from respx import MockRouter from inline_snapshot import get_snapshot_value from openai import OpenAI, AsyncOpenAI _T = TypeVar("_T") def make_snapshot_request( ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/chat/test_completions.py
tests/lib/chat/test_completions.py
from __future__ import annotations from enum import Enum from typing import List, Optional from typing_extensions import Literal, TypeVar import pytest from respx import MockRouter from pydantic import Field, BaseModel from inline_snapshot import snapshot import openai from openai import OpenAI, AsyncOpenAI from ope...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/chat/__init__.py
tests/lib/chat/__init__.py
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/chat/test_completions_streaming.py
tests/lib/chat/test_completions_streaming.py
from __future__ import annotations import os from typing import Any, Generic, Callable, Iterator, cast, overload from typing_extensions import Literal, TypeVar import rich import httpx import pytest from respx import MockRouter from pydantic import BaseModel from inline_snapshot import ( external, snapshot, ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/schema_types/query.py
tests/lib/schema_types/query.py
from enum import Enum from typing import List, Union, Optional from pydantic import BaseModel class Table(str, Enum): orders = "orders" customers = "customers" products = "products" class Column(str, Enum): id = "id" status = "status" expected_delivery_date = "expected_delivery_date" de...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/responses/test_responses.py
tests/lib/responses/test_responses.py
from __future__ import annotations from typing_extensions import TypeVar import pytest from respx import MockRouter from inline_snapshot import snapshot from openai import OpenAI, AsyncOpenAI from openai._utils import assert_signatures_in_sync from ...conftest import base_url from ..snapshots import make_snapshot_r...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/lib/responses/__init__.py
tests/lib/responses/__init__.py
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_utils/test_logging.py
tests/test_utils/test_logging.py
import logging from typing import Any, Dict, cast import pytest from openai._utils import SensitiveHeadersFilter @pytest.fixture def logger_with_filter() -> logging.Logger: logger = logging.getLogger("test_logger") logger.setLevel(logging.DEBUG) logger.addFilter(SensitiveHeadersFilter()) return logg...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_utils/test_proxy.py
tests/test_utils/test_proxy.py
import operator from typing import Any from typing_extensions import override from openai._utils import LazyProxy from openai._extras._common import MissingDependencyError class RecursiveLazyProxy(LazyProxy[Any]): @override def __load__(self) -> Any: return self def __call__(self, *_args: Any, *...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_utils/test_datetime_parse.py
tests/test_utils/test_datetime_parse.py
""" Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py with modifications so it works without pydantic v1 imports. """ from typing import Type, Union from datetime import date, datetime, timezone, timedelta import pytest from openai._utils import parse_date, parse_datetime ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/tests/test_utils/test_typing.py
tests/test_utils/test_typing.py
from __future__ import annotations from typing import Generic, TypeVar, cast from openai._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") class BaseGeneric(Generic[_T]): ... class SubclassGeneric(BaseGeneric[_T]): ... class BaseGenericMultipleTypeArgs(Generi...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/streaming.py
examples/streaming.py
#!/usr/bin/env -S poetry run python import asyncio from openai import OpenAI, AsyncOpenAI # This script assumes you have the OPENAI_API_KEY environment variable set to a valid OpenAI API key. # # You can run this script from the root directory like so: # `python examples/streaming.py` def sync_main() -> None: ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/text_to_speech.py
examples/text_to_speech.py
#!/usr/bin/env rye run python import time import asyncio from openai import AsyncOpenAI from openai.helpers import LocalAudioPlayer # gets OPENAI_API_KEY from your environment variables openai = AsyncOpenAI() async def main() -> None: start_time = time.time() async with openai.audio.speech.with_streaming_...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/audio.py
examples/audio.py
#!/usr/bin/env rye run python from pathlib import Path from openai import OpenAI # gets OPENAI_API_KEY from your environment variables openai = OpenAI() speech_file_path = Path(__file__).parent / "speech.mp3" def main() -> None: # Create text-to-speech audio file with openai.audio.speech.with_streaming_re...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/azure_ad.py
examples/azure_ad.py
import asyncio from openai.lib.azure import AzureOpenAI, AsyncAzureOpenAI, AzureADTokenProvider, AsyncAzureADTokenProvider scopes = "https://cognitiveservices.azure.com/.default" # May change in the future # https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning api_version = "2023-...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/speech_to_text.py
examples/speech_to_text.py
#!/usr/bin/env rye run python import asyncio from openai import AsyncOpenAI from openai.helpers import Microphone # gets OPENAI_API_KEY from your environment variables openai = AsyncOpenAI() async def main() -> None: print("Recording for the next 10 seconds...") recording = await Microphone(timeout=10).rec...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/parsing_tools_stream.py
examples/parsing_tools_stream.py
from __future__ import annotations import rich from pydantic import BaseModel import openai from openai import OpenAI class GetWeather(BaseModel): city: str country: str client = OpenAI() with client.chat.completions.stream( model="gpt-4o-2024-08-06", messages=[ { "role": "us...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/uploads.py
examples/uploads.py
import sys from pathlib import Path import rich from openai import OpenAI # generate this file using `./generate_file.sh` file = Path("/tmp/big_test_file.txt") client = OpenAI() def from_disk() -> None: print("uploading file from disk") upload = client.uploads.upload_file_chunked( file=file, ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/module_client.py
examples/module_client.py
import openai # will default to `os.environ['OPENAI_API_KEY']` if not explicitly set openai.api_key = "..." # all client options can be configured just like the `OpenAI` instantiation counterpart openai.base_url = "https://..." openai.default_headers = {"x-foo": "true"} # all API calls work in the exact same fashion...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false