mixpeek 0.11.2__py3-none-any.whl → 0.13__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 +9 -1
- mixpeek/_hooks/__init__.py +5 -0
- mixpeek/_hooks/registration.py +13 -0
- mixpeek/_hooks/sdkhooks.py +76 -0
- mixpeek/_hooks/types.py +94 -0
- mixpeek/_version.py +12 -0
- mixpeek/assets.py +1561 -0
- mixpeek/basesdk.py +350 -0
- mixpeek/collections.py +1029 -0
- mixpeek/featureextractors.py +205 -0
- mixpeek/features.py +1181 -0
- mixpeek/health.py +167 -0
- mixpeek/httpclient.py +84 -0
- mixpeek/ingest.py +831 -0
- mixpeek/interactions.py +221 -0
- mixpeek/models/__init__.py +751 -0
- mixpeek/models/actionusage.py +16 -0
- mixpeek/models/apierror.py +22 -0
- mixpeek/models/apikey.py +25 -0
- mixpeek/models/apikeyupdate.py +49 -0
- mixpeek/models/assetfeatures.py +55 -0
- mixpeek/models/assetresponse.py +166 -0
- mixpeek/models/assets_model_searchquery.py +21 -0
- mixpeek/models/assetupdate.py +28 -0
- mixpeek/models/availableindexesresponse.py +23 -0
- mixpeek/models/availablemodels.py +12 -0
- mixpeek/models/boolindexparams.py +18 -0
- mixpeek/models/collectionmodel.py +70 -0
- mixpeek/models/collectionresult.py +73 -0
- mixpeek/models/create_api_key_organizations_users_user_email_api_keys_postop.py +23 -0
- mixpeek/models/create_collection_collections_postop.py +62 -0
- mixpeek/models/create_interaction_features_search_interactions_postop.py +59 -0
- mixpeek/models/createcollectionrequest.py +59 -0
- mixpeek/models/createnamespacerequest.py +62 -0
- mixpeek/models/datetimeindexparams.py +18 -0
- mixpeek/models/dateusage.py +22 -0
- mixpeek/models/db_model_paginationresponse.py +59 -0
- mixpeek/models/db_model_taskresponse.py +20 -0
- mixpeek/models/delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py +23 -0
- mixpeek/models/delete_asset_assets_asset_id_deleteop.py +57 -0
- mixpeek/models/delete_collection_collections_collection_deleteop.py +59 -0
- mixpeek/models/delete_feature_features_feature_id_deleteop.py +57 -0
- mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +59 -0
- mixpeek/models/delete_namespace_namespaces_namespace_deleteop.py +18 -0
- mixpeek/models/delete_user_organizations_users_user_email_deleteop.py +16 -0
- mixpeek/models/denseembedding.py +16 -0
- mixpeek/models/embeddingrequest.py +59 -0
- mixpeek/models/embeddingresponse.py +64 -0
- mixpeek/models/errormessage.py +13 -0
- mixpeek/models/errorresponse.py +21 -0
- mixpeek/models/facedetectsettings.py +52 -0
- mixpeek/models/featureextractionembeddingrequest.py +54 -0
- mixpeek/models/featureresponse.py +74 -0
- mixpeek/models/features_model_paginationresponse.py +59 -0
- mixpeek/models/featureupdaterequest.py +21 -0
- mixpeek/models/filtercondition.py +74 -0
- mixpeek/models/floatindexparams.py +18 -0
- mixpeek/models/full_asset_update_assets_asset_id_putop.py +69 -0
- mixpeek/models/full_feature_update_features_feature_id_putop.py +69 -0
- mixpeek/models/geoindexparams.py +18 -0
- mixpeek/models/get_asset_assets_asset_id_getop.py +73 -0
- mixpeek/models/get_asset_with_features_assets_asset_id_features_getop.py +73 -0
- mixpeek/models/get_collection_collections_collection_getop.py +59 -0
- mixpeek/models/get_feature_features_feature_id_getop.py +70 -0
- mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +59 -0
- mixpeek/models/get_namespace_namespaces_namespace_getop.py +18 -0
- mixpeek/models/get_task_tasks_task_id_getop.py +57 -0
- mixpeek/models/get_user_organizations_users_user_email_getop.py +16 -0
- mixpeek/models/groupbyoptions.py +71 -0
- mixpeek/models/groupbyoptionsasset.py +71 -0
- mixpeek/models/groupedassetdata.py +18 -0
- mixpeek/models/healthcheckresponse.py +13 -0
- mixpeek/models/httpvalidationerror.py +21 -0
- mixpeek/models/imagedescribesettings.py +82 -0
- mixpeek/models/imagedetectsettings.py +53 -0
- mixpeek/models/imagereadsettings.py +71 -0
- mixpeek/models/imagesettings.py +79 -0
- mixpeek/models/ingest_image_url_ingest_images_url_postop.py +59 -0
- mixpeek/models/ingest_text_ingest_text_postop.py +59 -0
- mixpeek/models/ingest_video_url_ingest_videos_url_postop.py +59 -0
- mixpeek/models/inputtype.py +11 -0
- mixpeek/models/integerindexparams.py +24 -0
- mixpeek/models/interactionresponse.py +87 -0
- mixpeek/models/interactiontype.py +11 -0
- mixpeek/models/jsonimageoutputsettings.py +55 -0
- mixpeek/models/jsontextoutputsettings.py +55 -0
- mixpeek/models/jsonvideooutputsettings.py +55 -0
- mixpeek/models/keywordindexparams.py +21 -0
- mixpeek/models/kill_task_tasks_task_id_deleteop.py +57 -0
- mixpeek/models/list_assets_assets_postop.py +77 -0
- mixpeek/models/list_collections_collections_getop.py +65 -0
- mixpeek/models/list_features_features_postop.py +79 -0
- mixpeek/models/list_interactions_features_search_interactions_getop.py +96 -0
- mixpeek/models/listassetsrequest.py +75 -0
- mixpeek/models/listassetsresponse.py +22 -0
- mixpeek/models/listcollectionsresponse.py +22 -0
- mixpeek/models/listfeaturesrequest.py +77 -0
- mixpeek/models/listfeaturesresponse.py +22 -0
- mixpeek/models/logicaloperator_input.py +88 -0
- mixpeek/models/logicaloperator_output.py +103 -0
- mixpeek/models/logodetectsettings.py +52 -0
- mixpeek/models/modality.py +13 -0
- mixpeek/models/modeldetails.py +57 -0
- mixpeek/models/namespaceresponse.py +54 -0
- mixpeek/models/organizationmodel.py +45 -0
- mixpeek/models/partial_asset_update_assets_asset_id_patchop.py +69 -0
- mixpeek/models/payloadindexconfig.py +94 -0
- mixpeek/models/payloadindextype.py +17 -0
- mixpeek/models/payloadschematype.py +15 -0
- mixpeek/models/percolaterequest.py +57 -0
- mixpeek/models/permission.py +10 -0
- mixpeek/models/processimageurlinput.py +99 -0
- mixpeek/models/processtextinput.py +94 -0
- mixpeek/models/processvideourlinput.py +99 -0
- mixpeek/models/querysettings.py +56 -0
- mixpeek/models/rerankingoptions.py +47 -0
- mixpeek/models/search_assets_assets_search_postop.py +59 -0
- mixpeek/models/search_features_features_search_postop.py +96 -0
- mixpeek/models/search_model_searchquery_input.py +76 -0
- mixpeek/models/searchassetsrequest.py +78 -0
- mixpeek/models/searchinteraction.py +82 -0
- mixpeek/models/searchquery_output.py +79 -0
- mixpeek/models/searchrequestfeatures_input.py +151 -0
- mixpeek/models/searchrequestfeatures_output.py +151 -0
- mixpeek/models/sortoption.py +28 -0
- mixpeek/models/sparseembedding.py +21 -0
- mixpeek/models/tasks_model_taskresponse.py +24 -0
- mixpeek/models/taskstatus.py +16 -0
- mixpeek/models/textindexparams.py +31 -0
- mixpeek/models/textsettings.py +61 -0
- mixpeek/models/tokenizertype.py +11 -0
- mixpeek/models/update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py +30 -0
- mixpeek/models/update_collection_collections_collection_putop.py +74 -0
- mixpeek/models/update_namespace_namespaces_namespace_putop.py +28 -0
- mixpeek/models/updateassetrequest.py +60 -0
- mixpeek/models/updatenamespacerequest.py +26 -0
- mixpeek/models/usage.py +18 -0
- mixpeek/models/usermodel_input.py +36 -0
- mixpeek/models/usermodel_output.py +36 -0
- mixpeek/models/uuidindexparams.py +21 -0
- mixpeek/models/validationerror.py +26 -0
- mixpeek/models/vectormodel.py +11 -0
- mixpeek/models/vectortype.py +9 -0
- mixpeek/models/videodescribesettings.py +82 -0
- mixpeek/models/videodetectsettings.py +53 -0
- mixpeek/models/videoreadsettings.py +71 -0
- mixpeek/models/videosettings.py +101 -0
- mixpeek/models/videotranscriptionsettings.py +69 -0
- mixpeek/namespaces.py +1143 -0
- mixpeek/organizations.py +1508 -0
- mixpeek/py.typed +1 -0
- mixpeek/sdk.py +135 -0
- mixpeek/sdkconfiguration.py +45 -0
- mixpeek/searchinteractions.py +647 -0
- mixpeek/tasks.py +387 -0
- mixpeek/types/__init__.py +21 -0
- mixpeek/types/basemodel.py +39 -0
- mixpeek/utils/__init__.py +97 -0
- mixpeek/utils/annotations.py +55 -0
- mixpeek/utils/enums.py +34 -0
- mixpeek/utils/eventstreaming.py +238 -0
- mixpeek/utils/forms.py +202 -0
- mixpeek/utils/headers.py +136 -0
- mixpeek/utils/logger.py +27 -0
- mixpeek/utils/metadata.py +118 -0
- mixpeek/utils/queryparams.py +205 -0
- mixpeek/utils/requestbodies.py +66 -0
- mixpeek/utils/retries.py +217 -0
- mixpeek/utils/security.py +174 -0
- mixpeek/utils/serializers.py +215 -0
- mixpeek/utils/url.py +155 -0
- mixpeek/utils/values.py +134 -0
- mixpeek-0.13.dist-info/METADATA +439 -0
- mixpeek-0.13.dist-info/RECORD +176 -0
- {mixpeek-0.11.2.dist-info → mixpeek-0.13.dist-info}/WHEEL +1 -2
- py.typed +1 -0
- mixpeek/client.py +0 -27
- mixpeek/endpoints/__init__.py +0 -0
- mixpeek/endpoints/collections.py +0 -86
- mixpeek/endpoints/embed.py +0 -66
- mixpeek/endpoints/index.py +0 -51
- mixpeek/endpoints/register.py +0 -34
- mixpeek/endpoints/search.py +0 -44
- mixpeek/endpoints/tasks.py +0 -26
- mixpeek/endpoints/tools.py +0 -138
- mixpeek/exceptions.py +0 -13
- mixpeek-0.11.2.dist-info/METADATA +0 -375
- mixpeek-0.11.2.dist-info/RECORD +0 -15
- mixpeek-0.11.2.dist-info/top_level.txt +0 -1
mixpeek/ingest.py
ADDED
@@ -0,0 +1,831 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from mixpeek import models, utils
|
5
|
+
from mixpeek._hooks import HookContext
|
6
|
+
from mixpeek.types import OptionalNullable, UNSET
|
7
|
+
from typing import Any, List, Mapping, Optional, Union
|
8
|
+
|
9
|
+
|
10
|
+
class Ingest(BaseSDK):
|
11
|
+
def text(
|
12
|
+
self,
|
13
|
+
*,
|
14
|
+
collection: str,
|
15
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
16
|
+
asset_update: OptionalNullable[
|
17
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
18
|
+
] = UNSET,
|
19
|
+
metadata: Optional[
|
20
|
+
Union[
|
21
|
+
models.ProcessTextInputMetadata,
|
22
|
+
models.ProcessTextInputMetadataTypedDict,
|
23
|
+
]
|
24
|
+
] = None,
|
25
|
+
feature_extractors: OptionalNullable[
|
26
|
+
Union[models.TextSettings, models.TextSettingsTypedDict]
|
27
|
+
] = UNSET,
|
28
|
+
percolate: OptionalNullable[
|
29
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
30
|
+
] = UNSET,
|
31
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
32
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
33
|
+
server_url: Optional[str] = None,
|
34
|
+
timeout_ms: Optional[int] = None,
|
35
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
36
|
+
) -> models.DbModelTaskResponse:
|
37
|
+
r"""Ingest Text
|
38
|
+
|
39
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
40
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
41
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
42
|
+
:param metadata: Additional metadata associated with the file. Can include any key-value pairs relevant to the file.
|
43
|
+
:param feature_extractors: Settings for text processing.
|
44
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
45
|
+
:param skip_duplicate: Skips processing when a duplicate hash is found and stores an error by the task_id with the existing asset_id
|
46
|
+
:param retries: Override the default retry configuration for this method
|
47
|
+
:param server_url: Override the default server URL for this method
|
48
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
49
|
+
:param http_headers: Additional headers to set or replace on requests.
|
50
|
+
"""
|
51
|
+
base_url = None
|
52
|
+
url_variables = None
|
53
|
+
if timeout_ms is None:
|
54
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
55
|
+
|
56
|
+
if server_url is not None:
|
57
|
+
base_url = server_url
|
58
|
+
|
59
|
+
request = models.IngestTextIngestTextPostRequest(
|
60
|
+
x_namespace=x_namespace,
|
61
|
+
process_text_input=models.ProcessTextInput(
|
62
|
+
collection=collection,
|
63
|
+
asset_update=utils.get_pydantic_model(
|
64
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
65
|
+
),
|
66
|
+
metadata=utils.get_pydantic_model(
|
67
|
+
metadata, Optional[models.ProcessTextInputMetadata]
|
68
|
+
),
|
69
|
+
feature_extractors=utils.get_pydantic_model(
|
70
|
+
feature_extractors, OptionalNullable[models.TextSettings]
|
71
|
+
),
|
72
|
+
percolate=utils.get_pydantic_model(
|
73
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
74
|
+
),
|
75
|
+
skip_duplicate=skip_duplicate,
|
76
|
+
),
|
77
|
+
)
|
78
|
+
|
79
|
+
req = self.build_request(
|
80
|
+
method="POST",
|
81
|
+
path="/ingest/text",
|
82
|
+
base_url=base_url,
|
83
|
+
url_variables=url_variables,
|
84
|
+
request=request,
|
85
|
+
request_body_required=True,
|
86
|
+
request_has_path_params=False,
|
87
|
+
request_has_query_params=False,
|
88
|
+
user_agent_header="user-agent",
|
89
|
+
accept_header_value="application/json",
|
90
|
+
http_headers=http_headers,
|
91
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
92
|
+
request.process_text_input,
|
93
|
+
False,
|
94
|
+
False,
|
95
|
+
"json",
|
96
|
+
models.ProcessTextInput,
|
97
|
+
),
|
98
|
+
timeout_ms=timeout_ms,
|
99
|
+
)
|
100
|
+
|
101
|
+
if retries == UNSET:
|
102
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
103
|
+
retries = self.sdk_configuration.retry_config
|
104
|
+
|
105
|
+
retry_config = None
|
106
|
+
if isinstance(retries, utils.RetryConfig):
|
107
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
108
|
+
|
109
|
+
http_res = self.do_request(
|
110
|
+
hook_ctx=HookContext(
|
111
|
+
operation_id="ingest_text_ingest_text_post",
|
112
|
+
oauth2_scopes=[],
|
113
|
+
security_source=None,
|
114
|
+
),
|
115
|
+
request=req,
|
116
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
117
|
+
retry_config=retry_config,
|
118
|
+
)
|
119
|
+
|
120
|
+
data: Any = None
|
121
|
+
if utils.match_response(http_res, "200", "application/json"):
|
122
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
123
|
+
if utils.match_response(
|
124
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
125
|
+
):
|
126
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
127
|
+
raise models.ErrorResponse(data=data)
|
128
|
+
if utils.match_response(http_res, "422", "application/json"):
|
129
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
130
|
+
raise models.HTTPValidationError(data=data)
|
131
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
132
|
+
http_res_text = utils.stream_to_text(http_res)
|
133
|
+
raise models.APIError(
|
134
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
135
|
+
)
|
136
|
+
|
137
|
+
content_type = http_res.headers.get("Content-Type")
|
138
|
+
http_res_text = utils.stream_to_text(http_res)
|
139
|
+
raise models.APIError(
|
140
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
141
|
+
http_res.status_code,
|
142
|
+
http_res_text,
|
143
|
+
http_res,
|
144
|
+
)
|
145
|
+
|
146
|
+
async def text_async(
|
147
|
+
self,
|
148
|
+
*,
|
149
|
+
collection: str,
|
150
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
151
|
+
asset_update: OptionalNullable[
|
152
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
153
|
+
] = UNSET,
|
154
|
+
metadata: Optional[
|
155
|
+
Union[
|
156
|
+
models.ProcessTextInputMetadata,
|
157
|
+
models.ProcessTextInputMetadataTypedDict,
|
158
|
+
]
|
159
|
+
] = None,
|
160
|
+
feature_extractors: OptionalNullable[
|
161
|
+
Union[models.TextSettings, models.TextSettingsTypedDict]
|
162
|
+
] = UNSET,
|
163
|
+
percolate: OptionalNullable[
|
164
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
165
|
+
] = UNSET,
|
166
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
167
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
168
|
+
server_url: Optional[str] = None,
|
169
|
+
timeout_ms: Optional[int] = None,
|
170
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
171
|
+
) -> models.DbModelTaskResponse:
|
172
|
+
r"""Ingest Text
|
173
|
+
|
174
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
175
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
176
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
177
|
+
:param metadata: Additional metadata associated with the file. Can include any key-value pairs relevant to the file.
|
178
|
+
:param feature_extractors: Settings for text processing.
|
179
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
180
|
+
:param skip_duplicate: Skips processing when a duplicate hash is found and stores an error by the task_id with the existing asset_id
|
181
|
+
:param retries: Override the default retry configuration for this method
|
182
|
+
:param server_url: Override the default server URL for this method
|
183
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
184
|
+
:param http_headers: Additional headers to set or replace on requests.
|
185
|
+
"""
|
186
|
+
base_url = None
|
187
|
+
url_variables = None
|
188
|
+
if timeout_ms is None:
|
189
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
190
|
+
|
191
|
+
if server_url is not None:
|
192
|
+
base_url = server_url
|
193
|
+
|
194
|
+
request = models.IngestTextIngestTextPostRequest(
|
195
|
+
x_namespace=x_namespace,
|
196
|
+
process_text_input=models.ProcessTextInput(
|
197
|
+
collection=collection,
|
198
|
+
asset_update=utils.get_pydantic_model(
|
199
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
200
|
+
),
|
201
|
+
metadata=utils.get_pydantic_model(
|
202
|
+
metadata, Optional[models.ProcessTextInputMetadata]
|
203
|
+
),
|
204
|
+
feature_extractors=utils.get_pydantic_model(
|
205
|
+
feature_extractors, OptionalNullable[models.TextSettings]
|
206
|
+
),
|
207
|
+
percolate=utils.get_pydantic_model(
|
208
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
209
|
+
),
|
210
|
+
skip_duplicate=skip_duplicate,
|
211
|
+
),
|
212
|
+
)
|
213
|
+
|
214
|
+
req = self.build_request_async(
|
215
|
+
method="POST",
|
216
|
+
path="/ingest/text",
|
217
|
+
base_url=base_url,
|
218
|
+
url_variables=url_variables,
|
219
|
+
request=request,
|
220
|
+
request_body_required=True,
|
221
|
+
request_has_path_params=False,
|
222
|
+
request_has_query_params=False,
|
223
|
+
user_agent_header="user-agent",
|
224
|
+
accept_header_value="application/json",
|
225
|
+
http_headers=http_headers,
|
226
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
227
|
+
request.process_text_input,
|
228
|
+
False,
|
229
|
+
False,
|
230
|
+
"json",
|
231
|
+
models.ProcessTextInput,
|
232
|
+
),
|
233
|
+
timeout_ms=timeout_ms,
|
234
|
+
)
|
235
|
+
|
236
|
+
if retries == UNSET:
|
237
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
238
|
+
retries = self.sdk_configuration.retry_config
|
239
|
+
|
240
|
+
retry_config = None
|
241
|
+
if isinstance(retries, utils.RetryConfig):
|
242
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
243
|
+
|
244
|
+
http_res = await self.do_request_async(
|
245
|
+
hook_ctx=HookContext(
|
246
|
+
operation_id="ingest_text_ingest_text_post",
|
247
|
+
oauth2_scopes=[],
|
248
|
+
security_source=None,
|
249
|
+
),
|
250
|
+
request=req,
|
251
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
252
|
+
retry_config=retry_config,
|
253
|
+
)
|
254
|
+
|
255
|
+
data: Any = None
|
256
|
+
if utils.match_response(http_res, "200", "application/json"):
|
257
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
258
|
+
if utils.match_response(
|
259
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
260
|
+
):
|
261
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
262
|
+
raise models.ErrorResponse(data=data)
|
263
|
+
if utils.match_response(http_res, "422", "application/json"):
|
264
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
265
|
+
raise models.HTTPValidationError(data=data)
|
266
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
267
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
268
|
+
raise models.APIError(
|
269
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
270
|
+
)
|
271
|
+
|
272
|
+
content_type = http_res.headers.get("Content-Type")
|
273
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
274
|
+
raise models.APIError(
|
275
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
276
|
+
http_res.status_code,
|
277
|
+
http_res_text,
|
278
|
+
http_res,
|
279
|
+
)
|
280
|
+
|
281
|
+
def video_from_url(
|
282
|
+
self,
|
283
|
+
*,
|
284
|
+
url: str,
|
285
|
+
collection: str,
|
286
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
287
|
+
asset_update: OptionalNullable[
|
288
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
289
|
+
] = UNSET,
|
290
|
+
metadata: Optional[
|
291
|
+
Union[
|
292
|
+
models.ProcessVideoURLInputMetadata,
|
293
|
+
models.ProcessVideoURLInputMetadataTypedDict,
|
294
|
+
]
|
295
|
+
] = None,
|
296
|
+
percolate: OptionalNullable[
|
297
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
298
|
+
] = UNSET,
|
299
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
300
|
+
feature_extractors: OptionalNullable[
|
301
|
+
Union[List[models.VideoSettings], List[models.VideoSettingsTypedDict]]
|
302
|
+
] = UNSET,
|
303
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
304
|
+
server_url: Optional[str] = None,
|
305
|
+
timeout_ms: Optional[int] = None,
|
306
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
307
|
+
) -> models.DbModelTaskResponse:
|
308
|
+
r"""Ingest Video Url
|
309
|
+
|
310
|
+
:param url: The URL of the asset to be processed. Must be a valid HTTP or HTTPS URL.
|
311
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
312
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
313
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
314
|
+
:param metadata: Additional metadata associated with the asset. Can include any key-value pairs relevant to the asset.
|
315
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
316
|
+
:param skip_duplicate: Makes feature extraction idempotent. When True and a duplicate file hash is found, copies features from the existing asset instead of reprocessing. This allows the same file to be used multiple times with different metadata while avoiding redundant processing.
|
317
|
+
:param feature_extractors: Settings for video processing. Only applicable if the URL points to a video file.
|
318
|
+
:param retries: Override the default retry configuration for this method
|
319
|
+
:param server_url: Override the default server URL for this method
|
320
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
321
|
+
:param http_headers: Additional headers to set or replace on requests.
|
322
|
+
"""
|
323
|
+
base_url = None
|
324
|
+
url_variables = None
|
325
|
+
if timeout_ms is None:
|
326
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
327
|
+
|
328
|
+
if server_url is not None:
|
329
|
+
base_url = server_url
|
330
|
+
|
331
|
+
request = models.IngestVideoURLIngestVideosURLPostRequest(
|
332
|
+
x_namespace=x_namespace,
|
333
|
+
process_video_url_input=models.ProcessVideoURLInput(
|
334
|
+
url=url,
|
335
|
+
collection=collection,
|
336
|
+
asset_update=utils.get_pydantic_model(
|
337
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
338
|
+
),
|
339
|
+
metadata=utils.get_pydantic_model(
|
340
|
+
metadata, Optional[models.ProcessVideoURLInputMetadata]
|
341
|
+
),
|
342
|
+
percolate=utils.get_pydantic_model(
|
343
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
344
|
+
),
|
345
|
+
skip_duplicate=skip_duplicate,
|
346
|
+
feature_extractors=utils.get_pydantic_model(
|
347
|
+
feature_extractors, OptionalNullable[List[models.VideoSettings]]
|
348
|
+
),
|
349
|
+
),
|
350
|
+
)
|
351
|
+
|
352
|
+
req = self.build_request(
|
353
|
+
method="POST",
|
354
|
+
path="/ingest/videos/url",
|
355
|
+
base_url=base_url,
|
356
|
+
url_variables=url_variables,
|
357
|
+
request=request,
|
358
|
+
request_body_required=True,
|
359
|
+
request_has_path_params=False,
|
360
|
+
request_has_query_params=False,
|
361
|
+
user_agent_header="user-agent",
|
362
|
+
accept_header_value="application/json",
|
363
|
+
http_headers=http_headers,
|
364
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
365
|
+
request.process_video_url_input,
|
366
|
+
False,
|
367
|
+
False,
|
368
|
+
"json",
|
369
|
+
models.ProcessVideoURLInput,
|
370
|
+
),
|
371
|
+
timeout_ms=timeout_ms,
|
372
|
+
)
|
373
|
+
|
374
|
+
if retries == UNSET:
|
375
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
376
|
+
retries = self.sdk_configuration.retry_config
|
377
|
+
|
378
|
+
retry_config = None
|
379
|
+
if isinstance(retries, utils.RetryConfig):
|
380
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
381
|
+
|
382
|
+
http_res = self.do_request(
|
383
|
+
hook_ctx=HookContext(
|
384
|
+
operation_id="ingest_video_url_ingest_videos_url_post",
|
385
|
+
oauth2_scopes=[],
|
386
|
+
security_source=None,
|
387
|
+
),
|
388
|
+
request=req,
|
389
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
390
|
+
retry_config=retry_config,
|
391
|
+
)
|
392
|
+
|
393
|
+
data: Any = None
|
394
|
+
if utils.match_response(http_res, "200", "application/json"):
|
395
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
396
|
+
if utils.match_response(
|
397
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
398
|
+
):
|
399
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
400
|
+
raise models.ErrorResponse(data=data)
|
401
|
+
if utils.match_response(http_res, "422", "application/json"):
|
402
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
403
|
+
raise models.HTTPValidationError(data=data)
|
404
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
405
|
+
http_res_text = utils.stream_to_text(http_res)
|
406
|
+
raise models.APIError(
|
407
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
408
|
+
)
|
409
|
+
|
410
|
+
content_type = http_res.headers.get("Content-Type")
|
411
|
+
http_res_text = utils.stream_to_text(http_res)
|
412
|
+
raise models.APIError(
|
413
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
414
|
+
http_res.status_code,
|
415
|
+
http_res_text,
|
416
|
+
http_res,
|
417
|
+
)
|
418
|
+
|
419
|
+
async def video_from_url_async(
|
420
|
+
self,
|
421
|
+
*,
|
422
|
+
url: str,
|
423
|
+
collection: str,
|
424
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
425
|
+
asset_update: OptionalNullable[
|
426
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
427
|
+
] = UNSET,
|
428
|
+
metadata: Optional[
|
429
|
+
Union[
|
430
|
+
models.ProcessVideoURLInputMetadata,
|
431
|
+
models.ProcessVideoURLInputMetadataTypedDict,
|
432
|
+
]
|
433
|
+
] = None,
|
434
|
+
percolate: OptionalNullable[
|
435
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
436
|
+
] = UNSET,
|
437
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
438
|
+
feature_extractors: OptionalNullable[
|
439
|
+
Union[List[models.VideoSettings], List[models.VideoSettingsTypedDict]]
|
440
|
+
] = UNSET,
|
441
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
442
|
+
server_url: Optional[str] = None,
|
443
|
+
timeout_ms: Optional[int] = None,
|
444
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
445
|
+
) -> models.DbModelTaskResponse:
|
446
|
+
r"""Ingest Video Url
|
447
|
+
|
448
|
+
:param url: The URL of the asset to be processed. Must be a valid HTTP or HTTPS URL.
|
449
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
450
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
451
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
452
|
+
:param metadata: Additional metadata associated with the asset. Can include any key-value pairs relevant to the asset.
|
453
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
454
|
+
:param skip_duplicate: Makes feature extraction idempotent. When True and a duplicate file hash is found, copies features from the existing asset instead of reprocessing. This allows the same file to be used multiple times with different metadata while avoiding redundant processing.
|
455
|
+
:param feature_extractors: Settings for video processing. Only applicable if the URL points to a video file.
|
456
|
+
:param retries: Override the default retry configuration for this method
|
457
|
+
:param server_url: Override the default server URL for this method
|
458
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
459
|
+
:param http_headers: Additional headers to set or replace on requests.
|
460
|
+
"""
|
461
|
+
base_url = None
|
462
|
+
url_variables = None
|
463
|
+
if timeout_ms is None:
|
464
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
465
|
+
|
466
|
+
if server_url is not None:
|
467
|
+
base_url = server_url
|
468
|
+
|
469
|
+
request = models.IngestVideoURLIngestVideosURLPostRequest(
|
470
|
+
x_namespace=x_namespace,
|
471
|
+
process_video_url_input=models.ProcessVideoURLInput(
|
472
|
+
url=url,
|
473
|
+
collection=collection,
|
474
|
+
asset_update=utils.get_pydantic_model(
|
475
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
476
|
+
),
|
477
|
+
metadata=utils.get_pydantic_model(
|
478
|
+
metadata, Optional[models.ProcessVideoURLInputMetadata]
|
479
|
+
),
|
480
|
+
percolate=utils.get_pydantic_model(
|
481
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
482
|
+
),
|
483
|
+
skip_duplicate=skip_duplicate,
|
484
|
+
feature_extractors=utils.get_pydantic_model(
|
485
|
+
feature_extractors, OptionalNullable[List[models.VideoSettings]]
|
486
|
+
),
|
487
|
+
),
|
488
|
+
)
|
489
|
+
|
490
|
+
req = self.build_request_async(
|
491
|
+
method="POST",
|
492
|
+
path="/ingest/videos/url",
|
493
|
+
base_url=base_url,
|
494
|
+
url_variables=url_variables,
|
495
|
+
request=request,
|
496
|
+
request_body_required=True,
|
497
|
+
request_has_path_params=False,
|
498
|
+
request_has_query_params=False,
|
499
|
+
user_agent_header="user-agent",
|
500
|
+
accept_header_value="application/json",
|
501
|
+
http_headers=http_headers,
|
502
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
503
|
+
request.process_video_url_input,
|
504
|
+
False,
|
505
|
+
False,
|
506
|
+
"json",
|
507
|
+
models.ProcessVideoURLInput,
|
508
|
+
),
|
509
|
+
timeout_ms=timeout_ms,
|
510
|
+
)
|
511
|
+
|
512
|
+
if retries == UNSET:
|
513
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
514
|
+
retries = self.sdk_configuration.retry_config
|
515
|
+
|
516
|
+
retry_config = None
|
517
|
+
if isinstance(retries, utils.RetryConfig):
|
518
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
519
|
+
|
520
|
+
http_res = await self.do_request_async(
|
521
|
+
hook_ctx=HookContext(
|
522
|
+
operation_id="ingest_video_url_ingest_videos_url_post",
|
523
|
+
oauth2_scopes=[],
|
524
|
+
security_source=None,
|
525
|
+
),
|
526
|
+
request=req,
|
527
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
528
|
+
retry_config=retry_config,
|
529
|
+
)
|
530
|
+
|
531
|
+
data: Any = None
|
532
|
+
if utils.match_response(http_res, "200", "application/json"):
|
533
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
534
|
+
if utils.match_response(
|
535
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
536
|
+
):
|
537
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
538
|
+
raise models.ErrorResponse(data=data)
|
539
|
+
if utils.match_response(http_res, "422", "application/json"):
|
540
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
541
|
+
raise models.HTTPValidationError(data=data)
|
542
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
543
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
544
|
+
raise models.APIError(
|
545
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
546
|
+
)
|
547
|
+
|
548
|
+
content_type = http_res.headers.get("Content-Type")
|
549
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
550
|
+
raise models.APIError(
|
551
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
552
|
+
http_res.status_code,
|
553
|
+
http_res_text,
|
554
|
+
http_res,
|
555
|
+
)
|
556
|
+
|
557
|
+
def image_url(
|
558
|
+
self,
|
559
|
+
*,
|
560
|
+
url: str,
|
561
|
+
collection: str,
|
562
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
563
|
+
asset_update: OptionalNullable[
|
564
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
565
|
+
] = UNSET,
|
566
|
+
metadata: Optional[
|
567
|
+
Union[
|
568
|
+
models.ProcessImageURLInputMetadata,
|
569
|
+
models.ProcessImageURLInputMetadataTypedDict,
|
570
|
+
]
|
571
|
+
] = None,
|
572
|
+
percolate: OptionalNullable[
|
573
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
574
|
+
] = UNSET,
|
575
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
576
|
+
feature_extractors: OptionalNullable[
|
577
|
+
Union[models.ImageSettings, models.ImageSettingsTypedDict]
|
578
|
+
] = UNSET,
|
579
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
580
|
+
server_url: Optional[str] = None,
|
581
|
+
timeout_ms: Optional[int] = None,
|
582
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
583
|
+
) -> models.DbModelTaskResponse:
|
584
|
+
r"""Ingest Image Url
|
585
|
+
|
586
|
+
:param url: The URL of the asset to be processed. Must be a valid HTTP or HTTPS URL.
|
587
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
588
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
589
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
590
|
+
:param metadata: Additional metadata associated with the asset. Can include any key-value pairs relevant to the asset.
|
591
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
592
|
+
:param skip_duplicate: Makes feature extraction idempotent. When True and a duplicate file hash is found, copies features from the existing asset instead of reprocessing. This allows the same file to be used multiple times with different metadata while avoiding redundant processing.
|
593
|
+
:param feature_extractors: Settings for image processing. Only applicable if the URL points to an image file.
|
594
|
+
:param retries: Override the default retry configuration for this method
|
595
|
+
:param server_url: Override the default server URL for this method
|
596
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
597
|
+
:param http_headers: Additional headers to set or replace on requests.
|
598
|
+
"""
|
599
|
+
base_url = None
|
600
|
+
url_variables = None
|
601
|
+
if timeout_ms is None:
|
602
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
603
|
+
|
604
|
+
if server_url is not None:
|
605
|
+
base_url = server_url
|
606
|
+
|
607
|
+
request = models.IngestImageURLIngestImagesURLPostRequest(
|
608
|
+
x_namespace=x_namespace,
|
609
|
+
process_image_url_input=models.ProcessImageURLInput(
|
610
|
+
url=url,
|
611
|
+
collection=collection,
|
612
|
+
asset_update=utils.get_pydantic_model(
|
613
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
614
|
+
),
|
615
|
+
metadata=utils.get_pydantic_model(
|
616
|
+
metadata, Optional[models.ProcessImageURLInputMetadata]
|
617
|
+
),
|
618
|
+
percolate=utils.get_pydantic_model(
|
619
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
620
|
+
),
|
621
|
+
skip_duplicate=skip_duplicate,
|
622
|
+
feature_extractors=utils.get_pydantic_model(
|
623
|
+
feature_extractors, OptionalNullable[models.ImageSettings]
|
624
|
+
),
|
625
|
+
),
|
626
|
+
)
|
627
|
+
|
628
|
+
req = self.build_request(
|
629
|
+
method="POST",
|
630
|
+
path="/ingest/images/url",
|
631
|
+
base_url=base_url,
|
632
|
+
url_variables=url_variables,
|
633
|
+
request=request,
|
634
|
+
request_body_required=True,
|
635
|
+
request_has_path_params=False,
|
636
|
+
request_has_query_params=False,
|
637
|
+
user_agent_header="user-agent",
|
638
|
+
accept_header_value="application/json",
|
639
|
+
http_headers=http_headers,
|
640
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
641
|
+
request.process_image_url_input,
|
642
|
+
False,
|
643
|
+
False,
|
644
|
+
"json",
|
645
|
+
models.ProcessImageURLInput,
|
646
|
+
),
|
647
|
+
timeout_ms=timeout_ms,
|
648
|
+
)
|
649
|
+
|
650
|
+
if retries == UNSET:
|
651
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
652
|
+
retries = self.sdk_configuration.retry_config
|
653
|
+
|
654
|
+
retry_config = None
|
655
|
+
if isinstance(retries, utils.RetryConfig):
|
656
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
657
|
+
|
658
|
+
http_res = self.do_request(
|
659
|
+
hook_ctx=HookContext(
|
660
|
+
operation_id="ingest_image_url_ingest_images_url_post",
|
661
|
+
oauth2_scopes=[],
|
662
|
+
security_source=None,
|
663
|
+
),
|
664
|
+
request=req,
|
665
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
666
|
+
retry_config=retry_config,
|
667
|
+
)
|
668
|
+
|
669
|
+
data: Any = None
|
670
|
+
if utils.match_response(http_res, "200", "application/json"):
|
671
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
672
|
+
if utils.match_response(
|
673
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
674
|
+
):
|
675
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
676
|
+
raise models.ErrorResponse(data=data)
|
677
|
+
if utils.match_response(http_res, "422", "application/json"):
|
678
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
679
|
+
raise models.HTTPValidationError(data=data)
|
680
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
681
|
+
http_res_text = utils.stream_to_text(http_res)
|
682
|
+
raise models.APIError(
|
683
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
684
|
+
)
|
685
|
+
|
686
|
+
content_type = http_res.headers.get("Content-Type")
|
687
|
+
http_res_text = utils.stream_to_text(http_res)
|
688
|
+
raise models.APIError(
|
689
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
690
|
+
http_res.status_code,
|
691
|
+
http_res_text,
|
692
|
+
http_res,
|
693
|
+
)
|
694
|
+
|
695
|
+
async def image_url_async(
|
696
|
+
self,
|
697
|
+
*,
|
698
|
+
url: str,
|
699
|
+
collection: str,
|
700
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
701
|
+
asset_update: OptionalNullable[
|
702
|
+
Union[models.AssetUpdate, models.AssetUpdateTypedDict]
|
703
|
+
] = UNSET,
|
704
|
+
metadata: Optional[
|
705
|
+
Union[
|
706
|
+
models.ProcessImageURLInputMetadata,
|
707
|
+
models.ProcessImageURLInputMetadataTypedDict,
|
708
|
+
]
|
709
|
+
] = None,
|
710
|
+
percolate: OptionalNullable[
|
711
|
+
Union[models.PercolateRequest, models.PercolateRequestTypedDict]
|
712
|
+
] = UNSET,
|
713
|
+
skip_duplicate: OptionalNullable[bool] = UNSET,
|
714
|
+
feature_extractors: OptionalNullable[
|
715
|
+
Union[models.ImageSettings, models.ImageSettingsTypedDict]
|
716
|
+
] = UNSET,
|
717
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
718
|
+
server_url: Optional[str] = None,
|
719
|
+
timeout_ms: Optional[int] = None,
|
720
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
721
|
+
) -> models.DbModelTaskResponse:
|
722
|
+
r"""Ingest Image Url
|
723
|
+
|
724
|
+
:param url: The URL of the asset to be processed. Must be a valid HTTP or HTTPS URL.
|
725
|
+
:param collection: Unique identifier for the collection where the processed asset will be stored, can be the collection name or collection ID. If neither exist, the collection will be created.
|
726
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
727
|
+
:param asset_update: Controls how processing results are stored - either creating a new asset or updating an existing one.
|
728
|
+
:param metadata: Additional metadata associated with the asset. Can include any key-value pairs relevant to the asset.
|
729
|
+
:param percolate: Settings for percolating the asset against stored queries.
|
730
|
+
:param skip_duplicate: Makes feature extraction idempotent. When True and a duplicate file hash is found, copies features from the existing asset instead of reprocessing. This allows the same file to be used multiple times with different metadata while avoiding redundant processing.
|
731
|
+
:param feature_extractors: Settings for image processing. Only applicable if the URL points to an image file.
|
732
|
+
:param retries: Override the default retry configuration for this method
|
733
|
+
:param server_url: Override the default server URL for this method
|
734
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
735
|
+
:param http_headers: Additional headers to set or replace on requests.
|
736
|
+
"""
|
737
|
+
base_url = None
|
738
|
+
url_variables = None
|
739
|
+
if timeout_ms is None:
|
740
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
741
|
+
|
742
|
+
if server_url is not None:
|
743
|
+
base_url = server_url
|
744
|
+
|
745
|
+
request = models.IngestImageURLIngestImagesURLPostRequest(
|
746
|
+
x_namespace=x_namespace,
|
747
|
+
process_image_url_input=models.ProcessImageURLInput(
|
748
|
+
url=url,
|
749
|
+
collection=collection,
|
750
|
+
asset_update=utils.get_pydantic_model(
|
751
|
+
asset_update, OptionalNullable[models.AssetUpdate]
|
752
|
+
),
|
753
|
+
metadata=utils.get_pydantic_model(
|
754
|
+
metadata, Optional[models.ProcessImageURLInputMetadata]
|
755
|
+
),
|
756
|
+
percolate=utils.get_pydantic_model(
|
757
|
+
percolate, OptionalNullable[models.PercolateRequest]
|
758
|
+
),
|
759
|
+
skip_duplicate=skip_duplicate,
|
760
|
+
feature_extractors=utils.get_pydantic_model(
|
761
|
+
feature_extractors, OptionalNullable[models.ImageSettings]
|
762
|
+
),
|
763
|
+
),
|
764
|
+
)
|
765
|
+
|
766
|
+
req = self.build_request_async(
|
767
|
+
method="POST",
|
768
|
+
path="/ingest/images/url",
|
769
|
+
base_url=base_url,
|
770
|
+
url_variables=url_variables,
|
771
|
+
request=request,
|
772
|
+
request_body_required=True,
|
773
|
+
request_has_path_params=False,
|
774
|
+
request_has_query_params=False,
|
775
|
+
user_agent_header="user-agent",
|
776
|
+
accept_header_value="application/json",
|
777
|
+
http_headers=http_headers,
|
778
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
779
|
+
request.process_image_url_input,
|
780
|
+
False,
|
781
|
+
False,
|
782
|
+
"json",
|
783
|
+
models.ProcessImageURLInput,
|
784
|
+
),
|
785
|
+
timeout_ms=timeout_ms,
|
786
|
+
)
|
787
|
+
|
788
|
+
if retries == UNSET:
|
789
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
790
|
+
retries = self.sdk_configuration.retry_config
|
791
|
+
|
792
|
+
retry_config = None
|
793
|
+
if isinstance(retries, utils.RetryConfig):
|
794
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
795
|
+
|
796
|
+
http_res = await self.do_request_async(
|
797
|
+
hook_ctx=HookContext(
|
798
|
+
operation_id="ingest_image_url_ingest_images_url_post",
|
799
|
+
oauth2_scopes=[],
|
800
|
+
security_source=None,
|
801
|
+
),
|
802
|
+
request=req,
|
803
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
804
|
+
retry_config=retry_config,
|
805
|
+
)
|
806
|
+
|
807
|
+
data: Any = None
|
808
|
+
if utils.match_response(http_res, "200", "application/json"):
|
809
|
+
return utils.unmarshal_json(http_res.text, models.DbModelTaskResponse)
|
810
|
+
if utils.match_response(
|
811
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
812
|
+
):
|
813
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
814
|
+
raise models.ErrorResponse(data=data)
|
815
|
+
if utils.match_response(http_res, "422", "application/json"):
|
816
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
817
|
+
raise models.HTTPValidationError(data=data)
|
818
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
819
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
820
|
+
raise models.APIError(
|
821
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
822
|
+
)
|
823
|
+
|
824
|
+
content_type = http_res.headers.get("Content-Type")
|
825
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
826
|
+
raise models.APIError(
|
827
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
828
|
+
http_res.status_code,
|
829
|
+
http_res_text,
|
830
|
+
http_res,
|
831
|
+
)
|