casedev 0.1.0__py3-none-any.whl
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.
- casedev/__init__.py +104 -0
- casedev/_base_client.py +1995 -0
- casedev/_client.py +560 -0
- casedev/_compat.py +219 -0
- casedev/_constants.py +14 -0
- casedev/_exceptions.py +108 -0
- casedev/_files.py +123 -0
- casedev/_models.py +857 -0
- casedev/_qs.py +150 -0
- casedev/_resource.py +43 -0
- casedev/_response.py +830 -0
- casedev/_streaming.py +333 -0
- casedev/_types.py +260 -0
- casedev/_utils/__init__.py +64 -0
- casedev/_utils/_compat.py +45 -0
- casedev/_utils/_datetime_parse.py +136 -0
- casedev/_utils/_logs.py +25 -0
- casedev/_utils/_proxy.py +65 -0
- casedev/_utils/_reflection.py +42 -0
- casedev/_utils/_resources_proxy.py +24 -0
- casedev/_utils/_streams.py +12 -0
- casedev/_utils/_sync.py +58 -0
- casedev/_utils/_transform.py +457 -0
- casedev/_utils/_typing.py +156 -0
- casedev/_utils/_utils.py +421 -0
- casedev/_version.py +4 -0
- casedev/lib/.keep +4 -0
- casedev/py.typed +0 -0
- casedev/resources/__init__.py +173 -0
- casedev/resources/actions/__init__.py +33 -0
- casedev/resources/actions/actions.py +102 -0
- casedev/resources/actions/v1.py +640 -0
- casedev/resources/compute/__init__.py +33 -0
- casedev/resources/compute/compute.py +102 -0
- casedev/resources/compute/v1/__init__.py +89 -0
- casedev/resources/compute/v1/environments.py +492 -0
- casedev/resources/compute/v1/functions.py +278 -0
- casedev/resources/compute/v1/invoke.py +216 -0
- casedev/resources/compute/v1/runs.py +290 -0
- casedev/resources/compute/v1/secrets.py +655 -0
- casedev/resources/compute/v1/v1.py +583 -0
- casedev/resources/convert/__init__.py +33 -0
- casedev/resources/convert/convert.py +102 -0
- casedev/resources/convert/v1/__init__.py +33 -0
- casedev/resources/convert/v1/jobs.py +254 -0
- casedev/resources/convert/v1/v1.py +450 -0
- casedev/resources/format/__init__.py +33 -0
- casedev/resources/format/format.py +102 -0
- casedev/resources/format/v1/__init__.py +33 -0
- casedev/resources/format/v1/templates.py +419 -0
- casedev/resources/format/v1/v1.py +244 -0
- casedev/resources/llm/__init__.py +33 -0
- casedev/resources/llm/llm.py +192 -0
- casedev/resources/llm/v1/__init__.py +33 -0
- casedev/resources/llm/v1/chat.py +243 -0
- casedev/resources/llm/v1/v1.py +317 -0
- casedev/resources/ocr/__init__.py +33 -0
- casedev/resources/ocr/ocr.py +102 -0
- casedev/resources/ocr/v1.py +407 -0
- casedev/resources/search/__init__.py +33 -0
- casedev/resources/search/search.py +102 -0
- casedev/resources/search/v1.py +1052 -0
- casedev/resources/templates/__init__.py +33 -0
- casedev/resources/templates/templates.py +102 -0
- casedev/resources/templates/v1.py +633 -0
- casedev/resources/vault/__init__.py +47 -0
- casedev/resources/vault/graphrag.py +256 -0
- casedev/resources/vault/objects.py +571 -0
- casedev/resources/vault/vault.py +764 -0
- casedev/resources/voice/__init__.py +61 -0
- casedev/resources/voice/streaming.py +160 -0
- casedev/resources/voice/transcription.py +327 -0
- casedev/resources/voice/v1/__init__.py +33 -0
- casedev/resources/voice/v1/speak.py +478 -0
- casedev/resources/voice/v1/v1.py +290 -0
- casedev/resources/voice/voice.py +166 -0
- casedev/resources/webhooks/__init__.py +33 -0
- casedev/resources/webhooks/v1.py +447 -0
- casedev/resources/webhooks/webhooks.py +102 -0
- casedev/resources/workflows/__init__.py +33 -0
- casedev/resources/workflows/v1.py +1053 -0
- casedev/resources/workflows/workflows.py +102 -0
- casedev/types/__init__.py +12 -0
- casedev/types/actions/__init__.py +8 -0
- casedev/types/actions/v1_create_params.py +22 -0
- casedev/types/actions/v1_create_response.py +33 -0
- casedev/types/actions/v1_execute_params.py +16 -0
- casedev/types/actions/v1_execute_response.py +31 -0
- casedev/types/compute/__init__.py +7 -0
- casedev/types/compute/v1/__init__.py +18 -0
- casedev/types/compute/v1/environment_create_params.py +12 -0
- casedev/types/compute/v1/environment_create_response.py +34 -0
- casedev/types/compute/v1/environment_delete_response.py +11 -0
- casedev/types/compute/v1/function_get_logs_params.py +12 -0
- casedev/types/compute/v1/function_list_params.py +12 -0
- casedev/types/compute/v1/invoke_run_params.py +21 -0
- casedev/types/compute/v1/invoke_run_response.py +39 -0
- casedev/types/compute/v1/run_list_params.py +18 -0
- casedev/types/compute/v1/secret_create_params.py +24 -0
- casedev/types/compute/v1/secret_create_response.py +24 -0
- casedev/types/compute/v1/secret_delete_group_params.py +18 -0
- casedev/types/compute/v1/secret_list_params.py +15 -0
- casedev/types/compute/v1/secret_retrieve_group_params.py +12 -0
- casedev/types/compute/v1/secret_update_group_params.py +16 -0
- casedev/types/compute/v1_deploy_params.py +114 -0
- casedev/types/compute/v1_deploy_response.py +30 -0
- casedev/types/compute/v1_get_usage_params.py +15 -0
- casedev/types/convert/__init__.py +8 -0
- casedev/types/convert/v1/__init__.py +3 -0
- casedev/types/convert/v1_process_params.py +15 -0
- casedev/types/convert/v1_process_response.py +19 -0
- casedev/types/convert/v1_webhook_params.py +32 -0
- casedev/types/convert/v1_webhook_response.py +13 -0
- casedev/types/format/__init__.py +5 -0
- casedev/types/format/v1/__init__.py +7 -0
- casedev/types/format/v1/template_create_params.py +32 -0
- casedev/types/format/v1/template_create_response.py +27 -0
- casedev/types/format/v1/template_list_params.py +12 -0
- casedev/types/format/v1_create_document_params.py +42 -0
- casedev/types/llm/__init__.py +5 -0
- casedev/types/llm/v1/__init__.py +6 -0
- casedev/types/llm/v1/chat_create_completion_params.py +42 -0
- casedev/types/llm/v1/chat_create_completion_response.py +49 -0
- casedev/types/llm/v1_create_embedding_params.py +27 -0
- casedev/types/ocr/__init__.py +6 -0
- casedev/types/ocr/v1_process_params.py +44 -0
- casedev/types/ocr/v1_process_response.py +32 -0
- casedev/types/search/__init__.py +15 -0
- casedev/types/search/v1_answer_params.py +45 -0
- casedev/types/search/v1_answer_response.py +35 -0
- casedev/types/search/v1_contents_params.py +42 -0
- casedev/types/search/v1_contents_response.py +31 -0
- casedev/types/search/v1_research_params.py +23 -0
- casedev/types/search/v1_research_response.py +20 -0
- casedev/types/search/v1_retrieve_research_params.py +15 -0
- casedev/types/search/v1_search_params.py +56 -0
- casedev/types/search/v1_search_response.py +38 -0
- casedev/types/search/v1_similar_params.py +44 -0
- casedev/types/search/v1_similar_response.py +33 -0
- casedev/types/templates/__init__.py +8 -0
- casedev/types/templates/v1_execute_params.py +22 -0
- casedev/types/templates/v1_execute_response.py +31 -0
- casedev/types/templates/v1_list_params.py +32 -0
- casedev/types/templates/v1_search_params.py +18 -0
- casedev/types/vault/__init__.py +6 -0
- casedev/types/vault/object_create_presigned_url_params.py +22 -0
- casedev/types/vault/object_create_presigned_url_response.py +51 -0
- casedev/types/vault_create_params.py +20 -0
- casedev/types/vault_create_response.py +36 -0
- casedev/types/vault_ingest_response.py +26 -0
- casedev/types/vault_list_response.py +40 -0
- casedev/types/vault_search_params.py +27 -0
- casedev/types/vault_search_response.py +53 -0
- casedev/types/vault_upload_params.py +26 -0
- casedev/types/vault_upload_response.py +39 -0
- casedev/types/voice/__init__.py +7 -0
- casedev/types/voice/transcription_create_params.py +36 -0
- casedev/types/voice/transcription_retrieve_response.py +41 -0
- casedev/types/voice/v1/__init__.py +6 -0
- casedev/types/voice/v1/speak_create_params.py +59 -0
- casedev/types/voice/v1/speak_stream_params.py +58 -0
- casedev/types/voice/v1_list_voices_params.py +36 -0
- casedev/types/webhooks/__init__.py +6 -0
- casedev/types/webhooks/v1_create_params.py +20 -0
- casedev/types/webhooks/v1_create_response.py +33 -0
- casedev/types/workflows/__init__.py +19 -0
- casedev/types/workflows/v1_create_params.py +32 -0
- casedev/types/workflows/v1_create_response.py +29 -0
- casedev/types/workflows/v1_delete_response.py +13 -0
- casedev/types/workflows/v1_deploy_response.py +20 -0
- casedev/types/workflows/v1_execute_params.py +12 -0
- casedev/types/workflows/v1_execute_response.py +22 -0
- casedev/types/workflows/v1_list_executions_params.py +13 -0
- casedev/types/workflows/v1_list_executions_response.py +27 -0
- casedev/types/workflows/v1_list_params.py +18 -0
- casedev/types/workflows/v1_list_response.py +37 -0
- casedev/types/workflows/v1_retrieve_execution_response.py +31 -0
- casedev/types/workflows/v1_retrieve_response.py +35 -0
- casedev/types/workflows/v1_undeploy_response.py +13 -0
- casedev/types/workflows/v1_update_params.py +26 -0
- casedev/types/workflows/v1_update_response.py +17 -0
- casedev-0.1.0.dist-info/METADATA +454 -0
- casedev-0.1.0.dist-info/RECORD +185 -0
- casedev-0.1.0.dist-info/WHEEL +4 -0
- casedev-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
|
|
10
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
11
|
+
from ..._compat import cached_property
|
|
12
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
13
|
+
from ..._response import (
|
|
14
|
+
to_raw_response_wrapper,
|
|
15
|
+
to_streamed_response_wrapper,
|
|
16
|
+
async_to_raw_response_wrapper,
|
|
17
|
+
async_to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
19
|
+
from ...types.ocr import v1_process_params
|
|
20
|
+
from ..._base_client import make_request_options
|
|
21
|
+
from ...types.ocr.v1_process_response import V1ProcessResponse
|
|
22
|
+
|
|
23
|
+
__all__ = ["V1Resource", "AsyncV1Resource"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class V1Resource(SyncAPIResource):
|
|
27
|
+
@cached_property
|
|
28
|
+
def with_raw_response(self) -> V1ResourceWithRawResponse:
|
|
29
|
+
"""
|
|
30
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
31
|
+
the raw response object instead of the parsed content.
|
|
32
|
+
|
|
33
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
34
|
+
"""
|
|
35
|
+
return V1ResourceWithRawResponse(self)
|
|
36
|
+
|
|
37
|
+
@cached_property
|
|
38
|
+
def with_streaming_response(self) -> V1ResourceWithStreamingResponse:
|
|
39
|
+
"""
|
|
40
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
41
|
+
|
|
42
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
43
|
+
"""
|
|
44
|
+
return V1ResourceWithStreamingResponse(self)
|
|
45
|
+
|
|
46
|
+
def retrieve(
|
|
47
|
+
self,
|
|
48
|
+
id: str,
|
|
49
|
+
*,
|
|
50
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
51
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
52
|
+
extra_headers: Headers | None = None,
|
|
53
|
+
extra_query: Query | None = None,
|
|
54
|
+
extra_body: Body | None = None,
|
|
55
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Retrieve the status and results of an OCR job.
|
|
58
|
+
|
|
59
|
+
Returns job progress, extracted
|
|
60
|
+
text, and metadata when processing is complete.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
extra_headers: Send extra headers
|
|
64
|
+
|
|
65
|
+
extra_query: Add additional query parameters to the request
|
|
66
|
+
|
|
67
|
+
extra_body: Add additional JSON properties to the request
|
|
68
|
+
|
|
69
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
70
|
+
"""
|
|
71
|
+
if not id:
|
|
72
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
73
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
74
|
+
return self._get(
|
|
75
|
+
f"/ocr/v1/{id}",
|
|
76
|
+
options=make_request_options(
|
|
77
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
78
|
+
),
|
|
79
|
+
cast_to=NoneType,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def download(
|
|
83
|
+
self,
|
|
84
|
+
type: Literal["text", "json", "pdf", "original"],
|
|
85
|
+
*,
|
|
86
|
+
id: str,
|
|
87
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
88
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
89
|
+
extra_headers: Headers | None = None,
|
|
90
|
+
extra_query: Query | None = None,
|
|
91
|
+
extra_body: Body | None = None,
|
|
92
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""Download OCR processing results in various formats.
|
|
95
|
+
|
|
96
|
+
Returns the processed
|
|
97
|
+
document as text extraction, structured JSON with coordinates, searchable PDF
|
|
98
|
+
with text layer, or the original uploaded document.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
extra_headers: Send extra headers
|
|
102
|
+
|
|
103
|
+
extra_query: Add additional query parameters to the request
|
|
104
|
+
|
|
105
|
+
extra_body: Add additional JSON properties to the request
|
|
106
|
+
|
|
107
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
108
|
+
"""
|
|
109
|
+
if not id:
|
|
110
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
111
|
+
if not type:
|
|
112
|
+
raise ValueError(f"Expected a non-empty value for `type` but received {type!r}")
|
|
113
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
114
|
+
return self._get(
|
|
115
|
+
f"/ocr/v1/{id}/download/{type}",
|
|
116
|
+
options=make_request_options(
|
|
117
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
118
|
+
),
|
|
119
|
+
cast_to=NoneType,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def process(
|
|
123
|
+
self,
|
|
124
|
+
*,
|
|
125
|
+
document_url: str,
|
|
126
|
+
callback_url: str | Omit = omit,
|
|
127
|
+
document_id: str | Omit = omit,
|
|
128
|
+
engine: Literal["doctr", "paddleocr"] | Omit = omit,
|
|
129
|
+
features: v1_process_params.Features | Omit = omit,
|
|
130
|
+
result_bucket: str | Omit = omit,
|
|
131
|
+
result_prefix: str | Omit = omit,
|
|
132
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
133
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
134
|
+
extra_headers: Headers | None = None,
|
|
135
|
+
extra_query: Query | None = None,
|
|
136
|
+
extra_body: Body | None = None,
|
|
137
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
138
|
+
) -> V1ProcessResponse:
|
|
139
|
+
"""
|
|
140
|
+
Submit a document for OCR processing to extract text, detect tables, forms, and
|
|
141
|
+
other features. Supports PDFs, images, and scanned documents. Returns a job ID
|
|
142
|
+
that can be used to track processing status.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
document_url: URL or S3 path to the document to process
|
|
146
|
+
|
|
147
|
+
callback_url: URL to receive completion webhook
|
|
148
|
+
|
|
149
|
+
document_id: Optional custom document identifier
|
|
150
|
+
|
|
151
|
+
engine: OCR engine to use
|
|
152
|
+
|
|
153
|
+
features: OCR features to extract
|
|
154
|
+
|
|
155
|
+
result_bucket: S3 bucket to store results
|
|
156
|
+
|
|
157
|
+
result_prefix: S3 key prefix for results
|
|
158
|
+
|
|
159
|
+
extra_headers: Send extra headers
|
|
160
|
+
|
|
161
|
+
extra_query: Add additional query parameters to the request
|
|
162
|
+
|
|
163
|
+
extra_body: Add additional JSON properties to the request
|
|
164
|
+
|
|
165
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
166
|
+
"""
|
|
167
|
+
return self._post(
|
|
168
|
+
"/ocr/v1/process",
|
|
169
|
+
body=maybe_transform(
|
|
170
|
+
{
|
|
171
|
+
"document_url": document_url,
|
|
172
|
+
"callback_url": callback_url,
|
|
173
|
+
"document_id": document_id,
|
|
174
|
+
"engine": engine,
|
|
175
|
+
"features": features,
|
|
176
|
+
"result_bucket": result_bucket,
|
|
177
|
+
"result_prefix": result_prefix,
|
|
178
|
+
},
|
|
179
|
+
v1_process_params.V1ProcessParams,
|
|
180
|
+
),
|
|
181
|
+
options=make_request_options(
|
|
182
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
183
|
+
),
|
|
184
|
+
cast_to=V1ProcessResponse,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class AsyncV1Resource(AsyncAPIResource):
|
|
189
|
+
@cached_property
|
|
190
|
+
def with_raw_response(self) -> AsyncV1ResourceWithRawResponse:
|
|
191
|
+
"""
|
|
192
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
193
|
+
the raw response object instead of the parsed content.
|
|
194
|
+
|
|
195
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
196
|
+
"""
|
|
197
|
+
return AsyncV1ResourceWithRawResponse(self)
|
|
198
|
+
|
|
199
|
+
@cached_property
|
|
200
|
+
def with_streaming_response(self) -> AsyncV1ResourceWithStreamingResponse:
|
|
201
|
+
"""
|
|
202
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
203
|
+
|
|
204
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
205
|
+
"""
|
|
206
|
+
return AsyncV1ResourceWithStreamingResponse(self)
|
|
207
|
+
|
|
208
|
+
async def retrieve(
|
|
209
|
+
self,
|
|
210
|
+
id: str,
|
|
211
|
+
*,
|
|
212
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
213
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
214
|
+
extra_headers: Headers | None = None,
|
|
215
|
+
extra_query: Query | None = None,
|
|
216
|
+
extra_body: Body | None = None,
|
|
217
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
218
|
+
) -> None:
|
|
219
|
+
"""Retrieve the status and results of an OCR job.
|
|
220
|
+
|
|
221
|
+
Returns job progress, extracted
|
|
222
|
+
text, and metadata when processing is complete.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
extra_headers: Send extra headers
|
|
226
|
+
|
|
227
|
+
extra_query: Add additional query parameters to the request
|
|
228
|
+
|
|
229
|
+
extra_body: Add additional JSON properties to the request
|
|
230
|
+
|
|
231
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
232
|
+
"""
|
|
233
|
+
if not id:
|
|
234
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
235
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
236
|
+
return await self._get(
|
|
237
|
+
f"/ocr/v1/{id}",
|
|
238
|
+
options=make_request_options(
|
|
239
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
240
|
+
),
|
|
241
|
+
cast_to=NoneType,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
async def download(
|
|
245
|
+
self,
|
|
246
|
+
type: Literal["text", "json", "pdf", "original"],
|
|
247
|
+
*,
|
|
248
|
+
id: str,
|
|
249
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
250
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
251
|
+
extra_headers: Headers | None = None,
|
|
252
|
+
extra_query: Query | None = None,
|
|
253
|
+
extra_body: Body | None = None,
|
|
254
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
255
|
+
) -> None:
|
|
256
|
+
"""Download OCR processing results in various formats.
|
|
257
|
+
|
|
258
|
+
Returns the processed
|
|
259
|
+
document as text extraction, structured JSON with coordinates, searchable PDF
|
|
260
|
+
with text layer, or the original uploaded document.
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
extra_headers: Send extra headers
|
|
264
|
+
|
|
265
|
+
extra_query: Add additional query parameters to the request
|
|
266
|
+
|
|
267
|
+
extra_body: Add additional JSON properties to the request
|
|
268
|
+
|
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
270
|
+
"""
|
|
271
|
+
if not id:
|
|
272
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
273
|
+
if not type:
|
|
274
|
+
raise ValueError(f"Expected a non-empty value for `type` but received {type!r}")
|
|
275
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
276
|
+
return await self._get(
|
|
277
|
+
f"/ocr/v1/{id}/download/{type}",
|
|
278
|
+
options=make_request_options(
|
|
279
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
280
|
+
),
|
|
281
|
+
cast_to=NoneType,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
async def process(
|
|
285
|
+
self,
|
|
286
|
+
*,
|
|
287
|
+
document_url: str,
|
|
288
|
+
callback_url: str | Omit = omit,
|
|
289
|
+
document_id: str | Omit = omit,
|
|
290
|
+
engine: Literal["doctr", "paddleocr"] | Omit = omit,
|
|
291
|
+
features: v1_process_params.Features | Omit = omit,
|
|
292
|
+
result_bucket: str | Omit = omit,
|
|
293
|
+
result_prefix: str | Omit = omit,
|
|
294
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
295
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
296
|
+
extra_headers: Headers | None = None,
|
|
297
|
+
extra_query: Query | None = None,
|
|
298
|
+
extra_body: Body | None = None,
|
|
299
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
300
|
+
) -> V1ProcessResponse:
|
|
301
|
+
"""
|
|
302
|
+
Submit a document for OCR processing to extract text, detect tables, forms, and
|
|
303
|
+
other features. Supports PDFs, images, and scanned documents. Returns a job ID
|
|
304
|
+
that can be used to track processing status.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
document_url: URL or S3 path to the document to process
|
|
308
|
+
|
|
309
|
+
callback_url: URL to receive completion webhook
|
|
310
|
+
|
|
311
|
+
document_id: Optional custom document identifier
|
|
312
|
+
|
|
313
|
+
engine: OCR engine to use
|
|
314
|
+
|
|
315
|
+
features: OCR features to extract
|
|
316
|
+
|
|
317
|
+
result_bucket: S3 bucket to store results
|
|
318
|
+
|
|
319
|
+
result_prefix: S3 key prefix for results
|
|
320
|
+
|
|
321
|
+
extra_headers: Send extra headers
|
|
322
|
+
|
|
323
|
+
extra_query: Add additional query parameters to the request
|
|
324
|
+
|
|
325
|
+
extra_body: Add additional JSON properties to the request
|
|
326
|
+
|
|
327
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
328
|
+
"""
|
|
329
|
+
return await self._post(
|
|
330
|
+
"/ocr/v1/process",
|
|
331
|
+
body=await async_maybe_transform(
|
|
332
|
+
{
|
|
333
|
+
"document_url": document_url,
|
|
334
|
+
"callback_url": callback_url,
|
|
335
|
+
"document_id": document_id,
|
|
336
|
+
"engine": engine,
|
|
337
|
+
"features": features,
|
|
338
|
+
"result_bucket": result_bucket,
|
|
339
|
+
"result_prefix": result_prefix,
|
|
340
|
+
},
|
|
341
|
+
v1_process_params.V1ProcessParams,
|
|
342
|
+
),
|
|
343
|
+
options=make_request_options(
|
|
344
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
345
|
+
),
|
|
346
|
+
cast_to=V1ProcessResponse,
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
class V1ResourceWithRawResponse:
|
|
351
|
+
def __init__(self, v1: V1Resource) -> None:
|
|
352
|
+
self._v1 = v1
|
|
353
|
+
|
|
354
|
+
self.retrieve = to_raw_response_wrapper(
|
|
355
|
+
v1.retrieve,
|
|
356
|
+
)
|
|
357
|
+
self.download = to_raw_response_wrapper(
|
|
358
|
+
v1.download,
|
|
359
|
+
)
|
|
360
|
+
self.process = to_raw_response_wrapper(
|
|
361
|
+
v1.process,
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class AsyncV1ResourceWithRawResponse:
|
|
366
|
+
def __init__(self, v1: AsyncV1Resource) -> None:
|
|
367
|
+
self._v1 = v1
|
|
368
|
+
|
|
369
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
370
|
+
v1.retrieve,
|
|
371
|
+
)
|
|
372
|
+
self.download = async_to_raw_response_wrapper(
|
|
373
|
+
v1.download,
|
|
374
|
+
)
|
|
375
|
+
self.process = async_to_raw_response_wrapper(
|
|
376
|
+
v1.process,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class V1ResourceWithStreamingResponse:
|
|
381
|
+
def __init__(self, v1: V1Resource) -> None:
|
|
382
|
+
self._v1 = v1
|
|
383
|
+
|
|
384
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
385
|
+
v1.retrieve,
|
|
386
|
+
)
|
|
387
|
+
self.download = to_streamed_response_wrapper(
|
|
388
|
+
v1.download,
|
|
389
|
+
)
|
|
390
|
+
self.process = to_streamed_response_wrapper(
|
|
391
|
+
v1.process,
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class AsyncV1ResourceWithStreamingResponse:
|
|
396
|
+
def __init__(self, v1: AsyncV1Resource) -> None:
|
|
397
|
+
self._v1 = v1
|
|
398
|
+
|
|
399
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
400
|
+
v1.retrieve,
|
|
401
|
+
)
|
|
402
|
+
self.download = async_to_streamed_response_wrapper(
|
|
403
|
+
v1.download,
|
|
404
|
+
)
|
|
405
|
+
self.process = async_to_streamed_response_wrapper(
|
|
406
|
+
v1.process,
|
|
407
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .v1 import (
|
|
4
|
+
V1Resource,
|
|
5
|
+
AsyncV1Resource,
|
|
6
|
+
V1ResourceWithRawResponse,
|
|
7
|
+
AsyncV1ResourceWithRawResponse,
|
|
8
|
+
V1ResourceWithStreamingResponse,
|
|
9
|
+
AsyncV1ResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .search import (
|
|
12
|
+
SearchResource,
|
|
13
|
+
AsyncSearchResource,
|
|
14
|
+
SearchResourceWithRawResponse,
|
|
15
|
+
AsyncSearchResourceWithRawResponse,
|
|
16
|
+
SearchResourceWithStreamingResponse,
|
|
17
|
+
AsyncSearchResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"V1Resource",
|
|
22
|
+
"AsyncV1Resource",
|
|
23
|
+
"V1ResourceWithRawResponse",
|
|
24
|
+
"AsyncV1ResourceWithRawResponse",
|
|
25
|
+
"V1ResourceWithStreamingResponse",
|
|
26
|
+
"AsyncV1ResourceWithStreamingResponse",
|
|
27
|
+
"SearchResource",
|
|
28
|
+
"AsyncSearchResource",
|
|
29
|
+
"SearchResourceWithRawResponse",
|
|
30
|
+
"AsyncSearchResourceWithRawResponse",
|
|
31
|
+
"SearchResourceWithStreamingResponse",
|
|
32
|
+
"AsyncSearchResourceWithStreamingResponse",
|
|
33
|
+
]
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .v1 import (
|
|
6
|
+
V1Resource,
|
|
7
|
+
AsyncV1Resource,
|
|
8
|
+
V1ResourceWithRawResponse,
|
|
9
|
+
AsyncV1ResourceWithRawResponse,
|
|
10
|
+
V1ResourceWithStreamingResponse,
|
|
11
|
+
AsyncV1ResourceWithStreamingResponse,
|
|
12
|
+
)
|
|
13
|
+
from ..._compat import cached_property
|
|
14
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
|
|
16
|
+
__all__ = ["SearchResource", "AsyncSearchResource"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SearchResource(SyncAPIResource):
|
|
20
|
+
@cached_property
|
|
21
|
+
def v1(self) -> V1Resource:
|
|
22
|
+
return V1Resource(self._client)
|
|
23
|
+
|
|
24
|
+
@cached_property
|
|
25
|
+
def with_raw_response(self) -> SearchResourceWithRawResponse:
|
|
26
|
+
"""
|
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
28
|
+
the raw response object instead of the parsed content.
|
|
29
|
+
|
|
30
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
31
|
+
"""
|
|
32
|
+
return SearchResourceWithRawResponse(self)
|
|
33
|
+
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_streaming_response(self) -> SearchResourceWithStreamingResponse:
|
|
36
|
+
"""
|
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
38
|
+
|
|
39
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
40
|
+
"""
|
|
41
|
+
return SearchResourceWithStreamingResponse(self)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class AsyncSearchResource(AsyncAPIResource):
|
|
45
|
+
@cached_property
|
|
46
|
+
def v1(self) -> AsyncV1Resource:
|
|
47
|
+
return AsyncV1Resource(self._client)
|
|
48
|
+
|
|
49
|
+
@cached_property
|
|
50
|
+
def with_raw_response(self) -> AsyncSearchResourceWithRawResponse:
|
|
51
|
+
"""
|
|
52
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
53
|
+
the raw response object instead of the parsed content.
|
|
54
|
+
|
|
55
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
56
|
+
"""
|
|
57
|
+
return AsyncSearchResourceWithRawResponse(self)
|
|
58
|
+
|
|
59
|
+
@cached_property
|
|
60
|
+
def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse:
|
|
61
|
+
"""
|
|
62
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
63
|
+
|
|
64
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
65
|
+
"""
|
|
66
|
+
return AsyncSearchResourceWithStreamingResponse(self)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class SearchResourceWithRawResponse:
|
|
70
|
+
def __init__(self, search: SearchResource) -> None:
|
|
71
|
+
self._search = search
|
|
72
|
+
|
|
73
|
+
@cached_property
|
|
74
|
+
def v1(self) -> V1ResourceWithRawResponse:
|
|
75
|
+
return V1ResourceWithRawResponse(self._search.v1)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AsyncSearchResourceWithRawResponse:
|
|
79
|
+
def __init__(self, search: AsyncSearchResource) -> None:
|
|
80
|
+
self._search = search
|
|
81
|
+
|
|
82
|
+
@cached_property
|
|
83
|
+
def v1(self) -> AsyncV1ResourceWithRawResponse:
|
|
84
|
+
return AsyncV1ResourceWithRawResponse(self._search.v1)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class SearchResourceWithStreamingResponse:
|
|
88
|
+
def __init__(self, search: SearchResource) -> None:
|
|
89
|
+
self._search = search
|
|
90
|
+
|
|
91
|
+
@cached_property
|
|
92
|
+
def v1(self) -> V1ResourceWithStreamingResponse:
|
|
93
|
+
return V1ResourceWithStreamingResponse(self._search.v1)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class AsyncSearchResourceWithStreamingResponse:
|
|
97
|
+
def __init__(self, search: AsyncSearchResource) -> None:
|
|
98
|
+
self._search = search
|
|
99
|
+
|
|
100
|
+
@cached_property
|
|
101
|
+
def v1(self) -> AsyncV1ResourceWithStreamingResponse:
|
|
102
|
+
return AsyncV1ResourceWithStreamingResponse(self._search.v1)
|