Skip to content
Open
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.33.0"
".": "0.34.0"
}
4 changes: 2 additions & 2 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-498dee72535c9b0585491899c8e5173ac2b83676710c741ef41faef415821683.yml
openapi_spec_hash: aff11e3516f652d05f5416f6593994d1
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-5d2697ad30ccbbd1502ade612deb9221a1e05e70d09a156da743d0ca120942f9.yml
openapi_spec_hash: 0bde05b560fbd40711e91e6b562c3b0f
config_hash: a4a6c3089a2e53425351cc9f42b4b5aa
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.34.0 (2025-11-05)

Full Changelog: [v0.33.0...v0.34.0](https://github.com/groq/groq-python/compare/v0.33.0...v0.34.0)

### Features

* **api:** api update ([51bb951](https://github.com/groq/groq-python/commit/51bb951f04069bdbc79fbcc96e9a89ad9bb945ed))


### Bug Fixes

* **client:** close streams without requiring full consumption ([99b9431](https://github.com/groq/groq-python/commit/99b9431a9663dc1c2abb8f46c2444fa2bb397eb4))


### Chores

* **internal/tests:** avoid race condition with implicit client cleanup ([3af43e5](https://github.com/groq/groq-python/commit/3af43e5855668c3632a9053222d11c27fa40c70c))
* **internal:** grammar fix (it's -> its) ([37687bf](https://github.com/groq/groq-python/commit/37687bfc136e87b85f26f9617b02a80e21047858))

## 0.33.0 (2025-10-21)

Full Changelog: [v0.32.0...v0.33.0](https://github.com/groq/groq-python/compare/v0.32.0...v0.33.0)
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.33.0"
version = "0.34.0"
description = "The official Python library for the groq API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
10 changes: 4 additions & 6 deletions src/groq/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ def __stream__(self) -> Iterator[_T]:

yield process_data(data={"data": data, "event": sse.event}, cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
response.close()

def __enter__(self) -> Self:
return self
Expand Down Expand Up @@ -198,9 +197,8 @@ async def __stream__(self) -> AsyncIterator[_T]:

yield process_data(data={"data": data, "event": sse.event}, cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
async for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()

async def __aenter__(self) -> Self:
return self
Expand Down
2 changes: 1 addition & 1 deletion src/groq/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
# Type safe methods for narrowing types with TypeVars.
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
# however this cause Pyright to rightfully report errors. As we know we don't
# care about the contained types we can safely use `object` in it's place.
# care about the contained types we can safely use `object` in its place.
#
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
# `is_*` is for when you're dealing with an unknown input
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.33.0" # x-release-please-version
__version__ = "0.34.0" # x-release-please-version
48 changes: 48 additions & 0 deletions src/groq/types/chat/chat_completion_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

__all__ = [
"ChatCompletionMessage",
"Annotation",
"AnnotationDocumentCitation",
"AnnotationFunctionCitation",
"ExecutedTool",
"ExecutedToolBrowserResult",
"ExecutedToolCodeResult",
Expand All @@ -19,6 +22,45 @@
]


class AnnotationDocumentCitation(BaseModel):
document_id: str
"""
The ID of the document being cited, corresponding to a document provided in the
request.
"""

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

start_index: int
"""The character index in the message content where this citation begins."""


class AnnotationFunctionCitation(BaseModel):
end_index: int
"""The character index in the message content where this citation ends."""

start_index: int
"""The character index in the message content where this citation begins."""

tool_call_id: str
"""
The ID of the tool call being cited, corresponding to a tool call made during
the conversation.
"""


class Annotation(BaseModel):
type: Literal["document_citation", "function_citation"]
"""The type of annotation."""

document_citation: Optional[AnnotationDocumentCitation] = None
"""A citation referencing a specific document that was provided in the request."""

function_citation: Optional[AnnotationFunctionCitation] = None
"""A citation referencing the result of a function or tool call."""


class ExecutedToolBrowserResult(BaseModel):
title: str
"""The title of the browser window"""
Expand Down Expand Up @@ -189,6 +231,12 @@ class ChatCompletionMessage(BaseModel):
role: Literal["assistant"]
"""The role of the author of this message."""

annotations: Optional[List[Annotation]] = None
"""
A list of annotations providing citations and references for the content in the
message.
"""

executed_tools: Optional[List[ExecutedTool]] = None
"""
A list of tools that were executed during the chat completion for compound AI
Expand Down
Loading