mixpeek 0.6.6__py3-none-any.whl → 0.6.8__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/base_client.py +89 -63
- mixpeek/core/__init__.py +2 -0
- mixpeek/core/client_wrapper.py +1 -1
- mixpeek/core/jsonable_encoder.py +5 -9
- mixpeek/core/pydantic_utilities.py +12 -0
- mixpeek/pipeline/client.py +55 -47
- mixpeek/storage/client.py +19 -19
- mixpeek/storage/sample/client.py +37 -33
- mixpeek/types/api_key.py +3 -7
- mixpeek/types/audio_params.py +3 -7
- mixpeek/types/configs_response.py +6 -10
- mixpeek/types/connection.py +3 -7
- mixpeek/types/csv_params.py +3 -7
- mixpeek/types/destination.py +6 -10
- mixpeek/types/embedding_response.py +4 -8
- mixpeek/types/error_message.py +3 -7
- mixpeek/types/error_response.py +3 -7
- mixpeek/types/extract_response.py +4 -8
- mixpeek/types/generation_response.py +4 -8
- mixpeek/types/html_params.py +3 -7
- mixpeek/types/http_validation_error.py +3 -7
- mixpeek/types/image_params.py +4 -8
- mixpeek/types/message.py +5 -9
- mixpeek/types/metadata.py +3 -7
- mixpeek/types/model.py +5 -9
- mixpeek/types/pdf_params.py +4 -8
- mixpeek/types/pipeline_response.py +6 -10
- mixpeek/types/pipeline_task_response.py +4 -8
- mixpeek/types/ppt_params.py +3 -7
- mixpeek/types/pptx_params.py +3 -7
- mixpeek/types/settings.py +3 -7
- mixpeek/types/source.py +6 -10
- mixpeek/types/source_destination_mapping.py +6 -10
- mixpeek/types/txt_params.py +3 -7
- mixpeek/types/user.py +3 -7
- mixpeek/types/validation_error.py +3 -7
- mixpeek/types/video_params.py +3 -7
- mixpeek/types/workflow_code_response.py +3 -7
- mixpeek/types/workflow_response.py +3 -7
- mixpeek/types/workflow_settings.py +3 -7
- mixpeek/types/xlsx_params.py +3 -7
- mixpeek/user/client.py +37 -33
- mixpeek/workflow/client.py +55 -47
- {mixpeek-0.6.6.dist-info → mixpeek-0.6.8.dist-info}/METADATA +1 -1
- mixpeek-0.6.8.dist-info/RECORD +76 -0
- mixpeek-0.6.6.dist-info/RECORD +0 -75
- {mixpeek-0.6.6.dist-info → mixpeek-0.6.8.dist-info}/LICENSE +0 -0
- {mixpeek-0.6.6.dist-info → mixpeek-0.6.8.dist-info}/WHEEL +0 -0
mixpeek/storage/client.py
CHANGED
@@ -7,6 +7,7 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.bad_request_error import BadRequestError
|
@@ -19,11 +20,6 @@ from ..types.error_response import ErrorResponse
|
|
19
20
|
from ..types.http_validation_error import HttpValidationError
|
20
21
|
from .sample.client import AsyncSampleClient, SampleClient
|
21
22
|
|
22
|
-
try:
|
23
|
-
import pydantic.v1 as pydantic # type: ignore
|
24
|
-
except ImportError:
|
25
|
-
import pydantic # type: ignore
|
26
|
-
|
27
23
|
|
28
24
|
class StorageClient:
|
29
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
@@ -65,19 +61,21 @@ class StorageClient:
|
|
65
61
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
66
62
|
)
|
67
63
|
if 200 <= _response.status_code < 300:
|
68
|
-
return
|
64
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
69
65
|
if _response.status_code == 400:
|
70
|
-
raise BadRequestError(
|
66
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
71
67
|
if _response.status_code == 401:
|
72
|
-
raise UnauthorizedError(
|
68
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
73
69
|
if _response.status_code == 403:
|
74
|
-
raise ForbiddenError(
|
70
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
75
71
|
if _response.status_code == 404:
|
76
|
-
raise NotFoundError(
|
72
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
77
73
|
if _response.status_code == 422:
|
78
|
-
raise UnprocessableEntityError(
|
74
|
+
raise UnprocessableEntityError(
|
75
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
76
|
+
)
|
79
77
|
if _response.status_code == 500:
|
80
|
-
raise InternalServerError(
|
78
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
81
79
|
try:
|
82
80
|
_response_json = _response.json()
|
83
81
|
except JSONDecodeError:
|
@@ -125,19 +123,21 @@ class AsyncStorageClient:
|
|
125
123
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
126
124
|
)
|
127
125
|
if 200 <= _response.status_code < 300:
|
128
|
-
return
|
126
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
129
127
|
if _response.status_code == 400:
|
130
|
-
raise BadRequestError(
|
128
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
131
129
|
if _response.status_code == 401:
|
132
|
-
raise UnauthorizedError(
|
130
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
133
131
|
if _response.status_code == 403:
|
134
|
-
raise ForbiddenError(
|
132
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
135
133
|
if _response.status_code == 404:
|
136
|
-
raise NotFoundError(
|
134
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
137
135
|
if _response.status_code == 422:
|
138
|
-
raise UnprocessableEntityError(
|
136
|
+
raise UnprocessableEntityError(
|
137
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
138
|
+
)
|
139
139
|
if _response.status_code == 500:
|
140
|
-
raise InternalServerError(
|
140
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
141
141
|
try:
|
142
142
|
_response_json = _response.json()
|
143
143
|
except JSONDecodeError:
|
mixpeek/storage/sample/client.py
CHANGED
@@ -7,6 +7,7 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ...core.api_error import ApiError
|
8
8
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ...core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ...core.pydantic_utilities import pydantic_v1
|
10
11
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ...core.request_options import RequestOptions
|
12
13
|
from ...errors.bad_request_error import BadRequestError
|
@@ -18,11 +19,6 @@ from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
18
19
|
from ...types.error_response import ErrorResponse
|
19
20
|
from ...types.http_validation_error import HttpValidationError
|
20
21
|
|
21
|
-
try:
|
22
|
-
import pydantic.v1 as pydantic # type: ignore
|
23
|
-
except ImportError:
|
24
|
-
import pydantic # type: ignore
|
25
|
-
|
26
22
|
|
27
23
|
class SampleClient:
|
28
24
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
@@ -69,19 +65,21 @@ class SampleClient:
|
|
69
65
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
70
66
|
)
|
71
67
|
if 200 <= _response.status_code < 300:
|
72
|
-
return
|
68
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
73
69
|
if _response.status_code == 400:
|
74
|
-
raise BadRequestError(
|
70
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
75
71
|
if _response.status_code == 401:
|
76
|
-
raise UnauthorizedError(
|
72
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
77
73
|
if _response.status_code == 403:
|
78
|
-
raise ForbiddenError(
|
74
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
79
75
|
if _response.status_code == 404:
|
80
|
-
raise NotFoundError(
|
76
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
81
77
|
if _response.status_code == 422:
|
82
|
-
raise UnprocessableEntityError(
|
78
|
+
raise UnprocessableEntityError(
|
79
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
80
|
+
)
|
83
81
|
if _response.status_code == 500:
|
84
|
-
raise InternalServerError(
|
82
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
85
83
|
try:
|
86
84
|
_response_json = _response.json()
|
87
85
|
except JSONDecodeError:
|
@@ -132,19 +130,21 @@ class SampleClient:
|
|
132
130
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
133
131
|
)
|
134
132
|
if 200 <= _response.status_code < 300:
|
135
|
-
return
|
133
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
136
134
|
if _response.status_code == 400:
|
137
|
-
raise BadRequestError(
|
135
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
138
136
|
if _response.status_code == 401:
|
139
|
-
raise UnauthorizedError(
|
137
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
140
138
|
if _response.status_code == 403:
|
141
|
-
raise ForbiddenError(
|
139
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
142
140
|
if _response.status_code == 404:
|
143
|
-
raise NotFoundError(
|
141
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
144
142
|
if _response.status_code == 422:
|
145
|
-
raise UnprocessableEntityError(
|
143
|
+
raise UnprocessableEntityError(
|
144
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
145
|
+
)
|
146
146
|
if _response.status_code == 500:
|
147
|
-
raise InternalServerError(
|
147
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
148
148
|
try:
|
149
149
|
_response_json = _response.json()
|
150
150
|
except JSONDecodeError:
|
@@ -199,19 +199,21 @@ class AsyncSampleClient:
|
|
199
199
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
200
200
|
)
|
201
201
|
if 200 <= _response.status_code < 300:
|
202
|
-
return
|
202
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
203
203
|
if _response.status_code == 400:
|
204
|
-
raise BadRequestError(
|
204
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
205
205
|
if _response.status_code == 401:
|
206
|
-
raise UnauthorizedError(
|
206
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
207
207
|
if _response.status_code == 403:
|
208
|
-
raise ForbiddenError(
|
208
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
209
209
|
if _response.status_code == 404:
|
210
|
-
raise NotFoundError(
|
210
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
211
211
|
if _response.status_code == 422:
|
212
|
-
raise UnprocessableEntityError(
|
212
|
+
raise UnprocessableEntityError(
|
213
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
214
|
+
)
|
213
215
|
if _response.status_code == 500:
|
214
|
-
raise InternalServerError(
|
216
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
215
217
|
try:
|
216
218
|
_response_json = _response.json()
|
217
219
|
except JSONDecodeError:
|
@@ -262,19 +264,21 @@ class AsyncSampleClient:
|
|
262
264
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
263
265
|
)
|
264
266
|
if 200 <= _response.status_code < 300:
|
265
|
-
return
|
267
|
+
return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
266
268
|
if _response.status_code == 400:
|
267
|
-
raise BadRequestError(
|
269
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
268
270
|
if _response.status_code == 401:
|
269
|
-
raise UnauthorizedError(
|
271
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
270
272
|
if _response.status_code == 403:
|
271
|
-
raise ForbiddenError(
|
273
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
272
274
|
if _response.status_code == 404:
|
273
|
-
raise NotFoundError(
|
275
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
274
276
|
if _response.status_code == 422:
|
275
|
-
raise UnprocessableEntityError(
|
277
|
+
raise UnprocessableEntityError(
|
278
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
279
|
+
)
|
276
280
|
if _response.status_code == 500:
|
277
|
-
raise InternalServerError(
|
281
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
278
282
|
try:
|
279
283
|
_response_json = _response.json()
|
280
284
|
except JSONDecodeError:
|
mixpeek/types/api_key.py
CHANGED
@@ -4,14 +4,10 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class ApiKey(pydantic.BaseModel):
|
10
|
+
class ApiKey(pydantic_v1.BaseModel):
|
15
11
|
key: typing.Optional[str] = None
|
16
12
|
name: typing.Optional[str] = None
|
17
13
|
created_at: typing.Optional[dt.datetime] = None
|
@@ -27,5 +23,5 @@ class ApiKey(pydantic.BaseModel):
|
|
27
23
|
class Config:
|
28
24
|
frozen = True
|
29
25
|
smart_union = True
|
30
|
-
extra =
|
26
|
+
extra = pydantic_v1.Extra.allow
|
31
27
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/audio_params.py
CHANGED
@@ -4,14 +4,10 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class AudioParams(pydantic.BaseModel):
|
10
|
+
class AudioParams(pydantic_v1.BaseModel):
|
15
11
|
interval_range: typing.Optional[int] = None
|
16
12
|
|
17
13
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -25,5 +21,5 @@ class AudioParams(pydantic.BaseModel):
|
|
25
21
|
class Config:
|
26
22
|
frozen = True
|
27
23
|
smart_union = True
|
28
|
-
extra =
|
24
|
+
extra = pydantic_v1.Extra.allow
|
29
25
|
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,25 +4,21 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
dimensions: int = pydantic.Field()
|
10
|
+
class ConfigsResponse(pydantic_v1.BaseModel):
|
11
|
+
dimensions: int = pydantic_v1.Field()
|
16
12
|
"""
|
17
13
|
The dimensions of the processed data.
|
18
14
|
"""
|
19
15
|
|
20
|
-
elapsed_time: float =
|
16
|
+
elapsed_time: float = pydantic_v1.Field()
|
21
17
|
"""
|
22
18
|
The time taken to process the data.
|
23
19
|
"""
|
24
20
|
|
25
|
-
token_size: int =
|
21
|
+
token_size: int = pydantic_v1.Field()
|
26
22
|
"""
|
27
23
|
The size of the tokens in the processed data.
|
28
24
|
"""
|
@@ -38,5 +34,5 @@ class ConfigsResponse(pydantic.BaseModel):
|
|
38
34
|
class Config:
|
39
35
|
frozen = True
|
40
36
|
smart_union = True
|
41
|
-
extra =
|
37
|
+
extra = pydantic_v1.Extra.allow
|
42
38
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/connection.py
CHANGED
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
from .connection_engine import ConnectionEngine
|
8
9
|
|
9
|
-
try:
|
10
|
-
import pydantic.v1 as pydantic # type: ignore
|
11
|
-
except ImportError:
|
12
|
-
import pydantic # type: ignore
|
13
10
|
|
14
|
-
|
15
|
-
class Connection(pydantic.BaseModel):
|
11
|
+
class Connection(pydantic_v1.BaseModel):
|
16
12
|
engine: ConnectionEngine
|
17
13
|
host: str
|
18
14
|
port: typing.Optional[int] = None
|
@@ -32,5 +28,5 @@ class Connection(pydantic.BaseModel):
|
|
32
28
|
class Config:
|
33
29
|
frozen = True
|
34
30
|
smart_union = True
|
35
|
-
extra =
|
31
|
+
extra = pydantic_v1.Extra.allow
|
36
32
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/csv_params.py
CHANGED
@@ -4,14 +4,10 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class CsvParams(pydantic.BaseModel):
|
10
|
+
class CsvParams(pydantic_v1.BaseModel):
|
15
11
|
include_header: typing.Optional[bool] = None
|
16
12
|
|
17
13
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -25,5 +21,5 @@ class CsvParams(pydantic.BaseModel):
|
|
25
21
|
class Config:
|
26
22
|
frozen = True
|
27
23
|
smart_union = True
|
28
|
-
extra =
|
24
|
+
extra = pydantic_v1.Extra.allow
|
29
25
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/destination.py
CHANGED
@@ -4,25 +4,21 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
collection: str = pydantic.Field()
|
10
|
+
class Destination(pydantic_v1.BaseModel):
|
11
|
+
collection: str = pydantic_v1.Field()
|
16
12
|
"""
|
17
13
|
The collection name
|
18
14
|
"""
|
19
15
|
|
20
|
-
field: str =
|
16
|
+
field: str = pydantic_v1.Field()
|
21
17
|
"""
|
22
18
|
The field name
|
23
19
|
"""
|
24
20
|
|
25
|
-
embedding: str =
|
21
|
+
embedding: str = pydantic_v1.Field()
|
26
22
|
"""
|
27
23
|
The embedding
|
28
24
|
"""
|
@@ -38,5 +34,5 @@ class Destination(pydantic.BaseModel):
|
|
38
34
|
class Config:
|
39
35
|
frozen = True
|
40
36
|
smart_union = True
|
41
|
-
extra =
|
37
|
+
extra = pydantic_v1.Extra.allow
|
42
38
|
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
embedding: typing.List[float] = pydantic.Field()
|
10
|
+
class EmbeddingResponse(pydantic_v1.BaseModel):
|
11
|
+
embedding: typing.List[float] = pydantic_v1.Field()
|
16
12
|
"""
|
17
13
|
The embedding of the processed data.
|
18
14
|
"""
|
@@ -30,5 +26,5 @@ class EmbeddingResponse(pydantic.BaseModel):
|
|
30
26
|
class Config:
|
31
27
|
frozen = True
|
32
28
|
smart_union = True
|
33
|
-
extra =
|
29
|
+
extra = pydantic_v1.Extra.allow
|
34
30
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/error_message.py
CHANGED
@@ -4,14 +4,10 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class ErrorMessage(pydantic.BaseModel):
|
10
|
+
class ErrorMessage(pydantic_v1.BaseModel):
|
15
11
|
msg: str
|
16
12
|
|
17
13
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -25,5 +21,5 @@ class ErrorMessage(pydantic.BaseModel):
|
|
25
21
|
class Config:
|
26
22
|
frozen = True
|
27
23
|
smart_union = True
|
28
|
-
extra =
|
24
|
+
extra = pydantic_v1.Extra.allow
|
29
25
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/error_response.py
CHANGED
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
from .error_message import ErrorMessage
|
8
9
|
|
9
|
-
try:
|
10
|
-
import pydantic.v1 as pydantic # type: ignore
|
11
|
-
except ImportError:
|
12
|
-
import pydantic # type: ignore
|
13
10
|
|
14
|
-
|
15
|
-
class ErrorResponse(pydantic.BaseModel):
|
11
|
+
class ErrorResponse(pydantic_v1.BaseModel):
|
16
12
|
detail: typing.Optional[typing.List[ErrorMessage]] = None
|
17
13
|
|
18
14
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -26,5 +22,5 @@ class ErrorResponse(pydantic.BaseModel):
|
|
26
22
|
class Config:
|
27
23
|
frozen = True
|
28
24
|
smart_union = True
|
29
|
-
extra =
|
25
|
+
extra = pydantic_v1.Extra.allow
|
30
26
|
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,16 +4,12 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class ExtractResponse(pydantic.BaseModel):
|
10
|
+
class ExtractResponse(pydantic_v1.BaseModel):
|
15
11
|
output: typing.Any
|
16
|
-
metadata: typing.Dict[str, typing.Any] =
|
12
|
+
metadata: typing.Dict[str, typing.Any] = pydantic_v1.Field()
|
17
13
|
"""
|
18
14
|
Metadata related to the extraction process.
|
19
15
|
"""
|
@@ -31,5 +27,5 @@ class ExtractResponse(pydantic.BaseModel):
|
|
31
27
|
class Config:
|
32
28
|
frozen = True
|
33
29
|
smart_union = True
|
34
|
-
extra =
|
30
|
+
extra = pydantic_v1.Extra.allow
|
35
31
|
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,16 +4,12 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
from .metadata import Metadata
|
8
9
|
|
9
|
-
try:
|
10
|
-
import pydantic.v1 as pydantic # type: ignore
|
11
|
-
except ImportError:
|
12
|
-
import pydantic # type: ignore
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
response: typing.Dict[str, typing.Any] = pydantic.Field()
|
11
|
+
class GenerationResponse(pydantic_v1.BaseModel):
|
12
|
+
response: typing.Dict[str, typing.Any] = pydantic_v1.Field()
|
17
13
|
"""
|
18
14
|
The response from the generation.
|
19
15
|
"""
|
@@ -32,5 +28,5 @@ class GenerationResponse(pydantic.BaseModel):
|
|
32
28
|
class Config:
|
33
29
|
frozen = True
|
34
30
|
smart_union = True
|
35
|
-
extra =
|
31
|
+
extra = pydantic_v1.Extra.allow
|
36
32
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/html_params.py
CHANGED
@@ -4,14 +4,10 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
class HtmlParams(pydantic.BaseModel):
|
10
|
+
class HtmlParams(pydantic_v1.BaseModel):
|
15
11
|
skip_headers_and_footers: typing.Optional[bool] = None
|
16
12
|
|
17
13
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -25,5 +21,5 @@ class HtmlParams(pydantic.BaseModel):
|
|
25
21
|
class Config:
|
26
22
|
frozen = True
|
27
23
|
smart_union = True
|
28
|
-
extra =
|
24
|
+
extra = pydantic_v1.Extra.allow
|
29
25
|
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
from .validation_error import ValidationError
|
8
9
|
|
9
|
-
try:
|
10
|
-
import pydantic.v1 as pydantic # type: ignore
|
11
|
-
except ImportError:
|
12
|
-
import pydantic # type: ignore
|
13
10
|
|
14
|
-
|
15
|
-
class HttpValidationError(pydantic.BaseModel):
|
11
|
+
class HttpValidationError(pydantic_v1.BaseModel):
|
16
12
|
detail: typing.Optional[typing.List[ValidationError]] = None
|
17
13
|
|
18
14
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -26,5 +22,5 @@ class HttpValidationError(pydantic.BaseModel):
|
|
26
22
|
class Config:
|
27
23
|
frozen = True
|
28
24
|
smart_union = True
|
29
|
-
extra =
|
25
|
+
extra = pydantic_v1.Extra.allow
|
30
26
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/image_params.py
CHANGED
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
strategy: typing.Optional[str] = pydantic.Field(default=None)
|
10
|
+
class ImageParams(pydantic_v1.BaseModel):
|
11
|
+
strategy: typing.Optional[str] = pydantic_v1.Field(default=None)
|
16
12
|
"""
|
17
13
|
The strategy to use for parsing the image. Valid strategies are 'ocr', 'object', and 'auto'.
|
18
14
|
"""
|
@@ -28,5 +24,5 @@ class ImageParams(pydantic.BaseModel):
|
|
28
24
|
class Config:
|
29
25
|
frozen = True
|
30
26
|
smart_union = True
|
31
|
-
extra =
|
27
|
+
extra = pydantic_v1.Extra.allow
|
32
28
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/message.py
CHANGED
@@ -4,20 +4,16 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
|
8
|
-
try:
|
9
|
-
import pydantic.v1 as pydantic # type: ignore
|
10
|
-
except ImportError:
|
11
|
-
import pydantic # type: ignore
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
role: str = pydantic.Field()
|
10
|
+
class Message(pydantic_v1.BaseModel):
|
11
|
+
role: str = pydantic_v1.Field()
|
16
12
|
"""
|
17
13
|
The role of the message sender.
|
18
14
|
"""
|
19
15
|
|
20
|
-
content: str =
|
16
|
+
content: str = pydantic_v1.Field()
|
21
17
|
"""
|
22
18
|
The content of the message.
|
23
19
|
"""
|
@@ -33,5 +29,5 @@ class Message(pydantic.BaseModel):
|
|
33
29
|
class Config:
|
34
30
|
frozen = True
|
35
31
|
smart_union = True
|
36
|
-
extra =
|
32
|
+
extra = pydantic_v1.Extra.allow
|
37
33
|
json_encoders = {dt.datetime: serialize_datetime}
|
mixpeek/types/metadata.py
CHANGED
@@ -4,15 +4,11 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import pydantic_v1
|
7
8
|
from .model import Model
|
8
9
|
|
9
|
-
try:
|
10
|
-
import pydantic.v1 as pydantic # type: ignore
|
11
|
-
except ImportError:
|
12
|
-
import pydantic # type: ignore
|
13
10
|
|
14
|
-
|
15
|
-
class Metadata(pydantic.BaseModel):
|
11
|
+
class Metadata(pydantic_v1.BaseModel):
|
16
12
|
total_tokens: typing.Optional[int] = None
|
17
13
|
generation_id: typing.Optional[str] = None
|
18
14
|
model: typing.Optional[Model] = None
|
@@ -28,5 +24,5 @@ class Metadata(pydantic.BaseModel):
|
|
28
24
|
class Config:
|
29
25
|
frozen = True
|
30
26
|
smart_union = True
|
31
|
-
extra =
|
27
|
+
extra = pydantic_v1.Extra.allow
|
32
28
|
json_encoders = {dt.datetime: serialize_datetime}
|