mixpeek 0.6.7__py3-none-any.whl → 0.6.9__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.
- mixpeek/__init__.py +1 -106
- mixpeek/client.py +21 -65
- mixpeek/endpoints/connections.py +16 -0
- mixpeek/endpoints/embed.py +50 -0
- mixpeek/endpoints/extract.py +16 -0
- mixpeek/endpoints/generate.py +17 -0
- mixpeek/endpoints/tools.py +23 -0
- mixpeek/exceptions.py +13 -0
- mixpeek-0.6.9.dist-info/METADATA +68 -0
- mixpeek-0.6.9.dist-info/RECORD +13 -0
- {mixpeek-0.6.7.dist-info → mixpeek-0.6.9.dist-info}/WHEEL +2 -1
- mixpeek-0.6.9.dist-info/top_level.txt +1 -0
- mixpeek/base_client.py +0 -989
- mixpeek/core/__init__.py +0 -25
- mixpeek/core/api_error.py +0 -15
- mixpeek/core/client_wrapper.py +0 -83
- mixpeek/core/datetime_utils.py +0 -28
- mixpeek/core/file.py +0 -38
- mixpeek/core/http_client.py +0 -130
- mixpeek/core/jsonable_encoder.py +0 -103
- mixpeek/core/remove_none_from_dict.py +0 -11
- mixpeek/core/request_options.py +0 -32
- mixpeek/environment.py +0 -7
- mixpeek/errors/__init__.py +0 -17
- mixpeek/errors/bad_request_error.py +0 -9
- mixpeek/errors/forbidden_error.py +0 -9
- mixpeek/errors/internal_server_error.py +0 -9
- mixpeek/errors/not_found_error.py +0 -9
- mixpeek/errors/unauthorized_error.py +0 -9
- mixpeek/errors/unprocessable_entity_error.py +0 -9
- mixpeek/pipeline/__init__.py +0 -2
- mixpeek/pipeline/client.py +0 -474
- mixpeek/storage/__init__.py +0 -5
- mixpeek/storage/client.py +0 -145
- mixpeek/storage/sample/__init__.py +0 -2
- mixpeek/storage/sample/client.py +0 -282
- mixpeek/types/__init__.py +0 -81
- mixpeek/types/api_key.py +0 -31
- mixpeek/types/audio_params.py +0 -29
- mixpeek/types/configs_response.py +0 -42
- mixpeek/types/connection.py +0 -36
- mixpeek/types/connection_engine.py +0 -5
- mixpeek/types/csv_params.py +0 -29
- mixpeek/types/destination.py +0 -42
- mixpeek/types/embedding_response.py +0 -34
- mixpeek/types/error_message.py +0 -29
- mixpeek/types/error_response.py +0 -30
- mixpeek/types/extract_response.py +0 -35
- mixpeek/types/field_type.py +0 -5
- mixpeek/types/generation_response.py +0 -36
- mixpeek/types/html_params.py +0 -29
- mixpeek/types/http_validation_error.py +0 -30
- mixpeek/types/image_params.py +0 -32
- mixpeek/types/message.py +0 -37
- mixpeek/types/metadata.py +0 -32
- mixpeek/types/modality.py +0 -5
- mixpeek/types/model.py +0 -38
- mixpeek/types/models.py +0 -5
- mixpeek/types/pdf_params.py +0 -41
- mixpeek/types/pipeline_response.py +0 -49
- mixpeek/types/pipeline_task_response.py +0 -32
- mixpeek/types/ppt_params.py +0 -27
- mixpeek/types/pptx_params.py +0 -27
- mixpeek/types/settings.py +0 -35
- mixpeek/types/source.py +0 -43
- mixpeek/types/source_destination_mapping.py +0 -44
- mixpeek/types/txt_params.py +0 -27
- mixpeek/types/user.py +0 -36
- mixpeek/types/validation_error.py +0 -32
- mixpeek/types/validation_error_loc_item.py +0 -5
- mixpeek/types/video_params.py +0 -27
- mixpeek/types/workflow_code_response.py +0 -29
- mixpeek/types/workflow_response.py +0 -32
- mixpeek/types/workflow_settings.py +0 -30
- mixpeek/types/xlsx_params.py +0 -29
- mixpeek/user/__init__.py +0 -2
- mixpeek/user/client.py +0 -308
- mixpeek/version.py +0 -4
- mixpeek/workflow/__init__.py +0 -2
- mixpeek/workflow/client.py +0 -535
- mixpeek-0.6.7.dist-info/LICENSE +0 -21
- mixpeek-0.6.7.dist-info/METADATA +0 -145
- mixpeek-0.6.7.dist-info/RECORD +0 -75
- /mixpeek/{py.typed → endpoints/__init__.py} +0 -0
mixpeek/workflow/client.py
DELETED
@@ -1,535 +0,0 @@
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
2
|
-
|
3
|
-
import datetime as dt
|
4
|
-
import typing
|
5
|
-
import urllib.parse
|
6
|
-
from json.decoder import JSONDecodeError
|
7
|
-
|
8
|
-
from ..core.api_error import ApiError
|
9
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
10
|
-
from ..core.jsonable_encoder import jsonable_encoder
|
11
|
-
from ..core.remove_none_from_dict import remove_none_from_dict
|
12
|
-
from ..core.request_options import RequestOptions
|
13
|
-
from ..errors.bad_request_error import BadRequestError
|
14
|
-
from ..errors.forbidden_error import ForbiddenError
|
15
|
-
from ..errors.internal_server_error import InternalServerError
|
16
|
-
from ..errors.not_found_error import NotFoundError
|
17
|
-
from ..errors.unauthorized_error import UnauthorizedError
|
18
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
19
|
-
from ..types.error_response import ErrorResponse
|
20
|
-
from ..types.http_validation_error import HttpValidationError
|
21
|
-
from ..types.workflow_code_response import WorkflowCodeResponse
|
22
|
-
from ..types.workflow_response import WorkflowResponse
|
23
|
-
from ..types.workflow_settings import WorkflowSettings
|
24
|
-
|
25
|
-
try:
|
26
|
-
import pydantic.v1 as pydantic # type: ignore
|
27
|
-
except ImportError:
|
28
|
-
import pydantic # type: ignore
|
29
|
-
|
30
|
-
# this is used as the default value for optional parameters
|
31
|
-
OMIT = typing.cast(typing.Any, ...)
|
32
|
-
|
33
|
-
|
34
|
-
class WorkflowClient:
|
35
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
36
|
-
self._client_wrapper = client_wrapper
|
37
|
-
|
38
|
-
def create(
|
39
|
-
self,
|
40
|
-
*,
|
41
|
-
workflow_id: typing.Optional[str] = OMIT,
|
42
|
-
code_as_string: str,
|
43
|
-
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
44
|
-
settings: WorkflowSettings,
|
45
|
-
workflow_name: typing.Optional[str] = OMIT,
|
46
|
-
last_run: typing.Optional[dt.datetime] = OMIT,
|
47
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
48
|
-
request_options: typing.Optional[RequestOptions] = None,
|
49
|
-
) -> WorkflowResponse:
|
50
|
-
"""
|
51
|
-
Parameters:
|
52
|
-
- workflow_id: typing.Optional[str].
|
53
|
-
|
54
|
-
- code_as_string: str.
|
55
|
-
|
56
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
57
|
-
|
58
|
-
- settings: WorkflowSettings.
|
59
|
-
|
60
|
-
- workflow_name: typing.Optional[str].
|
61
|
-
|
62
|
-
- last_run: typing.Optional[dt.datetime].
|
63
|
-
|
64
|
-
- created_at: typing.Optional[dt.datetime].
|
65
|
-
|
66
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
67
|
-
---
|
68
|
-
from mixpeek import WorkflowSettings
|
69
|
-
from mixpeek.client import Mixpeek
|
70
|
-
|
71
|
-
client = Mixpeek(
|
72
|
-
authorization="YOUR_AUTHORIZATION",
|
73
|
-
index_id="YOUR_INDEX_ID",
|
74
|
-
api_key="YOUR_API_KEY",
|
75
|
-
)
|
76
|
-
client.workflow.create(
|
77
|
-
code_as_string="code_as_string",
|
78
|
-
settings=WorkflowSettings(),
|
79
|
-
)
|
80
|
-
"""
|
81
|
-
_request: typing.Dict[str, typing.Any] = {"code_as_string": code_as_string, "settings": settings}
|
82
|
-
if workflow_id is not OMIT:
|
83
|
-
_request["workflow_id"] = workflow_id
|
84
|
-
if metadata is not OMIT:
|
85
|
-
_request["metadata"] = metadata
|
86
|
-
if workflow_name is not OMIT:
|
87
|
-
_request["workflow_name"] = workflow_name
|
88
|
-
if last_run is not OMIT:
|
89
|
-
_request["last_run"] = last_run
|
90
|
-
if created_at is not OMIT:
|
91
|
-
_request["created_at"] = created_at
|
92
|
-
_response = self._client_wrapper.httpx_client.request(
|
93
|
-
"POST",
|
94
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "workflows"),
|
95
|
-
params=jsonable_encoder(
|
96
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
97
|
-
),
|
98
|
-
json=jsonable_encoder(_request)
|
99
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
100
|
-
else {
|
101
|
-
**jsonable_encoder(_request),
|
102
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
103
|
-
},
|
104
|
-
headers=jsonable_encoder(
|
105
|
-
remove_none_from_dict(
|
106
|
-
{
|
107
|
-
**self._client_wrapper.get_headers(),
|
108
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
109
|
-
}
|
110
|
-
)
|
111
|
-
),
|
112
|
-
timeout=request_options.get("timeout_in_seconds")
|
113
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
114
|
-
else self._client_wrapper.get_timeout(),
|
115
|
-
retries=0,
|
116
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
117
|
-
)
|
118
|
-
if 200 <= _response.status_code < 300:
|
119
|
-
return pydantic.parse_obj_as(WorkflowResponse, _response.json()) # type: ignore
|
120
|
-
if _response.status_code == 400:
|
121
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
122
|
-
if _response.status_code == 401:
|
123
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
124
|
-
if _response.status_code == 403:
|
125
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
126
|
-
if _response.status_code == 404:
|
127
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
128
|
-
if _response.status_code == 422:
|
129
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
130
|
-
if _response.status_code == 500:
|
131
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
132
|
-
try:
|
133
|
-
_response_json = _response.json()
|
134
|
-
except JSONDecodeError:
|
135
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
136
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
137
|
-
|
138
|
-
def invoke(
|
139
|
-
self,
|
140
|
-
workflow_id: str,
|
141
|
-
*,
|
142
|
-
websocket_id: typing.Optional[str] = None,
|
143
|
-
request: typing.Dict[str, typing.Any],
|
144
|
-
request_options: typing.Optional[RequestOptions] = None,
|
145
|
-
) -> typing.Any:
|
146
|
-
"""
|
147
|
-
Parameters:
|
148
|
-
- workflow_id: str.
|
149
|
-
|
150
|
-
- websocket_id: typing.Optional[str].
|
151
|
-
|
152
|
-
- request: typing.Dict[str, typing.Any].
|
153
|
-
|
154
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
155
|
-
---
|
156
|
-
from mixpeek.client import Mixpeek
|
157
|
-
|
158
|
-
client = Mixpeek(
|
159
|
-
authorization="YOUR_AUTHORIZATION",
|
160
|
-
index_id="YOUR_INDEX_ID",
|
161
|
-
api_key="YOUR_API_KEY",
|
162
|
-
)
|
163
|
-
client.workflow.invoke(
|
164
|
-
workflow_id="workflow_id",
|
165
|
-
request={},
|
166
|
-
)
|
167
|
-
"""
|
168
|
-
_response = self._client_wrapper.httpx_client.request(
|
169
|
-
"POST",
|
170
|
-
urllib.parse.urljoin(
|
171
|
-
f"{self._client_wrapper.get_base_url()}/", f"workflows/{jsonable_encoder(workflow_id)}/invoke"
|
172
|
-
),
|
173
|
-
params=jsonable_encoder(
|
174
|
-
remove_none_from_dict(
|
175
|
-
{
|
176
|
-
"websocket_id": websocket_id,
|
177
|
-
**(
|
178
|
-
request_options.get("additional_query_parameters", {})
|
179
|
-
if request_options is not None
|
180
|
-
else {}
|
181
|
-
),
|
182
|
-
}
|
183
|
-
)
|
184
|
-
),
|
185
|
-
json=jsonable_encoder(request)
|
186
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
187
|
-
else {
|
188
|
-
**jsonable_encoder(request),
|
189
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
190
|
-
},
|
191
|
-
headers=jsonable_encoder(
|
192
|
-
remove_none_from_dict(
|
193
|
-
{
|
194
|
-
**self._client_wrapper.get_headers(),
|
195
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
196
|
-
}
|
197
|
-
)
|
198
|
-
),
|
199
|
-
timeout=request_options.get("timeout_in_seconds")
|
200
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
201
|
-
else self._client_wrapper.get_timeout(),
|
202
|
-
retries=0,
|
203
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
204
|
-
)
|
205
|
-
if 200 <= _response.status_code < 300:
|
206
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
207
|
-
if _response.status_code == 400:
|
208
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
209
|
-
if _response.status_code == 401:
|
210
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
211
|
-
if _response.status_code == 403:
|
212
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
213
|
-
if _response.status_code == 404:
|
214
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
215
|
-
if _response.status_code == 422:
|
216
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
217
|
-
if _response.status_code == 500:
|
218
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
219
|
-
try:
|
220
|
-
_response_json = _response.json()
|
221
|
-
except JSONDecodeError:
|
222
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
223
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
224
|
-
|
225
|
-
def code(self, *, request: str, request_options: typing.Optional[RequestOptions] = None) -> WorkflowCodeResponse:
|
226
|
-
"""
|
227
|
-
Parameters:
|
228
|
-
- request: str.
|
229
|
-
|
230
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
231
|
-
---
|
232
|
-
from mixpeek.client import Mixpeek
|
233
|
-
|
234
|
-
client = Mixpeek(
|
235
|
-
authorization="YOUR_AUTHORIZATION",
|
236
|
-
index_id="YOUR_INDEX_ID",
|
237
|
-
api_key="YOUR_API_KEY",
|
238
|
-
)
|
239
|
-
client.workflow.code(
|
240
|
-
request="string",
|
241
|
-
)
|
242
|
-
"""
|
243
|
-
_response = self._client_wrapper.httpx_client.request(
|
244
|
-
"POST",
|
245
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "workflows/code"),
|
246
|
-
params=jsonable_encoder(
|
247
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
248
|
-
),
|
249
|
-
json=jsonable_encoder(request),
|
250
|
-
headers=jsonable_encoder(
|
251
|
-
remove_none_from_dict(
|
252
|
-
{
|
253
|
-
**self._client_wrapper.get_headers(),
|
254
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
255
|
-
}
|
256
|
-
)
|
257
|
-
),
|
258
|
-
timeout=request_options.get("timeout_in_seconds")
|
259
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
260
|
-
else self._client_wrapper.get_timeout(),
|
261
|
-
retries=0,
|
262
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
263
|
-
)
|
264
|
-
if 200 <= _response.status_code < 300:
|
265
|
-
return pydantic.parse_obj_as(WorkflowCodeResponse, _response.json()) # type: ignore
|
266
|
-
if _response.status_code == 400:
|
267
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
268
|
-
if _response.status_code == 401:
|
269
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
270
|
-
if _response.status_code == 403:
|
271
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
272
|
-
if _response.status_code == 404:
|
273
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
274
|
-
if _response.status_code == 422:
|
275
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
276
|
-
if _response.status_code == 500:
|
277
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
278
|
-
try:
|
279
|
-
_response_json = _response.json()
|
280
|
-
except JSONDecodeError:
|
281
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
282
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
283
|
-
|
284
|
-
|
285
|
-
class AsyncWorkflowClient:
|
286
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
287
|
-
self._client_wrapper = client_wrapper
|
288
|
-
|
289
|
-
async def create(
|
290
|
-
self,
|
291
|
-
*,
|
292
|
-
workflow_id: typing.Optional[str] = OMIT,
|
293
|
-
code_as_string: str,
|
294
|
-
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
295
|
-
settings: WorkflowSettings,
|
296
|
-
workflow_name: typing.Optional[str] = OMIT,
|
297
|
-
last_run: typing.Optional[dt.datetime] = OMIT,
|
298
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
299
|
-
request_options: typing.Optional[RequestOptions] = None,
|
300
|
-
) -> WorkflowResponse:
|
301
|
-
"""
|
302
|
-
Parameters:
|
303
|
-
- workflow_id: typing.Optional[str].
|
304
|
-
|
305
|
-
- code_as_string: str.
|
306
|
-
|
307
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
308
|
-
|
309
|
-
- settings: WorkflowSettings.
|
310
|
-
|
311
|
-
- workflow_name: typing.Optional[str].
|
312
|
-
|
313
|
-
- last_run: typing.Optional[dt.datetime].
|
314
|
-
|
315
|
-
- created_at: typing.Optional[dt.datetime].
|
316
|
-
|
317
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
318
|
-
---
|
319
|
-
from mixpeek import WorkflowSettings
|
320
|
-
from mixpeek.client import AsyncMixpeek
|
321
|
-
|
322
|
-
client = AsyncMixpeek(
|
323
|
-
authorization="YOUR_AUTHORIZATION",
|
324
|
-
index_id="YOUR_INDEX_ID",
|
325
|
-
api_key="YOUR_API_KEY",
|
326
|
-
)
|
327
|
-
await client.workflow.create(
|
328
|
-
code_as_string="code_as_string",
|
329
|
-
settings=WorkflowSettings(),
|
330
|
-
)
|
331
|
-
"""
|
332
|
-
_request: typing.Dict[str, typing.Any] = {"code_as_string": code_as_string, "settings": settings}
|
333
|
-
if workflow_id is not OMIT:
|
334
|
-
_request["workflow_id"] = workflow_id
|
335
|
-
if metadata is not OMIT:
|
336
|
-
_request["metadata"] = metadata
|
337
|
-
if workflow_name is not OMIT:
|
338
|
-
_request["workflow_name"] = workflow_name
|
339
|
-
if last_run is not OMIT:
|
340
|
-
_request["last_run"] = last_run
|
341
|
-
if created_at is not OMIT:
|
342
|
-
_request["created_at"] = created_at
|
343
|
-
_response = await self._client_wrapper.httpx_client.request(
|
344
|
-
"POST",
|
345
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "workflows"),
|
346
|
-
params=jsonable_encoder(
|
347
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
348
|
-
),
|
349
|
-
json=jsonable_encoder(_request)
|
350
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
351
|
-
else {
|
352
|
-
**jsonable_encoder(_request),
|
353
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
354
|
-
},
|
355
|
-
headers=jsonable_encoder(
|
356
|
-
remove_none_from_dict(
|
357
|
-
{
|
358
|
-
**self._client_wrapper.get_headers(),
|
359
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
360
|
-
}
|
361
|
-
)
|
362
|
-
),
|
363
|
-
timeout=request_options.get("timeout_in_seconds")
|
364
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
365
|
-
else self._client_wrapper.get_timeout(),
|
366
|
-
retries=0,
|
367
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
368
|
-
)
|
369
|
-
if 200 <= _response.status_code < 300:
|
370
|
-
return pydantic.parse_obj_as(WorkflowResponse, _response.json()) # type: ignore
|
371
|
-
if _response.status_code == 400:
|
372
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
373
|
-
if _response.status_code == 401:
|
374
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
375
|
-
if _response.status_code == 403:
|
376
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
377
|
-
if _response.status_code == 404:
|
378
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
379
|
-
if _response.status_code == 422:
|
380
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
381
|
-
if _response.status_code == 500:
|
382
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
383
|
-
try:
|
384
|
-
_response_json = _response.json()
|
385
|
-
except JSONDecodeError:
|
386
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
387
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
388
|
-
|
389
|
-
async def invoke(
|
390
|
-
self,
|
391
|
-
workflow_id: str,
|
392
|
-
*,
|
393
|
-
websocket_id: typing.Optional[str] = None,
|
394
|
-
request: typing.Dict[str, typing.Any],
|
395
|
-
request_options: typing.Optional[RequestOptions] = None,
|
396
|
-
) -> typing.Any:
|
397
|
-
"""
|
398
|
-
Parameters:
|
399
|
-
- workflow_id: str.
|
400
|
-
|
401
|
-
- websocket_id: typing.Optional[str].
|
402
|
-
|
403
|
-
- request: typing.Dict[str, typing.Any].
|
404
|
-
|
405
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
406
|
-
---
|
407
|
-
from mixpeek.client import AsyncMixpeek
|
408
|
-
|
409
|
-
client = AsyncMixpeek(
|
410
|
-
authorization="YOUR_AUTHORIZATION",
|
411
|
-
index_id="YOUR_INDEX_ID",
|
412
|
-
api_key="YOUR_API_KEY",
|
413
|
-
)
|
414
|
-
await client.workflow.invoke(
|
415
|
-
workflow_id="workflow_id",
|
416
|
-
request={},
|
417
|
-
)
|
418
|
-
"""
|
419
|
-
_response = await self._client_wrapper.httpx_client.request(
|
420
|
-
"POST",
|
421
|
-
urllib.parse.urljoin(
|
422
|
-
f"{self._client_wrapper.get_base_url()}/", f"workflows/{jsonable_encoder(workflow_id)}/invoke"
|
423
|
-
),
|
424
|
-
params=jsonable_encoder(
|
425
|
-
remove_none_from_dict(
|
426
|
-
{
|
427
|
-
"websocket_id": websocket_id,
|
428
|
-
**(
|
429
|
-
request_options.get("additional_query_parameters", {})
|
430
|
-
if request_options is not None
|
431
|
-
else {}
|
432
|
-
),
|
433
|
-
}
|
434
|
-
)
|
435
|
-
),
|
436
|
-
json=jsonable_encoder(request)
|
437
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
438
|
-
else {
|
439
|
-
**jsonable_encoder(request),
|
440
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
441
|
-
},
|
442
|
-
headers=jsonable_encoder(
|
443
|
-
remove_none_from_dict(
|
444
|
-
{
|
445
|
-
**self._client_wrapper.get_headers(),
|
446
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
447
|
-
}
|
448
|
-
)
|
449
|
-
),
|
450
|
-
timeout=request_options.get("timeout_in_seconds")
|
451
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
452
|
-
else self._client_wrapper.get_timeout(),
|
453
|
-
retries=0,
|
454
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
455
|
-
)
|
456
|
-
if 200 <= _response.status_code < 300:
|
457
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
458
|
-
if _response.status_code == 400:
|
459
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
460
|
-
if _response.status_code == 401:
|
461
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
462
|
-
if _response.status_code == 403:
|
463
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
464
|
-
if _response.status_code == 404:
|
465
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
466
|
-
if _response.status_code == 422:
|
467
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
468
|
-
if _response.status_code == 500:
|
469
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
470
|
-
try:
|
471
|
-
_response_json = _response.json()
|
472
|
-
except JSONDecodeError:
|
473
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
474
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
475
|
-
|
476
|
-
async def code(
|
477
|
-
self, *, request: str, request_options: typing.Optional[RequestOptions] = None
|
478
|
-
) -> WorkflowCodeResponse:
|
479
|
-
"""
|
480
|
-
Parameters:
|
481
|
-
- request: str.
|
482
|
-
|
483
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
484
|
-
---
|
485
|
-
from mixpeek.client import AsyncMixpeek
|
486
|
-
|
487
|
-
client = AsyncMixpeek(
|
488
|
-
authorization="YOUR_AUTHORIZATION",
|
489
|
-
index_id="YOUR_INDEX_ID",
|
490
|
-
api_key="YOUR_API_KEY",
|
491
|
-
)
|
492
|
-
await client.workflow.code(
|
493
|
-
request="string",
|
494
|
-
)
|
495
|
-
"""
|
496
|
-
_response = await self._client_wrapper.httpx_client.request(
|
497
|
-
"POST",
|
498
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "workflows/code"),
|
499
|
-
params=jsonable_encoder(
|
500
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
501
|
-
),
|
502
|
-
json=jsonable_encoder(request),
|
503
|
-
headers=jsonable_encoder(
|
504
|
-
remove_none_from_dict(
|
505
|
-
{
|
506
|
-
**self._client_wrapper.get_headers(),
|
507
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
508
|
-
}
|
509
|
-
)
|
510
|
-
),
|
511
|
-
timeout=request_options.get("timeout_in_seconds")
|
512
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
513
|
-
else self._client_wrapper.get_timeout(),
|
514
|
-
retries=0,
|
515
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
516
|
-
)
|
517
|
-
if 200 <= _response.status_code < 300:
|
518
|
-
return pydantic.parse_obj_as(WorkflowCodeResponse, _response.json()) # type: ignore
|
519
|
-
if _response.status_code == 400:
|
520
|
-
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
521
|
-
if _response.status_code == 401:
|
522
|
-
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
523
|
-
if _response.status_code == 403:
|
524
|
-
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
525
|
-
if _response.status_code == 404:
|
526
|
-
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
527
|
-
if _response.status_code == 422:
|
528
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
529
|
-
if _response.status_code == 500:
|
530
|
-
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
531
|
-
try:
|
532
|
-
_response_json = _response.json()
|
533
|
-
except JSONDecodeError:
|
534
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
535
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
mixpeek-0.6.7.dist-info/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024 Mixpeek.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|