isaacus 0.8.0__tar.gz → 0.9.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- isaacus-0.9.1/.release-please-manifest.json +3 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/CHANGELOG.md +63 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/PKG-INFO +54 -41
- {isaacus-0.8.0 → isaacus-0.9.1}/README.md +52 -39
- {isaacus-0.8.0 → isaacus-0.9.1}/api.md +18 -6
- {isaacus-0.8.0 → isaacus-0.9.1}/pyproject.toml +60 -4
- {isaacus-0.8.0 → isaacus-0.9.1}/requirements-dev.lock +6 -4
- {isaacus-0.8.0 → isaacus-0.9.1}/requirements.lock +6 -3
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/__init__.py +3 -1
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_base_client.py +40 -12
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_client.py +17 -9
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_compat.py +48 -48
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_files.py +4 -4
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_models.py +51 -45
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_qs.py +7 -7
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_types.py +53 -12
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/__init__.py +9 -2
- isaacus-0.9.1/src/isaacus/_utils/_compat.py +45 -0
- isaacus-0.9.1/src/isaacus/_utils/_datetime_parse.py +136 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_transform.py +13 -3
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_typing.py +6 -1
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_utils.py +4 -5
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_version.py +1 -1
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/__init__.py +14 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/classifications/universal.py +17 -17
- isaacus-0.9.1/src/isaacus/resources/embeddings.py +246 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/extractions/qa.py +23 -21
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/rerankings.py +19 -19
- isaacus-0.9.1/src/isaacus/types/__init__.py +8 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/types/classifications/__init__.py +1 -1
- isaacus-0.8.0/src/isaacus/types/classifications/universal_classification.py → isaacus-0.9.1/src/isaacus/types/classifications/universal_classification_response.py +2 -2
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/types/classifications/universal_create_params.py +4 -2
- isaacus-0.9.1/src/isaacus/types/embedding_create_params.py +49 -0
- isaacus-0.9.1/src/isaacus/types/embedding_response.py +31 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/types/extractions/__init__.py +1 -1
- isaacus-0.8.0/src/isaacus/types/extractions/answer_extraction.py → isaacus-0.9.1/src/isaacus/types/extractions/answer_extraction_response.py +2 -2
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/types/extractions/qa_create_params.py +7 -4
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/types/reranking_create_params.py +4 -2
- isaacus-0.8.0/src/isaacus/types/reranking.py → isaacus-0.9.1/src/isaacus/types/reranking_response.py +2 -2
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/classifications/test_universal.py +19 -19
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/extractions/test_qa.py +19 -19
- isaacus-0.9.1/tests/api_resources/test_embeddings.py +122 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/test_rerankings.py +19 -19
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_client.py +46 -97
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_models.py +24 -24
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_transform.py +17 -10
- isaacus-0.9.1/tests/test_utils/test_datetime_parse.py +110 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/utils.py +13 -5
- isaacus-0.8.0/.release-please-manifest.json +0 -3
- isaacus-0.8.0/mypy.ini +0 -50
- isaacus-0.8.0/src/isaacus/types/__init__.py +0 -6
- {isaacus-0.8.0 → isaacus-0.9.1}/.gitignore +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/CONTRIBUTING.md +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/LICENSE +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/SECURITY.md +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/bin/check-release-environment +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/bin/publish-pypi +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/examples/.keep +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/noxfile.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/release-please-config.json +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_constants.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_exceptions.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_resource.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_response.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_streaming.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_logs.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_proxy.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_reflection.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_resources_proxy.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_streams.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/_utils/_sync.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/lib/.keep +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/py.typed +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/classifications/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/classifications/classifications.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/extractions/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/src/isaacus/resources/extractions/extractions.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/classifications/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/api_resources/extractions/__init__.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/conftest.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/sample_file.txt +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_deepcopy.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_extract_files.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_files.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_qs.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_required_args.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_response.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_streaming.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_utils/test_proxy.py +0 -0
- {isaacus-0.8.0 → isaacus-0.9.1}/tests/test_utils/test_typing.py +0 -0
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.1 (2025-10-19)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.9.0...v0.9.1](https://github.com/isaacus-dev/isaacus-python/compare/v0.9.0...v0.9.1)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* bump `httpx-aiohttp` version to 0.1.9 ([7a85243](https://github.com/isaacus-dev/isaacus-python/commit/7a85243fcfb9d5b78d522d336310dcd1f009e904))
|
|
10
|
+
|
|
11
|
+
## 0.9.0 (2025-10-14)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.8.0...v0.9.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.8.0...v0.9.0)
|
|
14
|
+
|
|
15
|
+
### ⚠ BREAKING CHANGES
|
|
16
|
+
|
|
17
|
+
* **api:** reduce max length of embeddings input
|
|
18
|
+
* **sdk:** add `_response` to response models to finally fix duplicated names
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **api:** added embedding endpoint ([88190d6](https://github.com/isaacus-dev/isaacus-python/commit/88190d6d33c8d5e3cf59dfd3c488b5ae9abec93b))
|
|
23
|
+
* **api:** reduce max length of embeddings input ([0ad7114](https://github.com/isaacus-dev/isaacus-python/commit/0ad7114b5fec2fde9aaa830a6ba6163ad3b6fccc))
|
|
24
|
+
* **api:** rename embedding -> embeddings ([204a05d](https://github.com/isaacus-dev/isaacus-python/commit/204a05d7b1504901766db3c0d0d8ea47a22a16ed))
|
|
25
|
+
* **api:** revert embedding -> embeddings ([b934279](https://github.com/isaacus-dev/isaacus-python/commit/b9342795e50374817b8e3dc2e2f1163a2ff0805a))
|
|
26
|
+
* **client:** support file upload requests ([2ab398d](https://github.com/isaacus-dev/isaacus-python/commit/2ab398dde07e98411c9b6efd76f7b7120a9633a8))
|
|
27
|
+
* improve future compat with pydantic v3 ([5a20497](https://github.com/isaacus-dev/isaacus-python/commit/5a20497a9c4bbf88056df12a0c686566dc9bd162))
|
|
28
|
+
* **sdk:** add embeddings endpoint ([920ae0b](https://github.com/isaacus-dev/isaacus-python/commit/920ae0b65f2362ac098f8b94979b1e821f5143d8))
|
|
29
|
+
* **sdk:** toggle to force regen ([cf60482](https://github.com/isaacus-dev/isaacus-python/commit/cf60482ba0dd3933daee477fa9bd4ae29d900fb4))
|
|
30
|
+
* **sdk:** untoggle to force regen ([25d2067](https://github.com/isaacus-dev/isaacus-python/commit/25d2067fad4bb46ca595001f6e82458fd3d24a23))
|
|
31
|
+
* **types:** replace List[str] with SequenceNotStr in params ([d2733a9](https://github.com/isaacus-dev/isaacus-python/commit/d2733a9d0f16531537a9db017a8e29d2c8fb3912))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **api:** typo ([5d4a1b9](https://github.com/isaacus-dev/isaacus-python/commit/5d4a1b99e8a6ac2a1c3cc4e83e7b65108eea335a))
|
|
37
|
+
* avoid newer type syntax ([10253fe](https://github.com/isaacus-dev/isaacus-python/commit/10253fe93ed8142b52cf5199486221e81ac6ce5a))
|
|
38
|
+
* **sdk:** add `_response` to response models to finally fix duplicated names ([5c7462d](https://github.com/isaacus-dev/isaacus-python/commit/5c7462dd25c67c44126eb946a656a6b841dc6a50))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Chores
|
|
42
|
+
|
|
43
|
+
* **api:** try to force regen SDK ([2fafb55](https://github.com/isaacus-dev/isaacus-python/commit/2fafb555c1a20d7c359c91c35fd1f54868cffe54))
|
|
44
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([57b055e](https://github.com/isaacus-dev/isaacus-python/commit/57b055ed56fdcc58b4663e4ddad32afac25e7ec1))
|
|
45
|
+
* improve example values ([35b03bd](https://github.com/isaacus-dev/isaacus-python/commit/35b03bdbf4ceaccd00102e23d639a01d5bea136a))
|
|
46
|
+
* **internal:** add Sequence related utils ([5a2287e](https://github.com/isaacus-dev/isaacus-python/commit/5a2287ef854d250048c070f3fd88b00ca84b0d3c))
|
|
47
|
+
* **internal:** change ci workflow machines ([f86cbce](https://github.com/isaacus-dev/isaacus-python/commit/f86cbcef2583658466e95eaba4aba61f79646ef9))
|
|
48
|
+
* **internal:** codegen related update ([22b520b](https://github.com/isaacus-dev/isaacus-python/commit/22b520b3c67e570f9267135111a89542ee2bdf7f))
|
|
49
|
+
* **internal:** fix ruff target version ([889d576](https://github.com/isaacus-dev/isaacus-python/commit/889d576cdc28d06404c6ee3ce0c67bf4d3be75c4))
|
|
50
|
+
* **internal:** move mypy configurations to `pyproject.toml` file ([d5732d5](https://github.com/isaacus-dev/isaacus-python/commit/d5732d5e0145763723e8be24cbd8296f9a385264))
|
|
51
|
+
* **internal:** update comment in script ([7af966e](https://github.com/isaacus-dev/isaacus-python/commit/7af966e1677b44d412eda96c5ee8e9866f77ccfb))
|
|
52
|
+
* **internal:** update pydantic dependency ([68a7057](https://github.com/isaacus-dev/isaacus-python/commit/68a70578a2e269fa3b2c46e3c29e82ba770090d6))
|
|
53
|
+
* **internal:** update pyright exclude list ([6f0ae86](https://github.com/isaacus-dev/isaacus-python/commit/6f0ae86899883fe77aa669d595c623bedc2dc5c8))
|
|
54
|
+
* remove custom code ([491dbdc](https://github.com/isaacus-dev/isaacus-python/commit/491dbdcd82984d099b8ee11e94894ad450b2424d))
|
|
55
|
+
* **sdk:** restore original example ([079645e](https://github.com/isaacus-dev/isaacus-python/commit/079645e85259c2e4d3f6aa86b2ca2c21ce97367a))
|
|
56
|
+
* **tests:** simplify `get_platform` test ([e00ccd0](https://github.com/isaacus-dev/isaacus-python/commit/e00ccd0c41c3751eb3fae880223ebb05eae0f154))
|
|
57
|
+
* **types:** change optional parameter type from NotGiven to Omit ([38d13e0](https://github.com/isaacus-dev/isaacus-python/commit/38d13e0514b001d1a34446b881783d559e246865))
|
|
58
|
+
* update @stainless-api/prism-cli to v5.15.0 ([a3141f5](https://github.com/isaacus-dev/isaacus-python/commit/a3141f59b0ff6334fde2a9740fd2f86824fe5083))
|
|
59
|
+
* update github action ([0518028](https://github.com/isaacus-dev/isaacus-python/commit/05180288265bc111dba1c62fbfcd90139a6299ad))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Documentation
|
|
63
|
+
|
|
64
|
+
* **sdk:** make embeddings example first ([caa70f7](https://github.com/isaacus-dev/isaacus-python/commit/caa70f7acf6ce910d8cf80425437ca51970cd255))
|
|
65
|
+
|
|
3
66
|
## 0.8.0 (2025-07-25)
|
|
4
67
|
|
|
5
68
|
Full Changelog: [v0.7.0...v0.8.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.7.0...v0.8.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: isaacus
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: The official Python library for the isaacus API
|
|
5
5
|
Project-URL: Homepage, https://github.com/isaacus-dev/isaacus-python
|
|
6
6
|
Project-URL: Repository, https://github.com/isaacus-dev/isaacus-python
|
|
@@ -30,7 +30,7 @@ Requires-Dist: sniffio
|
|
|
30
30
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
31
31
|
Provides-Extra: aiohttp
|
|
32
32
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
33
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
33
|
+
Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
36
36
|
# Isaacus Python API library
|
|
@@ -67,12 +67,14 @@ client = Isaacus(
|
|
|
67
67
|
api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
model="kanon-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
embedding_response = client.embeddings.create(
|
|
71
|
+
model="kanon-2-embedder",
|
|
72
|
+
texts=[
|
|
73
|
+
"Are restraints of trade enforceable under English law?",
|
|
74
|
+
"What is a non-compete clause?",
|
|
75
|
+
],
|
|
74
76
|
)
|
|
75
|
-
print(
|
|
77
|
+
print(embedding_response.embeddings)
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
While you can provide an `api_key` keyword argument,
|
|
@@ -95,12 +97,14 @@ client = AsyncIsaacus(
|
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
async def main() -> None:
|
|
98
|
-
|
|
99
|
-
model="kanon-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
embedding_response = await client.embeddings.create(
|
|
101
|
+
model="kanon-2-embedder",
|
|
102
|
+
texts=[
|
|
103
|
+
"Are restraints of trade enforceable under English law?",
|
|
104
|
+
"What is a non-compete clause?",
|
|
105
|
+
],
|
|
102
106
|
)
|
|
103
|
-
print(
|
|
107
|
+
print(embedding_response.embeddings)
|
|
104
108
|
|
|
105
109
|
|
|
106
110
|
asyncio.run(main())
|
|
@@ -132,12 +136,14 @@ async def main() -> None:
|
|
|
132
136
|
api_key="My API Key",
|
|
133
137
|
http_client=DefaultAioHttpClient(),
|
|
134
138
|
) as client:
|
|
135
|
-
|
|
136
|
-
model="kanon-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
embedding_response = await client.embeddings.create(
|
|
140
|
+
model="kanon-2-embedder",
|
|
141
|
+
texts=[
|
|
142
|
+
"Are restraints of trade enforceable under English law?",
|
|
143
|
+
"What is a non-compete clause?",
|
|
144
|
+
],
|
|
139
145
|
)
|
|
140
|
-
print(
|
|
146
|
+
print(embedding_response.embeddings)
|
|
141
147
|
|
|
142
148
|
|
|
143
149
|
asyncio.run(main())
|
|
@@ -161,7 +167,7 @@ from isaacus import Isaacus
|
|
|
161
167
|
|
|
162
168
|
client = Isaacus()
|
|
163
169
|
|
|
164
|
-
|
|
170
|
+
universal_classification_response = client.classifications.universal.create(
|
|
165
171
|
model="kanon-universal-classifier",
|
|
166
172
|
query="This is a confidentiality clause.",
|
|
167
173
|
texts=["I agree not to tell anyone about the document."],
|
|
@@ -171,7 +177,7 @@ universal_classification = client.classifications.universal.create(
|
|
|
171
177
|
"size": 512,
|
|
172
178
|
},
|
|
173
179
|
)
|
|
174
|
-
print(
|
|
180
|
+
print(universal_classification_response.classifications)
|
|
175
181
|
```
|
|
176
182
|
|
|
177
183
|
## Handling errors
|
|
@@ -190,10 +196,12 @@ from isaacus import Isaacus
|
|
|
190
196
|
client = Isaacus()
|
|
191
197
|
|
|
192
198
|
try:
|
|
193
|
-
client.
|
|
194
|
-
model="kanon-
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
client.embeddings.create(
|
|
200
|
+
model="kanon-2-embedder",
|
|
201
|
+
texts=[
|
|
202
|
+
"Are restraints of trade enforceable under English law?",
|
|
203
|
+
"What is a non-compete clause?",
|
|
204
|
+
],
|
|
197
205
|
)
|
|
198
206
|
except isaacus.APIConnectionError as e:
|
|
199
207
|
print("The server could not be reached")
|
|
@@ -237,10 +245,12 @@ client = Isaacus(
|
|
|
237
245
|
)
|
|
238
246
|
|
|
239
247
|
# Or, configure per-request:
|
|
240
|
-
client.with_options(max_retries=5).
|
|
241
|
-
model="kanon-
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
client.with_options(max_retries=5).embeddings.create(
|
|
249
|
+
model="kanon-2-embedder",
|
|
250
|
+
texts=[
|
|
251
|
+
"Are restraints of trade enforceable under English law?",
|
|
252
|
+
"What is a non-compete clause?",
|
|
253
|
+
],
|
|
244
254
|
)
|
|
245
255
|
```
|
|
246
256
|
|
|
@@ -264,10 +274,12 @@ client = Isaacus(
|
|
|
264
274
|
)
|
|
265
275
|
|
|
266
276
|
# Override per-request:
|
|
267
|
-
client.with_options(timeout=5.0).
|
|
268
|
-
model="kanon-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
client.with_options(timeout=5.0).embeddings.create(
|
|
278
|
+
model="kanon-2-embedder",
|
|
279
|
+
texts=[
|
|
280
|
+
"Are restraints of trade enforceable under English law?",
|
|
281
|
+
"What is a non-compete clause?",
|
|
282
|
+
],
|
|
271
283
|
)
|
|
272
284
|
```
|
|
273
285
|
|
|
@@ -309,15 +321,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
309
321
|
from isaacus import Isaacus
|
|
310
322
|
|
|
311
323
|
client = Isaacus()
|
|
312
|
-
response = client.
|
|
313
|
-
model="kanon-
|
|
314
|
-
|
|
315
|
-
texts=["I agree not to tell anyone about the document."],
|
|
324
|
+
response = client.embeddings.with_raw_response.create(
|
|
325
|
+
model="kanon-2-embedder",
|
|
326
|
+
texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"],
|
|
316
327
|
)
|
|
317
328
|
print(response.headers.get('X-My-Header'))
|
|
318
329
|
|
|
319
|
-
|
|
320
|
-
print(
|
|
330
|
+
embedding = response.parse() # get the object that `embeddings.create()` would have returned
|
|
331
|
+
print(embedding.embeddings)
|
|
321
332
|
```
|
|
322
333
|
|
|
323
334
|
These methods return an [`APIResponse`](https://github.com/isaacus-dev/isaacus-python/tree/main/src/isaacus/_response.py) object.
|
|
@@ -331,10 +342,12 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
331
342
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
332
343
|
|
|
333
344
|
```python
|
|
334
|
-
with client.
|
|
335
|
-
model="kanon-
|
|
336
|
-
|
|
337
|
-
|
|
345
|
+
with client.embeddings.with_streaming_response.create(
|
|
346
|
+
model="kanon-2-embedder",
|
|
347
|
+
texts=[
|
|
348
|
+
"Are restraints of trade enforceable under English law?",
|
|
349
|
+
"What is a non-compete clause?",
|
|
350
|
+
],
|
|
338
351
|
) as response:
|
|
339
352
|
print(response.headers.get("X-My-Header"))
|
|
340
353
|
|
|
@@ -32,12 +32,14 @@ client = Isaacus(
|
|
|
32
32
|
api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
model="kanon-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
embedding_response = client.embeddings.create(
|
|
36
|
+
model="kanon-2-embedder",
|
|
37
|
+
texts=[
|
|
38
|
+
"Are restraints of trade enforceable under English law?",
|
|
39
|
+
"What is a non-compete clause?",
|
|
40
|
+
],
|
|
39
41
|
)
|
|
40
|
-
print(
|
|
42
|
+
print(embedding_response.embeddings)
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
While you can provide an `api_key` keyword argument,
|
|
@@ -60,12 +62,14 @@ client = AsyncIsaacus(
|
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
async def main() -> None:
|
|
63
|
-
|
|
64
|
-
model="kanon-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
embedding_response = await client.embeddings.create(
|
|
66
|
+
model="kanon-2-embedder",
|
|
67
|
+
texts=[
|
|
68
|
+
"Are restraints of trade enforceable under English law?",
|
|
69
|
+
"What is a non-compete clause?",
|
|
70
|
+
],
|
|
67
71
|
)
|
|
68
|
-
print(
|
|
72
|
+
print(embedding_response.embeddings)
|
|
69
73
|
|
|
70
74
|
|
|
71
75
|
asyncio.run(main())
|
|
@@ -97,12 +101,14 @@ async def main() -> None:
|
|
|
97
101
|
api_key="My API Key",
|
|
98
102
|
http_client=DefaultAioHttpClient(),
|
|
99
103
|
) as client:
|
|
100
|
-
|
|
101
|
-
model="kanon-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
embedding_response = await client.embeddings.create(
|
|
105
|
+
model="kanon-2-embedder",
|
|
106
|
+
texts=[
|
|
107
|
+
"Are restraints of trade enforceable under English law?",
|
|
108
|
+
"What is a non-compete clause?",
|
|
109
|
+
],
|
|
104
110
|
)
|
|
105
|
-
print(
|
|
111
|
+
print(embedding_response.embeddings)
|
|
106
112
|
|
|
107
113
|
|
|
108
114
|
asyncio.run(main())
|
|
@@ -126,7 +132,7 @@ from isaacus import Isaacus
|
|
|
126
132
|
|
|
127
133
|
client = Isaacus()
|
|
128
134
|
|
|
129
|
-
|
|
135
|
+
universal_classification_response = client.classifications.universal.create(
|
|
130
136
|
model="kanon-universal-classifier",
|
|
131
137
|
query="This is a confidentiality clause.",
|
|
132
138
|
texts=["I agree not to tell anyone about the document."],
|
|
@@ -136,7 +142,7 @@ universal_classification = client.classifications.universal.create(
|
|
|
136
142
|
"size": 512,
|
|
137
143
|
},
|
|
138
144
|
)
|
|
139
|
-
print(
|
|
145
|
+
print(universal_classification_response.classifications)
|
|
140
146
|
```
|
|
141
147
|
|
|
142
148
|
## Handling errors
|
|
@@ -155,10 +161,12 @@ from isaacus import Isaacus
|
|
|
155
161
|
client = Isaacus()
|
|
156
162
|
|
|
157
163
|
try:
|
|
158
|
-
client.
|
|
159
|
-
model="kanon-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
client.embeddings.create(
|
|
165
|
+
model="kanon-2-embedder",
|
|
166
|
+
texts=[
|
|
167
|
+
"Are restraints of trade enforceable under English law?",
|
|
168
|
+
"What is a non-compete clause?",
|
|
169
|
+
],
|
|
162
170
|
)
|
|
163
171
|
except isaacus.APIConnectionError as e:
|
|
164
172
|
print("The server could not be reached")
|
|
@@ -202,10 +210,12 @@ client = Isaacus(
|
|
|
202
210
|
)
|
|
203
211
|
|
|
204
212
|
# Or, configure per-request:
|
|
205
|
-
client.with_options(max_retries=5).
|
|
206
|
-
model="kanon-
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
client.with_options(max_retries=5).embeddings.create(
|
|
214
|
+
model="kanon-2-embedder",
|
|
215
|
+
texts=[
|
|
216
|
+
"Are restraints of trade enforceable under English law?",
|
|
217
|
+
"What is a non-compete clause?",
|
|
218
|
+
],
|
|
209
219
|
)
|
|
210
220
|
```
|
|
211
221
|
|
|
@@ -229,10 +239,12 @@ client = Isaacus(
|
|
|
229
239
|
)
|
|
230
240
|
|
|
231
241
|
# Override per-request:
|
|
232
|
-
client.with_options(timeout=5.0).
|
|
233
|
-
model="kanon-
|
|
234
|
-
|
|
235
|
-
|
|
242
|
+
client.with_options(timeout=5.0).embeddings.create(
|
|
243
|
+
model="kanon-2-embedder",
|
|
244
|
+
texts=[
|
|
245
|
+
"Are restraints of trade enforceable under English law?",
|
|
246
|
+
"What is a non-compete clause?",
|
|
247
|
+
],
|
|
236
248
|
)
|
|
237
249
|
```
|
|
238
250
|
|
|
@@ -274,15 +286,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
274
286
|
from isaacus import Isaacus
|
|
275
287
|
|
|
276
288
|
client = Isaacus()
|
|
277
|
-
response = client.
|
|
278
|
-
model="kanon-
|
|
279
|
-
|
|
280
|
-
texts=["I agree not to tell anyone about the document."],
|
|
289
|
+
response = client.embeddings.with_raw_response.create(
|
|
290
|
+
model="kanon-2-embedder",
|
|
291
|
+
texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"],
|
|
281
292
|
)
|
|
282
293
|
print(response.headers.get('X-My-Header'))
|
|
283
294
|
|
|
284
|
-
|
|
285
|
-
print(
|
|
295
|
+
embedding = response.parse() # get the object that `embeddings.create()` would have returned
|
|
296
|
+
print(embedding.embeddings)
|
|
286
297
|
```
|
|
287
298
|
|
|
288
299
|
These methods return an [`APIResponse`](https://github.com/isaacus-dev/isaacus-python/tree/main/src/isaacus/_response.py) object.
|
|
@@ -296,10 +307,12 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
296
307
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
297
308
|
|
|
298
309
|
```python
|
|
299
|
-
with client.
|
|
300
|
-
model="kanon-
|
|
301
|
-
|
|
302
|
-
|
|
310
|
+
with client.embeddings.with_streaming_response.create(
|
|
311
|
+
model="kanon-2-embedder",
|
|
312
|
+
texts=[
|
|
313
|
+
"Are restraints of trade enforceable under English law?",
|
|
314
|
+
"What is a non-compete clause?",
|
|
315
|
+
],
|
|
303
316
|
) as response:
|
|
304
317
|
print(response.headers.get("X-My-Header"))
|
|
305
318
|
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# Embeddings
|
|
2
|
+
|
|
3
|
+
Types:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from isaacus.types import EmbeddingResponse
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Methods:
|
|
10
|
+
|
|
11
|
+
- <code title="post /embeddings">client.embeddings.<a href="./src/isaacus/resources/embeddings.py">create</a>(\*\*<a href="src/isaacus/types/embedding_create_params.py">params</a>) -> <a href="./src/isaacus/types/embedding_response.py">EmbeddingResponse</a></code>
|
|
12
|
+
|
|
1
13
|
# Classifications
|
|
2
14
|
|
|
3
15
|
## Universal
|
|
@@ -5,24 +17,24 @@
|
|
|
5
17
|
Types:
|
|
6
18
|
|
|
7
19
|
```python
|
|
8
|
-
from isaacus.types.classifications import
|
|
20
|
+
from isaacus.types.classifications import UniversalClassificationResponse
|
|
9
21
|
```
|
|
10
22
|
|
|
11
23
|
Methods:
|
|
12
24
|
|
|
13
|
-
- <code title="post /classifications/universal">client.classifications.universal.<a href="./src/isaacus/resources/classifications/universal.py">create</a>(\*\*<a href="src/isaacus/types/classifications/universal_create_params.py">params</a>) -> <a href="./src/isaacus/types/classifications/
|
|
25
|
+
- <code title="post /classifications/universal">client.classifications.universal.<a href="./src/isaacus/resources/classifications/universal.py">create</a>(\*\*<a href="src/isaacus/types/classifications/universal_create_params.py">params</a>) -> <a href="./src/isaacus/types/classifications/universal_classification_response.py">UniversalClassificationResponse</a></code>
|
|
14
26
|
|
|
15
27
|
# Rerankings
|
|
16
28
|
|
|
17
29
|
Types:
|
|
18
30
|
|
|
19
31
|
```python
|
|
20
|
-
from isaacus.types import
|
|
32
|
+
from isaacus.types import RerankingResponse
|
|
21
33
|
```
|
|
22
34
|
|
|
23
35
|
Methods:
|
|
24
36
|
|
|
25
|
-
- <code title="post /rerankings">client.rerankings.<a href="./src/isaacus/resources/rerankings.py">create</a>(\*\*<a href="src/isaacus/types/reranking_create_params.py">params</a>) -> <a href="./src/isaacus/types/
|
|
37
|
+
- <code title="post /rerankings">client.rerankings.<a href="./src/isaacus/resources/rerankings.py">create</a>(\*\*<a href="src/isaacus/types/reranking_create_params.py">params</a>) -> <a href="./src/isaacus/types/reranking_response.py">RerankingResponse</a></code>
|
|
26
38
|
|
|
27
39
|
# Extractions
|
|
28
40
|
|
|
@@ -31,9 +43,9 @@ Methods:
|
|
|
31
43
|
Types:
|
|
32
44
|
|
|
33
45
|
```python
|
|
34
|
-
from isaacus.types.extractions import
|
|
46
|
+
from isaacus.types.extractions import AnswerExtractionResponse
|
|
35
47
|
```
|
|
36
48
|
|
|
37
49
|
Methods:
|
|
38
50
|
|
|
39
|
-
- <code title="post /extractions/qa">client.extractions.qa.<a href="./src/isaacus/resources/extractions/qa.py">create</a>(\*\*<a href="src/isaacus/types/extractions/qa_create_params.py">params</a>) -> <a href="./src/isaacus/types/extractions/
|
|
51
|
+
- <code title="post /extractions/qa">client.extractions.qa.<a href="./src/isaacus/resources/extractions/qa.py">create</a>(\*\*<a href="src/isaacus/types/extractions/qa_create_params.py">params</a>) -> <a href="./src/isaacus/types/extractions/answer_extraction_response.py">AnswerExtractionResponse</a></code>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "isaacus"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.1"
|
|
4
4
|
description = "The official Python library for the isaacus API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -39,7 +39,7 @@ Homepage = "https://github.com/isaacus-dev/isaacus-python"
|
|
|
39
39
|
Repository = "https://github.com/isaacus-dev/isaacus-python"
|
|
40
40
|
|
|
41
41
|
[project.optional-dependencies]
|
|
42
|
-
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.
|
|
42
|
+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
|
|
43
43
|
|
|
44
44
|
[tool.rye]
|
|
45
45
|
managed = true
|
|
@@ -56,7 +56,6 @@ dev-dependencies = [
|
|
|
56
56
|
"dirty-equals>=0.6.0",
|
|
57
57
|
"importlib-metadata>=6.7.0",
|
|
58
58
|
"rich>=13.7.1",
|
|
59
|
-
"nest_asyncio==1.6.0",
|
|
60
59
|
"pytest-xdist>=3.6.1",
|
|
61
60
|
]
|
|
62
61
|
|
|
@@ -148,6 +147,7 @@ exclude = [
|
|
|
148
147
|
"_dev",
|
|
149
148
|
".venv",
|
|
150
149
|
".nox",
|
|
150
|
+
".git",
|
|
151
151
|
]
|
|
152
152
|
|
|
153
153
|
reportImplicitOverride = true
|
|
@@ -156,10 +156,62 @@ reportOverlappingOverload = false
|
|
|
156
156
|
reportImportCycles = false
|
|
157
157
|
reportPrivateUsage = false
|
|
158
158
|
|
|
159
|
+
[tool.mypy]
|
|
160
|
+
pretty = true
|
|
161
|
+
show_error_codes = true
|
|
162
|
+
|
|
163
|
+
# Exclude _files.py because mypy isn't smart enough to apply
|
|
164
|
+
# the correct type narrowing and as this is an internal module
|
|
165
|
+
# it's fine to just use Pyright.
|
|
166
|
+
#
|
|
167
|
+
# We also exclude our `tests` as mypy doesn't always infer
|
|
168
|
+
# types correctly and Pyright will still catch any type errors.
|
|
169
|
+
exclude = ['src/isaacus/_files.py', '_dev/.*.py', 'tests/.*']
|
|
170
|
+
|
|
171
|
+
strict_equality = true
|
|
172
|
+
implicit_reexport = true
|
|
173
|
+
check_untyped_defs = true
|
|
174
|
+
no_implicit_optional = true
|
|
175
|
+
|
|
176
|
+
warn_return_any = true
|
|
177
|
+
warn_unreachable = true
|
|
178
|
+
warn_unused_configs = true
|
|
179
|
+
|
|
180
|
+
# Turn these options off as it could cause conflicts
|
|
181
|
+
# with the Pyright options.
|
|
182
|
+
warn_unused_ignores = false
|
|
183
|
+
warn_redundant_casts = false
|
|
184
|
+
|
|
185
|
+
disallow_any_generics = true
|
|
186
|
+
disallow_untyped_defs = true
|
|
187
|
+
disallow_untyped_calls = true
|
|
188
|
+
disallow_subclassing_any = true
|
|
189
|
+
disallow_incomplete_defs = true
|
|
190
|
+
disallow_untyped_decorators = true
|
|
191
|
+
cache_fine_grained = true
|
|
192
|
+
|
|
193
|
+
# By default, mypy reports an error if you assign a value to the result
|
|
194
|
+
# of a function call that doesn't return anything. We do this in our test
|
|
195
|
+
# cases:
|
|
196
|
+
# ```
|
|
197
|
+
# result = ...
|
|
198
|
+
# assert result is None
|
|
199
|
+
# ```
|
|
200
|
+
# Changing this codegen to make mypy happy would increase complexity
|
|
201
|
+
# and would not be worth it.
|
|
202
|
+
disable_error_code = "func-returns-value,overload-cannot-match"
|
|
203
|
+
|
|
204
|
+
# https://github.com/python/mypy/issues/12162
|
|
205
|
+
[[tool.mypy.overrides]]
|
|
206
|
+
module = "black.files.*"
|
|
207
|
+
ignore_errors = true
|
|
208
|
+
ignore_missing_imports = true
|
|
209
|
+
|
|
210
|
+
|
|
159
211
|
[tool.ruff]
|
|
160
212
|
line-length = 120
|
|
161
213
|
output-format = "grouped"
|
|
162
|
-
target-version = "
|
|
214
|
+
target-version = "py38"
|
|
163
215
|
|
|
164
216
|
[tool.ruff.format]
|
|
165
217
|
docstring-code-format = true
|
|
@@ -172,6 +224,8 @@ select = [
|
|
|
172
224
|
"B",
|
|
173
225
|
# remove unused imports
|
|
174
226
|
"F401",
|
|
227
|
+
# check for missing future annotations
|
|
228
|
+
"FA102",
|
|
175
229
|
# bare except statements
|
|
176
230
|
"E722",
|
|
177
231
|
# unused arguments
|
|
@@ -194,6 +248,8 @@ unfixable = [
|
|
|
194
248
|
"T203",
|
|
195
249
|
]
|
|
196
250
|
|
|
251
|
+
extend-safe-fixes = ["FA102"]
|
|
252
|
+
|
|
197
253
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
198
254
|
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"
|
|
199
255
|
|
|
@@ -56,7 +56,7 @@ httpx==0.28.1
|
|
|
56
56
|
# via httpx-aiohttp
|
|
57
57
|
# via isaacus
|
|
58
58
|
# via respx
|
|
59
|
-
httpx-aiohttp==0.1.
|
|
59
|
+
httpx-aiohttp==0.1.9
|
|
60
60
|
# via isaacus
|
|
61
61
|
idna==3.4
|
|
62
62
|
# via anyio
|
|
@@ -75,7 +75,6 @@ multidict==6.4.4
|
|
|
75
75
|
mypy==1.14.1
|
|
76
76
|
mypy-extensions==1.0.0
|
|
77
77
|
# via mypy
|
|
78
|
-
nest-asyncio==1.6.0
|
|
79
78
|
nodeenv==1.8.0
|
|
80
79
|
# via pyright
|
|
81
80
|
nox==2023.4.22
|
|
@@ -89,9 +88,9 @@ pluggy==1.5.0
|
|
|
89
88
|
propcache==0.3.1
|
|
90
89
|
# via aiohttp
|
|
91
90
|
# via yarl
|
|
92
|
-
pydantic==2.
|
|
91
|
+
pydantic==2.11.9
|
|
93
92
|
# via isaacus
|
|
94
|
-
pydantic-core==2.
|
|
93
|
+
pydantic-core==2.33.2
|
|
95
94
|
# via pydantic
|
|
96
95
|
pygments==2.18.0
|
|
97
96
|
# via rich
|
|
@@ -127,6 +126,9 @@ typing-extensions==4.12.2
|
|
|
127
126
|
# via pydantic
|
|
128
127
|
# via pydantic-core
|
|
129
128
|
# via pyright
|
|
129
|
+
# via typing-inspection
|
|
130
|
+
typing-inspection==0.4.1
|
|
131
|
+
# via pydantic
|
|
130
132
|
virtualenv==20.24.5
|
|
131
133
|
# via nox
|
|
132
134
|
yarl==1.20.0
|
|
@@ -43,7 +43,7 @@ httpcore==1.0.9
|
|
|
43
43
|
httpx==0.28.1
|
|
44
44
|
# via httpx-aiohttp
|
|
45
45
|
# via isaacus
|
|
46
|
-
httpx-aiohttp==0.1.
|
|
46
|
+
httpx-aiohttp==0.1.9
|
|
47
47
|
# via isaacus
|
|
48
48
|
idna==3.4
|
|
49
49
|
# via anyio
|
|
@@ -55,9 +55,9 @@ multidict==6.4.4
|
|
|
55
55
|
propcache==0.3.1
|
|
56
56
|
# via aiohttp
|
|
57
57
|
# via yarl
|
|
58
|
-
pydantic==2.
|
|
58
|
+
pydantic==2.11.9
|
|
59
59
|
# via isaacus
|
|
60
|
-
pydantic-core==2.
|
|
60
|
+
pydantic-core==2.33.2
|
|
61
61
|
# via pydantic
|
|
62
62
|
sniffio==1.3.0
|
|
63
63
|
# via anyio
|
|
@@ -68,5 +68,8 @@ typing-extensions==4.12.2
|
|
|
68
68
|
# via multidict
|
|
69
69
|
# via pydantic
|
|
70
70
|
# via pydantic-core
|
|
71
|
+
# via typing-inspection
|
|
72
|
+
typing-inspection==0.4.1
|
|
73
|
+
# via pydantic
|
|
71
74
|
yarl==1.20.0
|
|
72
75
|
# via aiohttp
|