Skip to content
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 14 additions & 2 deletions src/groq/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 8 additions & 1 deletion src/groq/types/chat/completion_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/chat/test_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down