Skip to content

Commit e6eefde

Browse files
authored
Merge pull request #30 from isaacus-dev/release-please--branches--main--changes--next
release: 0.1.4
2 parents 946a5c7 + 475e439 commit e6eefde

File tree

13 files changed

+91
-28
lines changed

13 files changed

+91
-28
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Install dependencies
@@ -42,7 +42,7 @@ jobs:
4242
curl -sSf https://rye.astral.sh/get | bash
4343
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4444
env:
45-
RYE_VERSION: '0.35.0'
45+
RYE_VERSION: '0.44.0'
4646
RYE_INSTALL_OPTION: '--yes'
4747

4848
- name: Bootstrap

.github/workflows/publish-pypi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Publish to PyPI

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.3"
2+
".": "0.1.4"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-472ef5f1174bab055fd83756f45445b5c0f1f3f442c531dfc275ea895ec229a7.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-ec269bff43481aeb5c72d3074aa31815ef915d435e78bc62b0290437a7b2992a.yml

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 0.1.4 (2025-03-15)
4+
5+
Full Changelog: [v0.1.3...v0.1.4](https://github.com/isaacus-dev/isaacus-python/compare/v0.1.3...v0.1.4)
6+
7+
### Features
8+
9+
* **api:** added latest OpenAPI specification ([#29](https://github.com/isaacus-dev/isaacus-python/issues/29)) ([411d83f](https://github.com/isaacus-dev/isaacus-python/commit/411d83f2da5913573e8e09c281a5dfb949670bf9))
10+
* **api:** added latest OpenAPI specification ([#33](https://github.com/isaacus-dev/isaacus-python/issues/33)) ([b053a4a](https://github.com/isaacus-dev/isaacus-python/commit/b053a4a60f48d9d3197d384fe6e3a57723216ac9))
11+
* **api:** added latest OpenAPI specification ([#34](https://github.com/isaacus-dev/isaacus-python/issues/34)) ([d9aef7f](https://github.com/isaacus-dev/isaacus-python/commit/d9aef7fa1d6f5283bdd3afd1962f52d2ed072499))
12+
13+
14+
### Bug Fixes
15+
16+
* **types:** handle more discriminated union shapes ([#32](https://github.com/isaacus-dev/isaacus-python/issues/32)) ([0644ad3](https://github.com/isaacus-dev/isaacus-python/commit/0644ad39f602b43ee03e4eb4ec58b05cb5ff28aa))
17+
18+
19+
### Chores
20+
21+
* **internal:** bump rye to 0.44.0 ([#31](https://github.com/isaacus-dev/isaacus-python/issues/31)) ([371c249](https://github.com/isaacus-dev/isaacus-python/commit/371c2490695cd773b8202c8cd016360535609923))
22+
323
## 0.1.3 (2025-03-15)
424

525
Full Changelog: [v0.1.2...v0.1.3](https://github.com/isaacus-dev/isaacus-python/compare/v0.1.2...v0.1.3)

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ The REST API documentation can be found on [docs.isaacus.com](https://docs.isaac
1515
## Installation
1616

1717
```sh
18-
# install from PyPI
19-
pip install isaacus
18+
# install from the production repo
19+
pip install git+ssh://[email protected]/isaacus-dev/isaacus-python.git
2020
```
2121

22+
> [!NOTE]
23+
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install isaacus`
24+
2225
## Usage
2326

2427
The full API of this library can be found in [api.md](api.md).
@@ -96,7 +99,7 @@ universal_classification = client.classifications.universal.create(
9699
text="I agree not to tell anyone about the document.",
97100
chunking_options={
98101
"overlap_ratio": 0.1,
99-
"overlap_tokens": 0,
102+
"overlap_tokens": None,
100103
"size": 512,
101104
},
102105
)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "isaacus"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "The official Python library for the isaacus API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/isaacus/_models.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
from ._constants import RAW_RESPONSE_HEADER
6666

6767
if TYPE_CHECKING:
68-
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
68+
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
6969

7070
__all__ = ["BaseModel", "GenericModel"]
7171

@@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
646646

647647
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
648648
schema = model.__pydantic_core_schema__
649+
if schema["type"] == "definitions":
650+
schema = schema["schema"]
651+
649652
if schema["type"] != "model":
650653
return None
651654

655+
schema = cast("ModelSchema", schema)
652656
fields_schema = schema["schema"]
653657
if fields_schema["type"] != "model-fields":
654658
return None
655659

656660
fields_schema = cast("ModelFieldsSchema", fields_schema)
657-
658661
field = fields_schema["fields"].get(field_name)
659662
if not field:
660663
return None

src/isaacus/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "isaacus"
4-
__version__ = "0.1.3" # x-release-please-version
4+
__version__ = "0.1.4" # x-release-please-version

src/isaacus/resources/classifications/universal.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ def create(
6868
legal AI classifier.
6969
7070
Args:
71-
model: The ID of the model to use for universal classification.
71+
model: The ID of the [model](https://docs.isaacus.com/models#universal-classification)
72+
to use for universal classification.
7273
73-
query: The Isaacus Query Language (IQL) query or, if IQL is disabled, the statement, to
74-
evaluate the text against.
74+
query: The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if
75+
IQL is disabled, the statement, to evaluate the text against.
7576
7677
The query must contain at least one non-whitespace character.
7778
@@ -84,8 +85,8 @@ def create(
8485
8586
chunking_options: Options for how to split text into smaller chunks.
8687
87-
is_iql: Whether the query should be interpreted as an Isaacus Query Language (IQL) query
88-
or else as a statement.
88+
is_iql: Whether the query should be interpreted as an
89+
[IQL](https://docs.isaacus.com/iql) query or else as a statement.
8990
9091
scoring_method: The method to use for producing an overall confidence score.
9192
@@ -168,10 +169,11 @@ async def create(
168169
legal AI classifier.
169170
170171
Args:
171-
model: The ID of the model to use for universal classification.
172+
model: The ID of the [model](https://docs.isaacus.com/models#universal-classification)
173+
to use for universal classification.
172174
173-
query: The Isaacus Query Language (IQL) query or, if IQL is disabled, the statement, to
174-
evaluate the text against.
175+
query: The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if
176+
IQL is disabled, the statement, to evaluate the text against.
175177
176178
The query must contain at least one non-whitespace character.
177179
@@ -184,8 +186,8 @@ async def create(
184186
185187
chunking_options: Options for how to split text into smaller chunks.
186188
187-
is_iql: Whether the query should be interpreted as an Isaacus Query Language (IQL) query
188-
or else as a statement.
189+
is_iql: Whether the query should be interpreted as an
190+
[IQL](https://docs.isaacus.com/iql) query or else as a statement.
189191
190192
scoring_method: The method to use for producing an overall confidence score.
191193

src/isaacus/types/classifications/universal_create_params.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
class UniversalCreateParams(TypedDict, total=False):
1212
model: Required[Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"]]
13-
"""The ID of the model to use for universal classification."""
13+
"""
14+
The ID of the [model](https://docs.isaacus.com/models#universal-classification)
15+
to use for universal classification.
16+
"""
1417

1518
query: Required[str]
1619
"""
17-
The Isaacus Query Language (IQL) query or, if IQL is disabled, the statement, to
18-
evaluate the text against.
20+
The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if
21+
IQL is disabled, the statement, to evaluate the text against.
1922
2023
The query must contain at least one non-whitespace character.
2124
@@ -34,8 +37,8 @@ class UniversalCreateParams(TypedDict, total=False):
3437

3538
is_iql: bool
3639
"""
37-
Whether the query should be interpreted as an Isaacus Query Language (IQL) query
38-
or else as a statement.
40+
Whether the query should be interpreted as an
41+
[IQL](https://docs.isaacus.com/iql) query or else as a statement.
3942
"""
4043

4144
scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"]

tests/test_models.py

+32
Original file line numberDiff line numberDiff line change
@@ -854,3 +854,35 @@ class Model(BaseModel):
854854
m = construct_type(value={"cls": "foo"}, type_=Model)
855855
assert isinstance(m, Model)
856856
assert isinstance(m.cls, str)
857+
858+
859+
def test_discriminated_union_case() -> None:
860+
class A(BaseModel):
861+
type: Literal["a"]
862+
863+
data: bool
864+
865+
class B(BaseModel):
866+
type: Literal["b"]
867+
868+
data: List[Union[A, object]]
869+
870+
class ModelA(BaseModel):
871+
type: Literal["modelA"]
872+
873+
data: int
874+
875+
class ModelB(BaseModel):
876+
type: Literal["modelB"]
877+
878+
required: str
879+
880+
data: Union[A, B]
881+
882+
# when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required`
883+
m = construct_type(
884+
value={"type": "modelB", "data": {"type": "a", "data": True}},
885+
type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]),
886+
)
887+
888+
assert isinstance(m, ModelB)

0 commit comments

Comments
 (0)