isaacus 0.7.0__tar.gz → 0.8.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 (84) hide show
  1. {isaacus-0.7.0 → isaacus-0.8.0}/.gitignore +0 -1
  2. isaacus-0.8.0/.release-please-manifest.json +3 -0
  3. {isaacus-0.7.0 → isaacus-0.8.0}/CHANGELOG.md +43 -0
  4. {isaacus-0.7.0 → isaacus-0.8.0}/PKG-INFO +43 -3
  5. {isaacus-0.7.0 → isaacus-0.8.0}/README.md +38 -2
  6. {isaacus-0.7.0 → isaacus-0.8.0}/bin/check-release-environment +1 -1
  7. {isaacus-0.7.0 → isaacus-0.8.0}/pyproject.toml +6 -2
  8. {isaacus-0.7.0 → isaacus-0.8.0}/requirements-dev.lock +33 -2
  9. {isaacus-0.7.0 → isaacus-0.8.0}/requirements.lock +29 -2
  10. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/__init__.py +2 -1
  11. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_base_client.py +47 -4
  12. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_models.py +31 -7
  13. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_version.py +1 -1
  14. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/classifications/test_universal.py +3 -1
  15. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/extractions/test_qa.py +3 -1
  16. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/test_rerankings.py +3 -1
  17. {isaacus-0.7.0 → isaacus-0.8.0}/tests/conftest.py +39 -6
  18. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_client.py +76 -75
  19. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_models.py +73 -1
  20. isaacus-0.7.0/.release-please-manifest.json +0 -3
  21. {isaacus-0.7.0 → isaacus-0.8.0}/CONTRIBUTING.md +0 -0
  22. {isaacus-0.7.0 → isaacus-0.8.0}/LICENSE +0 -0
  23. {isaacus-0.7.0 → isaacus-0.8.0}/SECURITY.md +0 -0
  24. {isaacus-0.7.0 → isaacus-0.8.0}/api.md +0 -0
  25. {isaacus-0.7.0 → isaacus-0.8.0}/bin/publish-pypi +0 -0
  26. {isaacus-0.7.0 → isaacus-0.8.0}/examples/.keep +0 -0
  27. {isaacus-0.7.0 → isaacus-0.8.0}/mypy.ini +0 -0
  28. {isaacus-0.7.0 → isaacus-0.8.0}/noxfile.py +0 -0
  29. {isaacus-0.7.0 → isaacus-0.8.0}/release-please-config.json +0 -0
  30. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_client.py +0 -0
  31. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_compat.py +0 -0
  32. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_constants.py +0 -0
  33. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_exceptions.py +0 -0
  34. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_files.py +0 -0
  35. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_qs.py +0 -0
  36. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_resource.py +0 -0
  37. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_response.py +0 -0
  38. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_streaming.py +0 -0
  39. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_types.py +0 -0
  40. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/__init__.py +0 -0
  41. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_logs.py +0 -0
  42. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_proxy.py +0 -0
  43. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_reflection.py +0 -0
  44. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_resources_proxy.py +0 -0
  45. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_streams.py +0 -0
  46. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_sync.py +0 -0
  47. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_transform.py +0 -0
  48. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_typing.py +0 -0
  49. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/_utils/_utils.py +0 -0
  50. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/lib/.keep +0 -0
  51. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/py.typed +0 -0
  52. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/__init__.py +0 -0
  53. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/classifications/__init__.py +0 -0
  54. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/classifications/classifications.py +0 -0
  55. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/classifications/universal.py +0 -0
  56. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/extractions/__init__.py +0 -0
  57. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/extractions/extractions.py +0 -0
  58. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/extractions/qa.py +0 -0
  59. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/resources/rerankings.py +0 -0
  60. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/__init__.py +0 -0
  61. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/classifications/__init__.py +0 -0
  62. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/classifications/universal_classification.py +0 -0
  63. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/classifications/universal_create_params.py +0 -0
  64. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/extractions/__init__.py +0 -0
  65. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/extractions/answer_extraction.py +0 -0
  66. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/extractions/qa_create_params.py +0 -0
  67. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/reranking.py +0 -0
  68. {isaacus-0.7.0 → isaacus-0.8.0}/src/isaacus/types/reranking_create_params.py +0 -0
  69. {isaacus-0.7.0 → isaacus-0.8.0}/tests/__init__.py +0 -0
  70. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/__init__.py +0 -0
  71. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/classifications/__init__.py +0 -0
  72. {isaacus-0.7.0 → isaacus-0.8.0}/tests/api_resources/extractions/__init__.py +0 -0
  73. {isaacus-0.7.0 → isaacus-0.8.0}/tests/sample_file.txt +0 -0
  74. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_deepcopy.py +0 -0
  75. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_extract_files.py +0 -0
  76. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_files.py +0 -0
  77. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_qs.py +0 -0
  78. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_required_args.py +0 -0
  79. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_response.py +0 -0
  80. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_streaming.py +0 -0
  81. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_transform.py +0 -0
  82. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_utils/test_proxy.py +0 -0
  83. {isaacus-0.7.0 → isaacus-0.8.0}/tests/test_utils/test_typing.py +0 -0
  84. {isaacus-0.7.0 → isaacus-0.8.0}/tests/utils.py +0 -0
@@ -1,5 +1,4 @@
1
1
  .prism.log
2
- .vscode
3
2
  _dev
4
3
 
5
4
  __pycache__
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.8.0"
3
+ }
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0 (2025-07-25)
4
+
5
+ Full Changelog: [v0.7.0...v0.8.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.7.0...v0.8.0)
6
+
7
+ ### Features
8
+
9
+ * clean up environment call outs ([3ee6948](https://github.com/isaacus-dev/isaacus-python/commit/3ee69481b6a6198503d06c6aa137ba69f7940db6))
10
+ * **client:** add support for aiohttp ([fba17e9](https://github.com/isaacus-dev/isaacus-python/commit/fba17e98279aa6d93dd3c9b6f9b95246b4fac813))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **ci:** correct conditional ([53c81d9](https://github.com/isaacus-dev/isaacus-python/commit/53c81d9e14882ae83a72c15481c8933226e668fa))
16
+ * **ci:** release-doctor — report correct token name ([3cb8672](https://github.com/isaacus-dev/isaacus-python/commit/3cb8672052edf1d1c4e72a5866fde3776d43a4e2))
17
+ * **client:** correctly parse binary response | stream ([5e316fe](https://github.com/isaacus-dev/isaacus-python/commit/5e316feaf5270e54321a917a9cd59efb2c42fcb3))
18
+ * **client:** don't send Content-Type header on GET requests ([2a5d531](https://github.com/isaacus-dev/isaacus-python/commit/2a5d531e7553aa012352d9dd85d280f4374b7ae7))
19
+ * **parsing:** correctly handle nested discriminated unions ([c5d5715](https://github.com/isaacus-dev/isaacus-python/commit/c5d571569cdafad9bd1392baf232287dca72855d))
20
+ * **parsing:** ignore empty metadata ([dd88d17](https://github.com/isaacus-dev/isaacus-python/commit/dd88d179302966445c63831f4b6f20491fe5632e))
21
+ * **parsing:** parse extra field types ([ba334c7](https://github.com/isaacus-dev/isaacus-python/commit/ba334c75676c37da235abfddd7c9746f89307c22))
22
+ * **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([638c7c4](https://github.com/isaacus-dev/isaacus-python/commit/638c7c4df7ecbc189480a0cba2d93125f9b97d2f))
23
+
24
+
25
+ ### Chores
26
+
27
+ * **ci:** change upload type ([e79525c](https://github.com/isaacus-dev/isaacus-python/commit/e79525c4ffe9601c3b7c5e39a94c93c248cfbf33))
28
+ * **ci:** enable for pull requests ([29244fd](https://github.com/isaacus-dev/isaacus-python/commit/29244fdb33a5706480e1c7314099a14ae177ee06))
29
+ * **ci:** only run for pushes and fork pull requests ([94ed1eb](https://github.com/isaacus-dev/isaacus-python/commit/94ed1ebf9fc4111236f1db2a5d326f081079bdc8))
30
+ * **internal:** bump pinned h11 dep ([5836163](https://github.com/isaacus-dev/isaacus-python/commit/58361635226de79f5ff27e953ec03dfeb392b3e0))
31
+ * **internal:** codegen related update ([cdfe0be](https://github.com/isaacus-dev/isaacus-python/commit/cdfe0beceeeaa21e4a24b6cdc86264dcaa3808f1))
32
+ * **internal:** update conftest.py ([e4a5936](https://github.com/isaacus-dev/isaacus-python/commit/e4a59368bd7d42d65fd368b03a208b2aa32a9144))
33
+ * **package:** mark python 3.13 as supported ([0f7b5d1](https://github.com/isaacus-dev/isaacus-python/commit/0f7b5d1c588adf28b502727948dceaa9ed54ee86))
34
+ * **project:** add settings file for vscode ([d6435b0](https://github.com/isaacus-dev/isaacus-python/commit/d6435b09a03f202867843ee83737b319ccef4ea6))
35
+ * **readme:** fix version rendering on pypi ([b09f1ad](https://github.com/isaacus-dev/isaacus-python/commit/b09f1ad5ce2624d23a32fc1d966f7d9703cd4ad3))
36
+ * **readme:** update badges ([cd48569](https://github.com/isaacus-dev/isaacus-python/commit/cd485693063d03f092d5be7f024b0f7e23da0897))
37
+ * **tests:** add tests for httpx client instantiation & proxies ([5d2c5b9](https://github.com/isaacus-dev/isaacus-python/commit/5d2c5b9e20bd80acd05240217b6be3991b46aae2))
38
+ * **tests:** run tests in parallel ([3f0e6da](https://github.com/isaacus-dev/isaacus-python/commit/3f0e6da6d9c6d9cd46cfa382da55a0b6a07d9d49))
39
+ * **tests:** skip some failing tests on the latest python versions ([b2b3fa8](https://github.com/isaacus-dev/isaacus-python/commit/b2b3fa82b87e9cc7e23164cc5589b3e157e635df))
40
+
41
+
42
+ ### Documentation
43
+
44
+ * **client:** fix httpx.Timeout documentation reference ([b68d394](https://github.com/isaacus-dev/isaacus-python/commit/b68d3944df0ca58b7df3e89e06e90799f7ade25b))
45
+
3
46
  ## 0.7.0 (2025-06-03)
4
47
 
5
48
  Full Changelog: [v0.6.1...v0.7.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.6.1...v0.7.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: isaacus
3
- Version: 0.7.0
3
+ Version: 0.8.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
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
23
  Classifier: Typing :: Typed
23
24
  Requires-Python: >=3.8
@@ -27,11 +28,15 @@ Requires-Dist: httpx<1,>=0.23.0
27
28
  Requires-Dist: pydantic<3,>=1.9.0
28
29
  Requires-Dist: sniffio
29
30
  Requires-Dist: typing-extensions<5,>=4.10
31
+ Provides-Extra: aiohttp
32
+ Requires-Dist: aiohttp; extra == 'aiohttp'
33
+ Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
30
34
  Description-Content-Type: text/markdown
31
35
 
32
36
  # Isaacus Python API library
33
37
 
34
- [![PyPI version](https://img.shields.io/pypi/v/isaacus.svg)](https://pypi.org/project/isaacus/)
38
+ <!-- prettier-ignore -->
39
+ [![PyPI version](https://img.shields.io/pypi/v/isaacus.svg?label=pypi%20(stable))](https://pypi.org/project/isaacus/)
35
40
 
36
41
  The Isaacus Python library provides convenient access to the Isaacus REST API from any Python 3.8+
37
42
  application. The library includes type definitions for all request params and response fields,
@@ -103,6 +108,41 @@ asyncio.run(main())
103
108
 
104
109
  Functionality between the synchronous and asynchronous clients is otherwise identical.
105
110
 
111
+ ### With aiohttp
112
+
113
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
114
+
115
+ You can enable this by installing `aiohttp`:
116
+
117
+ ```sh
118
+ # install from PyPI
119
+ pip install isaacus[aiohttp]
120
+ ```
121
+
122
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
123
+
124
+ ```python
125
+ import asyncio
126
+ from isaacus import DefaultAioHttpClient
127
+ from isaacus import AsyncIsaacus
128
+
129
+
130
+ async def main() -> None:
131
+ async with AsyncIsaacus(
132
+ api_key="My API Key",
133
+ http_client=DefaultAioHttpClient(),
134
+ ) 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
+ )
140
+ print(universal_classification.classifications)
141
+
142
+
143
+ asyncio.run(main())
144
+ ```
145
+
106
146
  ## Using types
107
147
 
108
148
  Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
@@ -207,7 +247,7 @@ client.with_options(max_retries=5).classifications.universal.create(
207
247
  ### Timeouts
208
248
 
209
249
  By default requests time out after 1 minute. You can configure this with a `timeout` option,
210
- which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
250
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
211
251
 
212
252
  ```python
213
253
  from isaacus import Isaacus
@@ -1,6 +1,7 @@
1
1
  # Isaacus Python API library
2
2
 
3
- [![PyPI version](https://img.shields.io/pypi/v/isaacus.svg)](https://pypi.org/project/isaacus/)
3
+ <!-- prettier-ignore -->
4
+ [![PyPI version](https://img.shields.io/pypi/v/isaacus.svg?label=pypi%20(stable))](https://pypi.org/project/isaacus/)
4
5
 
5
6
  The Isaacus Python library provides convenient access to the Isaacus REST API from any Python 3.8+
6
7
  application. The library includes type definitions for all request params and response fields,
@@ -72,6 +73,41 @@ asyncio.run(main())
72
73
 
73
74
  Functionality between the synchronous and asynchronous clients is otherwise identical.
74
75
 
76
+ ### With aiohttp
77
+
78
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
79
+
80
+ You can enable this by installing `aiohttp`:
81
+
82
+ ```sh
83
+ # install from PyPI
84
+ pip install isaacus[aiohttp]
85
+ ```
86
+
87
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
88
+
89
+ ```python
90
+ import asyncio
91
+ from isaacus import DefaultAioHttpClient
92
+ from isaacus import AsyncIsaacus
93
+
94
+
95
+ async def main() -> None:
96
+ async with AsyncIsaacus(
97
+ api_key="My API Key",
98
+ http_client=DefaultAioHttpClient(),
99
+ ) 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
+ )
105
+ print(universal_classification.classifications)
106
+
107
+
108
+ asyncio.run(main())
109
+ ```
110
+
75
111
  ## Using types
76
112
 
77
113
  Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
@@ -176,7 +212,7 @@ client.with_options(max_retries=5).classifications.universal.create(
176
212
  ### Timeouts
177
213
 
178
214
  By default requests time out after 1 minute. You can configure this with a `timeout` option,
179
- which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
215
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
180
216
 
181
217
  ```python
182
218
  from isaacus import Isaacus
@@ -3,7 +3,7 @@
3
3
  errors=()
4
4
 
5
5
  if [ -z "${PYPI_TOKEN}" ]; then
6
- errors+=("The ISAACUS_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
6
+ errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
7
7
  fi
8
8
 
9
9
  lenErrors=${#errors[@]}
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "isaacus"
3
- version = "0.7.0"
3
+ version = "0.8.0"
4
4
  description = "The official Python library for the isaacus API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -24,6 +24,7 @@ classifiers = [
24
24
  "Programming Language :: Python :: 3.10",
25
25
  "Programming Language :: Python :: 3.11",
26
26
  "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
27
28
  "Operating System :: OS Independent",
28
29
  "Operating System :: POSIX",
29
30
  "Operating System :: MacOS",
@@ -37,6 +38,8 @@ classifiers = [
37
38
  Homepage = "https://github.com/isaacus-dev/isaacus-python"
38
39
  Repository = "https://github.com/isaacus-dev/isaacus-python"
39
40
 
41
+ [project.optional-dependencies]
42
+ aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
40
43
 
41
44
  [tool.rye]
42
45
  managed = true
@@ -54,6 +57,7 @@ dev-dependencies = [
54
57
  "importlib-metadata>=6.7.0",
55
58
  "rich>=13.7.1",
56
59
  "nest_asyncio==1.6.0",
60
+ "pytest-xdist>=3.6.1",
57
61
  ]
58
62
 
59
63
  [tool.rye.scripts]
@@ -125,7 +129,7 @@ replacement = '[\1](https://github.com/isaacus-dev/isaacus-python/tree/main/\g<2
125
129
 
126
130
  [tool.pytest.ini_options]
127
131
  testpaths = ["tests"]
128
- addopts = "--tb=short"
132
+ addopts = "--tb=short -n auto"
129
133
  xfail_strict = true
130
134
  asyncio_mode = "auto"
131
135
  asyncio_default_fixture_loop_scope = "session"
@@ -10,6 +10,13 @@
10
10
  # universal: false
11
11
 
12
12
  -e file:.
13
+ aiohappyeyeballs==2.6.1
14
+ # via aiohttp
15
+ aiohttp==3.12.8
16
+ # via httpx-aiohttp
17
+ # via isaacus
18
+ aiosignal==1.3.2
19
+ # via aiohttp
13
20
  annotated-types==0.6.0
14
21
  # via pydantic
15
22
  anyio==4.4.0
@@ -17,6 +24,10 @@ anyio==4.4.0
17
24
  # via isaacus
18
25
  argcomplete==3.1.2
19
26
  # via nox
27
+ async-timeout==5.0.1
28
+ # via aiohttp
29
+ attrs==25.3.0
30
+ # via aiohttp
20
31
  certifi==2023.7.22
21
32
  # via httpcore
22
33
  # via httpx
@@ -30,18 +41,27 @@ distro==1.8.0
30
41
  exceptiongroup==1.2.2
31
42
  # via anyio
32
43
  # via pytest
44
+ execnet==2.1.1
45
+ # via pytest-xdist
33
46
  filelock==3.12.4
34
47
  # via virtualenv
35
- h11==0.14.0
48
+ frozenlist==1.6.2
49
+ # via aiohttp
50
+ # via aiosignal
51
+ h11==0.16.0
36
52
  # via httpcore
37
- httpcore==1.0.2
53
+ httpcore==1.0.9
38
54
  # via httpx
39
55
  httpx==0.28.1
56
+ # via httpx-aiohttp
40
57
  # via isaacus
41
58
  # via respx
59
+ httpx-aiohttp==0.1.8
60
+ # via isaacus
42
61
  idna==3.4
43
62
  # via anyio
44
63
  # via httpx
64
+ # via yarl
45
65
  importlib-metadata==7.0.0
46
66
  iniconfig==2.0.0
47
67
  # via pytest
@@ -49,6 +69,9 @@ markdown-it-py==3.0.0
49
69
  # via rich
50
70
  mdurl==0.1.2
51
71
  # via markdown-it-py
72
+ multidict==6.4.4
73
+ # via aiohttp
74
+ # via yarl
52
75
  mypy==1.14.1
53
76
  mypy-extensions==1.0.0
54
77
  # via mypy
@@ -63,6 +86,9 @@ platformdirs==3.11.0
63
86
  # via virtualenv
64
87
  pluggy==1.5.0
65
88
  # via pytest
89
+ propcache==0.3.1
90
+ # via aiohttp
91
+ # via yarl
66
92
  pydantic==2.10.3
67
93
  # via isaacus
68
94
  pydantic-core==2.27.1
@@ -72,7 +98,9 @@ pygments==2.18.0
72
98
  pyright==1.1.399
73
99
  pytest==8.3.3
74
100
  # via pytest-asyncio
101
+ # via pytest-xdist
75
102
  pytest-asyncio==0.24.0
103
+ pytest-xdist==3.7.0
76
104
  python-dateutil==2.8.2
77
105
  # via time-machine
78
106
  pytz==2023.3.post1
@@ -94,11 +122,14 @@ tomli==2.0.2
94
122
  typing-extensions==4.12.2
95
123
  # via anyio
96
124
  # via isaacus
125
+ # via multidict
97
126
  # via mypy
98
127
  # via pydantic
99
128
  # via pydantic-core
100
129
  # via pyright
101
130
  virtualenv==20.24.5
102
131
  # via nox
132
+ yarl==1.20.0
133
+ # via aiohttp
103
134
  zipp==3.17.0
104
135
  # via importlib-metadata
@@ -10,11 +10,22 @@
10
10
  # universal: false
11
11
 
12
12
  -e file:.
13
+ aiohappyeyeballs==2.6.1
14
+ # via aiohttp
15
+ aiohttp==3.12.8
16
+ # via httpx-aiohttp
17
+ # via isaacus
18
+ aiosignal==1.3.2
19
+ # via aiohttp
13
20
  annotated-types==0.6.0
14
21
  # via pydantic
15
22
  anyio==4.4.0
16
23
  # via httpx
17
24
  # via isaacus
25
+ async-timeout==5.0.1
26
+ # via aiohttp
27
+ attrs==25.3.0
28
+ # via aiohttp
18
29
  certifi==2023.7.22
19
30
  # via httpcore
20
31
  # via httpx
@@ -22,15 +33,28 @@ distro==1.8.0
22
33
  # via isaacus
23
34
  exceptiongroup==1.2.2
24
35
  # via anyio
25
- h11==0.14.0
36
+ frozenlist==1.6.2
37
+ # via aiohttp
38
+ # via aiosignal
39
+ h11==0.16.0
26
40
  # via httpcore
27
- httpcore==1.0.2
41
+ httpcore==1.0.9
28
42
  # via httpx
29
43
  httpx==0.28.1
44
+ # via httpx-aiohttp
45
+ # via isaacus
46
+ httpx-aiohttp==0.1.8
30
47
  # via isaacus
31
48
  idna==3.4
32
49
  # via anyio
33
50
  # via httpx
51
+ # via yarl
52
+ multidict==6.4.4
53
+ # via aiohttp
54
+ # via yarl
55
+ propcache==0.3.1
56
+ # via aiohttp
57
+ # via yarl
34
58
  pydantic==2.10.3
35
59
  # via isaacus
36
60
  pydantic-core==2.27.1
@@ -41,5 +65,8 @@ sniffio==1.3.0
41
65
  typing-extensions==4.12.2
42
66
  # via anyio
43
67
  # via isaacus
68
+ # via multidict
44
69
  # via pydantic
45
70
  # via pydantic-core
71
+ yarl==1.20.0
72
+ # via aiohttp
@@ -26,7 +26,7 @@ from ._exceptions import (
26
26
  UnprocessableEntityError,
27
27
  APIResponseValidationError,
28
28
  )
29
- from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
29
+ from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
30
30
  from ._utils._logs import setup_logging as _setup_logging
31
31
 
32
32
  __all__ = [
@@ -68,6 +68,7 @@ __all__ = [
68
68
  "DEFAULT_CONNECTION_LIMITS",
69
69
  "DefaultHttpxClient",
70
70
  "DefaultAsyncHttpxClient",
71
+ "DefaultAioHttpClient",
71
72
  ]
72
73
 
73
74
  if not _t.TYPE_CHECKING:
@@ -504,6 +504,15 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
504
504
  # work around https://github.com/encode/httpx/discussions/2880
505
505
  kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
506
506
 
507
+ is_body_allowed = options.method.lower() != "get"
508
+
509
+ if is_body_allowed:
510
+ kwargs["json"] = json_data if is_given(json_data) else None
511
+ kwargs["files"] = files
512
+ else:
513
+ headers.pop("Content-Type", None)
514
+ kwargs.pop("data", None)
515
+
507
516
  # TODO: report this error to httpx
508
517
  return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
509
518
  headers=headers,
@@ -515,8 +524,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
515
524
  # so that passing a `TypedDict` doesn't cause an error.
516
525
  # https://github.com/microsoft/pyright/issues/3526#event-6715453066
517
526
  params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
518
- json=json_data if is_given(json_data) else None,
519
- files=files,
520
527
  **kwargs,
521
528
  )
522
529
 
@@ -1046,7 +1053,14 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1046
1053
  ) -> ResponseT:
1047
1054
  origin = get_origin(cast_to) or cast_to
1048
1055
 
1049
- if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1056
+ if (
1057
+ inspect.isclass(origin)
1058
+ and issubclass(origin, BaseAPIResponse)
1059
+ # we only want to actually return the custom BaseAPIResponse class if we're
1060
+ # returning the raw response, or if we're not streaming SSE, as if we're streaming
1061
+ # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1062
+ and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1063
+ ):
1050
1064
  if not issubclass(origin, APIResponse):
1051
1065
  raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")
1052
1066
 
@@ -1257,6 +1271,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
1257
1271
  super().__init__(**kwargs)
1258
1272
 
1259
1273
 
1274
+ try:
1275
+ import httpx_aiohttp
1276
+ except ImportError:
1277
+
1278
+ class _DefaultAioHttpClient(httpx.AsyncClient):
1279
+ def __init__(self, **_kwargs: Any) -> None:
1280
+ raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
1281
+ else:
1282
+
1283
+ class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
1284
+ def __init__(self, **kwargs: Any) -> None:
1285
+ kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
1286
+ kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
1287
+ kwargs.setdefault("follow_redirects", True)
1288
+
1289
+ super().__init__(**kwargs)
1290
+
1291
+
1260
1292
  if TYPE_CHECKING:
1261
1293
  DefaultAsyncHttpxClient = httpx.AsyncClient
1262
1294
  """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1265,8 +1297,12 @@ if TYPE_CHECKING:
1265
1297
  This is useful because overriding the `http_client` with your own instance of
1266
1298
  `httpx.AsyncClient` will result in httpx's defaults being used, not ours.
1267
1299
  """
1300
+
1301
+ DefaultAioHttpClient = httpx.AsyncClient
1302
+ """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
1268
1303
  else:
1269
1304
  DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
1305
+ DefaultAioHttpClient = _DefaultAioHttpClient
1270
1306
 
1271
1307
 
1272
1308
  class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
@@ -1549,7 +1585,14 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1549
1585
  ) -> ResponseT:
1550
1586
  origin = get_origin(cast_to) or cast_to
1551
1587
 
1552
- if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1588
+ if (
1589
+ inspect.isclass(origin)
1590
+ and issubclass(origin, BaseAPIResponse)
1591
+ # we only want to actually return the custom BaseAPIResponse class if we're
1592
+ # returning the raw response, or if we're not streaming SSE, as if we're streaming
1593
+ # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1594
+ and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1595
+ ):
1553
1596
  if not issubclass(origin, AsyncAPIResponse):
1554
1597
  raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")
1555
1598
 
@@ -2,9 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  import inspect
5
- from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
5
+ from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
6
6
  from datetime import date, datetime
7
7
  from typing_extensions import (
8
+ List,
8
9
  Unpack,
9
10
  Literal,
10
11
  ClassVar,
@@ -207,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
207
208
  else:
208
209
  fields_values[name] = field_get_default(field)
209
210
 
211
+ extra_field_type = _get_extra_fields_type(__cls)
212
+
210
213
  _extra = {}
211
214
  for key, value in values.items():
212
215
  if key not in model_fields:
216
+ parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
217
+
213
218
  if PYDANTIC_V2:
214
- _extra[key] = value
219
+ _extra[key] = parsed
215
220
  else:
216
221
  _fields_set.add(key)
217
- fields_values[key] = value
222
+ fields_values[key] = parsed
218
223
 
219
224
  object.__setattr__(m, "__dict__", fields_values)
220
225
 
@@ -366,7 +371,24 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
366
371
  if type_ is None:
367
372
  raise RuntimeError(f"Unexpected field type is None for {key}")
368
373
 
369
- return construct_type(value=value, type_=type_)
374
+ return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
375
+
376
+
377
+ def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
378
+ if not PYDANTIC_V2:
379
+ # TODO
380
+ return None
381
+
382
+ schema = cls.__pydantic_core_schema__
383
+ if schema["type"] == "model":
384
+ fields = schema["schema"]
385
+ if fields["type"] == "model-fields":
386
+ extras = fields.get("extras_schema")
387
+ if extras and "cls" in extras:
388
+ # mypy can't narrow the type
389
+ return extras["cls"] # type: ignore[no-any-return]
390
+
391
+ return None
370
392
 
371
393
 
372
394
  def is_basemodel(type_: type) -> bool:
@@ -420,7 +442,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
420
442
  return cast(_T, construct_type(value=value, type_=type_))
421
443
 
422
444
 
423
- def construct_type(*, value: object, type_: object) -> object:
445
+ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
424
446
  """Loose coercion to the expected type with construction of nested values.
425
447
 
426
448
  If the given value does not match the expected type then it is returned as-is.
@@ -438,8 +460,10 @@ def construct_type(*, value: object, type_: object) -> object:
438
460
  type_ = type_.__value__ # type: ignore[unreachable]
439
461
 
440
462
  # unwrap `Annotated[T, ...]` -> `T`
441
- if is_annotated_type(type_):
442
- meta: tuple[Any, ...] = get_args(type_)[1:]
463
+ if metadata is not None and len(metadata) > 0:
464
+ meta: tuple[Any, ...] = tuple(metadata)
465
+ elif is_annotated_type(type_):
466
+ meta = get_args(type_)[1:]
443
467
  type_ = extract_type_arg(type_, 0)
444
468
  else:
445
469
  meta = tuple()
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "isaacus"
4
- __version__ = "0.7.0" # x-release-please-version
4
+ __version__ = "0.8.0" # x-release-please-version
@@ -76,7 +76,9 @@ class TestUniversal:
76
76
 
77
77
 
78
78
  class TestAsyncUniversal:
79
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
79
+ parametrize = pytest.mark.parametrize(
80
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
81
+ )
80
82
 
81
83
  @pytest.mark.skip()
82
84
  @parametrize
@@ -84,7 +84,9 @@ class TestQa:
84
84
 
85
85
 
86
86
  class TestAsyncQa:
87
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
87
+ parametrize = pytest.mark.parametrize(
88
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
89
+ )
88
90
 
89
91
  @pytest.mark.skip()
90
92
  @parametrize
@@ -101,7 +101,9 @@ class TestRerankings:
101
101
 
102
102
 
103
103
  class TestAsyncRerankings:
104
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
104
+ parametrize = pytest.mark.parametrize(
105
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
106
+ )
105
107
 
106
108
  @pytest.mark.skip()
107
109
  @parametrize