Commit fc4dafce

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2024-02-12 22:01:35
feat(api): updates (#1146)
1 parent 7f9e850
Changed files (3)
src
openai
tests
api_resources
src/openai/resources/chat/completions.py
@@ -68,6 +68,7 @@ class Completions(SyncAPIResource):
         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 @@ class Completions(SyncAPIResource):
 
               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 @@ class Completions(SyncAPIResource):
         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 @@ class Completions(SyncAPIResource):
 
               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 @@ class Completions(SyncAPIResource):
         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 @@ class Completions(SyncAPIResource):
 
               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 @@ class Completions(SyncAPIResource):
         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 @@ class Completions(SyncAPIResource):
                     "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 @@ class AsyncCompletions(AsyncAPIResource):
         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 @@ class AsyncCompletions(AsyncAPIResource):
 
               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 @@ class AsyncCompletions(AsyncAPIResource):
         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 @@ class AsyncCompletions(AsyncAPIResource):
 
               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 @@ class AsyncCompletions(AsyncAPIResource):
         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 @@ class AsyncCompletions(AsyncAPIResource):
 
               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 @@ class AsyncCompletions(AsyncAPIResource):
         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 @@ class AsyncCompletions(AsyncAPIResource):
                     "frequency_penalty": frequency_penalty,
                     "function_call": function_call,
                     "functions": functions,
+                    "instance_id": instance_id,
                     "logit_bias": logit_bias,
                     "logprobs": logprobs,
                     "max_tokens": max_tokens,
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.
 
tests/api_resources/chat/test_completions.py
@@ -50,6 +50,7 @@ class TestCompletions:
                     "parameters": {"foo": "bar"},
                 }
             ],
+            instance_id="string",
             logit_bias={"foo": 0},
             logprobs=True,
             max_tokens=0,
@@ -164,6 +165,7 @@ class TestCompletions:
                     "parameters": {"foo": "bar"},
                 }
             ],
+            instance_id="string",
             logit_bias={"foo": 0},
             logprobs=True,
             max_tokens=0,
@@ -280,6 +282,7 @@ class TestAsyncCompletions:
                     "parameters": {"foo": "bar"},
                 }
             ],
+            instance_id="string",
             logit_bias={"foo": 0},
             logprobs=True,
             max_tokens=0,
@@ -394,6 +397,7 @@ class TestAsyncCompletions:
                     "parameters": {"foo": "bar"},
                 }
             ],
+            instance_id="string",
             logit_bias={"foo": 0},
             logprobs=True,
             max_tokens=0,