isaacus 0.8.0__tar.gz → 0.9.0__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.
Files changed (92) hide show
  1. isaacus-0.9.0/.release-please-manifest.json +3 -0
  2. {isaacus-0.8.0 → isaacus-0.9.0}/CHANGELOG.md +55 -0
  3. {isaacus-0.8.0 → isaacus-0.9.0}/PKG-INFO +53 -40
  4. {isaacus-0.8.0 → isaacus-0.9.0}/README.md +52 -39
  5. {isaacus-0.8.0 → isaacus-0.9.0}/api.md +18 -6
  6. {isaacus-0.8.0 → isaacus-0.9.0}/pyproject.toml +59 -3
  7. {isaacus-0.8.0 → isaacus-0.9.0}/requirements-dev.lock +5 -3
  8. {isaacus-0.8.0 → isaacus-0.9.0}/requirements.lock +5 -2
  9. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/__init__.py +3 -1
  10. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_base_client.py +40 -12
  11. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_client.py +17 -9
  12. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_compat.py +48 -48
  13. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_files.py +4 -4
  14. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_models.py +51 -45
  15. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_qs.py +7 -7
  16. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_types.py +53 -12
  17. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/__init__.py +9 -2
  18. isaacus-0.9.0/src/isaacus/_utils/_compat.py +45 -0
  19. isaacus-0.9.0/src/isaacus/_utils/_datetime_parse.py +136 -0
  20. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_transform.py +13 -3
  21. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_typing.py +6 -1
  22. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_utils.py +4 -5
  23. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_version.py +1 -1
  24. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/__init__.py +14 -0
  25. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/classifications/universal.py +17 -17
  26. isaacus-0.9.0/src/isaacus/resources/embeddings.py +246 -0
  27. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/extractions/qa.py +23 -21
  28. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/rerankings.py +19 -19
  29. isaacus-0.9.0/src/isaacus/types/__init__.py +8 -0
  30. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/types/classifications/__init__.py +1 -1
  31. isaacus-0.8.0/src/isaacus/types/classifications/universal_classification.py → isaacus-0.9.0/src/isaacus/types/classifications/universal_classification_response.py +2 -2
  32. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/types/classifications/universal_create_params.py +4 -2
  33. isaacus-0.9.0/src/isaacus/types/embedding_create_params.py +49 -0
  34. isaacus-0.9.0/src/isaacus/types/embedding_response.py +31 -0
  35. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/types/extractions/__init__.py +1 -1
  36. isaacus-0.8.0/src/isaacus/types/extractions/answer_extraction.py → isaacus-0.9.0/src/isaacus/types/extractions/answer_extraction_response.py +2 -2
  37. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/types/extractions/qa_create_params.py +7 -4
  38. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/types/reranking_create_params.py +4 -2
  39. isaacus-0.8.0/src/isaacus/types/reranking.py → isaacus-0.9.0/src/isaacus/types/reranking_response.py +2 -2
  40. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/classifications/test_universal.py +19 -19
  41. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/extractions/test_qa.py +19 -19
  42. isaacus-0.9.0/tests/api_resources/test_embeddings.py +122 -0
  43. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/test_rerankings.py +19 -19
  44. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_client.py +46 -97
  45. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_models.py +24 -24
  46. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_transform.py +17 -10
  47. isaacus-0.9.0/tests/test_utils/test_datetime_parse.py +110 -0
  48. {isaacus-0.8.0 → isaacus-0.9.0}/tests/utils.py +13 -5
  49. isaacus-0.8.0/.release-please-manifest.json +0 -3
  50. isaacus-0.8.0/mypy.ini +0 -50
  51. isaacus-0.8.0/src/isaacus/types/__init__.py +0 -6
  52. {isaacus-0.8.0 → isaacus-0.9.0}/.gitignore +0 -0
  53. {isaacus-0.8.0 → isaacus-0.9.0}/CONTRIBUTING.md +0 -0
  54. {isaacus-0.8.0 → isaacus-0.9.0}/LICENSE +0 -0
  55. {isaacus-0.8.0 → isaacus-0.9.0}/SECURITY.md +0 -0
  56. {isaacus-0.8.0 → isaacus-0.9.0}/bin/check-release-environment +0 -0
  57. {isaacus-0.8.0 → isaacus-0.9.0}/bin/publish-pypi +0 -0
  58. {isaacus-0.8.0 → isaacus-0.9.0}/examples/.keep +0 -0
  59. {isaacus-0.8.0 → isaacus-0.9.0}/noxfile.py +0 -0
  60. {isaacus-0.8.0 → isaacus-0.9.0}/release-please-config.json +0 -0
  61. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_constants.py +0 -0
  62. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_exceptions.py +0 -0
  63. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_resource.py +0 -0
  64. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_response.py +0 -0
  65. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_streaming.py +0 -0
  66. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_logs.py +0 -0
  67. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_proxy.py +0 -0
  68. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_reflection.py +0 -0
  69. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_resources_proxy.py +0 -0
  70. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_streams.py +0 -0
  71. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/_utils/_sync.py +0 -0
  72. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/lib/.keep +0 -0
  73. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/py.typed +0 -0
  74. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/classifications/__init__.py +0 -0
  75. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/classifications/classifications.py +0 -0
  76. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/extractions/__init__.py +0 -0
  77. {isaacus-0.8.0 → isaacus-0.9.0}/src/isaacus/resources/extractions/extractions.py +0 -0
  78. {isaacus-0.8.0 → isaacus-0.9.0}/tests/__init__.py +0 -0
  79. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/__init__.py +0 -0
  80. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/classifications/__init__.py +0 -0
  81. {isaacus-0.8.0 → isaacus-0.9.0}/tests/api_resources/extractions/__init__.py +0 -0
  82. {isaacus-0.8.0 → isaacus-0.9.0}/tests/conftest.py +0 -0
  83. {isaacus-0.8.0 → isaacus-0.9.0}/tests/sample_file.txt +0 -0
  84. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_deepcopy.py +0 -0
  85. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_extract_files.py +0 -0
  86. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_files.py +0 -0
  87. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_qs.py +0 -0
  88. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_required_args.py +0 -0
  89. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_response.py +0 -0
  90. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_streaming.py +0 -0
  91. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_utils/test_proxy.py +0 -0
  92. {isaacus-0.8.0 → isaacus-0.9.0}/tests/test_utils/test_typing.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.9.0"
3
+ }
@@ -1,5 +1,60 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0 (2025-10-14)
4
+
5
+ Full Changelog: [v0.8.0...v0.9.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.8.0...v0.9.0)
6
+
7
+ ### ⚠ BREAKING CHANGES
8
+
9
+ * **api:** reduce max length of embeddings input
10
+ * **sdk:** add `_response` to response models to finally fix duplicated names
11
+
12
+ ### Features
13
+
14
+ * **api:** added embedding endpoint ([88190d6](https://github.com/isaacus-dev/isaacus-python/commit/88190d6d33c8d5e3cf59dfd3c488b5ae9abec93b))
15
+ * **api:** reduce max length of embeddings input ([0ad7114](https://github.com/isaacus-dev/isaacus-python/commit/0ad7114b5fec2fde9aaa830a6ba6163ad3b6fccc))
16
+ * **api:** rename embedding -> embeddings ([204a05d](https://github.com/isaacus-dev/isaacus-python/commit/204a05d7b1504901766db3c0d0d8ea47a22a16ed))
17
+ * **api:** revert embedding -> embeddings ([b934279](https://github.com/isaacus-dev/isaacus-python/commit/b9342795e50374817b8e3dc2e2f1163a2ff0805a))
18
+ * **client:** support file upload requests ([2ab398d](https://github.com/isaacus-dev/isaacus-python/commit/2ab398dde07e98411c9b6efd76f7b7120a9633a8))
19
+ * improve future compat with pydantic v3 ([5a20497](https://github.com/isaacus-dev/isaacus-python/commit/5a20497a9c4bbf88056df12a0c686566dc9bd162))
20
+ * **sdk:** add embeddings endpoint ([920ae0b](https://github.com/isaacus-dev/isaacus-python/commit/920ae0b65f2362ac098f8b94979b1e821f5143d8))
21
+ * **sdk:** toggle to force regen ([cf60482](https://github.com/isaacus-dev/isaacus-python/commit/cf60482ba0dd3933daee477fa9bd4ae29d900fb4))
22
+ * **sdk:** untoggle to force regen ([25d2067](https://github.com/isaacus-dev/isaacus-python/commit/25d2067fad4bb46ca595001f6e82458fd3d24a23))
23
+ * **types:** replace List[str] with SequenceNotStr in params ([d2733a9](https://github.com/isaacus-dev/isaacus-python/commit/d2733a9d0f16531537a9db017a8e29d2c8fb3912))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **api:** typo ([5d4a1b9](https://github.com/isaacus-dev/isaacus-python/commit/5d4a1b99e8a6ac2a1c3cc4e83e7b65108eea335a))
29
+ * avoid newer type syntax ([10253fe](https://github.com/isaacus-dev/isaacus-python/commit/10253fe93ed8142b52cf5199486221e81ac6ce5a))
30
+ * **sdk:** add `_response` to response models to finally fix duplicated names ([5c7462d](https://github.com/isaacus-dev/isaacus-python/commit/5c7462dd25c67c44126eb946a656a6b841dc6a50))
31
+
32
+
33
+ ### Chores
34
+
35
+ * **api:** try to force regen SDK ([2fafb55](https://github.com/isaacus-dev/isaacus-python/commit/2fafb555c1a20d7c359c91c35fd1f54868cffe54))
36
+ * do not install brew dependencies in ./scripts/bootstrap by default ([57b055e](https://github.com/isaacus-dev/isaacus-python/commit/57b055ed56fdcc58b4663e4ddad32afac25e7ec1))
37
+ * improve example values ([35b03bd](https://github.com/isaacus-dev/isaacus-python/commit/35b03bdbf4ceaccd00102e23d639a01d5bea136a))
38
+ * **internal:** add Sequence related utils ([5a2287e](https://github.com/isaacus-dev/isaacus-python/commit/5a2287ef854d250048c070f3fd88b00ca84b0d3c))
39
+ * **internal:** change ci workflow machines ([f86cbce](https://github.com/isaacus-dev/isaacus-python/commit/f86cbcef2583658466e95eaba4aba61f79646ef9))
40
+ * **internal:** codegen related update ([22b520b](https://github.com/isaacus-dev/isaacus-python/commit/22b520b3c67e570f9267135111a89542ee2bdf7f))
41
+ * **internal:** fix ruff target version ([889d576](https://github.com/isaacus-dev/isaacus-python/commit/889d576cdc28d06404c6ee3ce0c67bf4d3be75c4))
42
+ * **internal:** move mypy configurations to `pyproject.toml` file ([d5732d5](https://github.com/isaacus-dev/isaacus-python/commit/d5732d5e0145763723e8be24cbd8296f9a385264))
43
+ * **internal:** update comment in script ([7af966e](https://github.com/isaacus-dev/isaacus-python/commit/7af966e1677b44d412eda96c5ee8e9866f77ccfb))
44
+ * **internal:** update pydantic dependency ([68a7057](https://github.com/isaacus-dev/isaacus-python/commit/68a70578a2e269fa3b2c46e3c29e82ba770090d6))
45
+ * **internal:** update pyright exclude list ([6f0ae86](https://github.com/isaacus-dev/isaacus-python/commit/6f0ae86899883fe77aa669d595c623bedc2dc5c8))
46
+ * remove custom code ([491dbdc](https://github.com/isaacus-dev/isaacus-python/commit/491dbdcd82984d099b8ee11e94894ad450b2424d))
47
+ * **sdk:** restore original example ([079645e](https://github.com/isaacus-dev/isaacus-python/commit/079645e85259c2e4d3f6aa86b2ca2c21ce97367a))
48
+ * **tests:** simplify `get_platform` test ([e00ccd0](https://github.com/isaacus-dev/isaacus-python/commit/e00ccd0c41c3751eb3fae880223ebb05eae0f154))
49
+ * **types:** change optional parameter type from NotGiven to Omit ([38d13e0](https://github.com/isaacus-dev/isaacus-python/commit/38d13e0514b001d1a34446b881783d559e246865))
50
+ * update @stainless-api/prism-cli to v5.15.0 ([a3141f5](https://github.com/isaacus-dev/isaacus-python/commit/a3141f59b0ff6334fde2a9740fd2f86824fe5083))
51
+ * update github action ([0518028](https://github.com/isaacus-dev/isaacus-python/commit/05180288265bc111dba1c62fbfcd90139a6299ad))
52
+
53
+
54
+ ### Documentation
55
+
56
+ * **sdk:** make embeddings example first ([caa70f7](https://github.com/isaacus-dev/isaacus-python/commit/caa70f7acf6ce910d8cf80425437ca51970cd255))
57
+
3
58
  ## 0.8.0 (2025-07-25)
4
59
 
5
60
  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.8.0
3
+ Version: 0.9.0
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
@@ -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
- universal_classification = client.classifications.universal.create(
71
- model="kanon-universal-classifier",
72
- query="This is a confidentiality clause.",
73
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = await client.classifications.universal.create(
99
- model="kanon-universal-classifier",
100
- query="This is a confidentiality clause.",
101
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = await client.classifications.universal.create(
136
- model="kanon-universal-classifier",
137
- query="This is a confidentiality clause.",
138
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = client.classifications.universal.create(
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(universal_classification.classifications)
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.classifications.universal.create(
194
- model="kanon-universal-classifier",
195
- query="This is a confidentiality clause.",
196
- texts=["I agree not to tell anyone about the document."],
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).classifications.universal.create(
241
- model="kanon-universal-classifier",
242
- query="This is a confidentiality clause.",
243
- texts=["I agree not to tell anyone about the document."],
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).classifications.universal.create(
268
- model="kanon-universal-classifier",
269
- query="This is a confidentiality clause.",
270
- texts=["I agree not to tell anyone about the document."],
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.classifications.universal.with_raw_response.create(
313
- model="kanon-universal-classifier",
314
- query="This is a confidentiality clause.",
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
- universal = response.parse() # get the object that `classifications.universal.create()` would have returned
320
- print(universal.classifications)
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.classifications.universal.with_streaming_response.create(
335
- model="kanon-universal-classifier",
336
- query="This is a confidentiality clause.",
337
- texts=["I agree not to tell anyone about the document."],
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
- universal_classification = client.classifications.universal.create(
36
- model="kanon-universal-classifier",
37
- query="This is a confidentiality clause.",
38
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = await client.classifications.universal.create(
64
- model="kanon-universal-classifier",
65
- query="This is a confidentiality clause.",
66
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = await client.classifications.universal.create(
101
- model="kanon-universal-classifier",
102
- query="This is a confidentiality clause.",
103
- texts=["I agree not to tell anyone about the document."],
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(universal_classification.classifications)
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
- universal_classification = client.classifications.universal.create(
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(universal_classification.classifications)
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.classifications.universal.create(
159
- model="kanon-universal-classifier",
160
- query="This is a confidentiality clause.",
161
- texts=["I agree not to tell anyone about the document."],
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).classifications.universal.create(
206
- model="kanon-universal-classifier",
207
- query="This is a confidentiality clause.",
208
- texts=["I agree not to tell anyone about the document."],
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).classifications.universal.create(
233
- model="kanon-universal-classifier",
234
- query="This is a confidentiality clause.",
235
- texts=["I agree not to tell anyone about the document."],
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.classifications.universal.with_raw_response.create(
278
- model="kanon-universal-classifier",
279
- query="This is a confidentiality clause.",
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
- universal = response.parse() # get the object that `classifications.universal.create()` would have returned
285
- print(universal.classifications)
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.classifications.universal.with_streaming_response.create(
300
- model="kanon-universal-classifier",
301
- query="This is a confidentiality clause.",
302
- texts=["I agree not to tell anyone about the document."],
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 UniversalClassification
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/universal_classification.py">UniversalClassification</a></code>
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 Reranking
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/reranking.py">Reranking</a></code>
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 AnswerExtraction
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/answer_extraction.py">AnswerExtraction</a></code>
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.8.0"
3
+ version = "0.9.0"
4
4
  description = "The official Python library for the isaacus API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -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 = "py37"
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
 
@@ -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.10.3
91
+ pydantic==2.11.9
93
92
  # via isaacus
94
- pydantic-core==2.27.1
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
@@ -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.10.3
58
+ pydantic==2.11.9
59
59
  # via isaacus
60
- pydantic-core==2.27.1
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
@@ -3,7 +3,7 @@
3
3
  import typing as _t
4
4
 
5
5
  from . import types
6
- from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
6
+ from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
7
7
  from ._utils import file_from_path
8
8
  from ._client import Client, Stream, Isaacus, Timeout, Transport, AsyncClient, AsyncStream, AsyncIsaacus, RequestOptions
9
9
  from ._models import BaseModel
@@ -38,7 +38,9 @@ __all__ = [
38
38
  "ProxiesTypes",
39
39
  "NotGiven",
40
40
  "NOT_GIVEN",
41
+ "not_given",
41
42
  "Omit",
43
+ "omit",
42
44
  "IsaacusError",
43
45
  "APIError",
44
46
  "APIStatusError",