diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0db..e8fdcd6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.10.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d488b33..b091f80 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 6 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-22973c858422fbae26fb3ada2006695fb8f5d5daaf6862e6edb7ed5b8af436b0.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-7247e8d6fb71965ebfc666fb0c1379394b2d7744be2bb304e30e04acfa8855f8.yml openapi_spec_hash: 5511c4c03ee213ceaf68c9f9d889f861 -config_hash: 0d45e63699ddebca7fd366c1ca124e51 +config_hash: 9834a5ea02453b5f2bf894c522931d41 diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f2d35..cb70beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.10.1 (2026-04-11) + +Full Changelog: [v1.10.0...v1.10.1](https://github.com/landing-ai/ade-python/compare/v1.10.0...v1.10.1) + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([ce8fbb0](https://github.com/landing-ai/ade-python/commit/ce8fbb05283ef06ed237dc0df00d4db74436b80a)) +* ensure file data are only sent as 1 parameter ([5917bd2](https://github.com/landing-ai/ade-python/commit/5917bd22142ee3749fe919004b758d44d4e68028)) + ## 1.10.0 (2026-04-06) Full Changelog: [v1.9.0...v1.10.0](https://github.com/landing-ai/ade-python/compare/v1.9.0...v1.10.0) diff --git a/pyproject.toml b/pyproject.toml index 46f20be..0b4635a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "landingai-ade" -version = "1.10.0" +version = "1.10.1" description = "The official Python library for the landingai-ade API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/landingai_ade/_base_client.py b/src/landingai_ade/_base_client.py index 4e4868e..49709f0 100644 --- a/src/landingai_ade/_base_client.py +++ b/src/landingai_ade/_base_client.py @@ -540,6 +540,10 @@ def _build_request( files = cast(HttpxRequestFiles, ForceMultipartDict()) prepared_url = self._prepare_url(options.url) + # preserve hard-coded query params from the url + if params and prepared_url.query: + params = {**dict(prepared_url.params.items()), **params} + prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0]) if "_" in prepared_url.host: # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} diff --git a/src/landingai_ade/_utils/_utils.py b/src/landingai_ade/_utils/_utils.py index eec7f4a..63b8cd6 100644 --- a/src/landingai_ade/_utils/_utils.py +++ b/src/landingai_ade/_utils/_utils.py @@ -86,8 +86,9 @@ def _extract_items( index += 1 if is_dict(obj): try: - # We are at the last entry in the path so we must remove the field - if (len(path)) == index: + # Remove the field if there are no more dict keys in the path, + # only "" traversal markers or end. + if all(p == "" for p in path[index:]): item = obj.pop(key) else: item = obj[key] diff --git a/src/landingai_ade/_version.py b/src/landingai_ade/_version.py index d91be7a..dd732d2 100644 --- a/src/landingai_ade/_version.py +++ b/src/landingai_ade/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "landingai_ade" -__version__ = "1.10.0" # x-release-please-version +__version__ = "1.10.1" # x-release-please-version diff --git a/tests/test_client.py b/tests/test_client.py index 4dde1b7..c0d01b9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -429,6 +429,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: LandingAIADE) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: LandingAIADE) -> None: request = client._build_request( FinalRequestOptions( @@ -1342,6 +1366,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncLandingAIADE) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: LandingAIADE) -> None: request = client._build_request( FinalRequestOptions( diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index d071e9e..e0cda4c 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -35,6 +35,15 @@ def test_multiple_files() -> None: assert query == {"documents": [{}, {}]} +def test_top_level_file_array() -> None: + query = {"files": [b"file one", b"file two"], "title": "hello"} + assert extract_files(query, paths=[["files", ""]]) == [ + ("files[]", b"file one"), + ("files[]", b"file two"), + ] + assert query == {"title": "hello"} + + @pytest.mark.parametrize( "query,paths,expected", [