mixpeek 0.6.8__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.
Files changed (85) hide show
  1. mixpeek/__init__.py +1 -106
  2. mixpeek/client.py +21 -65
  3. mixpeek/endpoints/connections.py +16 -0
  4. mixpeek/endpoints/embed.py +50 -0
  5. mixpeek/endpoints/extract.py +16 -0
  6. mixpeek/endpoints/generate.py +17 -0
  7. mixpeek/endpoints/tools.py +23 -0
  8. mixpeek/exceptions.py +13 -0
  9. mixpeek-0.6.9.dist-info/METADATA +68 -0
  10. mixpeek-0.6.9.dist-info/RECORD +13 -0
  11. {mixpeek-0.6.8.dist-info → mixpeek-0.6.9.dist-info}/WHEEL +2 -1
  12. mixpeek-0.6.9.dist-info/top_level.txt +1 -0
  13. mixpeek/base_client.py +0 -1015
  14. mixpeek/core/__init__.py +0 -27
  15. mixpeek/core/api_error.py +0 -15
  16. mixpeek/core/client_wrapper.py +0 -83
  17. mixpeek/core/datetime_utils.py +0 -28
  18. mixpeek/core/file.py +0 -38
  19. mixpeek/core/http_client.py +0 -130
  20. mixpeek/core/jsonable_encoder.py +0 -99
  21. mixpeek/core/pydantic_utilities.py +0 -12
  22. mixpeek/core/remove_none_from_dict.py +0 -11
  23. mixpeek/core/request_options.py +0 -32
  24. mixpeek/environment.py +0 -7
  25. mixpeek/errors/__init__.py +0 -17
  26. mixpeek/errors/bad_request_error.py +0 -9
  27. mixpeek/errors/forbidden_error.py +0 -9
  28. mixpeek/errors/internal_server_error.py +0 -9
  29. mixpeek/errors/not_found_error.py +0 -9
  30. mixpeek/errors/unauthorized_error.py +0 -9
  31. mixpeek/errors/unprocessable_entity_error.py +0 -9
  32. mixpeek/pipeline/__init__.py +0 -2
  33. mixpeek/pipeline/client.py +0 -482
  34. mixpeek/storage/__init__.py +0 -5
  35. mixpeek/storage/client.py +0 -145
  36. mixpeek/storage/sample/__init__.py +0 -2
  37. mixpeek/storage/sample/client.py +0 -286
  38. mixpeek/types/__init__.py +0 -81
  39. mixpeek/types/api_key.py +0 -27
  40. mixpeek/types/audio_params.py +0 -25
  41. mixpeek/types/configs_response.py +0 -38
  42. mixpeek/types/connection.py +0 -32
  43. mixpeek/types/connection_engine.py +0 -5
  44. mixpeek/types/csv_params.py +0 -25
  45. mixpeek/types/destination.py +0 -38
  46. mixpeek/types/embedding_response.py +0 -30
  47. mixpeek/types/error_message.py +0 -25
  48. mixpeek/types/error_response.py +0 -26
  49. mixpeek/types/extract_response.py +0 -31
  50. mixpeek/types/field_type.py +0 -5
  51. mixpeek/types/generation_response.py +0 -32
  52. mixpeek/types/html_params.py +0 -25
  53. mixpeek/types/http_validation_error.py +0 -26
  54. mixpeek/types/image_params.py +0 -28
  55. mixpeek/types/message.py +0 -33
  56. mixpeek/types/metadata.py +0 -28
  57. mixpeek/types/modality.py +0 -5
  58. mixpeek/types/model.py +0 -34
  59. mixpeek/types/models.py +0 -5
  60. mixpeek/types/pdf_params.py +0 -37
  61. mixpeek/types/pipeline_response.py +0 -45
  62. mixpeek/types/pipeline_task_response.py +0 -28
  63. mixpeek/types/ppt_params.py +0 -23
  64. mixpeek/types/pptx_params.py +0 -23
  65. mixpeek/types/settings.py +0 -31
  66. mixpeek/types/source.py +0 -39
  67. mixpeek/types/source_destination_mapping.py +0 -40
  68. mixpeek/types/txt_params.py +0 -23
  69. mixpeek/types/user.py +0 -32
  70. mixpeek/types/validation_error.py +0 -28
  71. mixpeek/types/validation_error_loc_item.py +0 -5
  72. mixpeek/types/video_params.py +0 -23
  73. mixpeek/types/workflow_code_response.py +0 -25
  74. mixpeek/types/workflow_response.py +0 -28
  75. mixpeek/types/workflow_settings.py +0 -26
  76. mixpeek/types/xlsx_params.py +0 -25
  77. mixpeek/user/__init__.py +0 -2
  78. mixpeek/user/client.py +0 -312
  79. mixpeek/version.py +0 -4
  80. mixpeek/workflow/__init__.py +0 -2
  81. mixpeek/workflow/client.py +0 -543
  82. mixpeek-0.6.8.dist-info/LICENSE +0 -21
  83. mixpeek-0.6.8.dist-info/METADATA +0 -145
  84. mixpeek-0.6.8.dist-info/RECORD +0 -76
  85. /mixpeek/{py.typed → endpoints/__init__.py} +0 -0
@@ -1,482 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- import urllib.parse
5
- from json.decoder import JSONDecodeError
6
-
7
- from ..core.api_error import ApiError
8
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ..core.jsonable_encoder import jsonable_encoder
10
- from ..core.pydantic_utilities import pydantic_v1
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.pipeline_response import PipelineResponse
22
- from ..types.pipeline_task_response import PipelineTaskResponse
23
- from ..types.source_destination_mapping import SourceDestinationMapping
24
-
25
- # this is used as the default value for optional parameters
26
- OMIT = typing.cast(typing.Any, ...)
27
-
28
-
29
- class PipelineClient:
30
- def __init__(self, *, client_wrapper: SyncClientWrapper):
31
- self._client_wrapper = client_wrapper
32
-
33
- def invoke(
34
- self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
35
- ) -> PipelineTaskResponse:
36
- """
37
- Parameters:
38
- - pipeline_id: str.
39
-
40
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
41
- ---
42
- from mixpeek.client import Mixpeek
43
-
44
- client = Mixpeek(
45
- authorization="YOUR_AUTHORIZATION",
46
- index_id="YOUR_INDEX_ID",
47
- api_key="YOUR_API_KEY",
48
- )
49
- client.pipeline.invoke(
50
- pipeline_id="pipeline_id",
51
- )
52
- """
53
- _response = self._client_wrapper.httpx_client.request(
54
- "POST",
55
- urllib.parse.urljoin(
56
- f"{self._client_wrapper.get_base_url()}/", f"pipelines/{jsonable_encoder(pipeline_id)}"
57
- ),
58
- params=jsonable_encoder(
59
- request_options.get("additional_query_parameters") if request_options is not None else None
60
- ),
61
- json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
62
- if request_options is not None
63
- else None,
64
- headers=jsonable_encoder(
65
- remove_none_from_dict(
66
- {
67
- **self._client_wrapper.get_headers(),
68
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
69
- }
70
- )
71
- ),
72
- timeout=request_options.get("timeout_in_seconds")
73
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
74
- else self._client_wrapper.get_timeout(),
75
- retries=0,
76
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
77
- )
78
- if 200 <= _response.status_code < 300:
79
- return pydantic_v1.parse_obj_as(PipelineTaskResponse, _response.json()) # type: ignore
80
- if _response.status_code == 400:
81
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
82
- if _response.status_code == 401:
83
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
84
- if _response.status_code == 403:
85
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
86
- if _response.status_code == 404:
87
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
88
- if _response.status_code == 422:
89
- raise UnprocessableEntityError(
90
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
91
- )
92
- if _response.status_code == 500:
93
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
94
- try:
95
- _response_json = _response.json()
96
- except JSONDecodeError:
97
- raise ApiError(status_code=_response.status_code, body=_response.text)
98
- raise ApiError(status_code=_response.status_code, body=_response_json)
99
-
100
- def create(
101
- self,
102
- *,
103
- source_destination_mappings: typing.Sequence[SourceDestinationMapping],
104
- metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
105
- request_options: typing.Optional[RequestOptions] = None,
106
- ) -> PipelineResponse:
107
- """
108
- Parameters:
109
- - source_destination_mappings: typing.Sequence[SourceDestinationMapping]. The source-destination mappings
110
-
111
- - metadata: typing.Optional[typing.Dict[str, typing.Any]].
112
-
113
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
114
- ---
115
- from mixpeek import Destination, Source, SourceDestinationMapping
116
- from mixpeek.client import Mixpeek
117
-
118
- client = Mixpeek(
119
- authorization="YOUR_AUTHORIZATION",
120
- index_id="YOUR_INDEX_ID",
121
- api_key="YOUR_API_KEY",
122
- )
123
- client.pipeline.create(
124
- source_destination_mappings=[
125
- SourceDestinationMapping(
126
- embedding_model="embedding_model",
127
- source=Source(
128
- field="field",
129
- type="file_url",
130
- settings={},
131
- ),
132
- destination=Destination(
133
- collection="collection",
134
- field="field",
135
- embedding="embedding",
136
- ),
137
- )
138
- ],
139
- )
140
- """
141
- _request: typing.Dict[str, typing.Any] = {"source_destination_mappings": source_destination_mappings}
142
- if metadata is not OMIT:
143
- _request["metadata"] = metadata
144
- _response = self._client_wrapper.httpx_client.request(
145
- "POST",
146
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "pipelines"),
147
- params=jsonable_encoder(
148
- request_options.get("additional_query_parameters") if request_options is not None else None
149
- ),
150
- json=jsonable_encoder(_request)
151
- if request_options is None or request_options.get("additional_body_parameters") is None
152
- else {
153
- **jsonable_encoder(_request),
154
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
155
- },
156
- headers=jsonable_encoder(
157
- remove_none_from_dict(
158
- {
159
- **self._client_wrapper.get_headers(),
160
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
161
- }
162
- )
163
- ),
164
- timeout=request_options.get("timeout_in_seconds")
165
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
166
- else self._client_wrapper.get_timeout(),
167
- retries=0,
168
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
169
- )
170
- if 200 <= _response.status_code < 300:
171
- return pydantic_v1.parse_obj_as(PipelineResponse, _response.json()) # type: ignore
172
- if _response.status_code == 400:
173
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
174
- if _response.status_code == 401:
175
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
176
- if _response.status_code == 403:
177
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
178
- if _response.status_code == 404:
179
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
180
- if _response.status_code == 422:
181
- raise UnprocessableEntityError(
182
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
183
- )
184
- if _response.status_code == 500:
185
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
186
- try:
187
- _response_json = _response.json()
188
- except JSONDecodeError:
189
- raise ApiError(status_code=_response.status_code, body=_response.text)
190
- raise ApiError(status_code=_response.status_code, body=_response_json)
191
-
192
- def status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
193
- """
194
- Query tasks status.
195
-
196
- Parameters:
197
- - task_id: str.
198
-
199
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
200
- ---
201
- from mixpeek.client import Mixpeek
202
-
203
- client = Mixpeek(
204
- authorization="YOUR_AUTHORIZATION",
205
- index_id="YOUR_INDEX_ID",
206
- api_key="YOUR_API_KEY",
207
- )
208
- client.pipeline.status(
209
- task_id="task_id",
210
- )
211
- """
212
- _response = self._client_wrapper.httpx_client.request(
213
- "GET",
214
- urllib.parse.urljoin(
215
- f"{self._client_wrapper.get_base_url()}/", f"pipelines/status/{jsonable_encoder(task_id)}"
216
- ),
217
- params=jsonable_encoder(
218
- request_options.get("additional_query_parameters") if request_options is not None else None
219
- ),
220
- headers=jsonable_encoder(
221
- remove_none_from_dict(
222
- {
223
- **self._client_wrapper.get_headers(),
224
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
225
- }
226
- )
227
- ),
228
- timeout=request_options.get("timeout_in_seconds")
229
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
230
- else self._client_wrapper.get_timeout(),
231
- retries=0,
232
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
233
- )
234
- if 200 <= _response.status_code < 300:
235
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
236
- if _response.status_code == 400:
237
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
238
- if _response.status_code == 401:
239
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
240
- if _response.status_code == 403:
241
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
242
- if _response.status_code == 404:
243
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
244
- if _response.status_code == 422:
245
- raise UnprocessableEntityError(
246
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
247
- )
248
- if _response.status_code == 500:
249
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
250
- try:
251
- _response_json = _response.json()
252
- except JSONDecodeError:
253
- raise ApiError(status_code=_response.status_code, body=_response.text)
254
- raise ApiError(status_code=_response.status_code, body=_response_json)
255
-
256
-
257
- class AsyncPipelineClient:
258
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
259
- self._client_wrapper = client_wrapper
260
-
261
- async def invoke(
262
- self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
263
- ) -> PipelineTaskResponse:
264
- """
265
- Parameters:
266
- - pipeline_id: str.
267
-
268
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
269
- ---
270
- from mixpeek.client import AsyncMixpeek
271
-
272
- client = AsyncMixpeek(
273
- authorization="YOUR_AUTHORIZATION",
274
- index_id="YOUR_INDEX_ID",
275
- api_key="YOUR_API_KEY",
276
- )
277
- await client.pipeline.invoke(
278
- pipeline_id="pipeline_id",
279
- )
280
- """
281
- _response = await self._client_wrapper.httpx_client.request(
282
- "POST",
283
- urllib.parse.urljoin(
284
- f"{self._client_wrapper.get_base_url()}/", f"pipelines/{jsonable_encoder(pipeline_id)}"
285
- ),
286
- params=jsonable_encoder(
287
- request_options.get("additional_query_parameters") if request_options is not None else None
288
- ),
289
- json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
290
- if request_options is not None
291
- else None,
292
- headers=jsonable_encoder(
293
- remove_none_from_dict(
294
- {
295
- **self._client_wrapper.get_headers(),
296
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
297
- }
298
- )
299
- ),
300
- timeout=request_options.get("timeout_in_seconds")
301
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
302
- else self._client_wrapper.get_timeout(),
303
- retries=0,
304
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
305
- )
306
- if 200 <= _response.status_code < 300:
307
- return pydantic_v1.parse_obj_as(PipelineTaskResponse, _response.json()) # type: ignore
308
- if _response.status_code == 400:
309
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
310
- if _response.status_code == 401:
311
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
312
- if _response.status_code == 403:
313
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
314
- if _response.status_code == 404:
315
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
316
- if _response.status_code == 422:
317
- raise UnprocessableEntityError(
318
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
319
- )
320
- if _response.status_code == 500:
321
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
322
- try:
323
- _response_json = _response.json()
324
- except JSONDecodeError:
325
- raise ApiError(status_code=_response.status_code, body=_response.text)
326
- raise ApiError(status_code=_response.status_code, body=_response_json)
327
-
328
- async def create(
329
- self,
330
- *,
331
- source_destination_mappings: typing.Sequence[SourceDestinationMapping],
332
- metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
333
- request_options: typing.Optional[RequestOptions] = None,
334
- ) -> PipelineResponse:
335
- """
336
- Parameters:
337
- - source_destination_mappings: typing.Sequence[SourceDestinationMapping]. The source-destination mappings
338
-
339
- - metadata: typing.Optional[typing.Dict[str, typing.Any]].
340
-
341
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
342
- ---
343
- from mixpeek import Destination, Source, SourceDestinationMapping
344
- from mixpeek.client import AsyncMixpeek
345
-
346
- client = AsyncMixpeek(
347
- authorization="YOUR_AUTHORIZATION",
348
- index_id="YOUR_INDEX_ID",
349
- api_key="YOUR_API_KEY",
350
- )
351
- await client.pipeline.create(
352
- source_destination_mappings=[
353
- SourceDestinationMapping(
354
- embedding_model="embedding_model",
355
- source=Source(
356
- field="field",
357
- type="file_url",
358
- settings={},
359
- ),
360
- destination=Destination(
361
- collection="collection",
362
- field="field",
363
- embedding="embedding",
364
- ),
365
- )
366
- ],
367
- )
368
- """
369
- _request: typing.Dict[str, typing.Any] = {"source_destination_mappings": source_destination_mappings}
370
- if metadata is not OMIT:
371
- _request["metadata"] = metadata
372
- _response = await self._client_wrapper.httpx_client.request(
373
- "POST",
374
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "pipelines"),
375
- params=jsonable_encoder(
376
- request_options.get("additional_query_parameters") if request_options is not None else None
377
- ),
378
- json=jsonable_encoder(_request)
379
- if request_options is None or request_options.get("additional_body_parameters") is None
380
- else {
381
- **jsonable_encoder(_request),
382
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
383
- },
384
- headers=jsonable_encoder(
385
- remove_none_from_dict(
386
- {
387
- **self._client_wrapper.get_headers(),
388
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
389
- }
390
- )
391
- ),
392
- timeout=request_options.get("timeout_in_seconds")
393
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
394
- else self._client_wrapper.get_timeout(),
395
- retries=0,
396
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
397
- )
398
- if 200 <= _response.status_code < 300:
399
- return pydantic_v1.parse_obj_as(PipelineResponse, _response.json()) # type: ignore
400
- if _response.status_code == 400:
401
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
402
- if _response.status_code == 401:
403
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
404
- if _response.status_code == 403:
405
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
406
- if _response.status_code == 404:
407
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
408
- if _response.status_code == 422:
409
- raise UnprocessableEntityError(
410
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
411
- )
412
- if _response.status_code == 500:
413
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
414
- try:
415
- _response_json = _response.json()
416
- except JSONDecodeError:
417
- raise ApiError(status_code=_response.status_code, body=_response.text)
418
- raise ApiError(status_code=_response.status_code, body=_response_json)
419
-
420
- async def status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
421
- """
422
- Query tasks status.
423
-
424
- Parameters:
425
- - task_id: str.
426
-
427
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
428
- ---
429
- from mixpeek.client import AsyncMixpeek
430
-
431
- client = AsyncMixpeek(
432
- authorization="YOUR_AUTHORIZATION",
433
- index_id="YOUR_INDEX_ID",
434
- api_key="YOUR_API_KEY",
435
- )
436
- await client.pipeline.status(
437
- task_id="task_id",
438
- )
439
- """
440
- _response = await self._client_wrapper.httpx_client.request(
441
- "GET",
442
- urllib.parse.urljoin(
443
- f"{self._client_wrapper.get_base_url()}/", f"pipelines/status/{jsonable_encoder(task_id)}"
444
- ),
445
- params=jsonable_encoder(
446
- request_options.get("additional_query_parameters") if request_options is not None else None
447
- ),
448
- headers=jsonable_encoder(
449
- remove_none_from_dict(
450
- {
451
- **self._client_wrapper.get_headers(),
452
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
453
- }
454
- )
455
- ),
456
- timeout=request_options.get("timeout_in_seconds")
457
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
458
- else self._client_wrapper.get_timeout(),
459
- retries=0,
460
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
461
- )
462
- if 200 <= _response.status_code < 300:
463
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
464
- if _response.status_code == 400:
465
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
466
- if _response.status_code == 401:
467
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
468
- if _response.status_code == 403:
469
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
470
- if _response.status_code == 404:
471
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
472
- if _response.status_code == 422:
473
- raise UnprocessableEntityError(
474
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
475
- )
476
- if _response.status_code == 500:
477
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
478
- try:
479
- _response_json = _response.json()
480
- except JSONDecodeError:
481
- raise ApiError(status_code=_response.status_code, body=_response.text)
482
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from . import sample
4
-
5
- __all__ = ["sample"]
mixpeek/storage/client.py DELETED
@@ -1,145 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- import urllib.parse
5
- from json.decoder import JSONDecodeError
6
-
7
- from ..core.api_error import ApiError
8
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ..core.jsonable_encoder import jsonable_encoder
10
- from ..core.pydantic_utilities import pydantic_v1
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 .sample.client import AsyncSampleClient, SampleClient
22
-
23
-
24
- class StorageClient:
25
- def __init__(self, *, client_wrapper: SyncClientWrapper):
26
- self._client_wrapper = client_wrapper
27
- self.sample = SampleClient(client_wrapper=self._client_wrapper)
28
-
29
- def connect(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
30
- """
31
- Parameters:
32
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
33
- ---
34
- from mixpeek.client import Mixpeek
35
-
36
- client = Mixpeek(
37
- authorization="YOUR_AUTHORIZATION",
38
- index_id="YOUR_INDEX_ID",
39
- api_key="YOUR_API_KEY",
40
- )
41
- client.storage.connect()
42
- """
43
- _response = self._client_wrapper.httpx_client.request(
44
- "GET",
45
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "storage/connect"),
46
- params=jsonable_encoder(
47
- request_options.get("additional_query_parameters") if request_options is not None else None
48
- ),
49
- headers=jsonable_encoder(
50
- remove_none_from_dict(
51
- {
52
- **self._client_wrapper.get_headers(),
53
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
54
- }
55
- )
56
- ),
57
- timeout=request_options.get("timeout_in_seconds")
58
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
59
- else self._client_wrapper.get_timeout(),
60
- retries=0,
61
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
62
- )
63
- if 200 <= _response.status_code < 300:
64
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
65
- if _response.status_code == 400:
66
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
67
- if _response.status_code == 401:
68
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
69
- if _response.status_code == 403:
70
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
71
- if _response.status_code == 404:
72
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
73
- if _response.status_code == 422:
74
- raise UnprocessableEntityError(
75
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
76
- )
77
- if _response.status_code == 500:
78
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
79
- try:
80
- _response_json = _response.json()
81
- except JSONDecodeError:
82
- raise ApiError(status_code=_response.status_code, body=_response.text)
83
- raise ApiError(status_code=_response.status_code, body=_response_json)
84
-
85
-
86
- class AsyncStorageClient:
87
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
88
- self._client_wrapper = client_wrapper
89
- self.sample = AsyncSampleClient(client_wrapper=self._client_wrapper)
90
-
91
- async def connect(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
92
- """
93
- Parameters:
94
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
95
- ---
96
- from mixpeek.client import AsyncMixpeek
97
-
98
- client = AsyncMixpeek(
99
- authorization="YOUR_AUTHORIZATION",
100
- index_id="YOUR_INDEX_ID",
101
- api_key="YOUR_API_KEY",
102
- )
103
- await client.storage.connect()
104
- """
105
- _response = await self._client_wrapper.httpx_client.request(
106
- "GET",
107
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "storage/connect"),
108
- params=jsonable_encoder(
109
- request_options.get("additional_query_parameters") if request_options is not None else None
110
- ),
111
- headers=jsonable_encoder(
112
- remove_none_from_dict(
113
- {
114
- **self._client_wrapper.get_headers(),
115
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
116
- }
117
- )
118
- ),
119
- timeout=request_options.get("timeout_in_seconds")
120
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
121
- else self._client_wrapper.get_timeout(),
122
- retries=0,
123
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
124
- )
125
- if 200 <= _response.status_code < 300:
126
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
127
- if _response.status_code == 400:
128
- raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
129
- if _response.status_code == 401:
130
- raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
131
- if _response.status_code == 403:
132
- raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
133
- if _response.status_code == 404:
134
- raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
135
- if _response.status_code == 422:
136
- raise UnprocessableEntityError(
137
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
138
- )
139
- if _response.status_code == 500:
140
- raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
141
- try:
142
- _response_json = _response.json()
143
- except JSONDecodeError:
144
- raise ApiError(status_code=_response.status_code, body=_response.text)
145
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,2 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-