Skip to content

Commit f3354fb

Browse files
RobertCraigiemegamanics
authored andcommitted
v1.1.1 (openai#689)
* feat(client): support passing httpx.Timeout to method timeout argument * fix(api): retreival -> retrieval * fix(docs): use correct branch name in github links * v1.1.1
1 parent c0823d8 commit f3354fb

31 files changed

+192
-152
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ completion = response.parse() # get the object that `chat.completions.create()`
410410
print(completion)
411411
```
412412

413-
These methods return an [`APIResponse`](https://github.com/openai/openai-python/tree/v1/src/openai/_response.py) object.
413+
These methods return an [`APIResponse`](https://github.com/openai/openai-python/src/openai/_response.py) object.
414414

415415
### Configuring the HTTP client
416416

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "openai"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
description = "Client library for the openai API"
55
readme = "README.md"
66
license = "Apache-2.0"

src/openai/_base_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ def make_request_options(
15371537
extra_query: Query | None = None,
15381538
extra_body: Body | None = None,
15391539
idempotency_key: str | None = None,
1540-
timeout: float | None | NotGiven = NOT_GIVEN,
1540+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
15411541
post_parser: PostParser | NotGiven = NOT_GIVEN,
15421542
) -> RequestOptions:
15431543
"""Create a dict of type RequestOptions without keys of NotGiven values."""

src/openai/_files.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
2929
if not is_file_content(obj):
3030
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
3131
raise RuntimeError(
32-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/openai/openai-python/tree/v1#file-uploads"
32+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/openai/openai-python#file-uploads"
3333
) from None
3434

3535

src/openai/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless.
22

33
__title__ = "openai"
4-
__version__ = "1.1.0"
4+
__version__ = "1.1.1"

src/openai/resources/audio/speech.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING, Union
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
911
from ..._utils import maybe_transform
1012
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -38,7 +40,7 @@ def create(
3840
extra_headers: Headers | None = None,
3941
extra_query: Query | None = None,
4042
extra_body: Body | None = None,
41-
timeout: float | None | NotGiven = NOT_GIVEN,
43+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4244
) -> HttpxBinaryResponseContent:
4345
"""
4446
Generates audio from the input text.
@@ -105,7 +107,7 @@ async def create(
105107
extra_headers: Headers | None = None,
106108
extra_query: Query | None = None,
107109
extra_body: Body | None = None,
108-
timeout: float | None | NotGiven = NOT_GIVEN,
110+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
109111
) -> HttpxBinaryResponseContent:
110112
"""
111113
Generates audio from the input text.

src/openai/resources/audio/transcriptions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING, Union, Mapping, cast
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
911
from ..._utils import extract_files, maybe_transform, deepcopy_minimal
1012
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -39,7 +41,7 @@ def create(
3941
extra_headers: Headers | None = None,
4042
extra_query: Query | None = None,
4143
extra_body: Body | None = None,
42-
timeout: float | None | NotGiven = NOT_GIVEN,
44+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4345
) -> Transcription:
4446
"""
4547
Transcribes audio into the input language.
@@ -126,7 +128,7 @@ async def create(
126128
extra_headers: Headers | None = None,
127129
extra_query: Query | None = None,
128130
extra_body: Body | None = None,
129-
timeout: float | None | NotGiven = NOT_GIVEN,
131+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
130132
) -> Transcription:
131133
"""
132134
Transcribes audio into the input language.

src/openai/resources/audio/translations.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING, Union, Mapping, cast
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
911
from ..._utils import extract_files, maybe_transform, deepcopy_minimal
1012
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -38,7 +40,7 @@ def create(
3840
extra_headers: Headers | None = None,
3941
extra_query: Query | None = None,
4042
extra_body: Body | None = None,
41-
timeout: float | None | NotGiven = NOT_GIVEN,
43+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4244
) -> Translation:
4345
"""
4446
Translates audio into English.
@@ -118,7 +120,7 @@ async def create(
118120
extra_headers: Headers | None = None,
119121
extra_query: Query | None = None,
120122
extra_body: Body | None = None,
121-
timeout: float | None | NotGiven = NOT_GIVEN,
123+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
122124
) -> Translation:
123125
"""
124126
Translates audio into English.

src/openai/resources/beta/assistants/assistants.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING, List, Optional
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from .files import Files, AsyncFiles, FilesWithRawResponse, AsyncFilesWithRawResponse
911
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1012
from ...._utils import maybe_transform
@@ -50,7 +52,7 @@ def create(
5052
extra_headers: Headers | None = None,
5153
extra_query: Query | None = None,
5254
extra_body: Body | None = None,
53-
timeout: float | None | NotGiven = NOT_GIVEN,
55+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5456
) -> Assistant:
5557
"""
5658
Create an assistant with a model and instructions.
@@ -119,7 +121,7 @@ def retrieve(
119121
extra_headers: Headers | None = None,
120122
extra_query: Query | None = None,
121123
extra_body: Body | None = None,
122-
timeout: float | None | NotGiven = NOT_GIVEN,
124+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
123125
) -> Assistant:
124126
"""
125127
Retrieves an assistant.
@@ -158,7 +160,7 @@ def update(
158160
extra_headers: Headers | None = None,
159161
extra_query: Query | None = None,
160162
extra_body: Body | None = None,
161-
timeout: float | None | NotGiven = NOT_GIVEN,
163+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
162164
) -> Assistant:
163165
"""Modifies an assistant.
164166
@@ -233,7 +235,7 @@ def list(
233235
extra_headers: Headers | None = None,
234236
extra_query: Query | None = None,
235237
extra_body: Body | None = None,
236-
timeout: float | None | NotGiven = NOT_GIVEN,
238+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
237239
) -> SyncCursorPage[Assistant]:
238240
"""Returns a list of assistants.
239241
@@ -295,7 +297,7 @@ def delete(
295297
extra_headers: Headers | None = None,
296298
extra_query: Query | None = None,
297299
extra_body: Body | None = None,
298-
timeout: float | None | NotGiven = NOT_GIVEN,
300+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
299301
) -> AsssitantDeleted:
300302
"""
301303
Delete an assistant.
@@ -343,7 +345,7 @@ async def create(
343345
extra_headers: Headers | None = None,
344346
extra_query: Query | None = None,
345347
extra_body: Body | None = None,
346-
timeout: float | None | NotGiven = NOT_GIVEN,
348+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
347349
) -> Assistant:
348350
"""
349351
Create an assistant with a model and instructions.
@@ -412,7 +414,7 @@ async def retrieve(
412414
extra_headers: Headers | None = None,
413415
extra_query: Query | None = None,
414416
extra_body: Body | None = None,
415-
timeout: float | None | NotGiven = NOT_GIVEN,
417+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
416418
) -> Assistant:
417419
"""
418420
Retrieves an assistant.
@@ -451,7 +453,7 @@ async def update(
451453
extra_headers: Headers | None = None,
452454
extra_query: Query | None = None,
453455
extra_body: Body | None = None,
454-
timeout: float | None | NotGiven = NOT_GIVEN,
456+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
455457
) -> Assistant:
456458
"""Modifies an assistant.
457459
@@ -526,7 +528,7 @@ def list(
526528
extra_headers: Headers | None = None,
527529
extra_query: Query | None = None,
528530
extra_body: Body | None = None,
529-
timeout: float | None | NotGiven = NOT_GIVEN,
531+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
530532
) -> AsyncPaginator[Assistant, AsyncCursorPage[Assistant]]:
531533
"""Returns a list of assistants.
532534
@@ -588,7 +590,7 @@ async def delete(
588590
extra_headers: Headers | None = None,
589591
extra_query: Query | None = None,
590592
extra_body: Body | None = None,
591-
timeout: float | None | NotGiven = NOT_GIVEN,
593+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
592594
) -> AsssitantDeleted:
593595
"""
594596
Delete an assistant.

src/openai/resources/beta/assistants/files.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
911
from ...._utils import maybe_transform
1012
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -41,7 +43,7 @@ def create(
4143
extra_headers: Headers | None = None,
4244
extra_query: Query | None = None,
4345
extra_body: Body | None = None,
44-
timeout: float | None | NotGiven = NOT_GIVEN,
46+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4547
) -> AssistantFile:
4648
"""
4749
Create an assistant file by attaching a
@@ -81,7 +83,7 @@ def retrieve(
8183
extra_headers: Headers | None = None,
8284
extra_query: Query | None = None,
8385
extra_body: Body | None = None,
84-
timeout: float | None | NotGiven = NOT_GIVEN,
86+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8587
) -> AssistantFile:
8688
"""
8789
Retrieves an AssistantFile.
@@ -117,7 +119,7 @@ def list(
117119
extra_headers: Headers | None = None,
118120
extra_query: Query | None = None,
119121
extra_body: Body | None = None,
120-
timeout: float | None | NotGiven = NOT_GIVEN,
122+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
121123
) -> SyncCursorPage[AssistantFile]:
122124
"""
123125
Returns a list of assistant files.
@@ -179,7 +181,7 @@ def delete(
179181
extra_headers: Headers | None = None,
180182
extra_query: Query | None = None,
181183
extra_body: Body | None = None,
182-
timeout: float | None | NotGiven = NOT_GIVEN,
184+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
183185
) -> FileDeleteResponse:
184186
"""
185187
Delete an assistant file.
@@ -220,7 +222,7 @@ async def create(
220222
extra_headers: Headers | None = None,
221223
extra_query: Query | None = None,
222224
extra_body: Body | None = None,
223-
timeout: float | None | NotGiven = NOT_GIVEN,
225+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
224226
) -> AssistantFile:
225227
"""
226228
Create an assistant file by attaching a
@@ -260,7 +262,7 @@ async def retrieve(
260262
extra_headers: Headers | None = None,
261263
extra_query: Query | None = None,
262264
extra_body: Body | None = None,
263-
timeout: float | None | NotGiven = NOT_GIVEN,
265+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
264266
) -> AssistantFile:
265267
"""
266268
Retrieves an AssistantFile.
@@ -296,7 +298,7 @@ def list(
296298
extra_headers: Headers | None = None,
297299
extra_query: Query | None = None,
298300
extra_body: Body | None = None,
299-
timeout: float | None | NotGiven = NOT_GIVEN,
301+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
300302
) -> AsyncPaginator[AssistantFile, AsyncCursorPage[AssistantFile]]:
301303
"""
302304
Returns a list of assistant files.
@@ -358,7 +360,7 @@ async def delete(
358360
extra_headers: Headers | None = None,
359361
extra_query: Query | None = None,
360362
extra_body: Body | None = None,
361-
timeout: float | None | NotGiven = NOT_GIVEN,
363+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
362364
) -> FileDeleteResponse:
363365
"""
364366
Delete an assistant file.

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import TYPE_CHECKING
66
from typing_extensions import Literal
77

8+
import httpx
9+
810
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
911
from ....._utils import maybe_transform
1012
from ....._resource import SyncAPIResource, AsyncAPIResource
@@ -37,7 +39,7 @@ def retrieve(
3739
extra_headers: Headers | None = None,
3840
extra_query: Query | None = None,
3941
extra_body: Body | None = None,
40-
timeout: float | None | NotGiven = NOT_GIVEN,
42+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4143
) -> MessageFile:
4244
"""
4345
Retrieves a message file.
@@ -74,7 +76,7 @@ def list(
7476
extra_headers: Headers | None = None,
7577
extra_query: Query | None = None,
7678
extra_body: Body | None = None,
77-
timeout: float | None | NotGiven = NOT_GIVEN,
79+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
7880
) -> SyncCursorPage[MessageFile]:
7981
"""Returns a list of message files.
8082
@@ -146,7 +148,7 @@ async def retrieve(
146148
extra_headers: Headers | None = None,
147149
extra_query: Query | None = None,
148150
extra_body: Body | None = None,
149-
timeout: float | None | NotGiven = NOT_GIVEN,
151+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
150152
) -> MessageFile:
151153
"""
152154
Retrieves a message file.
@@ -183,7 +185,7 @@ def list(
183185
extra_headers: Headers | None = None,
184186
extra_query: Query | None = None,
185187
extra_body: Body | None = None,
186-
timeout: float | None | NotGiven = NOT_GIVEN,
188+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
187189
) -> AsyncPaginator[MessageFile, AsyncCursorPage[MessageFile]]:
188190
"""Returns a list of message files.
189191

0 commit comments

Comments
 (0)