chunkr-ai 0.1.0a4__tar.gz → 0.1.0a6__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. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/.gitignore +0 -2
  2. chunkr_ai-0.1.0a6/.release-please-manifest.json +3 -0
  3. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/CHANGELOG.md +26 -0
  4. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/PKG-INFO +4 -4
  5. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/README.md +3 -3
  6. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/pyproject.toml +1 -1
  7. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/__init__.py +0 -3
  8. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_client.py +4 -0
  9. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_constants.py +5 -5
  10. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_version.py +1 -1
  11. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/files.py +32 -4
  12. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/tasks/parse.py +124 -84
  13. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/tasks/tasks.py +46 -24
  14. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/task.py +18 -11
  15. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/task_get_params.py +3 -0
  16. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/tasks/parse_create_params.py +20 -13
  17. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/tasks/parse_update_params.py +18 -11
  18. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/tasks/test_parse.py +18 -0
  19. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/test_files.py +48 -0
  20. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/test_health.py +6 -0
  21. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/test_tasks.py +36 -0
  22. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_client.py +90 -28
  23. chunkr_ai-0.1.0a4/.release-please-manifest.json +0 -3
  24. chunkr_ai-0.1.0a4/src/chunkr_ai/lib/tasks_poll.py +0 -122
  25. chunkr_ai-0.1.0a4/tests/test_tasks_poll.py +0 -62
  26. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/CONTRIBUTING.md +0 -0
  27. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/LICENSE +0 -0
  28. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/SECURITY.md +0 -0
  29. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/api.md +0 -0
  30. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/bin/check-release-environment +0 -0
  31. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/bin/publish-pypi +0 -0
  32. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/examples/.keep +0 -0
  33. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/mypy.ini +0 -0
  34. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/noxfile.py +0 -0
  35. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/release-please-config.json +0 -0
  36. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/requirements-dev.lock +0 -0
  37. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/requirements.lock +0 -0
  38. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr/lib/.keep +0 -0
  39. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_base_client.py +0 -0
  40. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_compat.py +0 -0
  41. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_exceptions.py +0 -0
  42. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_files.py +0 -0
  43. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_models.py +0 -0
  44. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_qs.py +0 -0
  45. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_resource.py +0 -0
  46. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_response.py +0 -0
  47. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_streaming.py +0 -0
  48. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_types.py +0 -0
  49. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/__init__.py +0 -0
  50. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_logs.py +0 -0
  51. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_proxy.py +0 -0
  52. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_reflection.py +0 -0
  53. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_resources_proxy.py +0 -0
  54. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_streams.py +0 -0
  55. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_sync.py +0 -0
  56. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_transform.py +0 -0
  57. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_typing.py +0 -0
  58. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/_utils/_utils.py +0 -0
  59. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/lib/.keep +0 -0
  60. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/pagination.py +0 -0
  61. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/py.typed +0 -0
  62. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/__init__.py +0 -0
  63. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/health.py +0 -0
  64. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/resources/tasks/__init__.py +0 -0
  65. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/__init__.py +0 -0
  66. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/delete.py +0 -0
  67. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/file.py +0 -0
  68. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/file_create_params.py +0 -0
  69. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/file_list_params.py +0 -0
  70. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/file_url.py +0 -0
  71. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/file_url_params.py +0 -0
  72. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/files_list_response.py +0 -0
  73. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/health_check_response.py +0 -0
  74. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/task_list_params.py +0 -0
  75. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/src/chunkr_ai/types/tasks/__init__.py +0 -0
  76. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/__init__.py +0 -0
  77. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/__init__.py +0 -0
  78. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/api_resources/tasks/__init__.py +0 -0
  79. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/conftest.py +0 -0
  80. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/sample_file.txt +0 -0
  81. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_deepcopy.py +0 -0
  82. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_extract_files.py +0 -0
  83. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_files.py +0 -0
  84. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_models.py +0 -0
  85. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_qs.py +0 -0
  86. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_required_args.py +0 -0
  87. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_response.py +0 -0
  88. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_streaming.py +0 -0
  89. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_transform.py +0 -0
  90. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_utils/test_proxy.py +0 -0
  91. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/test_utils/test_typing.py +0 -0
  92. {chunkr_ai-0.1.0a4 → chunkr_ai-0.1.0a6}/tests/utils.py +0 -0
@@ -13,5 +13,3 @@ dist
13
13
  .envrc
14
14
  codegen.log
15
15
  Brewfile.lock.json
16
-
17
- .lh
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.6"
3
+ }
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.6 (2025-08-12)
4
+
5
+ Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/lumina-ai-inc/chunkr-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([5be70ea](https://github.com/lumina-ai-inc/chunkr-python/commit/5be70ea879606227d056d3dfc9b7b67add2871cd))
10
+
11
+
12
+ ### Chores
13
+
14
+ * **internal:** codegen related update ([ba667c4](https://github.com/lumina-ai-inc/chunkr-python/commit/ba667c468ec6af4fb059196e6cf9b7da8ad0b524))
15
+
16
+ ## 0.1.0-alpha.5 (2025-08-12)
17
+
18
+ Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/lumina-ai-inc/chunkr-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
19
+
20
+ ### Features
21
+
22
+ * **api:** added default timeouts ([d8fe4d0](https://github.com/lumina-ai-inc/chunkr-python/commit/d8fe4d089ea7024e90ab01941d7eeb616d0e7034))
23
+ * **api:** api update ([c925f82](https://github.com/lumina-ai-inc/chunkr-python/commit/c925f825bd9071616aeb45fc7c0853acbfb14797))
24
+ * **api:** manual updates ([6ac936b](https://github.com/lumina-ai-inc/chunkr-python/commit/6ac936b3ed6623edf21a9a6e7fc1e721398f35ab))
25
+ * **api:** manual updates ([5af3de5](https://github.com/lumina-ai-inc/chunkr-python/commit/5af3de5c2758931d7ac68e66c09cb2fe7f82f626))
26
+ * **api:** manual updates ([e768758](https://github.com/lumina-ai-inc/chunkr-python/commit/e768758ce2e2c9fc894be36f1ca08144c48e878e))
27
+ * **api:** manual updates ([a2ea967](https://github.com/lumina-ai-inc/chunkr-python/commit/a2ea967860af97eaead44ab74f8fb0b54577f3a9))
28
+
3
29
  ## 0.1.0-alpha.4 (2025-08-09)
4
30
 
5
31
  Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/lumina-ai-inc/chunkr-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chunkr-ai
3
- Version: 0.1.0a4
3
+ Version: 0.1.0a6
4
4
  Summary: The official Python library for the chunkr API
5
5
  Project-URL: Homepage, https://github.com/lumina-ai-inc/chunkr-python
6
6
  Project-URL: Repository, https://github.com/lumina-ai-inc/chunkr-python
@@ -299,7 +299,7 @@ Error codes are as follows:
299
299
 
300
300
  ### Retries
301
301
 
302
- Certain errors are automatically retried 2 times by default, with a short exponential backoff.
302
+ Certain errors are automatically retried 50 times by default, with a short exponential backoff.
303
303
  Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
304
304
  429 Rate Limit, and >=500 Internal errors are all retried by default.
305
305
 
@@ -322,7 +322,7 @@ client.with_options(max_retries=5).tasks.parse.create(
322
322
 
323
323
  ### Timeouts
324
324
 
325
- By default requests time out after 1 minute. You can configure this with a `timeout` option,
325
+ By default requests time out after 30 seconds. You can configure this with a `timeout` option,
326
326
  which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
327
327
 
328
328
  ```python
@@ -330,7 +330,7 @@ from chunkr_ai import Chunkr
330
330
 
331
331
  # Configure the default for all requests:
332
332
  client = Chunkr(
333
- # 20 seconds (default is 1 minute)
333
+ # 20 seconds (default is 30 seconds)
334
334
  timeout=20.0,
335
335
  )
336
336
 
@@ -264,7 +264,7 @@ Error codes are as follows:
264
264
 
265
265
  ### Retries
266
266
 
267
- Certain errors are automatically retried 2 times by default, with a short exponential backoff.
267
+ Certain errors are automatically retried 50 times by default, with a short exponential backoff.
268
268
  Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
269
269
  429 Rate Limit, and >=500 Internal errors are all retried by default.
270
270
 
@@ -287,7 +287,7 @@ client.with_options(max_retries=5).tasks.parse.create(
287
287
 
288
288
  ### Timeouts
289
289
 
290
- By default requests time out after 1 minute. You can configure this with a `timeout` option,
290
+ By default requests time out after 30 seconds. You can configure this with a `timeout` option,
291
291
  which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
292
292
 
293
293
  ```python
@@ -295,7 +295,7 @@ from chunkr_ai import Chunkr
295
295
 
296
296
  # Configure the default for all requests:
297
297
  client = Chunkr(
298
- # 20 seconds (default is 1 minute)
298
+ # 20 seconds (default is 30 seconds)
299
299
  timeout=20.0,
300
300
  )
301
301
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "chunkr-ai"
3
- version = "0.1.0-alpha.4"
3
+ version = "0.1.0-alpha.6"
4
4
  description = "The official Python library for the chunkr API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -72,9 +72,6 @@ __all__ = [
72
72
  ]
73
73
 
74
74
  if not _t.TYPE_CHECKING:
75
- # Load custom helpers that monkey-patch generated types.
76
- # This keeps custom code separate from generated files, per Stainless guidance.
77
- from .lib import tasks_poll as _tasks_poll # noqa: F401
78
75
  from ._utils._resources_proxy import resources as resources
79
76
 
80
77
  _setup_logging()
@@ -95,6 +95,8 @@ class Chunkr(SyncAPIClient):
95
95
  _strict_response_validation=_strict_response_validation,
96
96
  )
97
97
 
98
+ self._idempotency_header = "Idempotency-Key"
99
+
98
100
  self.tasks = tasks.TasksResource(self)
99
101
  self.files = files.FilesResource(self)
100
102
  self.health = health.HealthResource(self)
@@ -267,6 +269,8 @@ class AsyncChunkr(AsyncAPIClient):
267
269
  _strict_response_validation=_strict_response_validation,
268
270
  )
269
271
 
272
+ self._idempotency_header = "Idempotency-Key"
273
+
270
274
  self.tasks = tasks.AsyncTasksResource(self)
271
275
  self.files = files.AsyncFilesResource(self)
272
276
  self.health = health.AsyncHealthResource(self)
@@ -5,10 +5,10 @@ import httpx
5
5
  RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
6
6
  OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
7
7
 
8
- # default timeout is 1 minute
9
- DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0)
10
- DEFAULT_MAX_RETRIES = 2
8
+ # default timeout is 30 seconds
9
+ DEFAULT_TIMEOUT = httpx.Timeout(timeout=30, connect=5.0)
10
+ DEFAULT_MAX_RETRIES = 50
11
11
  DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
12
12
 
13
- INITIAL_RETRY_DELAY = 0.5
14
- MAX_RETRY_DELAY = 8.0
13
+ INITIAL_RETRY_DELAY = 1.0
14
+ MAX_RETRY_DELAY = 10.0
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "chunkr_ai"
4
- __version__ = "0.1.0-alpha.4" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.6" # x-release-please-version
@@ -59,6 +59,7 @@ class FilesResource(SyncAPIResource):
59
59
  extra_query: Query | None = None,
60
60
  extra_body: Body | None = None,
61
61
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62
+ idempotency_key: str | None = None,
62
63
  ) -> File:
63
64
  """
64
65
  Accepts multipart/form-data with fields:
@@ -78,6 +79,8 @@ class FilesResource(SyncAPIResource):
78
79
  extra_body: Add additional JSON properties to the request
79
80
 
80
81
  timeout: Override the client-level default timeout for this request, in seconds
82
+
83
+ idempotency_key: Specify a custom idempotency key for this request
81
84
  """
82
85
  body = deepcopy_minimal(
83
86
  {
@@ -95,7 +98,11 @@ class FilesResource(SyncAPIResource):
95
98
  body=maybe_transform(body, file_create_params.FileCreateParams),
96
99
  files=files,
97
100
  options=make_request_options(
98
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
101
+ extra_headers=extra_headers,
102
+ extra_query=extra_query,
103
+ extra_body=extra_body,
104
+ timeout=timeout,
105
+ idempotency_key=idempotency_key,
99
106
  ),
100
107
  cast_to=File,
101
108
  )
@@ -170,6 +177,7 @@ class FilesResource(SyncAPIResource):
170
177
  extra_query: Query | None = None,
171
178
  extra_body: Body | None = None,
172
179
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
180
+ idempotency_key: str | None = None,
173
181
  ) -> Delete:
174
182
  """Delete file contents and scrub sensitive metadata.
175
183
 
@@ -184,13 +192,19 @@ class FilesResource(SyncAPIResource):
184
192
  extra_body: Add additional JSON properties to the request
185
193
 
186
194
  timeout: Override the client-level default timeout for this request, in seconds
195
+
196
+ idempotency_key: Specify a custom idempotency key for this request
187
197
  """
188
198
  if not file_id:
189
199
  raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
190
200
  return self._delete(
191
201
  f"/files/{file_id}",
192
202
  options=make_request_options(
193
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
203
+ extra_headers=extra_headers,
204
+ extra_query=extra_query,
205
+ extra_body=extra_body,
206
+ timeout=timeout,
207
+ idempotency_key=idempotency_key,
194
208
  ),
195
209
  cast_to=Delete,
196
210
  )
@@ -353,6 +367,7 @@ class AsyncFilesResource(AsyncAPIResource):
353
367
  extra_query: Query | None = None,
354
368
  extra_body: Body | None = None,
355
369
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
370
+ idempotency_key: str | None = None,
356
371
  ) -> File:
357
372
  """
358
373
  Accepts multipart/form-data with fields:
@@ -372,6 +387,8 @@ class AsyncFilesResource(AsyncAPIResource):
372
387
  extra_body: Add additional JSON properties to the request
373
388
 
374
389
  timeout: Override the client-level default timeout for this request, in seconds
390
+
391
+ idempotency_key: Specify a custom idempotency key for this request
375
392
  """
376
393
  body = deepcopy_minimal(
377
394
  {
@@ -389,7 +406,11 @@ class AsyncFilesResource(AsyncAPIResource):
389
406
  body=await async_maybe_transform(body, file_create_params.FileCreateParams),
390
407
  files=files,
391
408
  options=make_request_options(
392
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
409
+ extra_headers=extra_headers,
410
+ extra_query=extra_query,
411
+ extra_body=extra_body,
412
+ timeout=timeout,
413
+ idempotency_key=idempotency_key,
393
414
  ),
394
415
  cast_to=File,
395
416
  )
@@ -464,6 +485,7 @@ class AsyncFilesResource(AsyncAPIResource):
464
485
  extra_query: Query | None = None,
465
486
  extra_body: Body | None = None,
466
487
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
488
+ idempotency_key: str | None = None,
467
489
  ) -> Delete:
468
490
  """Delete file contents and scrub sensitive metadata.
469
491
 
@@ -478,13 +500,19 @@ class AsyncFilesResource(AsyncAPIResource):
478
500
  extra_body: Add additional JSON properties to the request
479
501
 
480
502
  timeout: Override the client-level default timeout for this request, in seconds
503
+
504
+ idempotency_key: Specify a custom idempotency key for this request
481
505
  """
482
506
  if not file_id:
483
507
  raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
484
508
  return await self._delete(
485
509
  f"/files/{file_id}",
486
510
  options=make_request_options(
487
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
511
+ extra_headers=extra_headers,
512
+ extra_query=extra_query,
513
+ extra_body=extra_body,
514
+ timeout=timeout,
515
+ idempotency_key=idempotency_key,
488
516
  ),
489
517
  cast_to=Delete,
490
518
  )
@@ -63,26 +63,21 @@ class ParseResource(SyncAPIResource):
63
63
  extra_query: Query | None = None,
64
64
  extra_body: Body | None = None,
65
65
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
+ idempotency_key: str | None = None,
66
67
  ) -> Task:
67
68
  """
68
- Queues a document for processing and returns a TaskResponse containing:
69
+ Queues a document for processing and returns a `TaskResponse` with the assigned
70
+ `task_id`, initial configuration, file metadata, and timestamps. The initial
71
+ status is `Starting`.
69
72
 
70
- - Task ID for status polling
71
- - Initial configuration
72
- - File metadata
73
- - Processing status
74
- - Creation timestamp
75
- - Presigned URLs for file access
76
-
77
- The returned task will typically be in a `Starting` or `Processing` state. Use
78
- the `GET /tasks/{task_id}` endpoint to poll for completion.
73
+ Creates a task and returns its metadata immediately.
79
74
 
80
75
  Args:
81
76
  file:
82
77
  The file to be uploaded. Supported inputs:
83
78
 
84
- - `ch://files/{file_id}`: References a previously uploaded file you own
85
- (authorization enforced)
79
+ - `ch://files/{file_id}`: Reference to an existing file. Upload via the Files
80
+ API
86
81
  - `http(s)://...`: Remote URL to fetch
87
82
  - `data:*;base64,...` or raw base64 string
88
83
 
@@ -114,22 +109,29 @@ class ParseResource(SyncAPIResource):
114
109
 
115
110
  segment_processing: Defines how each segment type is handled when generating the final output.
116
111
 
117
- Each segment uses one of three strategies. The chosen strategy controls:
118
- Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`). • How the
119
- content is produced (rule-based vs. LLM). The output format (`Html` or
120
- `Markdown`).
112
+ Each segment uses one of three strategies. The chosen strategy controls:
113
+
114
+ - Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`).
115
+ - How the content is produced (rule-based vs. LLM).
116
+ - The output format (`Html` or `Markdown`).
121
117
 
122
118
  Optional flags such as image **cropping**, **extended context**, and
123
119
  **descriptions** further refine behaviour.
124
120
 
125
- **Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
126
- `Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
127
- (HTML, description on) `Picture` → **LLM** (Markdown, description off,
128
- cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off)
129
- `PageHeader`, `PageFooter` → **Ignore** (removed from output)
121
+ **Default strategy per segment**
122
+
123
+ - `Title`, `SectionHeader`, `Text`, `ListItem`, `Caption`, `Footnote` → **Auto**
124
+ (Markdown, description off)
125
+ - `Table` → **LLM** (HTML, description on)
126
+ - `Picture` → **LLM** (Markdown, description off, cropping _All_)
127
+ - `Formula`, `Page` → **LLM** (Markdown, description off)
128
+ - `PageHeader`, `PageFooter` → **Ignore** (removed from output)
130
129
 
131
- **Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
132
- generate content with an LLM. • **Ignore** – exclude the segment entirely.
130
+ **Strategy reference**
131
+
132
+ - **Auto** – rule-based content generation.
133
+ - **LLM** – generate content with an LLM.
134
+ - **Ignore** – exclude the segment entirely.
133
135
 
134
136
  segmentation_strategy:
135
137
  Controls the segmentation strategy:
@@ -147,6 +149,8 @@ class ParseResource(SyncAPIResource):
147
149
  extra_body: Add additional JSON properties to the request
148
150
 
149
151
  timeout: Override the client-level default timeout for this request, in seconds
152
+
153
+ idempotency_key: Specify a custom idempotency key for this request
150
154
  """
151
155
  return self._post(
152
156
  "/tasks/parse",
@@ -166,7 +170,11 @@ class ParseResource(SyncAPIResource):
166
170
  parse_create_params.ParseCreateParams,
167
171
  ),
168
172
  options=make_request_options(
169
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
173
+ extra_headers=extra_headers,
174
+ extra_query=extra_query,
175
+ extra_body=extra_body,
176
+ timeout=timeout,
177
+ idempotency_key=idempotency_key,
170
178
  ),
171
179
  cast_to=Task,
172
180
  )
@@ -190,20 +198,19 @@ class ParseResource(SyncAPIResource):
190
198
  extra_query: Query | None = None,
191
199
  extra_body: Body | None = None,
192
200
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
201
+ idempotency_key: str | None = None,
193
202
  ) -> Task:
194
203
  """Updates an existing task's configuration and reprocesses the document.
195
204
 
196
205
  The
197
- original configuration will be used for all values that are not provided in the
198
- update.
206
+ current configuration is used as the base; only provided fields are changed.
199
207
 
200
208
  Requirements:
201
209
 
202
- - Task must have status `Succeeded` or `Failed`
203
- - New configuration must be different from the current one
210
+ - Task must be in a terminal state (`Succeeded` or `Failed`).
211
+ - The new configuration must differ from the current configuration.
204
212
 
205
- The returned task will typically be in a `Starting` or `Processing` state. Use
206
- the `GET /tasks/{task_id}` endpoint to poll for completion.
213
+ Updates a task and returns its new metadata immediately.
207
214
 
208
215
  Args:
209
216
  chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
@@ -235,22 +242,29 @@ class ParseResource(SyncAPIResource):
235
242
 
236
243
  segment_processing: Defines how each segment type is handled when generating the final output.
237
244
 
238
- Each segment uses one of three strategies. The chosen strategy controls:
239
- Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`). • How the
240
- content is produced (rule-based vs. LLM). The output format (`Html` or
241
- `Markdown`).
245
+ Each segment uses one of three strategies. The chosen strategy controls:
246
+
247
+ - Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`).
248
+ - How the content is produced (rule-based vs. LLM).
249
+ - The output format (`Html` or `Markdown`).
242
250
 
243
251
  Optional flags such as image **cropping**, **extended context**, and
244
252
  **descriptions** further refine behaviour.
245
253
 
246
- **Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
247
- `Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
248
- (HTML, description on) `Picture` → **LLM** (Markdown, description off,
249
- cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off)
250
- `PageHeader`, `PageFooter` → **Ignore** (removed from output)
254
+ **Default strategy per segment**
255
+
256
+ - `Title`, `SectionHeader`, `Text`, `ListItem`, `Caption`, `Footnote` → **Auto**
257
+ (Markdown, description off)
258
+ - `Table` → **LLM** (HTML, description on)
259
+ - `Picture` → **LLM** (Markdown, description off, cropping _All_)
260
+ - `Formula`, `Page` → **LLM** (Markdown, description off)
261
+ - `PageHeader`, `PageFooter` → **Ignore** (removed from output)
251
262
 
252
- **Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
253
- generate content with an LLM. • **Ignore** – exclude the segment entirely.
263
+ **Strategy reference**
264
+
265
+ - **Auto** – rule-based content generation.
266
+ - **LLM** – generate content with an LLM.
267
+ - **Ignore** – exclude the segment entirely.
254
268
 
255
269
  segmentation_strategy:
256
270
  Controls the segmentation strategy:
@@ -268,6 +282,8 @@ class ParseResource(SyncAPIResource):
268
282
  extra_body: Add additional JSON properties to the request
269
283
 
270
284
  timeout: Override the client-level default timeout for this request, in seconds
285
+
286
+ idempotency_key: Specify a custom idempotency key for this request
271
287
  """
272
288
  if not task_id:
273
289
  raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
@@ -288,7 +304,11 @@ class ParseResource(SyncAPIResource):
288
304
  parse_update_params.ParseUpdateParams,
289
305
  ),
290
306
  options=make_request_options(
291
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
307
+ extra_headers=extra_headers,
308
+ extra_query=extra_query,
309
+ extra_body=extra_body,
310
+ timeout=timeout,
311
+ idempotency_key=idempotency_key,
292
312
  ),
293
313
  cast_to=Task,
294
314
  )
@@ -333,26 +353,21 @@ class AsyncParseResource(AsyncAPIResource):
333
353
  extra_query: Query | None = None,
334
354
  extra_body: Body | None = None,
335
355
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
356
+ idempotency_key: str | None = None,
336
357
  ) -> Task:
337
358
  """
338
- Queues a document for processing and returns a TaskResponse containing:
359
+ Queues a document for processing and returns a `TaskResponse` with the assigned
360
+ `task_id`, initial configuration, file metadata, and timestamps. The initial
361
+ status is `Starting`.
339
362
 
340
- - Task ID for status polling
341
- - Initial configuration
342
- - File metadata
343
- - Processing status
344
- - Creation timestamp
345
- - Presigned URLs for file access
346
-
347
- The returned task will typically be in a `Starting` or `Processing` state. Use
348
- the `GET /tasks/{task_id}` endpoint to poll for completion.
363
+ Creates a task and returns its metadata immediately.
349
364
 
350
365
  Args:
351
366
  file:
352
367
  The file to be uploaded. Supported inputs:
353
368
 
354
- - `ch://files/{file_id}`: References a previously uploaded file you own
355
- (authorization enforced)
369
+ - `ch://files/{file_id}`: Reference to an existing file. Upload via the Files
370
+ API
356
371
  - `http(s)://...`: Remote URL to fetch
357
372
  - `data:*;base64,...` or raw base64 string
358
373
 
@@ -384,22 +399,29 @@ class AsyncParseResource(AsyncAPIResource):
384
399
 
385
400
  segment_processing: Defines how each segment type is handled when generating the final output.
386
401
 
387
- Each segment uses one of three strategies. The chosen strategy controls:
388
- Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`). • How the
389
- content is produced (rule-based vs. LLM). The output format (`Html` or
390
- `Markdown`).
402
+ Each segment uses one of three strategies. The chosen strategy controls:
403
+
404
+ - Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`).
405
+ - How the content is produced (rule-based vs. LLM).
406
+ - The output format (`Html` or `Markdown`).
391
407
 
392
408
  Optional flags such as image **cropping**, **extended context**, and
393
409
  **descriptions** further refine behaviour.
394
410
 
395
- **Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
396
- `Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
397
- (HTML, description on) `Picture` → **LLM** (Markdown, description off,
398
- cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off)
399
- `PageHeader`, `PageFooter` → **Ignore** (removed from output)
411
+ **Default strategy per segment**
412
+
413
+ - `Title`, `SectionHeader`, `Text`, `ListItem`, `Caption`, `Footnote` → **Auto**
414
+ (Markdown, description off)
415
+ - `Table` → **LLM** (HTML, description on)
416
+ - `Picture` → **LLM** (Markdown, description off, cropping _All_)
417
+ - `Formula`, `Page` → **LLM** (Markdown, description off)
418
+ - `PageHeader`, `PageFooter` → **Ignore** (removed from output)
400
419
 
401
- **Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
402
- generate content with an LLM. • **Ignore** – exclude the segment entirely.
420
+ **Strategy reference**
421
+
422
+ - **Auto** – rule-based content generation.
423
+ - **LLM** – generate content with an LLM.
424
+ - **Ignore** – exclude the segment entirely.
403
425
 
404
426
  segmentation_strategy:
405
427
  Controls the segmentation strategy:
@@ -417,6 +439,8 @@ class AsyncParseResource(AsyncAPIResource):
417
439
  extra_body: Add additional JSON properties to the request
418
440
 
419
441
  timeout: Override the client-level default timeout for this request, in seconds
442
+
443
+ idempotency_key: Specify a custom idempotency key for this request
420
444
  """
421
445
  return await self._post(
422
446
  "/tasks/parse",
@@ -436,7 +460,11 @@ class AsyncParseResource(AsyncAPIResource):
436
460
  parse_create_params.ParseCreateParams,
437
461
  ),
438
462
  options=make_request_options(
439
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
463
+ extra_headers=extra_headers,
464
+ extra_query=extra_query,
465
+ extra_body=extra_body,
466
+ timeout=timeout,
467
+ idempotency_key=idempotency_key,
440
468
  ),
441
469
  cast_to=Task,
442
470
  )
@@ -460,20 +488,19 @@ class AsyncParseResource(AsyncAPIResource):
460
488
  extra_query: Query | None = None,
461
489
  extra_body: Body | None = None,
462
490
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
491
+ idempotency_key: str | None = None,
463
492
  ) -> Task:
464
493
  """Updates an existing task's configuration and reprocesses the document.
465
494
 
466
495
  The
467
- original configuration will be used for all values that are not provided in the
468
- update.
496
+ current configuration is used as the base; only provided fields are changed.
469
497
 
470
498
  Requirements:
471
499
 
472
- - Task must have status `Succeeded` or `Failed`
473
- - New configuration must be different from the current one
500
+ - Task must be in a terminal state (`Succeeded` or `Failed`).
501
+ - The new configuration must differ from the current configuration.
474
502
 
475
- The returned task will typically be in a `Starting` or `Processing` state. Use
476
- the `GET /tasks/{task_id}` endpoint to poll for completion.
503
+ Updates a task and returns its new metadata immediately.
477
504
 
478
505
  Args:
479
506
  chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
@@ -505,22 +532,29 @@ class AsyncParseResource(AsyncAPIResource):
505
532
 
506
533
  segment_processing: Defines how each segment type is handled when generating the final output.
507
534
 
508
- Each segment uses one of three strategies. The chosen strategy controls:
509
- Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`). • How the
510
- content is produced (rule-based vs. LLM). The output format (`Html` or
511
- `Markdown`).
535
+ Each segment uses one of three strategies. The chosen strategy controls:
536
+
537
+ - Whether the segment is kept (`Auto`, `LLM`) or skipped (`Ignore`).
538
+ - How the content is produced (rule-based vs. LLM).
539
+ - The output format (`Html` or `Markdown`).
512
540
 
513
541
  Optional flags such as image **cropping**, **extended context**, and
514
542
  **descriptions** further refine behaviour.
515
543
 
516
- **Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
517
- `Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
518
- (HTML, description on) `Picture` → **LLM** (Markdown, description off,
519
- cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off)
520
- `PageHeader`, `PageFooter` → **Ignore** (removed from output)
544
+ **Default strategy per segment**
545
+
546
+ - `Title`, `SectionHeader`, `Text`, `ListItem`, `Caption`, `Footnote` → **Auto**
547
+ (Markdown, description off)
548
+ - `Table` → **LLM** (HTML, description on)
549
+ - `Picture` → **LLM** (Markdown, description off, cropping _All_)
550
+ - `Formula`, `Page` → **LLM** (Markdown, description off)
551
+ - `PageHeader`, `PageFooter` → **Ignore** (removed from output)
521
552
 
522
- **Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
523
- generate content with an LLM. • **Ignore** – exclude the segment entirely.
553
+ **Strategy reference**
554
+
555
+ - **Auto** – rule-based content generation.
556
+ - **LLM** – generate content with an LLM.
557
+ - **Ignore** – exclude the segment entirely.
524
558
 
525
559
  segmentation_strategy:
526
560
  Controls the segmentation strategy:
@@ -538,6 +572,8 @@ class AsyncParseResource(AsyncAPIResource):
538
572
  extra_body: Add additional JSON properties to the request
539
573
 
540
574
  timeout: Override the client-level default timeout for this request, in seconds
575
+
576
+ idempotency_key: Specify a custom idempotency key for this request
541
577
  """
542
578
  if not task_id:
543
579
  raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
@@ -558,7 +594,11 @@ class AsyncParseResource(AsyncAPIResource):
558
594
  parse_update_params.ParseUpdateParams,
559
595
  ),
560
596
  options=make_request_options(
561
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
597
+ extra_headers=extra_headers,
598
+ extra_query=extra_query,
599
+ extra_body=extra_body,
600
+ timeout=timeout,
601
+ idempotency_key=idempotency_key,
562
602
  ),
563
603
  cast_to=Task,
564
604
  )