Skip to content

Commit acd18f3

Browse files
authored
Merge branch 'main' into awalker4-patch-2
2 parents 9169f70 + 33e7d79 commit acd18f3

File tree

10 files changed

+92
-36
lines changed

10 files changed

+92
-36
lines changed

.github/workflows/claude.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Run Claude Code
33+
id: claude
34+
uses: anthropics/claude-code-action@beta
35+
with:
36+
anthropic_api_key: ${{ secrets.GH_ANTHROPIC_API_KEY }}
37+
allowed_tools: "Bash(git:*),View,GlobTool,GrepTool,BatchTool"

.speakeasy/gen.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
lockVersion: 2.0.0
22
id: 8b5fa338-9106-4734-abf0-e30d67044a90
33
management:
4-
docChecksum: b83a55777bc5d3b1bda7cdfe7ee07a04
5-
docVersion: 1.1.30
4+
docChecksum: 3e52fdac3e417f8e48fcb920b829025c
5+
docVersion: 1.1.34
66
speakeasyVersion: 1.552.0
77
generationVersion: 2.610.0
8-
releaseVersion: 0.38.1
9-
configChecksum: accf1dab899bf95bca0a1c9d8f7ce37a
8+
releaseVersion: 0.39.1
9+
configChecksum: 2b0094ee827eb2deb71ef0ff9e572192
1010
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
1111
repoSubDirectory: .
1212
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ speakeasyVersion: 1.552.0
22
sources:
33
my-source:
44
sourceNamespace: my-source
5-
sourceRevisionDigest: sha256:2f2db6ff7bc20d7cf5d761369bbca095edb6c1fd11a11cbf90b1356285b31cea
6-
sourceBlobDigest: sha256:ebd768e737b62ea63eb80866cbb5520c544310d41e0960dad7f1b7f056e8e9c7
5+
sourceRevisionDigest: sha256:ac2955e4a812caa63ad339156504c9bdfae02dd241800a6c48892aaf37552c54
6+
sourceBlobDigest: sha256:eb516ced31caa9801a7996b8216fa7c7a46ab16dc9edd4d9eef5721cee7acd6c
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1751553080
10-
- 1.1.30
9+
- speakeasy-sdk-regen-1752365566
10+
- 1.1.34
1111
targets:
1212
unstructured-python:
1313
source: my-source
1414
sourceNamespace: my-source
15-
sourceRevisionDigest: sha256:2f2db6ff7bc20d7cf5d761369bbca095edb6c1fd11a11cbf90b1356285b31cea
16-
sourceBlobDigest: sha256:ebd768e737b62ea63eb80866cbb5520c544310d41e0960dad7f1b7f056e8e9c7
15+
sourceRevisionDigest: sha256:ac2955e4a812caa63ad339156504c9bdfae02dd241800a6c48892aaf37552c54
16+
sourceBlobDigest: sha256:eb516ced31caa9801a7996b8216fa7c7a46ab16dc9edd4d9eef5721cee7acd6c
1717
codeSamplesNamespace: my-source-code-samples
18-
codeSamplesRevisionDigest: sha256:d7f7ccae807fbcc93d5037607208e53a3605ebc2c0919f8ad2d9f5d63fdd006d
18+
codeSamplesRevisionDigest: sha256:e644b82aab2fb0dc0c506d643aa22910ae14bc998f2b13ac7cc019a789dbe552
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

README.md

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ with UnstructuredClient() as uc_client:
316316

317317
</br>
318318

319-
The same SDK client can also be used to make asychronous requests by importing asyncio.
319+
The same SDK client can also be used to make asynchronous requests by importing asyncio.
320320
```python
321321
# Asynchronous Example
322322
import asyncio
@@ -351,7 +351,7 @@ See [page splitting](https://docs.unstructured.io/api-reference/api-services/sdk
351351
In order to speed up processing of large PDF files, the client splits up PDFs into smaller files, sends these to the API concurrently, and recombines the results. `split_pdf_page` can be set to `False` to disable this.
352352

353353
The amount of workers utilized for splitting PDFs is dictated by the `split_pdf_concurrency_level` parameter, with a default of 5 and a maximum of 15 to keep resource usage and costs in check. The splitting process leverages `asyncio` to manage concurrency effectively.
354-
The size of each batch of pages (ranging from 2 to 20) is internally determined based on the concurrency level and the total number of pages in the document. Because the splitting process uses `asyncio` the client can encouter event loop issues if it is nested in another async runner, like running in a `gevent` spawned task. Instead, this is safe to run in multiprocessing workers (e.g., using `multiprocessing.Pool` with `fork` context).
354+
The size of each batch of pages (ranging from 2 to 20) is internally determined based on the concurrency level and the total number of pages in the document. Because the splitting process uses `asyncio` the client can encounter event loop issues if it is nested in another async runner, like running in a `gevent` spawned task. Instead, this is safe to run in multiprocessing workers (e.g., using `multiprocessing.Pool` with `fork` context).
355355

356356
Example:
357357
```python

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,4 +1048,14 @@ Based on:
10481048
### Generated
10491049
- [python v0.38.1] .
10501050
### Releases
1051-
- [PyPI v0.38.1] https://pypi.org/project/unstructured-client/0.38.1 - .
1051+
- [PyPI v0.38.1] https://pypi.org/project/unstructured-client/0.38.1 - .
1052+
1053+
## 2025-07-16 19:20:27
1054+
### Changes
1055+
Based on:
1056+
- OpenAPI Doc
1057+
- Speakeasy CLI 1.552.0 (2.610.0) https://github.com/speakeasy-api/speakeasy
1058+
### Generated
1059+
- [python v0.39.1] .
1060+
### Releases
1061+
- [PyPI v0.39.1] https://pypi.org/project/unstructured-client/0.39.1 - .

gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ generation:
1414
oAuth2ClientCredentialsEnabled: false
1515
oAuth2PasswordEnabled: false
1616
python:
17-
version: 0.38.1
17+
version: 0.39.1
1818
additionalDependencies:
1919
dev:
2020
deepdiff: '>=6.0'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "unstructured-client"
3-
version = "0.38.1"
3+
version = "0.39.1"
44
description = "Python Client SDK for Unstructured API"
55
authors = [{ name = "Unstructured" },]
66
readme = "README-PYPI.md"

src/unstructured_client/_hooks/custom/request_utils.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@
2323
FormData,
2424
)
2525
from unstructured_client.models import shared
26-
from unstructured_client.utils import BackoffStrategy, Retries, RetryConfig, retry_async, serialize_request_body
26+
from unstructured_client.utils import (
27+
BackoffStrategy,
28+
Retries,
29+
RetryConfig,
30+
retry_async,
31+
serialize_request_body,
32+
)
2733

2834
logger = logging.getLogger(UNSTRUCTURED_CLIENT_LOGGER_NAME)
2935

36+
3037
def get_multipart_stream_fields(request: httpx.Request) -> dict[str, Any]:
3138
"""Extracts the multipart fields from the request.
3239
@@ -65,9 +72,9 @@ def get_multipart_stream_fields(request: httpx.Request) -> dict[str, Any]:
6572
}
6673
return mapped_fields
6774

75+
6876
def create_pdf_chunk_request_params(
69-
form_data: FormData,
70-
page_number: int
77+
form_data: FormData, page_number: int
7178
) -> dict[str, Any]:
7279
"""Creates the request body for the partition API."
7380
@@ -88,11 +95,14 @@ def create_pdf_chunk_request_params(
8895
PARTITION_FORM_SPLIT_CACHE_TMP_DATA_KEY,
8996
PARTITION_FORM_SPLIT_CACHE_TMP_DATA_DIR_KEY,
9097
]
91-
chunk_payload = {key: form_data[key] for key in form_data if key not in fields_to_drop}
98+
chunk_payload = {
99+
key: form_data[key] for key in form_data if key not in fields_to_drop
100+
}
92101
chunk_payload[PARTITION_FORM_SPLIT_PDF_PAGE_KEY] = "false"
93102
chunk_payload[PARTITION_FORM_STARTING_PAGE_NUMBER_KEY] = str(page_number)
94103
return chunk_payload
95104

105+
96106
def create_pdf_chunk_request(
97107
form_data: FormData,
98108
pdf_chunk: Tuple[BinaryIO, int],
@@ -148,7 +158,6 @@ def create_pdf_chunk_request(
148158
)
149159

150160

151-
152161
async def call_api_async(
153162
client: httpx.AsyncClient,
154163
pdf_chunk_request: httpx.Request,
@@ -161,12 +170,12 @@ async def call_api_async(
161170
retry_config = RetryConfig(
162171
"backoff",
163172
BackoffStrategy(
164-
initial_interval = one_second * 3,
165-
max_interval = one_minute * 12,
166-
max_elapsed_time = one_minute * 30,
167-
exponent = 1.88,
173+
initial_interval=one_second * 3,
174+
max_interval=one_minute * 12,
175+
max_elapsed_time=one_minute * 30,
176+
exponent=1.88,
168177
),
169-
retry_connection_errors=True
178+
retry_connection_errors=True,
170179
)
171180

172181
retryable_codes = ["5xx"]
@@ -177,12 +186,11 @@ async def do_request():
177186
async with limiter:
178187
try:
179188
response = await retry_async(
180-
do_request,
181-
Retries(retry_config, retryable_codes)
189+
do_request, Retries(retry_config, retryable_codes)
182190
)
183191
return response
184192
except Exception as e:
185-
logger.error("Request failed with error", exc_info=e)
193+
logger.error("Request failed with error: %s", e, exc_info=e)
186194
raise e
187195
finally:
188196
if not isinstance(pdf_chunk_file, io.BytesIO) and not pdf_chunk_file.closed:
@@ -205,6 +213,7 @@ def prepare_request_headers(
205213
new_headers.pop("Content-Length", None)
206214
return new_headers
207215

216+
208217
def create_response(elements: list) -> httpx.Response:
209218
"""
210219
Creates a modified response object with updated content.
@@ -216,13 +225,16 @@ def create_response(elements: list) -> httpx.Response:
216225
Returns:
217226
The modified response object with updated content.
218227
"""
219-
response = httpx.Response(status_code=200, headers={"Content-Type": "application/json"})
228+
response = httpx.Response(
229+
status_code=200, headers={"Content-Type": "application/json"}
230+
)
220231
content = json.dumps(elements).encode()
221232
content_length = str(len(content))
222233
response.headers.update({"Content-Length": content_length})
223234
setattr(response, "_content", content)
224235
return response
225236

237+
226238
def get_base_url(url: str | URL) -> str:
227239
"""Extracts the base URL from the given URL.
228240

src/unstructured_client/_hooks/custom/split_pdf_hook.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,8 @@ def after_success(
669669
elements = self._await_elements(operation_id)
670670

671671
# if fails are disallowed, return the first failed response
672-
# Note(austin): Stick a 500 status code in here so the SDK
673-
# does not trigger its own retry logic
674672
if not self.allow_failed and self.api_failed_responses.get(operation_id):
675673
failure_response = self.api_failed_responses[operation_id][0]
676-
failure_response.status_code = 500
677674

678675
self._clear_operation(operation_id)
679676
return failure_response

src/unstructured_client/_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import importlib.metadata
44

55
__title__: str = "unstructured-client"
6-
__version__: str = "0.38.1"
7-
__openapi_doc_version__: str = "1.1.30"
6+
__version__: str = "0.39.1"
7+
__openapi_doc_version__: str = "1.1.34"
88
__gen_version__: str = "2.610.0"
9-
__user_agent__: str = "speakeasy-sdk/python 0.38.1 2.610.0 1.1.30 unstructured-client"
9+
__user_agent__: str = "speakeasy-sdk/python 0.39.1 2.610.0 1.1.34 unstructured-client"
1010

1111
try:
1212
if __package__ is not None:

0 commit comments

Comments
 (0)