Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(api): updates #1146

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/openai/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -122,6 +123,9 @@ def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -259,6 +263,7 @@ def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -319,6 +324,9 @@ def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -449,6 +457,7 @@ def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -509,6 +518,9 @@ def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -638,6 +650,7 @@ def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -669,6 +682,7 @@ def create(
"frequency_penalty": frequency_penalty,
"function_call": function_call,
"functions": functions,
"instance_id": instance_id,
"logit_bias": logit_bias,
"logprobs": logprobs,
"max_tokens": max_tokens,
Expand Down Expand Up @@ -735,6 +749,7 @@ async def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -789,6 +804,9 @@ async def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -926,6 +944,7 @@ async def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -986,6 +1005,9 @@ async def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -1116,6 +1138,7 @@ async def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -1176,6 +1199,9 @@ async def create(

A list of functions the model may generate JSON inputs for.

instance_id: An unique identifier to a custom instance to execute the request. The requesting
organization is required to have access to the instance.

logit_bias: Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the
Expand Down Expand Up @@ -1305,6 +1331,7 @@ async def create(
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
function_call: completion_create_params.FunctionCall | NotGiven = NOT_GIVEN,
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
instance_id: Optional[str] | 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 Down Expand Up @@ -1336,6 +1363,7 @@ async def create(
"frequency_penalty": frequency_penalty,
"function_call": function_call,
"functions": functions,
"instance_id": instance_id,
"logit_bias": logit_bias,
"logprobs": logprobs,
"max_tokens": max_tokens,
Expand Down
6 changes: 6 additions & 0 deletions src/openai/types/chat/completion_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ class CompletionCreateParamsBase(TypedDict, total=False):
A list of functions the model may generate JSON inputs for.
"""

instance_id: Optional[str]
"""An unique identifier to a custom instance to execute the request.

The requesting organization is required to have access to the instance.
"""

logit_bias: Optional[Dict[str, int]]
"""Modify the likelihood of specified tokens appearing in the completion.

Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/chat/test_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
"parameters": {"foo": "bar"},
}
],
instance_id="string",
logit_bias={"foo": 0},
logprobs=True,
max_tokens=0,
Expand Down Expand Up @@ -164,6 +165,7 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
"parameters": {"foo": "bar"},
}
],
instance_id="string",
logit_bias={"foo": 0},
logprobs=True,
max_tokens=0,
Expand Down Expand Up @@ -280,6 +282,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
"parameters": {"foo": "bar"},
}
],
instance_id="string",
logit_bias={"foo": 0},
logprobs=True,
max_tokens=0,
Expand Down Expand Up @@ -394,6 +397,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
"parameters": {"foo": "bar"},
}
],
instance_id="string",
logit_bias={"foo": 0},
logprobs=True,
max_tokens=0,
Expand Down