Skip to content

Commit f81239d

Browse files
committed
DO NOT MERGE THIS COMMIT
1 parent 4b57b0f commit f81239d

File tree

12 files changed

+64
-26
lines changed

12 files changed

+64
-26
lines changed

.speakeasy/gen.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
lockVersion: 2.0.0
22
id: 8b5fa338-9106-4734-abf0-e30d67044a90
33
management:
4-
docChecksum: b1c17258d127ea2ce7e4bfa09a8eb004
5-
docVersion: 1.0.51
4+
docChecksum: 3ffa7dee90c40fda6656210850e12475
5+
docVersion: 1.0.52
66
speakeasyVersion: 1.421.0
77
generationVersion: 2.438.15
8-
releaseVersion: 0.26.2
9-
configChecksum: c46fa7f108a08d4565530aa29da677b5
8+
releaseVersion: 0.27.1
9+
configChecksum: f885d47394f7c0242b6fbfc5f0244886
1010
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
1111
repoSubDirectory: .
1212
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git
1313
published: true
1414
features:
1515
python:
16+
acceptHeaders: 3.0.0
1617
additionalDependencies: 1.0.0
1718
constsAndDefaults: 1.0.4
1819
core: 5.6.0
@@ -106,6 +107,7 @@ examples:
106107
responses:
107108
"200":
108109
application/json: [{"type": "Title", "element_id": "6aa0ff22f91bbe7e26e8e25ca8052acd", "text": "LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis", "metadata": {"languages": ["eng"], "page_number": 1, "filename": "layout-parser-paper.pdf", "filetype": "application/pdf"}}]
110+
text/csv: "0x42E2Ffaf1A"
109111
"422":
110112
application/json: {"detail": []}
111113
5XX:

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ res = s.general.partition(request={
9595
},
9696
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
9797

98-
if res.elements is not None:
98+
if res.two_hundred_application_json_elements is not None:
9999
# handle response
100100
pass
101101

@@ -126,7 +126,7 @@ res = s.general.partition(request={
126126
},
127127
})
128128

129-
if res.elements is not None:
129+
if res.two_hundred_application_json_elements is not None:
130130
# handle response
131131
pass
132132

@@ -181,7 +181,7 @@ try:
181181
},
182182
})
183183

184-
if res.elements is not None:
184+
if res.two_hundred_application_json_elements is not None:
185185
# handle response
186186
pass
187187

@@ -316,7 +316,7 @@ res = s.general.partition(request={
316316
},
317317
})
318318

319-
if res.elements is not None:
319+
if res.two_hundred_application_json_elements is not None:
320320
# handle response
321321
pass
322322
```
@@ -346,7 +346,7 @@ async def main():
346346
"strategy": shared.Strategy.HI_RES,
347347
},
348348
})
349-
if res.elements is not None:
349+
if res.two_hundred_application_json_elements is not None:
350350
# handle response
351351
pass
352352

@@ -444,7 +444,7 @@ res = s.general.partition(request={
444444
},
445445
})
446446

447-
if res.elements is not None:
447+
if res.two_hundred_application_json_elements is not None:
448448
# handle response
449449
pass
450450

USAGE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ res = s.general.partition(request={
2121
},
2222
})
2323

24-
if res.elements is not None:
24+
if res.two_hundred_application_json_elements is not None:
2525
# handle response
2626
pass
2727
```
@@ -51,7 +51,7 @@ async def main():
5151
"strategy": shared.Strategy.HI_RES,
5252
},
5353
})
54-
if res.elements is not None:
54+
if res.two_hundred_application_json_elements is not None:
5555
# handle response
5656
pass
5757

docs/models/operations/partitionresponse.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation |
99
| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
1010
| `raw_response` | [httpx.Response](https://www.python-httpx.org/api/#response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
11-
| `elements` | List[Dict[str, *Any*]] | :heavy_minus_sign: | Successful Response |
11+
| `two_hundred_application_json_elements` | List[Dict[str, *Any*]] | :heavy_minus_sign: | Successful Response |
12+
| `body` | *Optional[bytes]* | :heavy_minus_sign: | N/A |

docs/models/shared/strategy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ The strategy to use for partitioning PDF/image. Options are fast, hi_res, auto.
1010
| `FAST` | fast |
1111
| `HI_RES` | hi_res |
1212
| `AUTO` | auto |
13-
| `OCR_ONLY` | ocr_only |
13+
| `OCR_ONLY` | ocr_only |
14+
| `OD_ONLY` | od_only |

gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ generation:
1010
auth:
1111
oAuth2ClientCredentialsEnabled: false
1212
python:
13-
version: 0.26.2
13+
version: 0.27.1
1414
additionalDependencies:
1515
dev:
1616
deepdiff: '>=6.0'

pyproject.toml

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

src/unstructured_client/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import importlib.metadata
44

55
__title__: str = "unstructured-client"
6-
__version__: str = "0.26.2"
6+
__version__: str = "0.27.1"
77

88
try:
99
if __package__ is not None:

src/unstructured_client/general.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
22

33
from .basesdk import BaseSDK
4+
from enum import Enum
45
from typing import Any, Dict, List, Optional, Union, cast
56
from unstructured_client import utils
67
from unstructured_client._hooks import HookContext
78
from unstructured_client.models import errors, operations, shared
89
from unstructured_client.types import BaseModel, OptionalNullable, UNSET
910

1011

12+
class PartitionAcceptEnum(str, Enum):
13+
APPLICATION_JSON = "application/json"
14+
TEXT_CSV = "text/csv"
15+
16+
1117
class General(BaseSDK):
1218
def partition(
1319
self,
@@ -18,6 +24,7 @@ def partition(
1824
retries: OptionalNullable[utils.RetryConfig] = UNSET,
1925
server_url: Optional[str] = None,
2026
timeout_ms: Optional[int] = None,
27+
accept_header_override: Optional[PartitionAcceptEnum] = None,
2128
) -> operations.PartitionResponse:
2229
r"""Summary
2330
@@ -27,6 +34,7 @@ def partition(
2734
:param retries: Override the default retry configuration for this method
2835
:param server_url: Override the default server URL for this method
2936
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
37+
:param accept_header_override: Override the default accept header for this method
3038
"""
3139
base_url = None
3240
url_variables = None
@@ -50,7 +58,9 @@ def partition(
5058
request_has_path_params=False,
5159
request_has_query_params=True,
5260
user_agent_header="user-agent",
53-
accept_header_value="application/json",
61+
accept_header_value=accept_header_override.value
62+
if accept_header_override is not None
63+
else "application/json;q=1, text/csv;q=0",
5464
security=self.sdk_configuration.security,
5565
get_serialized_body=lambda: utils.serialize_request_body(
5666
request.partition_parameters,
@@ -88,13 +98,21 @@ def partition(
8898
data: Any = None
8999
if utils.match_response(http_res, "200", "application/json"):
90100
return operations.PartitionResponse(
91-
elements=utils.unmarshal_json(
101+
two_hundred_application_json_elements=utils.unmarshal_json(
92102
http_res.text, Optional[List[Dict[str, Any]]]
93103
),
94104
status_code=http_res.status_code,
95105
content_type=http_res.headers.get("Content-Type") or "",
96106
raw_response=http_res,
97107
)
108+
if utils.match_response(http_res, "200", "text/csv"):
109+
http_res_bytes = utils.stream_to_bytes(http_res)
110+
return operations.PartitionResponse(
111+
body=http_res_bytes,
112+
status_code=http_res.status_code,
113+
content_type=http_res.headers.get("Content-Type") or "",
114+
raw_response=http_res,
115+
)
98116
if utils.match_response(http_res, "422", "application/json"):
99117
data = utils.unmarshal_json(http_res.text, errors.HTTPValidationErrorData)
100118
raise errors.HTTPValidationError(data=data)
@@ -125,6 +143,7 @@ async def partition_async(
125143
retries: OptionalNullable[utils.RetryConfig] = UNSET,
126144
server_url: Optional[str] = None,
127145
timeout_ms: Optional[int] = None,
146+
accept_header_override: Optional[PartitionAcceptEnum] = None,
128147
) -> operations.PartitionResponse:
129148
r"""Summary
130149
@@ -134,6 +153,7 @@ async def partition_async(
134153
:param retries: Override the default retry configuration for this method
135154
:param server_url: Override the default server URL for this method
136155
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
156+
:param accept_header_override: Override the default accept header for this method
137157
"""
138158
base_url = None
139159
url_variables = None
@@ -157,7 +177,9 @@ async def partition_async(
157177
request_has_path_params=False,
158178
request_has_query_params=True,
159179
user_agent_header="user-agent",
160-
accept_header_value="application/json",
180+
accept_header_value=accept_header_override.value
181+
if accept_header_override is not None
182+
else "application/json;q=1, text/csv;q=0",
161183
security=self.sdk_configuration.security,
162184
get_serialized_body=lambda: utils.serialize_request_body(
163185
request.partition_parameters,
@@ -195,13 +217,21 @@ async def partition_async(
195217
data: Any = None
196218
if utils.match_response(http_res, "200", "application/json"):
197219
return operations.PartitionResponse(
198-
elements=utils.unmarshal_json(
220+
two_hundred_application_json_elements=utils.unmarshal_json(
199221
http_res.text, Optional[List[Dict[str, Any]]]
200222
),
201223
status_code=http_res.status_code,
202224
content_type=http_res.headers.get("Content-Type") or "",
203225
raw_response=http_res,
204226
)
227+
if utils.match_response(http_res, "200", "text/csv"):
228+
http_res_bytes = await utils.stream_to_bytes_async(http_res)
229+
return operations.PartitionResponse(
230+
body=http_res_bytes,
231+
status_code=http_res.status_code,
232+
content_type=http_res.headers.get("Content-Type") or "",
233+
raw_response=http_res,
234+
)
205235
if utils.match_response(http_res, "422", "application/json"):
206236
data = utils.unmarshal_json(http_res.text, errors.HTTPValidationErrorData)
207237
raise errors.HTTPValidationError(data=data)

src/unstructured_client/models/operations/partition.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ class PartitionResponseTypedDict(TypedDict):
7474
r"""HTTP response status code for this operation"""
7575
raw_response: httpx.Response
7676
r"""Raw HTTP response; suitable for custom response parsing"""
77-
elements: NotRequired[List[Dict[str, Any]]]
77+
two_hundred_application_json_elements: NotRequired[List[Dict[str, Any]]]
7878
r"""Successful Response"""
79+
body: NotRequired[bytes]
7980

8081

8182
class PartitionResponse(BaseModel):
@@ -88,5 +89,7 @@ class PartitionResponse(BaseModel):
8889
raw_response: httpx.Response
8990
r"""Raw HTTP response; suitable for custom response parsing"""
9091

91-
elements: Optional[List[Dict[str, Any]]] = None
92+
two_hundred_application_json_elements: Optional[List[Dict[str, Any]]] = None
9293
r"""Successful Response"""
94+
95+
body: Optional[bytes] = None

0 commit comments

Comments
 (0)