Skip to content

release: 0.21.0 #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 1, 2025
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.20.0"
".": "0.21.0"
}
4 changes: 3 additions & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-57e8ccf3bae48a219b987a94bd6eaec7318eb2cf4459e9f528b701722272b969.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-8d531e091886f4bb814247a78a6323f6f12351881269a4e8cf68223b9245c64f.yml
openapi_spec_hash: 418d99cedb3b70fbd0615eed3ceb2872
config_hash: dd20374dfa31ce00f3b6dd0a6dfbe802
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.21.0 (2025-04-01)

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

### Features

* **api:** api update ([#224](https://github.com/groq/groq-python/issues/224)) ([94f29cf](https://github.com/groq/groq-python/commit/94f29cfa5a5873d46de380de98b3bb37aff78615))
* **api:** api update ([#225](https://github.com/groq/groq-python/issues/225)) ([cdf668c](https://github.com/groq/groq-python/commit/cdf668c5b45ea5bef841f2e2da38664c09454a55))
* **api:** manual updates ([#226](https://github.com/groq/groq-python/issues/226)) ([499e454](https://github.com/groq/groq-python/commit/499e4544aa45a25f333de8b34714dbaa5242dcbc))


### Chores

* fix typos ([#222](https://github.com/groq/groq-python/issues/222)) ([51bb8ad](https://github.com/groq/groq-python/commit/51bb8ad9c5826d72ecaa95bd00d36f86fc1b5b98))

## 0.20.0 (2025-03-19)

Full Changelog: [v0.19.0...v0.20.0](https://github.com/groq/groq-python/compare/v0.19.0...v0.20.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.20.0"
version = "0.21.0"
description = "The official Python library for the groq API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/groq/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
setattr(typ, "__pydantic_config__", config) # noqa: B010


# our use of subclasssing here causes weirdness for type checkers,
# our use of subclassing here causes weirdness for type checkers,
# so we just pretend that we don't subclass
if TYPE_CHECKING:
GenericModel = BaseModel
Expand Down
2 changes: 1 addition & 1 deletion src/groq/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None:
def _maybe_transform_key(key: str, type_: type) -> str:
"""Transform the given `data` based on the annotations provided in `type_`.
Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata.
Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata.
"""
annotated_type = _get_annotated_type(type_)
if annotated_type is None:
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.20.0" # x-release-please-version
__version__ = "0.21.0" # x-release-please-version
16 changes: 10 additions & 6 deletions src/groq/resources/audio/transcriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def create(

file:
The audio file object (not file name) to transcribe, in one of these formats:
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. Either a file or a URL must
be provided. Note that the file field is not supported in Batch API requests.

language: The language of the input audio. Supplying the input language in
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
Expand All @@ -204,8 +205,9 @@ def create(
is no additional latency for segment timestamps, but generating word timestamps
incurs additional latency.

url: The audio URL to translate/transcribe (supports Base64URL). Either file of url
must be provided.
url: The audio URL to translate/transcribe (supports Base64URL). Either a file or a
URL must be provided. For Batch API requests, the URL field is required since
the file field is not supported.

extra_headers: Send extra headers

Expand Down Expand Up @@ -394,7 +396,8 @@ async def create(

file:
The audio file object (not file name) to transcribe, in one of these formats:
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. Either a file or a URL must
be provided. Note that the file field is not supported in Batch API requests.

language: The language of the input audio. Supplying the input language in
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
Expand All @@ -418,8 +421,9 @@ async def create(
is no additional latency for segment timestamps, but generating word timestamps
incurs additional latency.

url: The audio URL to translate/transcribe (supports Base64URL). Either file of url
must be provided.
url: The audio URL to translate/transcribe (supports Base64URL). Either a file or a
URL must be provided. For Batch API requests, the URL field is required since
the file field is not supported.

extra_headers: Send extra headers

Expand Down
8 changes: 4 additions & 4 deletions src/groq/resources/audio/translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def create(
[log probability](https://en.wikipedia.org/wiki/Log_probability) to
automatically increase the temperature until certain thresholds are hit.

url: The audio URL to translate/transcribe (supports Base64URL). Either file of url
must be provided.
url: The audio URL to translate/transcribe (supports Base64URL). Either file or url
must be provided. When using the Batch API only url is supported.

extra_headers: Send extra headers

Expand Down Expand Up @@ -184,8 +184,8 @@ async def create(
[log probability](https://en.wikipedia.org/wiki/Log_probability) to
automatically increase the temperature until certain thresholds are hit.

url: The audio URL to translate/transcribe (supports Base64URL). Either file of url
must be provided.
url: The audio URL to translate/transcribe (supports Base64URL). Either file or url
must be provided. When using the Batch API only url is supported.

extra_headers: Send extra headers

Expand Down
10 changes: 6 additions & 4 deletions src/groq/types/audio/transcription_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class TranscriptionCreateParams(TypedDict, total=False):
file: FileTypes
"""
The audio file object (not file name) to transcribe, in one of these formats:
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. Either a file or a URL must
be provided. Note that the file field is not supported in Batch API requests.
"""

language: Union[
Expand Down Expand Up @@ -164,7 +165,8 @@ class TranscriptionCreateParams(TypedDict, total=False):
"""

url: str
"""The audio URL to translate/transcribe (supports Base64URL).

Either file of url must be provided.
"""
The audio URL to translate/transcribe (supports Base64URL). Either a file or a
URL must be provided. For Batch API requests, the URL field is required since
the file field is not supported.
"""
3 changes: 2 additions & 1 deletion src/groq/types/audio/translation_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ class TranslationCreateParams(TypedDict, total=False):
url: str
"""The audio URL to translate/transcribe (supports Base64URL).

Either file of url must be provided.
Either file or url must be provided. When using the Batch API only url is
supported.
"""
21 changes: 20 additions & 1 deletion src/groq/types/chat/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .chat_completion_message import ChatCompletionMessage
from .chat_completion_token_logprob import ChatCompletionTokenLogprob

__all__ = ["ChatCompletion", "Choice", "ChoiceLogprobs"]
__all__ = ["ChatCompletion", "Choice", "ChoiceLogprobs", "UsageBreakdown", "UsageBreakdownModel"]


class ChoiceLogprobs(BaseModel):
Expand Down Expand Up @@ -36,6 +36,19 @@ class Choice(BaseModel):
"""A chat completion message generated by the model."""


class UsageBreakdownModel(BaseModel):
model: str
"""The name/identifier of the model used"""

usage: CompletionUsage
"""Usage statistics for the completion request."""


class UsageBreakdown(BaseModel):
models: List[UsageBreakdownModel]
"""List of models used in the request and their individual usage statistics"""


class ChatCompletion(BaseModel):
id: str
"""A unique identifier for the chat completion."""
Expand Down Expand Up @@ -64,3 +77,9 @@ class ChatCompletion(BaseModel):

usage: Optional[CompletionUsage] = None
"""Usage statistics for the completion request."""

usage_breakdown: Optional[UsageBreakdown] = None
"""
Detailed usage breakdown by model when multiple models are used in the request
for compound AI systems.
"""
22 changes: 21 additions & 1 deletion src/groq/types/chat/chat_completion_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
from ..._models import BaseModel
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall

__all__ = ["ChatCompletionMessage", "FunctionCall"]
__all__ = ["ChatCompletionMessage", "ExecutedTool", "FunctionCall"]


class ExecutedTool(BaseModel):
arguments: str
"""The arguments passed to the tool in JSON format."""

index: int
"""The index of the executed tool."""

type: str
"""The type of tool that was executed."""

output: Optional[str] = None
"""The output returned by the tool."""


class FunctionCall(BaseModel):
Expand All @@ -29,6 +43,12 @@ class ChatCompletionMessage(BaseModel):
role: Literal["assistant"]
"""The role of the author of this message."""

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

function_call: Optional[FunctionCall] = None
"""Deprecated and replaced by `tool_calls`.

Expand Down
8 changes: 8 additions & 0 deletions tests/api_resources/audio/test_transcriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
class TestTranscriptions:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_method_create(self, client: Groq) -> None:
transcription = client.audio.transcriptions.create(
model="whisper-large-v3",
)
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_method_create_with_all_params(self, client: Groq) -> None:
transcription = client.audio.transcriptions.create(
Expand All @@ -38,6 +40,7 @@ def test_method_create_with_all_params(self, client: Groq) -> None:
)
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_raw_response_create(self, client: Groq) -> None:
response = client.audio.transcriptions.with_raw_response.create(
Expand All @@ -49,6 +52,7 @@ def test_raw_response_create(self, client: Groq) -> None:
transcription = response.parse()
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_streaming_response_create(self, client: Groq) -> None:
with client.audio.transcriptions.with_streaming_response.create(
Expand All @@ -66,13 +70,15 @@ def test_streaming_response_create(self, client: Groq) -> None:
class TestAsyncTranscriptions:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_method_create(self, async_client: AsyncGroq) -> None:
transcription = await async_client.audio.transcriptions.create(
model="whisper-large-v3",
)
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> None:
transcription = await async_client.audio.transcriptions.create(
Expand All @@ -87,6 +93,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> N
)
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_raw_response_create(self, async_client: AsyncGroq) -> None:
response = await async_client.audio.transcriptions.with_raw_response.create(
Expand All @@ -98,6 +105,7 @@ async def test_raw_response_create(self, async_client: AsyncGroq) -> None:
transcription = await response.parse()
assert_matches_type(Transcription, transcription, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_streaming_response_create(self, async_client: AsyncGroq) -> None:
async with async_client.audio.transcriptions.with_streaming_response.create(
Expand Down
8 changes: 8 additions & 0 deletions tests/api_resources/audio/test_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
class TestTranslations:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_method_create(self, client: Groq) -> None:
translation = client.audio.translations.create(
model="whisper-1",
)
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_method_create_with_all_params(self, client: Groq) -> None:
translation = client.audio.translations.create(
Expand All @@ -36,6 +38,7 @@ def test_method_create_with_all_params(self, client: Groq) -> None:
)
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_raw_response_create(self, client: Groq) -> None:
response = client.audio.translations.with_raw_response.create(
Expand All @@ -47,6 +50,7 @@ def test_raw_response_create(self, client: Groq) -> None:
translation = response.parse()
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
def test_streaming_response_create(self, client: Groq) -> None:
with client.audio.translations.with_streaming_response.create(
Expand All @@ -64,13 +68,15 @@ def test_streaming_response_create(self, client: Groq) -> None:
class TestAsyncTranslations:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_method_create(self, async_client: AsyncGroq) -> None:
translation = await async_client.audio.translations.create(
model="whisper-1",
)
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> None:
translation = await async_client.audio.translations.create(
Expand All @@ -83,6 +89,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> N
)
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_raw_response_create(self, async_client: AsyncGroq) -> None:
response = await async_client.audio.translations.with_raw_response.create(
Expand All @@ -94,6 +101,7 @@ async def test_raw_response_create(self, async_client: AsyncGroq) -> None:
translation = await response.parse()
assert_matches_type(Translation, translation, path=["response"])

@pytest.mark.skip(reason="Unsupported either condition")
@parametrize
async def test_streaming_response_create(self, async_client: AsyncGroq) -> None:
async with async_client.audio.translations.with_streaming_response.create(
Expand Down