Skip to content

Commit 871d247

Browse files
release: 0.29.0 (#246)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 842e56a commit 871d247

22 files changed

+348
-131
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- 'integrated/**'
88
- 'stl-preview-head/**'
99
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
1014

1115
jobs:
1216
lint:

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.28.0"
2+
".": "0.29.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-ea5b03626ef6c5d62792b87e2bef9acff936112791abe056db5d0a7a66ba39d7.yml
3-
openapi_spec_hash: 841fe2e4ce7db3d377f7ad03cd973344
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-1cdb4a5cd72775ee5627d03ec76df2a4d1dc5d2de4a5352ff76e0e4a228fd1a3.yml
3+
openapi_spec_hash: ce67895609996ea0c6086814d47641ab
44
config_hash: 6b1c374dcc1ffa3165dd22f52a77ff89

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# Changelog
22

3+
## 0.29.0 (2025-06-25)
4+
5+
Full Changelog: [v0.28.0...v0.29.0](https://github.com/groq/groq-python/compare/v0.28.0...v0.29.0)
6+
7+
### Features
8+
9+
* **api:** api update ([2f78465](https://github.com/groq/groq-python/commit/2f7846558486855edc4001eefc6bec003a943d26))
10+
* **client:** add support for aiohttp ([a306987](https://github.com/groq/groq-python/commit/a30698732eeaa097832132908429c6b04e7cf027))
11+
12+
13+
### Bug Fixes
14+
15+
* **client:** correctly parse binary response | stream ([da571bc](https://github.com/groq/groq-python/commit/da571bc0979873525bbf9c2d6efa53aee27a8519))
16+
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([778531f](https://github.com/groq/groq-python/commit/778531f0de3f65881b226bf42b93cac119d3f209))
17+
18+
19+
### Chores
20+
21+
* **ci:** enable for pull requests ([daf0500](https://github.com/groq/groq-python/commit/daf050078783c0389c950d422335533d85320cf6))
22+
* **internal:** update conftest.py ([ed4b0b5](https://github.com/groq/groq-python/commit/ed4b0b59bc0bc63363f46d2baed8ff833470130e))
23+
* **readme:** update badges ([d08d4f4](https://github.com/groq/groq-python/commit/d08d4f4472e452eaa92ed1385342cb01b1a0797d))
24+
* **tests:** add tests for httpx client instantiation & proxies ([94821d3](https://github.com/groq/groq-python/commit/94821d3c726bb3ca7057c7a19958e6111789c9de))
25+
* **tests:** run tests in parallel ([ce56989](https://github.com/groq/groq-python/commit/ce56989094581c26b79605012c637e942c972689))
26+
* **tests:** skip some failing tests on the latest python versions ([15a744b](https://github.com/groq/groq-python/commit/15a744b4ce1043d3e17dfee8bcae329f5708e6c8))
27+
28+
29+
### Documentation
30+
31+
* **client:** fix httpx.Timeout documentation reference ([5776227](https://github.com/groq/groq-python/commit/577622772f66242961d216dffef1d6e003028d7f))
32+
333
## 0.28.0 (2025-06-12)
434

535
Full Changelog: [v0.27.0...v0.28.0](https://github.com/groq/groq-python/compare/v0.27.0...v0.28.0)

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Groq Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/groq.svg)](https://pypi.org/project/groq/)
3+
[![PyPI version](<https://img.shields.io/pypi/v/groq.svg?label=pypi%20(stable)>)](https://pypi.org/project/groq/)
44

55
The Groq Python library provides convenient access to the Groq REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
@@ -80,6 +80,46 @@ asyncio.run(main())
8080

8181
Functionality between the synchronous and asynchronous clients is otherwise identical.
8282

83+
### With aiohttp
84+
85+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
86+
87+
You can enable this by installing `aiohttp`:
88+
89+
```sh
90+
# install from PyPI
91+
pip install groq[aiohttp]
92+
```
93+
94+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
95+
96+
```python
97+
import os
98+
import asyncio
99+
from groq import DefaultAioHttpClient
100+
from groq import AsyncGroq
101+
102+
103+
async def main() -> None:
104+
async with AsyncGroq(
105+
api_key=os.environ.get("GROQ_API_KEY"), # This is the default and can be omitted
106+
http_client=DefaultAioHttpClient(),
107+
) as client:
108+
chat_completion = await client.chat.completions.create(
109+
messages=[
110+
{
111+
"role": "user",
112+
"content": "Explain the importance of low latency LLMs",
113+
}
114+
],
115+
model="llama3-8b-8192",
116+
)
117+
print(chat_completion.id)
118+
119+
120+
asyncio.run(main())
121+
```
122+
83123
## Using types
84124

85125
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
@@ -218,7 +258,7 @@ client.with_options(max_retries=5).chat.completions.create(
218258
### Timeouts
219259

220260
By default requests time out after 1 minute. You can configure this with a `timeout` option,
221-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
261+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
222262

223263
```python
224264
from groq import Groq

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "groq"
3-
version = "0.28.0"
3+
version = "0.29.0"
44
description = "The official Python library for the groq API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -37,6 +37,8 @@ classifiers = [
3737
Homepage = "https://github.com/groq/groq-python"
3838
Repository = "https://github.com/groq/groq-python"
3939

40+
[project.optional-dependencies]
41+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
4042

4143
[tool.rye]
4244
managed = true
@@ -54,6 +56,7 @@ dev-dependencies = [
5456
"importlib-metadata>=6.7.0",
5557
"rich>=13.7.1",
5658
"nest_asyncio==1.6.0",
59+
"pytest-xdist>=3.6.1",
5760
]
5861

5962
[tool.rye.scripts]
@@ -125,7 +128,7 @@ replacement = '[\1](https://github.com/groq/groq-python/tree/main/\g<2>)'
125128

126129
[tool.pytest.ini_options]
127130
testpaths = ["tests"]
128-
addopts = "--tb=short"
131+
addopts = "--tb=short -n auto"
129132
xfail_strict = true
130133
asyncio_mode = "auto"
131134
asyncio_default_fixture_loop_scope = "session"

requirements-dev.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,24 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.8
16+
# via groq
17+
# via httpx-aiohttp
18+
aiosignal==1.3.2
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anyio==4.4.0
1623
# via groq
1724
# via httpx
1825
argcomplete==3.1.2
1926
# via nox
27+
async-timeout==5.0.1
28+
# via aiohttp
29+
attrs==25.3.0
30+
# via aiohttp
2031
certifi==2023.7.22
2132
# via httpcore
2233
# via httpx
@@ -30,25 +41,37 @@ distro==1.8.0
3041
exceptiongroup==1.2.2
3142
# via anyio
3243
# via pytest
44+
execnet==2.1.1
45+
# via pytest-xdist
3346
filelock==3.12.4
3447
# via virtualenv
48+
frozenlist==1.6.2
49+
# via aiohttp
50+
# via aiosignal
3551
h11==0.14.0
3652
# via httpcore
3753
httpcore==1.0.2
3854
# via httpx
3955
httpx==0.28.1
4056
# via groq
57+
# via httpx-aiohttp
4158
# via respx
59+
httpx-aiohttp==0.1.6
60+
# via groq
4261
idna==3.4
4362
# via anyio
4463
# via httpx
64+
# via yarl
4565
importlib-metadata==7.0.0
4666
iniconfig==2.0.0
4767
# via pytest
4868
markdown-it-py==3.0.0
4969
# via rich
5070
mdurl==0.1.2
5171
# via markdown-it-py
72+
multidict==6.4.4
73+
# via aiohttp
74+
# via yarl
5275
mypy==1.14.1
5376
mypy-extensions==1.0.0
5477
# via mypy
@@ -63,6 +86,9 @@ platformdirs==3.11.0
6386
# via virtualenv
6487
pluggy==1.5.0
6588
# via pytest
89+
propcache==0.3.1
90+
# via aiohttp
91+
# via yarl
6692
pydantic==2.10.3
6793
# via groq
6894
pydantic-core==2.27.1
@@ -72,7 +98,9 @@ pygments==2.18.0
7298
pyright==1.1.399
7399
pytest==8.3.3
74100
# via pytest-asyncio
101+
# via pytest-xdist
75102
pytest-asyncio==0.24.0
103+
pytest-xdist==3.7.0
76104
python-dateutil==2.8.2
77105
# via time-machine
78106
pytz==2023.3.post1
@@ -94,11 +122,14 @@ tomli==2.0.2
94122
typing-extensions==4.12.2
95123
# via anyio
96124
# via groq
125+
# via multidict
97126
# via mypy
98127
# via pydantic
99128
# via pydantic-core
100129
# via pyright
101130
virtualenv==20.24.5
102131
# via nox
132+
yarl==1.20.0
133+
# via aiohttp
103134
zipp==3.17.0
104135
# via importlib-metadata

requirements.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,51 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.8
16+
# via groq
17+
# via httpx-aiohttp
18+
aiosignal==1.3.2
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anyio==4.4.0
1623
# via groq
1724
# via httpx
25+
async-timeout==5.0.1
26+
# via aiohttp
27+
attrs==25.3.0
28+
# via aiohttp
1829
certifi==2023.7.22
1930
# via httpcore
2031
# via httpx
2132
distro==1.8.0
2233
# via groq
2334
exceptiongroup==1.2.2
2435
# via anyio
36+
frozenlist==1.6.2
37+
# via aiohttp
38+
# via aiosignal
2539
h11==0.14.0
2640
# via httpcore
2741
httpcore==1.0.2
2842
# via httpx
2943
httpx==0.28.1
3044
# via groq
45+
# via httpx-aiohttp
46+
httpx-aiohttp==0.1.6
47+
# via groq
3148
idna==3.4
3249
# via anyio
3350
# via httpx
51+
# via yarl
52+
multidict==6.4.4
53+
# via aiohttp
54+
# via yarl
55+
propcache==0.3.1
56+
# via aiohttp
57+
# via yarl
3458
pydantic==2.10.3
3559
# via groq
3660
pydantic-core==2.27.1
@@ -41,5 +65,8 @@ sniffio==1.3.0
4165
typing-extensions==4.12.2
4266
# via anyio
4367
# via groq
68+
# via multidict
4469
# via pydantic
4570
# via pydantic-core
71+
yarl==1.20.0
72+
# via aiohttp

src/groq/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
UnprocessableEntityError,
2727
APIResponseValidationError,
2828
)
29-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
29+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
3030
from ._utils._logs import setup_logging as _setup_logging
3131

3232
__all__ = [
@@ -68,6 +68,7 @@
6868
"DEFAULT_CONNECTION_LIMITS",
6969
"DefaultHttpxClient",
7070
"DefaultAsyncHttpxClient",
71+
"DefaultAioHttpClient",
7172
]
7273

7374
if not _t.TYPE_CHECKING:

0 commit comments

Comments
 (0)