diff --git a/.stats.yml b/.stats.yml index ba76caea..80c80080 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-33be0d612b9f1153b86f53e95bf7c571af2f1e466bda2330b632e6c05832e2a6.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-8bf31041292f851076489c3ac1270d06c49b995225d91cf5de2288a4bcfa8c29.yml diff --git a/src/groq/resources/chat/completions.py b/src/groq/resources/chat/completions.py index 7840189b..00291793 100644 --- a/src/groq/resources/chat/completions.py +++ b/src/groq/resources/chat/completions.py @@ -60,6 +60,7 @@ def create( functions: Optional[Iterable[completion_create_params.Function]] | NotGiven = NOT_GIVEN, logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN, logprobs: Optional[bool] | NotGiven = NOT_GIVEN, + max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN, max_tokens: Optional[int] | NotGiven = NOT_GIVEN, n: Optional[int] | NotGiven = NOT_GIVEN, parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN, @@ -117,10 +118,14 @@ def create( probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - max_tokens: The maximum number of tokens that can be generated in the chat completion. The + max_completion_tokens: The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. + max_tokens: Deprecated in favor of `max_completion_tokens`. The maximum number of tokens + that can be generated in the chat completion. The total length of input tokens + and generated tokens is limited by the model's context length. + n: How many chat completion choices to generate for each input message. Note that the current moment, only n=1 is supported. Other values will result in a 400 response. @@ -209,6 +214,7 @@ def create( "functions": functions, "logit_bias": logit_bias, "logprobs": logprobs, + "max_completion_tokens": max_completion_tokens, "max_tokens": max_tokens, "n": n, "parallel_tool_calls": parallel_tool_calls, @@ -264,6 +270,7 @@ async def create( functions: Optional[Iterable[completion_create_params.Function]] | NotGiven = NOT_GIVEN, logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN, logprobs: Optional[bool] | NotGiven = NOT_GIVEN, + max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN, max_tokens: Optional[int] | NotGiven = NOT_GIVEN, n: Optional[int] | NotGiven = NOT_GIVEN, parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN, @@ -321,10 +328,14 @@ async def create( probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - max_tokens: The maximum number of tokens that can be generated in the chat completion. The + max_completion_tokens: The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. + max_tokens: Deprecated in favor of `max_completion_tokens`. The maximum number of tokens + that can be generated in the chat completion. The total length of input tokens + and generated tokens is limited by the model's context length. + n: How many chat completion choices to generate for each input message. Note that the current moment, only n=1 is supported. Other values will result in a 400 response. @@ -413,6 +424,7 @@ async def create( "functions": functions, "logit_bias": logit_bias, "logprobs": logprobs, + "max_completion_tokens": max_completion_tokens, "max_tokens": max_tokens, "n": n, "parallel_tool_calls": parallel_tool_calls, diff --git a/src/groq/types/chat/completion_create_params.py b/src/groq/types/chat/completion_create_params.py index 770578ed..030c1fba 100644 --- a/src/groq/types/chat/completion_create_params.py +++ b/src/groq/types/chat/completion_create_params.py @@ -64,13 +64,20 @@ class CompletionCreateParams(TypedDict, total=False): probabilities of each output token returned in the `content` of `message`. """ - max_tokens: Optional[int] + max_completion_tokens: Optional[int] """The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. """ + max_tokens: Optional[int] + """ + Deprecated in favor of `max_completion_tokens`. The maximum number of tokens + that can be generated in the chat completion. The total length of input tokens + and generated tokens is limited by the model's context length. + """ + n: Optional[int] """How many chat completion choices to generate for each input message. diff --git a/tests/api_resources/chat/test_completions.py b/tests/api_resources/chat/test_completions.py index 53bbc1a8..292a2234 100644 --- a/tests/api_resources/chat/test_completions.py +++ b/tests/api_resources/chat/test_completions.py @@ -52,6 +52,7 @@ def test_method_create_with_all_params(self, client: Groq) -> None: ], logit_bias={"foo": 0}, logprobs=True, + max_completion_tokens=0, max_tokens=0, n=1, parallel_tool_calls=True, @@ -154,6 +155,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> N ], logit_bias={"foo": 0}, logprobs=True, + max_completion_tokens=0, max_tokens=0, n=1, parallel_tool_calls=True,