stract-api 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.
- stract_api/__init__.py +141 -0
- stract_api/api/__init__.py +16 -0
- stract_api/api/account_api.py +1098 -0
- stract_api/api/account_credit_ledger_api.py +286 -0
- stract_api/api/api_key_api.py +286 -0
- stract_api/api/catalog_api.py +837 -0
- stract_api/api/credits_api.py +534 -0
- stract_api/api/document_api.py +2799 -0
- stract_api/api/field_api.py +1168 -0
- stract_api/api/job_api.py +2857 -0
- stract_api/api/job_document_api.py +575 -0
- stract_api/api/llm_model_api.py +286 -0
- stract_api/api/struct_api.py +837 -0
- stract_api/api/user_api.py +572 -0
- stract_api/api_client.py +866 -0
- stract_api/api_response.py +21 -0
- stract_api/configuration.py +655 -0
- stract_api/exceptions.py +219 -0
- stract_api/models/__init__.py +52 -0
- stract_api/models/account.py +130 -0
- stract_api/models/account_credit_cache.py +112 -0
- stract_api/models/account_credit_ledger.py +125 -0
- stract_api/models/account_user.py +104 -0
- stract_api/models/account_user_role.py +38 -0
- stract_api/models/api_key.py +102 -0
- stract_api/models/catalog.py +100 -0
- stract_api/models/create_account_user_request.py +97 -0
- stract_api/models/create_catalog_request.py +90 -0
- stract_api/models/create_field_request.py +102 -0
- stract_api/models/create_job_request.py +109 -0
- stract_api/models/create_struct_request.py +90 -0
- stract_api/models/deleted_document.py +91 -0
- stract_api/models/deleted_field.py +91 -0
- stract_api/models/document.py +107 -0
- stract_api/models/document_link.py +90 -0
- stract_api/models/document_processing_status.py +39 -0
- stract_api/models/document_text.py +95 -0
- stract_api/models/edit_account_request.py +90 -0
- stract_api/models/edit_field_request.py +102 -0
- stract_api/models/edit_my_user_request.py +92 -0
- stract_api/models/field_type.py +42 -0
- stract_api/models/job.py +129 -0
- stract_api/models/job_document.py +123 -0
- stract_api/models/job_output.py +98 -0
- stract_api/models/job_output_record.py +103 -0
- stract_api/models/job_status.py +41 -0
- stract_api/models/llm_model.py +126 -0
- stract_api/models/login_request.py +92 -0
- stract_api/models/login_response.py +90 -0
- stract_api/models/model_field.py +110 -0
- stract_api/models/struct.py +100 -0
- stract_api/models/sync_text_job_request.py +118 -0
- stract_api/models/upload_text_document_request.py +93 -0
- stract_api/models/user.py +102 -0
- stract_api/py.typed +0 -0
- stract_api/rest.py +335 -0
- stract_api-0.1.0.dist-info/METADATA +266 -0
- stract_api-0.1.0.dist-info/RECORD +61 -0
- stract_api-0.1.0.dist-info/WHEEL +5 -0
- stract_api-0.1.0.dist-info/licenses/LICENSE +21 -0
- stract_api-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Stract API
|
|
3
|
+
|
|
4
|
+
Get structured output from unstructured inputs ## Machine authentication Programmatic access to the API is authenticated with an API key. Include the API key in every request as a bearer token in the `authorization` header: ``` authorization: bearer [apiKey] ``` ## SDKs Official SDKs are available for the following languages: - **Node (JavaScript / TypeScript)**: [`stract-api` on npm](https://www.npmjs.com/package/stract-api) - **Java (17+)**: [`com.stract-api:stract-api` on Maven Central](https://central.sonatype.com/artifact/com.stract-api/stract-api)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.9.4
|
|
7
|
+
Contact: matt@stract-api.com
|
|
8
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
|
+
|
|
10
|
+
Do not edit the class manually.
|
|
11
|
+
""" # noqa: E501
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import warnings
|
|
15
|
+
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
16
|
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
|
+
from typing_extensions import Annotated
|
|
18
|
+
|
|
19
|
+
from typing import List
|
|
20
|
+
from stract_api.models.llm_model import LlmModel
|
|
21
|
+
|
|
22
|
+
from stract_api.api_client import ApiClient, RequestSerialized
|
|
23
|
+
from stract_api.api_response import ApiResponse
|
|
24
|
+
from stract_api.rest import RESTResponseType
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class LlmModelApi:
|
|
28
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
29
|
+
Ref: https://openapi-generator.tech
|
|
30
|
+
|
|
31
|
+
Do not edit the class manually.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(self, api_client=None) -> None:
|
|
35
|
+
if api_client is None:
|
|
36
|
+
api_client = ApiClient.get_default()
|
|
37
|
+
self.api_client = api_client
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@validate_call
|
|
41
|
+
def get_llm_models(
|
|
42
|
+
self,
|
|
43
|
+
_request_timeout: Union[
|
|
44
|
+
None,
|
|
45
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
46
|
+
Tuple[
|
|
47
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
48
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
49
|
+
]
|
|
50
|
+
] = None,
|
|
51
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
52
|
+
_content_type: Optional[StrictStr] = None,
|
|
53
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
54
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
55
|
+
) -> List[LlmModel]:
|
|
56
|
+
"""Get the available LLM models
|
|
57
|
+
|
|
58
|
+
Retrieve the list of LLM models that can be selected via llm_model_id when creating a job
|
|
59
|
+
|
|
60
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
61
|
+
number provided, it will be total request
|
|
62
|
+
timeout. It can also be a pair (tuple) of
|
|
63
|
+
(connection, read) timeouts.
|
|
64
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
65
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
66
|
+
request; this effectively ignores the
|
|
67
|
+
authentication in the spec for a single request.
|
|
68
|
+
:type _request_auth: dict, optional
|
|
69
|
+
:param _content_type: force content-type for the request.
|
|
70
|
+
:type _content_type: str, Optional
|
|
71
|
+
:param _headers: set to override the headers for a single
|
|
72
|
+
request; this effectively ignores the headers
|
|
73
|
+
in the spec for a single request.
|
|
74
|
+
:type _headers: dict, optional
|
|
75
|
+
:param _host_index: set to override the host_index for a single
|
|
76
|
+
request; this effectively ignores the host_index
|
|
77
|
+
in the spec for a single request.
|
|
78
|
+
:type _host_index: int, optional
|
|
79
|
+
:return: Returns the result object.
|
|
80
|
+
""" # noqa: E501
|
|
81
|
+
|
|
82
|
+
_param = self._get_llm_models_serialize(
|
|
83
|
+
_request_auth=_request_auth,
|
|
84
|
+
_content_type=_content_type,
|
|
85
|
+
_headers=_headers,
|
|
86
|
+
_host_index=_host_index
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
90
|
+
'200': "List[LlmModel]",
|
|
91
|
+
'401': "str",
|
|
92
|
+
}
|
|
93
|
+
response_data = self.api_client.call_api(
|
|
94
|
+
*_param,
|
|
95
|
+
_request_timeout=_request_timeout
|
|
96
|
+
)
|
|
97
|
+
response_data.read()
|
|
98
|
+
return self.api_client.response_deserialize(
|
|
99
|
+
response_data=response_data,
|
|
100
|
+
response_types_map=_response_types_map,
|
|
101
|
+
).data
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@validate_call
|
|
105
|
+
def get_llm_models_with_http_info(
|
|
106
|
+
self,
|
|
107
|
+
_request_timeout: Union[
|
|
108
|
+
None,
|
|
109
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
110
|
+
Tuple[
|
|
111
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
112
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
113
|
+
]
|
|
114
|
+
] = None,
|
|
115
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
116
|
+
_content_type: Optional[StrictStr] = None,
|
|
117
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
118
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
119
|
+
) -> ApiResponse[List[LlmModel]]:
|
|
120
|
+
"""Get the available LLM models
|
|
121
|
+
|
|
122
|
+
Retrieve the list of LLM models that can be selected via llm_model_id when creating a job
|
|
123
|
+
|
|
124
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
125
|
+
number provided, it will be total request
|
|
126
|
+
timeout. It can also be a pair (tuple) of
|
|
127
|
+
(connection, read) timeouts.
|
|
128
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
129
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
130
|
+
request; this effectively ignores the
|
|
131
|
+
authentication in the spec for a single request.
|
|
132
|
+
:type _request_auth: dict, optional
|
|
133
|
+
:param _content_type: force content-type for the request.
|
|
134
|
+
:type _content_type: str, Optional
|
|
135
|
+
:param _headers: set to override the headers for a single
|
|
136
|
+
request; this effectively ignores the headers
|
|
137
|
+
in the spec for a single request.
|
|
138
|
+
:type _headers: dict, optional
|
|
139
|
+
:param _host_index: set to override the host_index for a single
|
|
140
|
+
request; this effectively ignores the host_index
|
|
141
|
+
in the spec for a single request.
|
|
142
|
+
:type _host_index: int, optional
|
|
143
|
+
:return: Returns the result object.
|
|
144
|
+
""" # noqa: E501
|
|
145
|
+
|
|
146
|
+
_param = self._get_llm_models_serialize(
|
|
147
|
+
_request_auth=_request_auth,
|
|
148
|
+
_content_type=_content_type,
|
|
149
|
+
_headers=_headers,
|
|
150
|
+
_host_index=_host_index
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
154
|
+
'200': "List[LlmModel]",
|
|
155
|
+
'401': "str",
|
|
156
|
+
}
|
|
157
|
+
response_data = self.api_client.call_api(
|
|
158
|
+
*_param,
|
|
159
|
+
_request_timeout=_request_timeout
|
|
160
|
+
)
|
|
161
|
+
response_data.read()
|
|
162
|
+
return self.api_client.response_deserialize(
|
|
163
|
+
response_data=response_data,
|
|
164
|
+
response_types_map=_response_types_map,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@validate_call
|
|
169
|
+
def get_llm_models_without_preload_content(
|
|
170
|
+
self,
|
|
171
|
+
_request_timeout: Union[
|
|
172
|
+
None,
|
|
173
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
174
|
+
Tuple[
|
|
175
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
176
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
177
|
+
]
|
|
178
|
+
] = None,
|
|
179
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
180
|
+
_content_type: Optional[StrictStr] = None,
|
|
181
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
182
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
183
|
+
) -> RESTResponseType:
|
|
184
|
+
"""Get the available LLM models
|
|
185
|
+
|
|
186
|
+
Retrieve the list of LLM models that can be selected via llm_model_id when creating a job
|
|
187
|
+
|
|
188
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
189
|
+
number provided, it will be total request
|
|
190
|
+
timeout. It can also be a pair (tuple) of
|
|
191
|
+
(connection, read) timeouts.
|
|
192
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
193
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
194
|
+
request; this effectively ignores the
|
|
195
|
+
authentication in the spec for a single request.
|
|
196
|
+
:type _request_auth: dict, optional
|
|
197
|
+
:param _content_type: force content-type for the request.
|
|
198
|
+
:type _content_type: str, Optional
|
|
199
|
+
:param _headers: set to override the headers for a single
|
|
200
|
+
request; this effectively ignores the headers
|
|
201
|
+
in the spec for a single request.
|
|
202
|
+
:type _headers: dict, optional
|
|
203
|
+
:param _host_index: set to override the host_index for a single
|
|
204
|
+
request; this effectively ignores the host_index
|
|
205
|
+
in the spec for a single request.
|
|
206
|
+
:type _host_index: int, optional
|
|
207
|
+
:return: Returns the result object.
|
|
208
|
+
""" # noqa: E501
|
|
209
|
+
|
|
210
|
+
_param = self._get_llm_models_serialize(
|
|
211
|
+
_request_auth=_request_auth,
|
|
212
|
+
_content_type=_content_type,
|
|
213
|
+
_headers=_headers,
|
|
214
|
+
_host_index=_host_index
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
218
|
+
'200': "List[LlmModel]",
|
|
219
|
+
'401': "str",
|
|
220
|
+
}
|
|
221
|
+
response_data = self.api_client.call_api(
|
|
222
|
+
*_param,
|
|
223
|
+
_request_timeout=_request_timeout
|
|
224
|
+
)
|
|
225
|
+
return response_data.response
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _get_llm_models_serialize(
|
|
229
|
+
self,
|
|
230
|
+
_request_auth,
|
|
231
|
+
_content_type,
|
|
232
|
+
_headers,
|
|
233
|
+
_host_index,
|
|
234
|
+
) -> RequestSerialized:
|
|
235
|
+
|
|
236
|
+
_host = None
|
|
237
|
+
|
|
238
|
+
_collection_formats: Dict[str, str] = {
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
_path_params: Dict[str, str] = {}
|
|
242
|
+
_query_params: List[Tuple[str, str]] = []
|
|
243
|
+
_header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
|
|
244
|
+
_form_params: List[Tuple[str, str]] = []
|
|
245
|
+
_files: Dict[
|
|
246
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
247
|
+
] = {}
|
|
248
|
+
_body_params: Optional[bytes] = None
|
|
249
|
+
|
|
250
|
+
# process the path parameters
|
|
251
|
+
# process the query parameters
|
|
252
|
+
# process the header parameters
|
|
253
|
+
# process the form parameters
|
|
254
|
+
# process the body parameter
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# set the HTTP header `Accept`
|
|
258
|
+
if not any(key.lower() == 'accept' for key in _header_params):
|
|
259
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
260
|
+
[
|
|
261
|
+
'application/json'
|
|
262
|
+
]
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
# authentication setting
|
|
267
|
+
_auth_settings: List[str] = [
|
|
268
|
+
'bearerAuth'
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
return self.api_client.param_serialize(
|
|
272
|
+
method='GET',
|
|
273
|
+
resource_path='/llm_model',
|
|
274
|
+
path_params=_path_params,
|
|
275
|
+
query_params=_query_params,
|
|
276
|
+
header_params=_header_params,
|
|
277
|
+
body=_body_params,
|
|
278
|
+
post_params=_form_params,
|
|
279
|
+
files=_files,
|
|
280
|
+
auth_settings=_auth_settings,
|
|
281
|
+
collection_formats=_collection_formats,
|
|
282
|
+
_host=_host,
|
|
283
|
+
_request_auth=_request_auth
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
|