From 1e99aa438e488d81e2e37ad5ea41a48e7b60f1eb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 05:12:57 +0000 Subject: [PATCH 1/4] fix(client): preserve hardcoded query params when merging with user params --- src/isaacus/_base_client.py | 4 ++++ tests/test_client.py | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/isaacus/_base_client.py b/src/isaacus/_base_client.py index 967ce99..628eead 100644 --- a/src/isaacus/_base_client.py +++ b/src/isaacus/_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/tests/test_client.py b/tests/test_client.py index ac88537..156ebfd 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -427,6 +427,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: Isaacus) -> 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: Isaacus) -> None: request = client._build_request( FinalRequestOptions( @@ -1335,6 +1359,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncIsaacus) -> 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: Isaacus) -> None: request = client._build_request( FinalRequestOptions( From 32dab0e1abc9f4f5ea0446cb8bb17c9ee2b55b7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:04:11 +0000 Subject: [PATCH 2/4] fix: ensure file data are only sent as 1 parameter --- src/isaacus/_utils/_utils.py | 5 +++-- tests/test_extract_files.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/isaacus/_utils/_utils.py b/src/isaacus/_utils/_utils.py index eec7f4a..63b8cd6 100644 --- a/src/isaacus/_utils/_utils.py +++ b/src/isaacus/_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/tests/test_extract_files.py b/tests/test_extract_files.py index 7d5b442..7ef62a0 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", [ From 4186943a4a7c4571c7ee2a097bd1715ec074e5dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:08:38 +0000 Subject: [PATCH 3/4] docs: update examples --- .../classifications/test_universal.py | 8 ++--- tests/api_resources/extractions/test_qa.py | 12 +++---- tests/api_resources/test_embeddings.py | 4 +-- tests/api_resources/test_enrichments.py | 32 ++++++++++++++----- tests/api_resources/test_rerankings.py | 16 +++++----- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/tests/api_resources/classifications/test_universal.py b/tests/api_resources/classifications/test_universal.py index 215db24..757e645 100644 --- a/tests/api_resources/classifications/test_universal.py +++ b/tests/api_resources/classifications/test_universal.py @@ -38,8 +38,8 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: scoring_method="auto", chunking_options={ "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(UniversalClassificationResponse, universal, path=["response"]) @@ -101,8 +101,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - scoring_method="auto", chunking_options={ "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(UniversalClassificationResponse, universal, path=["response"]) diff --git a/tests/api_resources/extractions/test_qa.py b/tests/api_resources/extractions/test_qa.py index a76e06d..4841f7f 100644 --- a/tests/api_resources/extractions/test_qa.py +++ b/tests/api_resources/extractions/test_qa.py @@ -41,9 +41,9 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: ignore_inextractability=False, top_k=1, chunking_options={ - "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "size": None, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(AnswerExtractionResponse, qa, path=["response"]) @@ -112,9 +112,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - ignore_inextractability=False, top_k=1, chunking_options={ - "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "size": None, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(AnswerExtractionResponse, qa, path=["response"]) diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py index 5ae4bce..932e12c 100644 --- a/tests/api_resources/test_embeddings.py +++ b/tests/api_resources/test_embeddings.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"], task="retrieval/query", overflow_strategy="drop_end", - dimensions=1, + dimensions=1792, ) assert_matches_type(EmbeddingResponse, embedding, path=["response"]) @@ -89,7 +89,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"], task="retrieval/query", overflow_strategy="drop_end", - dimensions=1, + dimensions=1792, ) assert_matches_type(EmbeddingResponse, embedding, path=["response"]) diff --git a/tests/api_resources/test_enrichments.py b/tests/api_resources/test_enrichments.py index 18ab2d8..3b120d3 100644 --- a/tests/api_resources/test_enrichments.py +++ b/tests/api_resources/test_enrichments.py @@ -22,7 +22,9 @@ class TestEnrichments: def test_method_create(self, client: Isaacus) -> None: enrichment = client.enrichments.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) assert_matches_type(EnrichmentResponse, enrichment, path=["response"]) @@ -31,7 +33,9 @@ def test_method_create(self, client: Isaacus) -> None: def test_method_create_with_all_params(self, client: Isaacus) -> None: enrichment = client.enrichments.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], overflow_strategy="auto", ) assert_matches_type(EnrichmentResponse, enrichment, path=["response"]) @@ -41,7 +45,9 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: def test_raw_response_create(self, client: Isaacus) -> None: response = client.enrichments.with_raw_response.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) assert response.is_closed is True @@ -54,7 +60,9 @@ def test_raw_response_create(self, client: Isaacus) -> None: def test_streaming_response_create(self, client: Isaacus) -> None: with client.enrichments.with_streaming_response.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -75,7 +83,9 @@ class TestAsyncEnrichments: async def test_method_create(self, async_client: AsyncIsaacus) -> None: enrichment = await async_client.enrichments.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) assert_matches_type(EnrichmentResponse, enrichment, path=["response"]) @@ -84,7 +94,9 @@ async def test_method_create(self, async_client: AsyncIsaacus) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) -> None: enrichment = await async_client.enrichments.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], overflow_strategy="auto", ) assert_matches_type(EnrichmentResponse, enrichment, path=["response"]) @@ -94,7 +106,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - async def test_raw_response_create(self, async_client: AsyncIsaacus) -> None: response = await async_client.enrichments.with_raw_response.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) assert response.is_closed is True @@ -107,7 +121,9 @@ async def test_raw_response_create(self, async_client: AsyncIsaacus) -> None: async def test_streaming_response_create(self, async_client: AsyncIsaacus) -> None: async with async_client.enrichments.with_streaming_response.create( model="kanon-2-enricher", - texts=['1.5 You (the "User") agree to be bound by these Terms.'], + texts=[ + '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that "§ 206 of Title 29 of the U.S. Code (the "Labor Title") does not apply to the plaintiff, Ms. Moody, given the definition of an "employee" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria."' + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_rerankings.py b/tests/api_resources/test_rerankings.py index 51cb025..7e349db 100644 --- a/tests/api_resources/test_rerankings.py +++ b/tests/api_resources/test_rerankings.py @@ -46,13 +46,13 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.", ], - top_n=1, + top_n=None, is_iql=False, scoring_method="auto", chunking_options={ - "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "size": None, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(RerankingResponse, reranking, path=["response"]) @@ -134,13 +134,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.", ], - top_n=1, + top_n=None, is_iql=False, scoring_method="auto", chunking_options={ - "size": 512, - "overlap_ratio": 0.1, - "overlap_tokens": 10, + "size": None, + "overlap_ratio": None, + "overlap_tokens": None, }, ) assert_matches_type(RerankingResponse, reranking, path=["response"]) From d2b45229bcaa9259e26d3e3399c5e5c044a16c79 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:08:54 +0000 Subject: [PATCH 4/4] release: 0.21.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- src/isaacus/_version.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 86b0e83..6c7bc2e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.21.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2e00c..73b1b56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.21.1 (2026-04-11) + +Full Changelog: [v0.21.0...v0.21.1](https://github.com/isaacus-dev/isaacus-python/compare/v0.21.0...v0.21.1) + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([1e99aa4](https://github.com/isaacus-dev/isaacus-python/commit/1e99aa438e488d81e2e37ad5ea41a48e7b60f1eb)) +* ensure file data are only sent as 1 parameter ([32dab0e](https://github.com/isaacus-dev/isaacus-python/commit/32dab0e1abc9f4f5ea0446cb8bb17c9ee2b55b7a)) + + +### Documentation + +* update examples ([4186943](https://github.com/isaacus-dev/isaacus-python/commit/4186943a4a7c4571c7ee2a097bd1715ec074e5dd)) + ## 0.21.0 (2026-03-27) Full Changelog: [v0.20.0...v0.21.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.20.0...v0.21.0) diff --git a/pyproject.toml b/pyproject.toml index 43ce8b0..227c1c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "isaacus" -version = "0.21.0" +version = "0.21.1" description = "The official Python library for the isaacus API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/isaacus/_version.py b/src/isaacus/_version.py index fe74c62..b42f9bf 100644 --- a/src/isaacus/_version.py +++ b/src/isaacus/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "isaacus" -__version__ = "0.21.0" # x-release-please-version +__version__ = "0.21.1" # x-release-please-version