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.17.0"
".": "0.18.0"
}
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
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-d1588e103a6ae0234752b8e54a746fb1e4c93a0ee51ede294017bcd4f0ee4ac0.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.18.0 (2025-02-05)

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

### Features

* **api:** Add batch API ([#191](https://github.com/groq/groq-python/issues/191)) ([367a744](https://github.com/groq/groq-python/commit/367a744f461ec82353b916c7d95224d9baa78737))


### Chores

* **internal:** bummp ruff dependency ([#190](https://github.com/groq/groq-python/issues/190)) ([61678fc](https://github.com/groq/groq-python/commit/61678fc5fd4eb42e42d88057934b6204d19086af))
* **internal:** change default timeout to an int ([#188](https://github.com/groq/groq-python/issues/188)) ([348e152](https://github.com/groq/groq-python/commit/348e1526711e4d162379dcd80a9b201572508376))

## 0.17.0 (2025-02-03)

Full Changelog: [v0.16.0...v0.17.0](https://github.com/groq/groq-python/compare/v0.16.0...v0.17.0)
Expand Down
36 changes: 36 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,39 @@ Methods:
- <code title="get /openai/v1/models/{model}">client.models.<a href="./src/groq/resources/models.py">retrieve</a>(model) -> <a href="./src/groq/types/model.py">Model</a></code>
- <code title="get /openai/v1/models">client.models.<a href="./src/groq/resources/models.py">list</a>() -> <a href="./src/groq/types/model_list_response.py">ModelListResponse</a></code>
- <code title="delete /openai/v1/models/{model}">client.models.<a href="./src/groq/resources/models.py">delete</a>(model) -> <a href="./src/groq/types/model_deleted.py">ModelDeleted</a></code>

# Batches

Types:

```python
from groq.types import BatchCreateResponse, BatchRetrieveResponse, BatchListResponse
```

Methods:

- <code title="post /openai/v1/batches">client.batches.<a href="./src/groq/resources/batches.py">create</a>(\*\*<a href="src/groq/types/batch_create_params.py">params</a>) -> <a href="./src/groq/types/batch_create_response.py">BatchCreateResponse</a></code>
- <code title="get /openai/v1/batches/{batch_id}">client.batches.<a href="./src/groq/resources/batches.py">retrieve</a>(batch_id) -> <a href="./src/groq/types/batch_retrieve_response.py">BatchRetrieveResponse</a></code>
- <code title="get /openai/v1/batches">client.batches.<a href="./src/groq/resources/batches.py">list</a>() -> <a href="./src/groq/types/batch_list_response.py">BatchListResponse</a></code>

# Files

Types:

```python
from groq.types import (
FileCreateResponse,
FileListResponse,
FileDeleteResponse,
FileContentResponse,
FileInfoResponse,
)
```

Methods:

- <code title="post /openai/v1/files">client.files.<a href="./src/groq/resources/files.py">create</a>(\*\*<a href="src/groq/types/file_create_params.py">params</a>) -> <a href="./src/groq/types/file_create_response.py">FileCreateResponse</a></code>
- <code title="get /openai/v1/files">client.files.<a href="./src/groq/resources/files.py">list</a>() -> <a href="./src/groq/types/file_list_response.py">FileListResponse</a></code>
- <code title="delete /openai/v1/files/{file_id}">client.files.<a href="./src/groq/resources/files.py">delete</a>(file_id) -> <a href="./src/groq/types/file_delete_response.py">FileDeleteResponse</a></code>
- <code title="get /openai/v1/files/{file_id}/content">client.files.<a href="./src/groq/resources/files.py">content</a>(file_id) -> str</code>
- <code title="get /openai/v1/files/{file_id}">client.files.<a href="./src/groq/resources/files.py">info</a>(file_id) -> <a href="./src/groq/types/file_info_response.py">FileInfoResponse</a></code>
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "groq"
version = "0.17.0"
version = "0.18.0"
description = "The official Python library for the groq API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -177,7 +177,7 @@ select = [
"T201",
"T203",
# misuse of typing.TYPE_CHECKING
"TCH004",
"TC004",
# import rules
"TID251",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pytz==2023.3.post1
# via dirty-equals
respx==0.22.0
rich==13.7.1
ruff==0.6.9
ruff==0.9.4
setuptools==68.2.2
# via nodeenv
six==1.16.0
Expand Down
4 changes: 2 additions & 2 deletions scripts/utils/ruffen-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str:
with _collect_error(match):
code = format_code_block(code)
code = textwrap.indent(code, match["indent"])
return f'{match["before"]}{code}{match["after"]}'
return f"{match['before']}{code}{match['after']}"

def _pycon_match(match: Match[str]) -> str:
code = ""
Expand Down Expand Up @@ -97,7 +97,7 @@ def finish_fragment() -> None:
def _md_pycon_match(match: Match[str]) -> str:
code = _pycon_match(match)
code = textwrap.indent(code, match["indent"])
return f'{match["before"]}{code}{match["after"]}'
return f"{match['before']}{code}{match['after']}"

src = MD_RE.sub(_md_match, src)
src = MD_PYCON_RE.sub(_md_pycon_match, src)
Expand Down
18 changes: 17 additions & 1 deletion src/groq/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
get_async_library,
)
from ._version import __version__
from .resources import models, embeddings
from .resources import files, models, batches, embeddings
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import GroqError, APIStatusError
from ._base_client import (
Expand All @@ -43,6 +43,8 @@ class Groq(SyncAPIClient):
embeddings: embeddings.Embeddings
audio: audio.Audio
models: models.Models
batches: batches.Batches
files: files.Files
with_raw_response: GroqWithRawResponse
with_streaming_response: GroqWithStreamedResponse

Expand Down Expand Up @@ -104,6 +106,8 @@ def __init__(
self.embeddings = embeddings.Embeddings(self)
self.audio = audio.Audio(self)
self.models = models.Models(self)
self.batches = batches.Batches(self)
self.files = files.Files(self)
self.with_raw_response = GroqWithRawResponse(self)
self.with_streaming_response = GroqWithStreamedResponse(self)

Expand Down Expand Up @@ -217,6 +221,8 @@ class AsyncGroq(AsyncAPIClient):
embeddings: embeddings.AsyncEmbeddings
audio: audio.AsyncAudio
models: models.AsyncModels
batches: batches.AsyncBatches
files: files.AsyncFiles
with_raw_response: AsyncGroqWithRawResponse
with_streaming_response: AsyncGroqWithStreamedResponse

Expand Down Expand Up @@ -278,6 +284,8 @@ def __init__(
self.embeddings = embeddings.AsyncEmbeddings(self)
self.audio = audio.AsyncAudio(self)
self.models = models.AsyncModels(self)
self.batches = batches.AsyncBatches(self)
self.files = files.AsyncFiles(self)
self.with_raw_response = AsyncGroqWithRawResponse(self)
self.with_streaming_response = AsyncGroqWithStreamedResponse(self)

Expand Down Expand Up @@ -392,6 +400,8 @@ def __init__(self, client: Groq) -> None:
self.embeddings = embeddings.EmbeddingsWithRawResponse(client.embeddings)
self.audio = audio.AudioWithRawResponse(client.audio)
self.models = models.ModelsWithRawResponse(client.models)
self.batches = batches.BatchesWithRawResponse(client.batches)
self.files = files.FilesWithRawResponse(client.files)


class AsyncGroqWithRawResponse:
Expand All @@ -400,6 +410,8 @@ def __init__(self, client: AsyncGroq) -> None:
self.embeddings = embeddings.AsyncEmbeddingsWithRawResponse(client.embeddings)
self.audio = audio.AsyncAudioWithRawResponse(client.audio)
self.models = models.AsyncModelsWithRawResponse(client.models)
self.batches = batches.AsyncBatchesWithRawResponse(client.batches)
self.files = files.AsyncFilesWithRawResponse(client.files)


class GroqWithStreamedResponse:
Expand All @@ -408,6 +420,8 @@ def __init__(self, client: Groq) -> None:
self.embeddings = embeddings.EmbeddingsWithStreamingResponse(client.embeddings)
self.audio = audio.AudioWithStreamingResponse(client.audio)
self.models = models.ModelsWithStreamingResponse(client.models)
self.batches = batches.BatchesWithStreamingResponse(client.batches)
self.files = files.FilesWithStreamingResponse(client.files)


class AsyncGroqWithStreamedResponse:
Expand All @@ -416,6 +430,8 @@ def __init__(self, client: AsyncGroq) -> None:
self.embeddings = embeddings.AsyncEmbeddingsWithStreamingResponse(client.embeddings)
self.audio = audio.AsyncAudioWithStreamingResponse(client.audio)
self.models = models.AsyncModelsWithStreamingResponse(client.models)
self.batches = batches.AsyncBatchesWithStreamingResponse(client.batches)
self.files = files.AsyncFilesWithStreamingResponse(client.files)


Client = Groq
Expand Down
2 changes: 1 addition & 1 deletion src/groq/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"

# default timeout is 1 minute
DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0)
DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0)
DEFAULT_MAX_RETRIES = 2
DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)

Expand Down
2 changes: 1 addition & 1 deletion src/groq/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def to_json(
@override
def __str__(self) -> str:
# mypy complains about an invalid self arg
return f'{self.__repr_name__()}({self.__repr_str__(", ")})' # type: ignore[misc]
return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc]

# Override the 'construct' method in a way that supports recursive parsing without validation.
# Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836.
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.17.0" # x-release-please-version
__version__ = "0.18.0" # x-release-please-version
28 changes: 28 additions & 0 deletions src/groq/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
AudioWithStreamingResponse,
AsyncAudioWithStreamingResponse,
)
from .files import (
Files,
AsyncFiles,
FilesWithRawResponse,
AsyncFilesWithRawResponse,
FilesWithStreamingResponse,
AsyncFilesWithStreamingResponse,
)
from .models import (
Models,
AsyncModels,
Expand All @@ -24,6 +32,14 @@
ModelsWithStreamingResponse,
AsyncModelsWithStreamingResponse,
)
from .batches import (
Batches,
AsyncBatches,
BatchesWithRawResponse,
AsyncBatchesWithRawResponse,
BatchesWithStreamingResponse,
AsyncBatchesWithStreamingResponse,
)
from .embeddings import (
Embeddings,
AsyncEmbeddings,
Expand Down Expand Up @@ -58,4 +74,16 @@
"AsyncModelsWithRawResponse",
"ModelsWithStreamingResponse",
"AsyncModelsWithStreamingResponse",
"Batches",
"AsyncBatches",
"BatchesWithRawResponse",
"AsyncBatchesWithRawResponse",
"BatchesWithStreamingResponse",
"AsyncBatchesWithStreamingResponse",
"Files",
"AsyncFiles",
"FilesWithRawResponse",
"AsyncFilesWithRawResponse",
"FilesWithStreamingResponse",
"AsyncFilesWithStreamingResponse",
]
Loading