diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fb1bd8f..6a197be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.2" + ".": "1.17.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a1ed1e..42ffee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.17.0 (2025-08-06) + +Full Changelog: [v1.16.2...v1.17.0](https://github.com/lumalabs/lumaai-python/compare/v1.16.2...v1.17.0) + +### Features + +* **client:** support file upload requests ([34a3cfb](https://github.com/lumalabs/lumaai-python/commit/34a3cfb3ca6655c5014fcebf8fb6fbee157cf202)) + + +### Chores + +* **internal:** fix ruff target version ([eb0161d](https://github.com/lumalabs/lumaai-python/commit/eb0161d4e30ec79cb2e6193b508af6e9bfd36668)) + ## 1.16.2 (2025-07-25) Full Changelog: [v1.16.1...v1.16.2](https://github.com/lumalabs/lumaai-python/compare/v1.16.1...v1.16.2) diff --git a/pyproject.toml b/pyproject.toml index 47e5b16..dde79d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lumaai" -version = "1.16.2" +version = "1.17.0" description = "The official Python library for the lumaai API" dynamic = ["readme"] license = "Apache-2.0" @@ -159,7 +159,7 @@ reportPrivateUsage = false [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" [tool.ruff.format] docstring-code-format = true diff --git a/src/lumaai/_base_client.py b/src/lumaai/_base_client.py index 4a8b7ba..2e3c4f7 100644 --- a/src/lumaai/_base_client.py +++ b/src/lumaai/_base_client.py @@ -532,7 +532,10 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - kwargs["json"] = json_data if is_given(json_data) else None + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/lumaai/_files.py b/src/lumaai/_files.py index 715cc20..cc14c14 100644 --- a/src/lumaai/_files.py +++ b/src/lumaai/_files.py @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() diff --git a/src/lumaai/_version.py b/src/lumaai/_version.py index 51e2321..356bdd3 100644 --- a/src/lumaai/_version.py +++ b/src/lumaai/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "lumaai" -__version__ = "1.16.2" # x-release-please-version +__version__ = "1.17.0" # x-release-please-version