Skip to content
Merged
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.3.3"
".": "0.4.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-d58ccd91625a3b12fd8d1ceece128b604010bd840096000287c927cb5dcf79eb.yml
openapi_spec_hash: 22c8c973d55f26649e9df96c89ea537f
config_hash: 1d603d50b7183a492ad6df5f728a1863
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-213d554b23f35e746460af23dd32bdde471230549ad223518c86d42ea917a180.yml
openapi_spec_hash: 3672281fe031a42fc59e3a2af758a8f8
config_hash: 1d15d860383a3f6da1ac388297687cc9
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.4.0 (2025-04-19)

Full Changelog: [v0.3.3...v0.4.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.3.3...v0.4.0)

### ⚠ BREAKING CHANGES

* **api:** made universal classification endpoint multi-input only

### Features

* **api:** made universal classification endpoint multi-input only ([4fb2535](https://github.com/isaacus-dev/isaacus-python/commit/4fb2535407d88d51c1db1e9a37c9ea767cdf06c0))


### Chores

* **internal:** bump pyright version ([2f992e7](https://github.com/isaacus-dev/isaacus-python/commit/2f992e788860d16739438a021bd8825a7999b1e4))
* **internal:** update models test ([bb3df78](https://github.com/isaacus-dev/isaacus-python/commit/bb3df7823dd27e6482b5e97ef17019ee0a1e596c))

## 0.3.3 (2025-04-16)

Full Changelog: [v0.3.2...v0.3.3](https://github.com/isaacus-dev/isaacus-python/compare/v0.3.2...v0.3.3)
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ client = Isaacus(
universal_classification = client.classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
print(universal_classification.chunks)
print(universal_classification.classifications)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -62,9 +62,9 @@ async def main() -> None:
universal_classification = await client.classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
print(universal_classification.chunks)
print(universal_classification.classifications)


asyncio.run(main())
Expand Down Expand Up @@ -93,7 +93,7 @@ client = Isaacus()
universal_classification = client.classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
chunking_options={
"overlap_ratio": 0.1,
"overlap_tokens": None,
Expand Down Expand Up @@ -122,7 +122,7 @@ try:
client.classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
except isaacus.APIConnectionError as e:
print("The server could not be reached")
Expand Down Expand Up @@ -169,7 +169,7 @@ client = Isaacus(
client.with_options(max_retries=5).classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
```

Expand All @@ -196,7 +196,7 @@ client = Isaacus(
client.with_options(timeout=5.0).classifications.universal.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
```

Expand Down Expand Up @@ -241,12 +241,12 @@ client = Isaacus()
response = client.classifications.universal.with_raw_response.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
)
print(response.headers.get('X-My-Header'))

universal = response.parse() # get the object that `classifications.universal.create()` would have returned
print(universal.chunks)
print(universal.classifications)
```

These methods return an [`APIResponse`](https://github.com/isaacus-dev/isaacus-python/tree/main/src/isaacus/_response.py) object.
Expand All @@ -263,7 +263,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
with client.classifications.universal.with_streaming_response.create(
model="kanon-universal-classifier",
query="This is a confidentiality clause.",
text="I agree not to tell anyone about the document.",
texts=["I agree not to tell anyone about the document."],
) as response:
print(response.headers.get("X-My-Header"))

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "isaacus"
version = "0.3.3"
version = "0.4.0"
description = "The official Python library for the isaacus API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ Repository = "https://github.com/isaacus-dev/isaacus-python"
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright>=1.1.359",
"pyright==1.1.399",
"mypy",
"respx",
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.392.post0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
6 changes: 5 additions & 1 deletion src/isaacus/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@
_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any])

if TYPE_CHECKING:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
from httpx._config import (
DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage]
)

HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG
else:
try:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
Expand Down
1 change: 0 additions & 1 deletion src/isaacus/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
)

import pydantic
import pydantic.generics
from pydantic.fields import FieldInfo

from ._types import (
Expand Down
2 changes: 1 addition & 1 deletion src/isaacus/_utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MyResponse(Foo[_T]):
```
"""
cls = cast(object, get_origin(typ) or typ)
if cls in generic_bases:
if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains]
# we're given the class directly
return extract_type_arg(typ, index)

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.3.3" # x-release-please-version
__version__ = "0.4.0" # x-release-please-version
46 changes: 23 additions & 23 deletions src/isaacus/resources/classifications/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -52,7 +52,7 @@ def create(
*,
model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
query: str,
text: str,
texts: List[str],
chunking_options: Optional[universal_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
is_iql: bool | NotGiven = NOT_GIVEN,
scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | NotGiven = NOT_GIVEN,
Expand All @@ -64,24 +64,24 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UniversalClassification:
"""
Classify the relevance of a legal document to a query with an Isaacus universal
Classify the relevance of legal documents to a query with an Isaacus universal
legal AI classifier.

Args:
model: The ID of the [model](https://docs.isaacus.com/models#universal-classification)
to use for universal classification.

query: The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if
IQL is disabled, the statement, to evaluate the text against.
IQL is disabled, the statement, to evaluate the texts against.

The query must contain at least one non-whitespace character.

Unlike the text being classified, the query cannot be so long that it exceeds
Unlike the texts being classified, the query cannot be so long that it exceeds
the maximum input length of the universal classifier.

text: The text to classify.
texts: The texts to classify.

The text must contain at least one non-whitespace character.
The texts must contain at least one non-whitespace character.

chunking_options: Options for how to split text into smaller chunks.

Expand All @@ -92,13 +92,13 @@ def create(

`auto` is the default scoring method and is recommended for most use cases.
Currently, it is equivalent to `chunk_max`. In the future, it will automatically
select the best method based on the model and input.
select the best method based on the model and inputs.

`chunk_max` uses the highest confidence score of all of the text's chunks.
`chunk_max` uses the highest confidence score of all of the texts' chunks.

`chunk_avg` averages the confidence scores of all of the text's chunks.
`chunk_avg` averages the confidence scores of all of the texts' chunks.

`chunk_min` uses the lowest confidence score of all of the text's chunks.
`chunk_min` uses the lowest confidence score of all of the texts' chunks.

extra_headers: Send extra headers

Expand All @@ -114,7 +114,7 @@ def create(
{
"model": model,
"query": query,
"text": text,
"texts": texts,
"chunking_options": chunking_options,
"is_iql": is_iql,
"scoring_method": scoring_method,
Expand Down Expand Up @@ -153,7 +153,7 @@ async def create(
*,
model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
query: str,
text: str,
texts: List[str],
chunking_options: Optional[universal_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
is_iql: bool | NotGiven = NOT_GIVEN,
scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | NotGiven = NOT_GIVEN,
Expand All @@ -165,24 +165,24 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UniversalClassification:
"""
Classify the relevance of a legal document to a query with an Isaacus universal
Classify the relevance of legal documents to a query with an Isaacus universal
legal AI classifier.

Args:
model: The ID of the [model](https://docs.isaacus.com/models#universal-classification)
to use for universal classification.

query: The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if
IQL is disabled, the statement, to evaluate the text against.
IQL is disabled, the statement, to evaluate the texts against.

The query must contain at least one non-whitespace character.

Unlike the text being classified, the query cannot be so long that it exceeds
Unlike the texts being classified, the query cannot be so long that it exceeds
the maximum input length of the universal classifier.

text: The text to classify.
texts: The texts to classify.

The text must contain at least one non-whitespace character.
The texts must contain at least one non-whitespace character.

chunking_options: Options for how to split text into smaller chunks.

Expand All @@ -193,13 +193,13 @@ async def create(

`auto` is the default scoring method and is recommended for most use cases.
Currently, it is equivalent to `chunk_max`. In the future, it will automatically
select the best method based on the model and input.
select the best method based on the model and inputs.

`chunk_max` uses the highest confidence score of all of the text's chunks.
`chunk_max` uses the highest confidence score of all of the texts' chunks.

`chunk_avg` averages the confidence scores of all of the text's chunks.
`chunk_avg` averages the confidence scores of all of the texts' chunks.

`chunk_min` uses the lowest confidence score of all of the text's chunks.
`chunk_min` uses the lowest confidence score of all of the texts' chunks.

extra_headers: Send extra headers

Expand All @@ -215,7 +215,7 @@ async def create(
{
"model": model,
"query": query,
"text": text,
"texts": texts,
"chunking_options": chunking_options,
"is_iql": is_iql,
"scoring_method": scoring_method,
Expand Down
Loading