From 4135fce6f851a0fd819f7b9192dedbb59f48df64 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:01:35 -0500 Subject: [PATCH] feat(api): updates (#1146) --- src/openai/resources/chat/completions.py | 28 +++++++++++++++++++ .../types/chat/completion_create_params.py | 6 ++++ tests/api_resources/chat/test_completions.py | 4 +++ 3 files changed, 38 insertions(+) diff --git a/src/openai/resources/chat/completions.py b/src/openai/resources/chat/completions.py index 0011d75e6e..caf712c604 100644 --- a/src/openai/resources/chat/completions.py +++ b/src/openai/resources/chat/completions.py @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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, @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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, diff --git a/src/openai/types/chat/completion_create_params.py b/src/openai/types/chat/completion_create_params.py index e02a81bc51..2c80d84e6a 100644 --- a/src/openai/types/chat/completion_create_params.py +++ b/src/openai/types/chat/completion_create_params.py @@ -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. diff --git a/tests/api_resources/chat/test_completions.py b/tests/api_resources/chat/test_completions.py index 4fa069ba2e..856b7dc12c 100644 --- a/tests/api_resources/chat/test_completions.py +++ b/tests/api_resources/chat/test_completions.py @@ -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, @@ -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, @@ -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, @@ -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,