mixpeek 0.15.2__py3-none-any.whl → 0.16.1__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/_hooks/__init__.py +0 -1
  2. mixpeek/_hooks/sdkhooks.py +0 -2
  3. mixpeek/_version.py +1 -1
  4. mixpeek/assets.py +74 -56
  5. mixpeek/collections.py +46 -40
  6. mixpeek/{featureextractors.py → feature_extractors.py} +6 -6
  7. mixpeek/feature_search.py +334 -0
  8. mixpeek/features.py +44 -356
  9. mixpeek/health.py +3 -15
  10. mixpeek/{ingest.py → ingest_assets.py} +43 -25
  11. mixpeek/models/__init__.py +291 -160
  12. mixpeek/models/assignmentconfig.py +25 -0
  13. mixpeek/models/availablemodels.py +2 -1
  14. mixpeek/models/{availableindexesresponse.py → availablemodelsresponse.py} +8 -4
  15. mixpeek/models/classificationmatch.py +72 -0
  16. mixpeek/models/classificationwithfeature.py +73 -0
  17. mixpeek/models/classify_features_v1_entities_taxonomies_taxonomy_classify_postop.py +73 -0
  18. mixpeek/models/{create_api_key_organizations_users_user_email_api_keys_postop.py → create_api_key_v1_organizations_users_user_email_api_keys_postop.py} +2 -2
  19. mixpeek/models/{create_collection_collections_postop.py → create_collection_v1_collections_postop.py} +2 -2
  20. mixpeek/models/create_taxonomy_v1_entities_taxonomies_postop.py +59 -0
  21. mixpeek/models/createnamespacerequest.py +2 -2
  22. mixpeek/models/{delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py → delete_api_key_v1_organizations_users_user_email_api_keys_key_name_deleteop.py} +2 -2
  23. mixpeek/models/{delete_asset_assets_asset_id_deleteop.py → delete_asset_v1_assets_asset_id_deleteop.py} +2 -2
  24. mixpeek/models/delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_deleteop.py +70 -0
  25. mixpeek/models/{delete_collection_collections_collection_deleteop.py → delete_collection_v1_collections_collection_deleteop.py} +2 -2
  26. mixpeek/models/{delete_feature_features_feature_id_deleteop.py → delete_feature_v1_features_feature_id_deleteop.py} +2 -2
  27. mixpeek/models/{delete_namespace_namespaces_namespace_deleteop.py → delete_namespace_v1_namespaces_namespace_deleteop.py} +2 -2
  28. mixpeek/models/delete_taxonomy_v1_entities_taxonomies_taxonomy_deleteop.py +59 -0
  29. mixpeek/models/{delete_user_organizations_users_user_email_deleteop.py → delete_user_v1_organizations_users_user_email_deleteop.py} +2 -2
  30. mixpeek/models/discoverrequest.py +74 -0
  31. mixpeek/models/embeddingconfig.py +33 -0
  32. mixpeek/models/embeddingrequest.py +40 -7
  33. mixpeek/models/featureoptions.py +25 -0
  34. mixpeek/models/{full_asset_update_assets_asset_id_putop.py → full_asset_update_v1_assets_asset_id_putop.py} +2 -2
  35. mixpeek/models/{full_feature_update_features_feature_id_putop.py → full_feature_update_v1_features_feature_id_putop.py} +2 -2
  36. mixpeek/models/genericsuccessresponse.py +17 -0
  37. mixpeek/models/{get_asset_assets_asset_id_getop.py → get_asset_v1_assets_asset_id_getop.py} +2 -2
  38. mixpeek/models/{get_asset_with_features_assets_asset_id_features_getop.py → get_asset_with_features_v1_assets_asset_id_features_getop.py} +2 -2
  39. mixpeek/models/{get_collection_collections_collection_getop.py → get_collection_v1_collections_collection_getop.py} +2 -2
  40. mixpeek/models/{get_feature_features_feature_id_getop.py → get_feature_v1_features_feature_id_getop.py} +2 -2
  41. mixpeek/models/{get_namespace_namespaces_namespace_getop.py → get_namespace_v1_namespaces_namespace_getop.py} +2 -2
  42. mixpeek/models/{get_task_tasks_task_id_getop.py → get_task_v1_tasks_task_id_getop.py} +2 -2
  43. mixpeek/models/get_taxonomy_node_v1_entities_taxonomies_nodes_node_getop.py +59 -0
  44. mixpeek/models/get_taxonomy_v1_entities_taxonomies_taxonomy_getop.py +59 -0
  45. mixpeek/models/{get_user_organizations_users_user_email_getop.py → get_user_v1_organizations_users_user_email_getop.py} +2 -2
  46. mixpeek/models/{ingest_image_url_ingest_images_url_postop.py → ingest_image_url_v1_ingest_images_url_postop.py} +2 -2
  47. mixpeek/models/{ingest_text_ingest_text_postop.py → ingest_text_v1_ingest_text_postop.py} +2 -2
  48. mixpeek/models/{ingest_video_url_ingest_videos_url_postop.py → ingest_video_url_v1_ingest_videos_url_postop.py} +2 -2
  49. mixpeek/models/{kill_task_tasks_task_id_deleteop.py → kill_task_v1_tasks_task_id_deleteop.py} +2 -2
  50. mixpeek/models/{list_assets_assets_postop.py → list_assets_v1_assets_postop.py} +2 -2
  51. mixpeek/models/list_classifications_v1_entities_taxonomies_taxonomy_classifications_postop.py +92 -0
  52. mixpeek/models/{list_collections_collections_getop.py → list_collections_v1_collections_getop.py} +2 -2
  53. mixpeek/models/{list_features_features_postop.py → list_features_v1_features_postop.py} +2 -2
  54. mixpeek/models/list_taxonomies_v1_entities_taxonomies_getop.py +67 -0
  55. mixpeek/models/listclassificationsrequest.py +69 -0
  56. mixpeek/models/listclassificationsresponse.py +31 -0
  57. mixpeek/models/listtaxonomiesresponse.py +24 -0
  58. mixpeek/models/modeldetails.py +9 -5
  59. mixpeek/models/nodeoptions.py +16 -0
  60. mixpeek/models/nodeupdate.py +51 -0
  61. mixpeek/models/{partial_asset_update_assets_asset_id_patchop.py → partial_asset_update_v1_assets_asset_id_patchop.py} +2 -2
  62. mixpeek/models/permission.py +12 -0
  63. mixpeek/models/{search_assets_assets_search_postop.py → search_assets_v1_assets_search_postop.py} +2 -2
  64. mixpeek/models/{search_features_features_search_postop.py → search_features_v1_features_search_postop.py} +4 -4
  65. mixpeek/models/searchrequestfeatures.py +9 -7
  66. mixpeek/models/taxonomycreate.py +20 -0
  67. mixpeek/models/taxonomymodel.py +27 -0
  68. mixpeek/models/taxonomynode.py +101 -0
  69. mixpeek/models/taxonomynodecreate.py +63 -0
  70. mixpeek/models/taxonomyupdate.py +55 -0
  71. mixpeek/models/{update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py → update_api_key_v1_organizations_users_user_email_api_keys_key_name_patchop.py} +2 -2
  72. mixpeek/models/{update_collection_collections_collection_putop.py → update_collection_v1_collections_collection_putop.py} +2 -2
  73. mixpeek/models/{update_namespace_namespaces_namespace_putop.py → update_namespace_v1_namespaces_namespace_putop.py} +2 -2
  74. mixpeek/models/update_node_v1_entities_taxonomies_nodes_node_patchop.py +71 -0
  75. mixpeek/models/update_taxonomy_v1_entities_taxonomies_taxonomy_patchop.py +71 -0
  76. mixpeek/models/vectormodel.py +1 -0
  77. mixpeek/namespaces.py +52 -52
  78. mixpeek/organizations.py +82 -58
  79. mixpeek/sdk.py +12 -6
  80. mixpeek/sdkconfiguration.py +4 -4
  81. mixpeek/tasks.py +22 -16
  82. mixpeek/taxonomy_entities.py +2214 -0
  83. {mixpeek-0.15.2.dist-info → mixpeek-0.16.1.dist-info}/METADATA +64 -49
  84. {mixpeek-0.15.2.dist-info → mixpeek-0.16.1.dist-info}/RECORD +85 -56
  85. {mixpeek-0.15.2.dist-info → mixpeek-0.16.1.dist-info}/WHEEL +1 -1
@@ -0,0 +1,334 @@
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 mixpeek.utils import get_security_from_env
8
+ from typing import Any, List, Mapping, Optional, Union
9
+
10
+
11
+ class FeatureSearch(BaseSDK):
12
+ def search_features_v1_features_search_post(
13
+ self,
14
+ *,
15
+ collections: List[str],
16
+ offset_position: OptionalNullable[int] = UNSET,
17
+ page_size: Optional[int] = 10,
18
+ x_namespace: OptionalNullable[str] = UNSET,
19
+ queries: OptionalNullable[
20
+ Union[
21
+ List[models.SearchModelSearchQuery],
22
+ List[models.SearchModelSearchQueryTypedDict],
23
+ ]
24
+ ] = UNSET,
25
+ filters: OptionalNullable[
26
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
27
+ ] = UNSET,
28
+ group_by: OptionalNullable[
29
+ Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
30
+ ] = UNSET,
31
+ sort: OptionalNullable[
32
+ Union[models.SortOption, models.SortOptionTypedDict]
33
+ ] = UNSET,
34
+ select: OptionalNullable[List[str]] = UNSET,
35
+ reranking_options: OptionalNullable[
36
+ Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
37
+ ] = UNSET,
38
+ session_id: OptionalNullable[str] = UNSET,
39
+ return_url: OptionalNullable[bool] = UNSET,
40
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
41
+ server_url: Optional[str] = None,
42
+ timeout_ms: Optional[int] = None,
43
+ http_headers: Optional[Mapping[str, str]] = None,
44
+ ) -> models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost:
45
+ r"""Search Features
46
+
47
+ This endpoint allows you to search features.
48
+
49
+ :param collections: List of Collection names to search within, required
50
+ :param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
51
+ :param page_size: Number of results to return per page.
52
+ :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.
53
+ :param queries: List of search queries to perform. Behavior: - Single query: Results are returned directly from that query - Multiple queries: Results are combined using Reciprocal Rank Fusion (RRF) RRF combines results from multiple queries by: 1. Taking each item's rank position in each result list 2. Re-ranking all items by their combined RRF scores When merging lists from different sources, RRF considers all items that appear in any of the input lists, not just items that appear in all lists. This helps surface items that rank well across multiple queries while reducing the impact of outlier high rankings in single queries. NOTE: If query array is empty, it will return all features.
54
+ :param filters: Used for filtering across all indexes
55
+ :param group_by: Grouping options for search results
56
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
57
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
58
+ :param reranking_options: Options for ranking the search results, including weights and feedback application
59
+ :param session_id: Identifier for tracking search session interactions
60
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
61
+ :param retries: Override the default retry configuration for this method
62
+ :param server_url: Override the default server URL for this method
63
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
64
+ :param http_headers: Additional headers to set or replace on requests.
65
+ """
66
+ base_url = None
67
+ url_variables = None
68
+ if timeout_ms is None:
69
+ timeout_ms = self.sdk_configuration.timeout_ms
70
+
71
+ if server_url is not None:
72
+ base_url = server_url
73
+
74
+ request = models.SearchFeaturesV1FeaturesSearchPostRequest(
75
+ offset_position=offset_position,
76
+ page_size=page_size,
77
+ x_namespace=x_namespace,
78
+ search_request_features=models.SearchRequestFeatures(
79
+ queries=utils.get_pydantic_model(
80
+ queries, OptionalNullable[List[models.SearchModelSearchQuery]]
81
+ ),
82
+ collections=collections,
83
+ filters=utils.get_pydantic_model(
84
+ filters, OptionalNullable[models.LogicalOperator]
85
+ ),
86
+ group_by=utils.get_pydantic_model(
87
+ group_by, OptionalNullable[models.GroupByOptions]
88
+ ),
89
+ sort=utils.get_pydantic_model(
90
+ sort, OptionalNullable[models.SortOption]
91
+ ),
92
+ select=select,
93
+ reranking_options=utils.get_pydantic_model(
94
+ reranking_options, OptionalNullable[models.RerankingOptions]
95
+ ),
96
+ session_id=session_id,
97
+ return_url=return_url,
98
+ ),
99
+ )
100
+
101
+ req = self._build_request(
102
+ method="POST",
103
+ path="/v1/features/search",
104
+ base_url=base_url,
105
+ url_variables=url_variables,
106
+ request=request,
107
+ request_body_required=True,
108
+ request_has_path_params=False,
109
+ request_has_query_params=True,
110
+ user_agent_header="user-agent",
111
+ accept_header_value="application/json",
112
+ http_headers=http_headers,
113
+ security=self.sdk_configuration.security,
114
+ get_serialized_body=lambda: utils.serialize_request_body(
115
+ request.search_request_features,
116
+ False,
117
+ False,
118
+ "json",
119
+ models.SearchRequestFeatures,
120
+ ),
121
+ timeout_ms=timeout_ms,
122
+ )
123
+
124
+ if retries == UNSET:
125
+ if self.sdk_configuration.retry_config is not UNSET:
126
+ retries = self.sdk_configuration.retry_config
127
+
128
+ retry_config = None
129
+ if isinstance(retries, utils.RetryConfig):
130
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
131
+
132
+ http_res = self.do_request(
133
+ hook_ctx=HookContext(
134
+ operation_id="search_features_v1_features_search_post",
135
+ oauth2_scopes=[],
136
+ security_source=get_security_from_env(
137
+ self.sdk_configuration.security, models.Security
138
+ ),
139
+ ),
140
+ request=req,
141
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
142
+ retry_config=retry_config,
143
+ )
144
+
145
+ data: Any = None
146
+ if utils.match_response(http_res, "200", "application/json"):
147
+ return utils.unmarshal_json(
148
+ http_res.text,
149
+ models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost,
150
+ )
151
+ if utils.match_response(
152
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
153
+ ):
154
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
155
+ raise models.ErrorResponse(data=data)
156
+ if utils.match_response(http_res, "422", "application/json"):
157
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
158
+ raise models.HTTPValidationError(data=data)
159
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
160
+ http_res_text = utils.stream_to_text(http_res)
161
+ raise models.APIError(
162
+ "API error occurred", http_res.status_code, http_res_text, http_res
163
+ )
164
+
165
+ content_type = http_res.headers.get("Content-Type")
166
+ http_res_text = utils.stream_to_text(http_res)
167
+ raise models.APIError(
168
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
169
+ http_res.status_code,
170
+ http_res_text,
171
+ http_res,
172
+ )
173
+
174
+ async def search_features_v1_features_search_post_async(
175
+ self,
176
+ *,
177
+ collections: List[str],
178
+ offset_position: OptionalNullable[int] = UNSET,
179
+ page_size: Optional[int] = 10,
180
+ x_namespace: OptionalNullable[str] = UNSET,
181
+ queries: OptionalNullable[
182
+ Union[
183
+ List[models.SearchModelSearchQuery],
184
+ List[models.SearchModelSearchQueryTypedDict],
185
+ ]
186
+ ] = UNSET,
187
+ filters: OptionalNullable[
188
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
189
+ ] = UNSET,
190
+ group_by: OptionalNullable[
191
+ Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
192
+ ] = UNSET,
193
+ sort: OptionalNullable[
194
+ Union[models.SortOption, models.SortOptionTypedDict]
195
+ ] = UNSET,
196
+ select: OptionalNullable[List[str]] = UNSET,
197
+ reranking_options: OptionalNullable[
198
+ Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
199
+ ] = UNSET,
200
+ session_id: OptionalNullable[str] = UNSET,
201
+ return_url: OptionalNullable[bool] = UNSET,
202
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
203
+ server_url: Optional[str] = None,
204
+ timeout_ms: Optional[int] = None,
205
+ http_headers: Optional[Mapping[str, str]] = None,
206
+ ) -> models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost:
207
+ r"""Search Features
208
+
209
+ This endpoint allows you to search features.
210
+
211
+ :param collections: List of Collection names to search within, required
212
+ :param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
213
+ :param page_size: Number of results to return per page.
214
+ :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.
215
+ :param queries: List of search queries to perform. Behavior: - Single query: Results are returned directly from that query - Multiple queries: Results are combined using Reciprocal Rank Fusion (RRF) RRF combines results from multiple queries by: 1. Taking each item's rank position in each result list 2. Re-ranking all items by their combined RRF scores When merging lists from different sources, RRF considers all items that appear in any of the input lists, not just items that appear in all lists. This helps surface items that rank well across multiple queries while reducing the impact of outlier high rankings in single queries. NOTE: If query array is empty, it will return all features.
216
+ :param filters: Used for filtering across all indexes
217
+ :param group_by: Grouping options for search results
218
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
219
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
220
+ :param reranking_options: Options for ranking the search results, including weights and feedback application
221
+ :param session_id: Identifier for tracking search session interactions
222
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
223
+ :param retries: Override the default retry configuration for this method
224
+ :param server_url: Override the default server URL for this method
225
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
226
+ :param http_headers: Additional headers to set or replace on requests.
227
+ """
228
+ base_url = None
229
+ url_variables = None
230
+ if timeout_ms is None:
231
+ timeout_ms = self.sdk_configuration.timeout_ms
232
+
233
+ if server_url is not None:
234
+ base_url = server_url
235
+
236
+ request = models.SearchFeaturesV1FeaturesSearchPostRequest(
237
+ offset_position=offset_position,
238
+ page_size=page_size,
239
+ x_namespace=x_namespace,
240
+ search_request_features=models.SearchRequestFeatures(
241
+ queries=utils.get_pydantic_model(
242
+ queries, OptionalNullable[List[models.SearchModelSearchQuery]]
243
+ ),
244
+ collections=collections,
245
+ filters=utils.get_pydantic_model(
246
+ filters, OptionalNullable[models.LogicalOperator]
247
+ ),
248
+ group_by=utils.get_pydantic_model(
249
+ group_by, OptionalNullable[models.GroupByOptions]
250
+ ),
251
+ sort=utils.get_pydantic_model(
252
+ sort, OptionalNullable[models.SortOption]
253
+ ),
254
+ select=select,
255
+ reranking_options=utils.get_pydantic_model(
256
+ reranking_options, OptionalNullable[models.RerankingOptions]
257
+ ),
258
+ session_id=session_id,
259
+ return_url=return_url,
260
+ ),
261
+ )
262
+
263
+ req = self._build_request_async(
264
+ method="POST",
265
+ path="/v1/features/search",
266
+ base_url=base_url,
267
+ url_variables=url_variables,
268
+ request=request,
269
+ request_body_required=True,
270
+ request_has_path_params=False,
271
+ request_has_query_params=True,
272
+ user_agent_header="user-agent",
273
+ accept_header_value="application/json",
274
+ http_headers=http_headers,
275
+ security=self.sdk_configuration.security,
276
+ get_serialized_body=lambda: utils.serialize_request_body(
277
+ request.search_request_features,
278
+ False,
279
+ False,
280
+ "json",
281
+ models.SearchRequestFeatures,
282
+ ),
283
+ timeout_ms=timeout_ms,
284
+ )
285
+
286
+ if retries == UNSET:
287
+ if self.sdk_configuration.retry_config is not UNSET:
288
+ retries = self.sdk_configuration.retry_config
289
+
290
+ retry_config = None
291
+ if isinstance(retries, utils.RetryConfig):
292
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
293
+
294
+ http_res = await self.do_request_async(
295
+ hook_ctx=HookContext(
296
+ operation_id="search_features_v1_features_search_post",
297
+ oauth2_scopes=[],
298
+ security_source=get_security_from_env(
299
+ self.sdk_configuration.security, models.Security
300
+ ),
301
+ ),
302
+ request=req,
303
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
304
+ retry_config=retry_config,
305
+ )
306
+
307
+ data: Any = None
308
+ if utils.match_response(http_res, "200", "application/json"):
309
+ return utils.unmarshal_json(
310
+ http_res.text,
311
+ models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost,
312
+ )
313
+ if utils.match_response(
314
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
315
+ ):
316
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
317
+ raise models.ErrorResponse(data=data)
318
+ if utils.match_response(http_res, "422", "application/json"):
319
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
320
+ raise models.HTTPValidationError(data=data)
321
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
322
+ http_res_text = await utils.stream_to_text_async(http_res)
323
+ raise models.APIError(
324
+ "API error occurred", http_res.status_code, http_res_text, http_res
325
+ )
326
+
327
+ content_type = http_res.headers.get("Content-Type")
328
+ http_res_text = await utils.stream_to_text_async(http_res)
329
+ raise models.APIError(
330
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
331
+ http_res.status_code,
332
+ http_res_text,
333
+ http_res,
334
+ )