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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.37.1"
".": "1.0.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-72c846893a3d08d716638abd70d621c0ffc6c4b3aa9f5b8b06dde07c68fa529b.yml
openapi_spec_hash: 7d29da2abb6833f7a891a53f49449122
config_hash: 4719968e58eab04c8641284bcf18ef5d
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-2c4683b6cf3c31fe903d6b314823be4440c5f1c3db00545bca9534a816179fed.yml
openapi_spec_hash: 4fad55cf0c3fc26500f4030edf31b64d
config_hash: eca7e3cb24b18c605dd1bc936da8ef3e
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 1.0.0 (2025-12-17)

Full Changelog: [v0.37.1...v1.0.0](https://github.com/groq/groq-python/compare/v0.37.1...v1.0.0)

### Features

* **api:** api update ([f1f83f8](https://github.com/groq/groq-python/commit/f1f83f83fb8b91599d83db9c1a17da21a3b5d19a))


### Bug Fixes

* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([4847b77](https://github.com/groq/groq-python/commit/4847b77d575ee800a28b02c8e01165a0c8931ceb))
* use async_to_httpx_files in patch method ([360421b](https://github.com/groq/groq-python/commit/360421b88be0c9feb545ee7a2512a0af9ef53196))


### Chores

* add missing docstrings ([047ce99](https://github.com/groq/groq-python/commit/047ce99d97d4085227849a3f293411e1c6fe348b))
* **internal:** add missing files argument to base client ([7c889d7](https://github.com/groq/groq-python/commit/7c889d73ea3b785aeec893c37c2e09289a4887b6))

## 0.37.1 (2025-12-04)

Full Changelog: [v0.37.0...v0.37.1](https://github.com/groq/groq-python/compare/v0.37.0...v0.37.1)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "groq"
version = "0.37.1"
version = "1.0.0"
description = "The official Python library for the groq API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
10 changes: 8 additions & 2 deletions src/groq/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,9 +1247,12 @@ def patch(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
opts = FinalRequestOptions.construct(
method="patch", url=path, json_data=body, files=to_httpx_files(files), **options
)
return self.request(cast_to, opts)

def put(
Expand Down Expand Up @@ -1767,9 +1770,12 @@ async def patch(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
opts = FinalRequestOptions.construct(
method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options
)
return await self.request(cast_to, opts)

async def put(
Expand Down
5 changes: 3 additions & 2 deletions src/groq/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False):
if TYPE_CHECKING:
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
#
# Note: index() and count() methods are intentionally omitted to allow pyright to properly
# infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr.
class SequenceNotStr(Protocol[_T_co]):
@overload
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
Expand All @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
def __contains__(self, value: object, /) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
def count(self, value: Any, /) -> int: ...
def __reversed__(self) -> Iterator[_T_co]: ...
else:
# just point this to a normal `Sequence` at runtime to avoid having to special case
Expand Down
2 changes: 1 addition & 1 deletion src/groq/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "groq"
__version__ = "0.37.1" # x-release-please-version
__version__ = "1.0.0" # x-release-please-version
4 changes: 4 additions & 0 deletions src/groq/types/audio/transcription.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@


class Transcription(BaseModel):
"""
Represents a transcription response returned by model, based on the provided input.
"""

text: str
"""The transcribed text."""
2 changes: 2 additions & 0 deletions src/groq/types/batch_cancel_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Errors(BaseModel):


class RequestCounts(BaseModel):
"""The request counts for different statuses within the batch."""

completed: int
"""Number of requests that have been completed successfully."""

Expand Down
2 changes: 2 additions & 0 deletions src/groq/types/batch_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Errors(BaseModel):


class RequestCounts(BaseModel):
"""The request counts for different statuses within the batch."""

completed: int
"""Number of requests that have been completed successfully."""

Expand Down
2 changes: 2 additions & 0 deletions src/groq/types/batch_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class DataErrors(BaseModel):


class DataRequestCounts(BaseModel):
"""The request counts for different statuses within the batch."""

completed: int
"""Number of requests that have been completed successfully."""

Expand Down
2 changes: 2 additions & 0 deletions src/groq/types/batch_retrieve_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Errors(BaseModel):


class RequestCounts(BaseModel):
"""The request counts for different statuses within the batch."""

completed: int
"""Number of requests that have been completed successfully."""

Expand Down
19 changes: 19 additions & 0 deletions src/groq/types/chat/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@


class ChoiceLogprobs(BaseModel):
"""Log probability information for the choice."""

content: Optional[List[ChatCompletionTokenLogprob]] = None
"""A list of message content tokens with log probability information."""

Expand Down Expand Up @@ -84,11 +86,20 @@ class UsageBreakdownModel(BaseModel):


class UsageBreakdown(BaseModel):
"""
Detailed usage breakdown by model when multiple models are used in the request for compound AI systems.
"""

models: List[UsageBreakdownModel]
"""List of models used in the request and their individual usage statistics"""


class XGroqDebug(BaseModel):
"""Debug information including input and output token IDs and strings.

Only present when debug=true in the request.
"""

input_token_ids: Optional[List[int]] = None
"""Token IDs for the input."""

Expand All @@ -103,6 +114,8 @@ class XGroqDebug(BaseModel):


class XGroqUsage(BaseModel):
"""Additional Groq-specific usage metrics (hardware cache statistics)."""

dram_cached_tokens: Optional[int] = None
"""Number of tokens served from DRAM cache."""

Expand All @@ -111,6 +124,8 @@ class XGroqUsage(BaseModel):


class XGroq(BaseModel):
"""Groq-specific metadata for non-streaming chat completion responses."""

id: str
"""
A groq request ID which can be used to refer to a specific request to groq
Expand All @@ -134,6 +149,10 @@ class XGroq(BaseModel):


class ChatCompletion(BaseModel):
"""
Represents a chat completion response returned by model, based on the provided input.
"""

id: str
"""A unique identifier for the chat completion."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@


class FunctionCall(TypedDict, total=False):
"""Deprecated and replaced by `tool_calls`.

The name and arguments of a function that should be called, as generated by the model.
"""

arguments: str
"""
The arguments to call the function with, as generated by the model in JSON
Expand Down Expand Up @@ -51,7 +56,8 @@ class ChatCompletionAssistantMessageParam(TypedDict, total=False):
reasoning: Optional[str]
"""
The reasoning output by the assistant if reasoning_format was set to 'parsed'.
This field is only useable with qwen3 models.
This field is supported on
[models that support reasoning](https://console.groq.com/docs/reasoning).
"""

tool_calls: Iterable[ChatCompletionMessageToolCallParam]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@


class ChatCompletionFunctionCallOptionParam(TypedDict, total=False):
"""
Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.
"""

name: Required[str]
"""The name of the function to call."""
20 changes: 18 additions & 2 deletions src/groq/types/chat/chat_completion_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@


class AnnotationDocumentCitation(BaseModel):
"""A citation referencing a specific document that was provided in the request."""

document_id: str
"""
The ID of the document being cited, corresponding to a document provided in the
Expand All @@ -37,6 +39,8 @@ class AnnotationDocumentCitation(BaseModel):


class AnnotationFunctionCitation(BaseModel):
"""A citation referencing the result of a function or tool call."""

end_index: int
"""The character index in the message content where this citation ends."""

Expand All @@ -51,6 +55,8 @@ class AnnotationFunctionCitation(BaseModel):


class Annotation(BaseModel):
"""An annotation that provides citations or references for content in a message."""

type: Literal["document_citation", "function_citation"]
"""The type of annotation."""

Expand Down Expand Up @@ -181,6 +187,8 @@ class ExecutedToolSearchResultsResult(BaseModel):


class ExecutedToolSearchResults(BaseModel):
"""The search results returned by the tool, if applicable."""

images: Optional[List[str]] = None
"""List of image URLs returned by the search"""

Expand Down Expand Up @@ -212,6 +220,11 @@ class ExecutedTool(BaseModel):


class FunctionCall(BaseModel):
"""Deprecated and replaced by `tool_calls`.

The name and arguments of a function that should be called, as generated by the model.
"""

arguments: str
"""
The arguments to call the function with, as generated by the model in JSON
Expand All @@ -225,6 +238,8 @@ class FunctionCall(BaseModel):


class ChatCompletionMessage(BaseModel):
"""A chat completion message generated by the model."""

content: Optional[str] = None
"""The contents of the message."""

Expand Down Expand Up @@ -253,8 +268,9 @@ class ChatCompletionMessage(BaseModel):
reasoning: Optional[str] = None
"""The model's reasoning for a response.

Only available for reasoning models when requests parameter reasoning_format has
value `parsed.
Only available for
[models that support reasoning](https://console.groq.com/docs/reasoning) when
request parameter reasoning_format has value `parsed`.
"""

tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
Expand Down
2 changes: 2 additions & 0 deletions src/groq/types/chat/chat_completion_message_tool_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class Function(BaseModel):
"""The function that the model called."""

arguments: str
"""
The arguments to call the function with, as generated by the model in JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class Function(TypedDict, total=False):
"""The function that the model called."""

arguments: Required[str]
"""
The arguments to call the function with, as generated by the model in JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class Function(TypedDict, total=False):


class ChatCompletionNamedToolChoiceParam(TypedDict, total=False):
"""Specifies a tool the model should use.

Use to force the model to call a specific function.
"""

function: Required[Function]

type: Required[Literal["function"]]
Expand Down
Loading