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