Skip to content
Open
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.21.0"
".": "0.21.1"
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/isaacus/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("_", "-")}
Expand Down
5 changes: 3 additions & 2 deletions src/isaacus/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<array>" traversal markers or end.
if all(p == "<array>" for p in path[index:]):
item = obj.pop(key)
else:
item = obj[key]
Expand Down
2 changes: 1 addition & 1 deletion src/isaacus/_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__ = "isaacus"
__version__ = "0.21.0" # x-release-please-version
__version__ = "0.21.1" # x-release-please-version
8 changes: 4 additions & 4 deletions tests/api_resources/classifications/test_universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"])
Expand Down
12 changes: 6 additions & 6 deletions tests/api_resources/extractions/test_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down Expand Up @@ -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"])

Expand Down
32 changes: 24 additions & 8 deletions tests/api_resources/test_enrichments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -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"])
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"])

Expand All @@ -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"])
Expand All @@ -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
Expand All @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions tests/api_resources/test_rerankings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"])
Expand Down
48 changes: 48 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions tests/test_extract_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<array>"]]) == [
("files[]", b"file one"),
("files[]", b"file two"),
]
assert query == {"title": "hello"}


@pytest.mark.parametrize(
"query,paths,expected",
[
Expand Down