Skip to content

Commit bdb31a3

Browse files
fix(types): loosen most List params types to Iterable (#1129)
1 parent 4c021c0 commit bdb31a3

17 files changed

+77
-77
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import List, Iterable, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -59,7 +59,7 @@ def create(
5959
instructions: Optional[str] | NotGiven = NOT_GIVEN,
6060
metadata: Optional[object] | NotGiven = NOT_GIVEN,
6161
name: Optional[str] | NotGiven = NOT_GIVEN,
62-
tools: List[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
62+
tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
6363
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6464
# The extra values given here take precedence over values defined on the client or passed to this method.
6565
extra_headers: Headers | None = None,
@@ -169,7 +169,7 @@ def update(
169169
metadata: Optional[object] | NotGiven = NOT_GIVEN,
170170
model: str | NotGiven = NOT_GIVEN,
171171
name: Optional[str] | NotGiven = NOT_GIVEN,
172-
tools: List[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
172+
tools: Iterable[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
173173
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
174174
# The extra values given here take precedence over values defined on the client or passed to this method.
175175
extra_headers: Headers | None = None,
@@ -362,7 +362,7 @@ async def create(
362362
instructions: Optional[str] | NotGiven = NOT_GIVEN,
363363
metadata: Optional[object] | NotGiven = NOT_GIVEN,
364364
name: Optional[str] | NotGiven = NOT_GIVEN,
365-
tools: List[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
365+
tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
366366
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
367367
# The extra values given here take precedence over values defined on the client or passed to this method.
368368
extra_headers: Headers | None = None,
@@ -472,7 +472,7 @@ async def update(
472472
metadata: Optional[object] | NotGiven = NOT_GIVEN,
473473
model: str | NotGiven = NOT_GIVEN,
474474
name: Optional[str] | NotGiven = NOT_GIVEN,
475-
tools: List[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
475+
tools: Iterable[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
476476
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
477477
# The extra values given here take precedence over values defined on the client or passed to this method.
478478
extra_headers: Headers | None = None,

src/openai/resources/beta/threads/runs/runs.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import Iterable, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -59,7 +59,7 @@ def create(
5959
instructions: Optional[str] | NotGiven = NOT_GIVEN,
6060
metadata: Optional[object] | NotGiven = NOT_GIVEN,
6161
model: Optional[str] | NotGiven = NOT_GIVEN,
62-
tools: Optional[List[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
62+
tools: Optional[Iterable[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
6363
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6464
# The extra values given here take precedence over values defined on the client or passed to this method.
6565
extra_headers: Headers | None = None,
@@ -316,7 +316,7 @@ def submit_tool_outputs(
316316
run_id: str,
317317
*,
318318
thread_id: str,
319-
tool_outputs: List[run_submit_tool_outputs_params.ToolOutput],
319+
tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput],
320320
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
321321
# The extra values given here take precedence over values defined on the client or passed to this method.
322322
extra_headers: Headers | None = None,
@@ -380,7 +380,7 @@ async def create(
380380
instructions: Optional[str] | NotGiven = NOT_GIVEN,
381381
metadata: Optional[object] | NotGiven = NOT_GIVEN,
382382
model: Optional[str] | NotGiven = NOT_GIVEN,
383-
tools: Optional[List[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
383+
tools: Optional[Iterable[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
384384
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
385385
# The extra values given here take precedence over values defined on the client or passed to this method.
386386
extra_headers: Headers | None = None,
@@ -637,7 +637,7 @@ async def submit_tool_outputs(
637637
run_id: str,
638638
*,
639639
thread_id: str,
640-
tool_outputs: List[run_submit_tool_outputs_params.ToolOutput],
640+
tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput],
641641
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
642642
# The extra values given here take precedence over values defined on the client or passed to this method.
643643
extra_headers: Headers | None = None,

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import Iterable, Optional
66

77
import httpx
88

@@ -65,7 +65,7 @@ def with_streaming_response(self) -> ThreadsWithStreamingResponse:
6565
def create(
6666
self,
6767
*,
68-
messages: List[thread_create_params.Message] | NotGiven = NOT_GIVEN,
68+
messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN,
6969
metadata: Optional[object] | NotGiven = NOT_GIVEN,
7070
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7171
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -227,7 +227,7 @@ def create_and_run(
227227
metadata: Optional[object] | NotGiven = NOT_GIVEN,
228228
model: Optional[str] | NotGiven = NOT_GIVEN,
229229
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
230-
tools: Optional[List[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
230+
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
231231
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
232232
# The extra values given here take precedence over values defined on the client or passed to this method.
233233
extra_headers: Headers | None = None,
@@ -310,7 +310,7 @@ def with_streaming_response(self) -> AsyncThreadsWithStreamingResponse:
310310
async def create(
311311
self,
312312
*,
313-
messages: List[thread_create_params.Message] | NotGiven = NOT_GIVEN,
313+
messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN,
314314
metadata: Optional[object] | NotGiven = NOT_GIVEN,
315315
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
316316
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -472,7 +472,7 @@ async def create_and_run(
472472
metadata: Optional[object] | NotGiven = NOT_GIVEN,
473473
model: Optional[str] | NotGiven = NOT_GIVEN,
474474
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
475-
tools: Optional[List[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
475+
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
476476
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
477477
# The extra values given here take precedence over values defined on the client or passed to this method.
478478
extra_headers: Headers | None = None,

src/openai/resources/chat/completions.py

+25-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Optional, overload
5+
from typing import Dict, List, Union, Iterable, Optional, overload
66
from typing_extensions import Literal
77

88
import httpx
@@ -42,7 +42,7 @@ def with_streaming_response(self) -> CompletionsWithStreamingResponse:
4242
def create(
4343
self,
4444
*,
45-
messages: List[ChatCompletionMessageParam],
45+
messages: Iterable[ChatCompletionMessageParam],
4646
model: Union[
4747
str,
4848
Literal[
@@ -67,7 +67,7 @@ def create(
6767
],
6868
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
6969
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
70-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
70+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
7171
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
7272
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
7373
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -79,7 +79,7 @@ def create(
7979
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
8080
temperature: Optional[float] | NotGiven = NOT_GIVEN,
8181
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
82-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
82+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
8383
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
8484
top_p: Optional[float] | NotGiven = NOT_GIVEN,
8585
user: str | NotGiven = NOT_GIVEN,
@@ -232,7 +232,7 @@ def create(
232232
def create(
233233
self,
234234
*,
235-
messages: List[ChatCompletionMessageParam],
235+
messages: Iterable[ChatCompletionMessageParam],
236236
model: Union[
237237
str,
238238
Literal[
@@ -258,7 +258,7 @@ def create(
258258
stream: Literal[True],
259259
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
260260
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
261-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
261+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
262262
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
263263
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
264264
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -269,7 +269,7 @@ def create(
269269
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
270270
temperature: Optional[float] | NotGiven = NOT_GIVEN,
271271
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
272-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
272+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
273273
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
274274
top_p: Optional[float] | NotGiven = NOT_GIVEN,
275275
user: str | NotGiven = NOT_GIVEN,
@@ -422,7 +422,7 @@ def create(
422422
def create(
423423
self,
424424
*,
425-
messages: List[ChatCompletionMessageParam],
425+
messages: Iterable[ChatCompletionMessageParam],
426426
model: Union[
427427
str,
428428
Literal[
@@ -448,7 +448,7 @@ def create(
448448
stream: bool,
449449
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
450450
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
451-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
451+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
452452
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
453453
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
454454
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -459,7 +459,7 @@ def create(
459459
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
460460
temperature: Optional[float] | NotGiven = NOT_GIVEN,
461461
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
462-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
462+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
463463
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
464464
top_p: Optional[float] | NotGiven = NOT_GIVEN,
465465
user: str | NotGiven = NOT_GIVEN,
@@ -612,7 +612,7 @@ def create(
612612
def create(
613613
self,
614614
*,
615-
messages: List[ChatCompletionMessageParam],
615+
messages: Iterable[ChatCompletionMessageParam],
616616
model: Union[
617617
str,
618618
Literal[
@@ -637,7 +637,7 @@ def create(
637637
],
638638
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
639639
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
640-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
640+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
641641
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
642642
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
643643
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -649,7 +649,7 @@ def create(
649649
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
650650
temperature: Optional[float] | NotGiven = NOT_GIVEN,
651651
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
652-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
652+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
653653
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
654654
top_p: Optional[float] | NotGiven = NOT_GIVEN,
655655
user: str | NotGiven = NOT_GIVEN,
@@ -709,7 +709,7 @@ def with_streaming_response(self) -> AsyncCompletionsWithStreamingResponse:
709709
async def create(
710710
self,
711711
*,
712-
messages: List[ChatCompletionMessageParam],
712+
messages: Iterable[ChatCompletionMessageParam],
713713
model: Union[
714714
str,
715715
Literal[
@@ -734,7 +734,7 @@ async def create(
734734
],
735735
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
736736
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
737-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
737+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
738738
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
739739
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
740740
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -746,7 +746,7 @@ async def create(
746746
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
747747
temperature: Optional[float] | NotGiven = NOT_GIVEN,
748748
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
749-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
749+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
750750
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
751751
top_p: Optional[float] | NotGiven = NOT_GIVEN,
752752
user: str | NotGiven = NOT_GIVEN,
@@ -899,7 +899,7 @@ async def create(
899899
async def create(
900900
self,
901901
*,
902-
messages: List[ChatCompletionMessageParam],
902+
messages: Iterable[ChatCompletionMessageParam],
903903
model: Union[
904904
str,
905905
Literal[
@@ -925,7 +925,7 @@ async def create(
925925
stream: Literal[True],
926926
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
927927
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
928-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
928+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
929929
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
930930
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
931931
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -936,7 +936,7 @@ async def create(
936936
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
937937
temperature: Optional[float] | NotGiven = NOT_GIVEN,
938938
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
939-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
939+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
940940
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
941941
top_p: Optional[float] | NotGiven = NOT_GIVEN,
942942
user: str | NotGiven = NOT_GIVEN,
@@ -1089,7 +1089,7 @@ async def create(
10891089
async def create(
10901090
self,
10911091
*,
1092-
messages: List[ChatCompletionMessageParam],
1092+
messages: Iterable[ChatCompletionMessageParam],
10931093
model: Union[
10941094
str,
10951095
Literal[
@@ -1115,7 +1115,7 @@ async def create(
11151115
stream: bool,
11161116
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
11171117
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
1118-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
1118+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
11191119
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
11201120
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
11211121
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -1126,7 +1126,7 @@ async def create(
11261126
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
11271127
temperature: Optional[float] | NotGiven = NOT_GIVEN,
11281128
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
1129-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
1129+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
11301130
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
11311131
top_p: Optional[float] | NotGiven = NOT_GIVEN,
11321132
user: str | NotGiven = NOT_GIVEN,
@@ -1279,7 +1279,7 @@ async def create(
12791279
async def create(
12801280
self,
12811281
*,
1282-
messages: List[ChatCompletionMessageParam],
1282+
messages: Iterable[ChatCompletionMessageParam],
12831283
model: Union[
12841284
str,
12851285
Literal[
@@ -1304,7 +1304,7 @@ async def create(
13041304
],
13051305
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
13061306
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
1307-
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
1307+
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
13081308
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
13091309
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
13101310
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
@@ -1316,7 +1316,7 @@ async def create(
13161316
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
13171317
temperature: Optional[float] | NotGiven = NOT_GIVEN,
13181318
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
1319-
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
1319+
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
13201320
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
13211321
top_p: Optional[float] | NotGiven = NOT_GIVEN,
13221322
user: str | NotGiven = NOT_GIVEN,

0 commit comments

Comments
 (0)