Skip to content

Commit

Permalink
fix(types): loosen most List params types to Iterable (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 9, 2024
1 parent 0f09346 commit 2dc3976
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 77 deletions.
10 changes: 5 additions & 5 deletions src/openai/resources/beta/assistants/assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Optional
from typing import List, Iterable, Optional
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -59,7 +59,7 @@ def create(
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
tools: List[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -169,7 +169,7 @@ def update(
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: str | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
tools: List[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
tools: Iterable[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -362,7 +362,7 @@ async def create(
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
tools: List[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -472,7 +472,7 @@ async def update(
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: str | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
tools: List[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
tools: Iterable[assistant_update_params.Tool] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
10 changes: 5 additions & 5 deletions src/openai/resources/beta/threads/runs/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Optional
from typing import Iterable, Optional
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -59,7 +59,7 @@ def create(
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: Optional[str] | NotGiven = NOT_GIVEN,
tools: Optional[List[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
tools: Optional[Iterable[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -316,7 +316,7 @@ def submit_tool_outputs(
run_id: str,
*,
thread_id: str,
tool_outputs: List[run_submit_tool_outputs_params.ToolOutput],
tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -380,7 +380,7 @@ async def create(
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: Optional[str] | NotGiven = NOT_GIVEN,
tools: Optional[List[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
tools: Optional[Iterable[run_create_params.Tool]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -637,7 +637,7 @@ async def submit_tool_outputs(
run_id: str,
*,
thread_id: str,
tool_outputs: List[run_submit_tool_outputs_params.ToolOutput],
tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
10 changes: 5 additions & 5 deletions src/openai/resources/beta/threads/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Optional
from typing import Iterable, Optional

import httpx

Expand Down Expand Up @@ -65,7 +65,7 @@ def with_streaming_response(self) -> ThreadsWithStreamingResponse:
def create(
self,
*,
messages: List[thread_create_params.Message] | NotGiven = NOT_GIVEN,
messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -227,7 +227,7 @@ def create_and_run(
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: Optional[str] | NotGiven = NOT_GIVEN,
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
tools: Optional[List[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -310,7 +310,7 @@ def with_streaming_response(self) -> AsyncThreadsWithStreamingResponse:
async def create(
self,
*,
messages: List[thread_create_params.Message] | NotGiven = NOT_GIVEN,
messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -472,7 +472,7 @@ async def create_and_run(
metadata: Optional[object] | NotGiven = NOT_GIVEN,
model: Optional[str] | NotGiven = NOT_GIVEN,
thread: thread_create_and_run_params.Thread | NotGiven = NOT_GIVEN,
tools: Optional[List[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
tools: Optional[Iterable[thread_create_and_run_params.Tool]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
50 changes: 25 additions & 25 deletions src/openai/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Dict, List, Union, Optional, overload
from typing import Dict, List, Union, Iterable, Optional, overload
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -42,7 +42,7 @@ def with_streaming_response(self) -> CompletionsWithStreamingResponse:
def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -67,7 +67,7 @@ def create(
],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -79,7 +79,7 @@ def create(
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -232,7 +232,7 @@ def create(
def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -258,7 +258,7 @@ def create(
stream: Literal[True],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -269,7 +269,7 @@ def create(
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -422,7 +422,7 @@ def create(
def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -448,7 +448,7 @@ def create(
stream: bool,
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -459,7 +459,7 @@ def create(
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -612,7 +612,7 @@ def create(
def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -637,7 +637,7 @@ def create(
],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -649,7 +649,7 @@ def create(
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -709,7 +709,7 @@ def with_streaming_response(self) -> AsyncCompletionsWithStreamingResponse:
async def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -734,7 +734,7 @@ async def create(
],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -746,7 +746,7 @@ async def create(
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -899,7 +899,7 @@ async def create(
async def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -925,7 +925,7 @@ async def create(
stream: Literal[True],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -936,7 +936,7 @@ async def create(
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1089,7 +1089,7 @@ async def create(
async def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -1115,7 +1115,7 @@ async def create(
stream: bool,
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -1126,7 +1126,7 @@ async def create(
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1279,7 +1279,7 @@ async def create(
async def create(
self,
*,
messages: List[ChatCompletionMessageParam],
messages: Iterable[ChatCompletionMessageParam],
model: Union[
str,
Literal[
Expand All @@ -1304,7 +1304,7 @@ async def create(
],
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: List[completion_create_params.Function] | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
Expand All @@ -1316,7 +1316,7 @@ async def create(
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN,
tools: List[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN,
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
top_p: Optional[float] | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down
Loading

0 comments on commit 2dc3976

Please sign in to comment.