mixpeek 0.17.9__py3-none-any.whl → 0.18.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.
- mixpeek/_version.py +2 -2
- mixpeek/assets.py +14 -14
- mixpeek/collections.py +10 -10
- mixpeek/{feature_extractors.py → featureextractors.py} +2 -2
- mixpeek/features.py +348 -8
- mixpeek/{ingest_assets.py → ingestassets.py} +6 -6
- mixpeek/namespaces.py +12 -12
- mixpeek/organizations.py +10 -626
- mixpeek/sdk.py +9 -6
- mixpeek/tasks.py +6 -6
- mixpeek/taxonomies.py +686 -0
- mixpeek/{taxonomy_entities.py → taxonomyentities.py} +14 -690
- mixpeek/users.py +626 -0
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.1.dist-info}/METADATA +57 -54
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.1.dist-info}/RECORD +16 -15
- mixpeek/feature_search.py +0 -350
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.1.dist-info}/WHEEL +0 -0
mixpeek/_version.py
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
import importlib.metadata
|
4
4
|
|
5
5
|
__title__: str = "mixpeek"
|
6
|
-
__version__: str = "0.
|
6
|
+
__version__: str = "0.18.1"
|
7
7
|
__openapi_doc_version__: str = "0.81"
|
8
8
|
__gen_version__: str = "2.493.32"
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.18.1 2.493.32 0.81 mixpeek"
|
10
10
|
|
11
11
|
try:
|
12
12
|
if __package__ is not None:
|
mixpeek/assets.py
CHANGED
@@ -9,7 +9,7 @@ from typing import Any, List, Mapping, Optional, Union
|
|
9
9
|
|
10
10
|
|
11
11
|
class Assets(BaseSDK):
|
12
|
-
def
|
12
|
+
def get(
|
13
13
|
self,
|
14
14
|
*,
|
15
15
|
asset_id: str,
|
@@ -117,7 +117,7 @@ class Assets(BaseSDK):
|
|
117
117
|
http_res,
|
118
118
|
)
|
119
119
|
|
120
|
-
async def
|
120
|
+
async def get_async(
|
121
121
|
self,
|
122
122
|
*,
|
123
123
|
asset_id: str,
|
@@ -225,7 +225,7 @@ class Assets(BaseSDK):
|
|
225
225
|
http_res,
|
226
226
|
)
|
227
227
|
|
228
|
-
def
|
228
|
+
def delete(
|
229
229
|
self,
|
230
230
|
*,
|
231
231
|
asset_id: str,
|
@@ -331,7 +331,7 @@ class Assets(BaseSDK):
|
|
331
331
|
http_res,
|
332
332
|
)
|
333
333
|
|
334
|
-
async def
|
334
|
+
async def delete_async(
|
335
335
|
self,
|
336
336
|
*,
|
337
337
|
asset_id: str,
|
@@ -437,7 +437,7 @@ class Assets(BaseSDK):
|
|
437
437
|
http_res,
|
438
438
|
)
|
439
439
|
|
440
|
-
def
|
440
|
+
def update(
|
441
441
|
self,
|
442
442
|
*,
|
443
443
|
asset_id: str,
|
@@ -565,7 +565,7 @@ class Assets(BaseSDK):
|
|
565
565
|
http_res,
|
566
566
|
)
|
567
567
|
|
568
|
-
async def
|
568
|
+
async def update_async(
|
569
569
|
self,
|
570
570
|
*,
|
571
571
|
asset_id: str,
|
@@ -693,7 +693,7 @@ class Assets(BaseSDK):
|
|
693
693
|
http_res,
|
694
694
|
)
|
695
695
|
|
696
|
-
def
|
696
|
+
def partial_update(
|
697
697
|
self,
|
698
698
|
*,
|
699
699
|
asset_id: str,
|
@@ -821,7 +821,7 @@ class Assets(BaseSDK):
|
|
821
821
|
http_res,
|
822
822
|
)
|
823
823
|
|
824
|
-
async def
|
824
|
+
async def partial_update_async(
|
825
825
|
self,
|
826
826
|
*,
|
827
827
|
asset_id: str,
|
@@ -949,7 +949,7 @@ class Assets(BaseSDK):
|
|
949
949
|
http_res,
|
950
950
|
)
|
951
951
|
|
952
|
-
def
|
952
|
+
def get_with_features(
|
953
953
|
self,
|
954
954
|
*,
|
955
955
|
asset_id: str,
|
@@ -1057,7 +1057,7 @@ class Assets(BaseSDK):
|
|
1057
1057
|
http_res,
|
1058
1058
|
)
|
1059
1059
|
|
1060
|
-
async def
|
1060
|
+
async def get_with_features_async(
|
1061
1061
|
self,
|
1062
1062
|
*,
|
1063
1063
|
asset_id: str,
|
@@ -1165,7 +1165,7 @@ class Assets(BaseSDK):
|
|
1165
1165
|
http_res,
|
1166
1166
|
)
|
1167
1167
|
|
1168
|
-
def
|
1168
|
+
def list(
|
1169
1169
|
self,
|
1170
1170
|
*,
|
1171
1171
|
collections: List[str],
|
@@ -1310,7 +1310,7 @@ class Assets(BaseSDK):
|
|
1310
1310
|
http_res,
|
1311
1311
|
)
|
1312
1312
|
|
1313
|
-
async def
|
1313
|
+
async def list_async(
|
1314
1314
|
self,
|
1315
1315
|
*,
|
1316
1316
|
collections: List[str],
|
@@ -1455,7 +1455,7 @@ class Assets(BaseSDK):
|
|
1455
1455
|
http_res,
|
1456
1456
|
)
|
1457
1457
|
|
1458
|
-
def
|
1458
|
+
def search(
|
1459
1459
|
self,
|
1460
1460
|
*,
|
1461
1461
|
collections: List[str],
|
@@ -1594,7 +1594,7 @@ class Assets(BaseSDK):
|
|
1594
1594
|
http_res,
|
1595
1595
|
)
|
1596
1596
|
|
1597
|
-
async def
|
1597
|
+
async def search_async(
|
1598
1598
|
self,
|
1599
1599
|
*,
|
1600
1600
|
collections: List[str],
|
mixpeek/collections.py
CHANGED
@@ -9,7 +9,7 @@ from typing import Any, Mapping, Optional, Union
|
|
9
9
|
|
10
10
|
|
11
11
|
class Collections(BaseSDK):
|
12
|
-
def
|
12
|
+
def list(
|
13
13
|
self,
|
14
14
|
*,
|
15
15
|
page: OptionalNullable[int] = UNSET,
|
@@ -115,7 +115,7 @@ class Collections(BaseSDK):
|
|
115
115
|
http_res,
|
116
116
|
)
|
117
117
|
|
118
|
-
async def
|
118
|
+
async def list_async(
|
119
119
|
self,
|
120
120
|
*,
|
121
121
|
page: OptionalNullable[int] = UNSET,
|
@@ -221,7 +221,7 @@ class Collections(BaseSDK):
|
|
221
221
|
http_res,
|
222
222
|
)
|
223
223
|
|
224
|
-
def
|
224
|
+
def create(
|
225
225
|
self,
|
226
226
|
*,
|
227
227
|
collection_name: str,
|
@@ -346,7 +346,7 @@ class Collections(BaseSDK):
|
|
346
346
|
http_res,
|
347
347
|
)
|
348
348
|
|
349
|
-
async def
|
349
|
+
async def create_async(
|
350
350
|
self,
|
351
351
|
*,
|
352
352
|
collection_name: str,
|
@@ -471,7 +471,7 @@ class Collections(BaseSDK):
|
|
471
471
|
http_res,
|
472
472
|
)
|
473
473
|
|
474
|
-
def
|
474
|
+
def delete(
|
475
475
|
self,
|
476
476
|
*,
|
477
477
|
collection: str,
|
@@ -576,7 +576,7 @@ class Collections(BaseSDK):
|
|
576
576
|
http_res,
|
577
577
|
)
|
578
578
|
|
579
|
-
async def
|
579
|
+
async def delete_async(
|
580
580
|
self,
|
581
581
|
*,
|
582
582
|
collection: str,
|
@@ -681,7 +681,7 @@ class Collections(BaseSDK):
|
|
681
681
|
http_res,
|
682
682
|
)
|
683
683
|
|
684
|
-
def
|
684
|
+
def update(
|
685
685
|
self,
|
686
686
|
*,
|
687
687
|
collection: str,
|
@@ -808,7 +808,7 @@ class Collections(BaseSDK):
|
|
808
808
|
http_res,
|
809
809
|
)
|
810
810
|
|
811
|
-
async def
|
811
|
+
async def update_async(
|
812
812
|
self,
|
813
813
|
*,
|
814
814
|
collection: str,
|
@@ -935,7 +935,7 @@ class Collections(BaseSDK):
|
|
935
935
|
http_res,
|
936
936
|
)
|
937
937
|
|
938
|
-
def
|
938
|
+
def get(
|
939
939
|
self,
|
940
940
|
*,
|
941
941
|
collection: str,
|
@@ -1040,7 +1040,7 @@ class Collections(BaseSDK):
|
|
1040
1040
|
http_res,
|
1041
1041
|
)
|
1042
1042
|
|
1043
|
-
async def
|
1043
|
+
async def get_async(
|
1044
1044
|
self,
|
1045
1045
|
*,
|
1046
1046
|
collection: str,
|
@@ -9,7 +9,7 @@ from typing import Any, Mapping, Optional
|
|
9
9
|
|
10
10
|
|
11
11
|
class FeatureExtractors(BaseSDK):
|
12
|
-
def
|
12
|
+
def extract_embeddings(
|
13
13
|
self,
|
14
14
|
*,
|
15
15
|
type_: models.InputType,
|
@@ -118,7 +118,7 @@ class FeatureExtractors(BaseSDK):
|
|
118
118
|
http_res,
|
119
119
|
)
|
120
120
|
|
121
|
-
async def
|
121
|
+
async def extract_embeddings_async(
|
122
122
|
self,
|
123
123
|
*,
|
124
124
|
type_: models.InputType,
|
mixpeek/features.py
CHANGED
@@ -9,7 +9,7 @@ from typing import Any, List, Mapping, Optional, Union
|
|
9
9
|
|
10
10
|
|
11
11
|
class Features(BaseSDK):
|
12
|
-
def
|
12
|
+
def get(
|
13
13
|
self,
|
14
14
|
*,
|
15
15
|
feature_id: str,
|
@@ -115,7 +115,7 @@ class Features(BaseSDK):
|
|
115
115
|
http_res,
|
116
116
|
)
|
117
117
|
|
118
|
-
async def
|
118
|
+
async def get_async(
|
119
119
|
self,
|
120
120
|
*,
|
121
121
|
feature_id: str,
|
@@ -221,7 +221,7 @@ class Features(BaseSDK):
|
|
221
221
|
http_res,
|
222
222
|
)
|
223
223
|
|
224
|
-
def
|
224
|
+
def delete(
|
225
225
|
self,
|
226
226
|
*,
|
227
227
|
feature_id: str,
|
@@ -327,7 +327,7 @@ class Features(BaseSDK):
|
|
327
327
|
http_res,
|
328
328
|
)
|
329
329
|
|
330
|
-
async def
|
330
|
+
async def delete_async(
|
331
331
|
self,
|
332
332
|
*,
|
333
333
|
feature_id: str,
|
@@ -433,7 +433,7 @@ class Features(BaseSDK):
|
|
433
433
|
http_res,
|
434
434
|
)
|
435
435
|
|
436
|
-
def
|
436
|
+
def update(
|
437
437
|
self,
|
438
438
|
*,
|
439
439
|
feature_id: str,
|
@@ -556,7 +556,7 @@ class Features(BaseSDK):
|
|
556
556
|
http_res,
|
557
557
|
)
|
558
558
|
|
559
|
-
async def
|
559
|
+
async def update_async(
|
560
560
|
self,
|
561
561
|
*,
|
562
562
|
feature_id: str,
|
@@ -679,7 +679,7 @@ class Features(BaseSDK):
|
|
679
679
|
http_res,
|
680
680
|
)
|
681
681
|
|
682
|
-
def
|
682
|
+
def list(
|
683
683
|
self,
|
684
684
|
*,
|
685
685
|
collections: List[str],
|
@@ -821,7 +821,7 @@ class Features(BaseSDK):
|
|
821
821
|
http_res,
|
822
822
|
)
|
823
823
|
|
824
|
-
async def
|
824
|
+
async def list_async(
|
825
825
|
self,
|
826
826
|
*,
|
827
827
|
collections: List[str],
|
@@ -962,3 +962,343 @@ class Features(BaseSDK):
|
|
962
962
|
http_res_text,
|
963
963
|
http_res,
|
964
964
|
)
|
965
|
+
|
966
|
+
def search(
|
967
|
+
self,
|
968
|
+
*,
|
969
|
+
collections: List[str],
|
970
|
+
offset_position: OptionalNullable[int] = UNSET,
|
971
|
+
page_size: Optional[int] = 10,
|
972
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
973
|
+
queries: OptionalNullable[
|
974
|
+
Union[
|
975
|
+
List[models.SearchModelSearchQuery],
|
976
|
+
List[models.SearchModelSearchQueryTypedDict],
|
977
|
+
]
|
978
|
+
] = UNSET,
|
979
|
+
filters: OptionalNullable[
|
980
|
+
Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
|
981
|
+
] = UNSET,
|
982
|
+
group_by: OptionalNullable[
|
983
|
+
Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
|
984
|
+
] = UNSET,
|
985
|
+
sort: OptionalNullable[
|
986
|
+
Union[models.SortOption, models.SortOptionTypedDict]
|
987
|
+
] = UNSET,
|
988
|
+
select: OptionalNullable[List[str]] = UNSET,
|
989
|
+
reranking_options: OptionalNullable[
|
990
|
+
Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
|
991
|
+
] = UNSET,
|
992
|
+
session_id: OptionalNullable[str] = UNSET,
|
993
|
+
return_url: OptionalNullable[bool] = UNSET,
|
994
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
995
|
+
server_url: Optional[str] = None,
|
996
|
+
timeout_ms: Optional[int] = None,
|
997
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
998
|
+
) -> models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost:
|
999
|
+
r"""Search Features
|
1000
|
+
|
1001
|
+
This endpoint allows you to search features.
|
1002
|
+
|
1003
|
+
:param collections: List of Collection names to search within, required
|
1004
|
+
:param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
|
1005
|
+
:param page_size: Number of results to return per page.
|
1006
|
+
: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.
|
1007
|
+
: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.
|
1008
|
+
:param filters: Used for filtering across all indexes
|
1009
|
+
:param group_by: Grouping options for search results
|
1010
|
+
:param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
|
1011
|
+
:param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
|
1012
|
+
:param reranking_options: Options for ranking the search results, including weights and feedback application
|
1013
|
+
:param session_id: Identifier for tracking search session interactions
|
1014
|
+
:param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
|
1015
|
+
:param retries: Override the default retry configuration for this method
|
1016
|
+
:param server_url: Override the default server URL for this method
|
1017
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1018
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1019
|
+
"""
|
1020
|
+
base_url = None
|
1021
|
+
url_variables = None
|
1022
|
+
if timeout_ms is None:
|
1023
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1024
|
+
|
1025
|
+
if server_url is not None:
|
1026
|
+
base_url = server_url
|
1027
|
+
|
1028
|
+
request = models.SearchFeaturesV1FeaturesSearchPostRequest(
|
1029
|
+
offset_position=offset_position,
|
1030
|
+
page_size=page_size,
|
1031
|
+
x_namespace=x_namespace,
|
1032
|
+
search_request_features=models.SearchRequestFeatures(
|
1033
|
+
queries=utils.get_pydantic_model(
|
1034
|
+
queries, OptionalNullable[List[models.SearchModelSearchQuery]]
|
1035
|
+
),
|
1036
|
+
collections=collections,
|
1037
|
+
filters=utils.get_pydantic_model(
|
1038
|
+
filters, OptionalNullable[models.LogicalOperator]
|
1039
|
+
),
|
1040
|
+
group_by=utils.get_pydantic_model(
|
1041
|
+
group_by, OptionalNullable[models.GroupByOptions]
|
1042
|
+
),
|
1043
|
+
sort=utils.get_pydantic_model(
|
1044
|
+
sort, OptionalNullable[models.SortOption]
|
1045
|
+
),
|
1046
|
+
select=select,
|
1047
|
+
reranking_options=utils.get_pydantic_model(
|
1048
|
+
reranking_options, OptionalNullable[models.RerankingOptions]
|
1049
|
+
),
|
1050
|
+
session_id=session_id,
|
1051
|
+
return_url=return_url,
|
1052
|
+
),
|
1053
|
+
)
|
1054
|
+
|
1055
|
+
req = self._build_request(
|
1056
|
+
method="POST",
|
1057
|
+
path="/v1/features/search",
|
1058
|
+
base_url=base_url,
|
1059
|
+
url_variables=url_variables,
|
1060
|
+
request=request,
|
1061
|
+
request_body_required=True,
|
1062
|
+
request_has_path_params=False,
|
1063
|
+
request_has_query_params=True,
|
1064
|
+
user_agent_header="user-agent",
|
1065
|
+
accept_header_value="application/json",
|
1066
|
+
http_headers=http_headers,
|
1067
|
+
security=self.sdk_configuration.security,
|
1068
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
1069
|
+
request.search_request_features,
|
1070
|
+
False,
|
1071
|
+
False,
|
1072
|
+
"json",
|
1073
|
+
models.SearchRequestFeatures,
|
1074
|
+
),
|
1075
|
+
timeout_ms=timeout_ms,
|
1076
|
+
)
|
1077
|
+
|
1078
|
+
if retries == UNSET:
|
1079
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1080
|
+
retries = self.sdk_configuration.retry_config
|
1081
|
+
|
1082
|
+
retry_config = None
|
1083
|
+
if isinstance(retries, utils.RetryConfig):
|
1084
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1085
|
+
|
1086
|
+
http_res = self.do_request(
|
1087
|
+
hook_ctx=HookContext(
|
1088
|
+
operation_id="search_features_v1_features_search_post",
|
1089
|
+
oauth2_scopes=[],
|
1090
|
+
security_source=get_security_from_env(
|
1091
|
+
self.sdk_configuration.security, models.Security
|
1092
|
+
),
|
1093
|
+
),
|
1094
|
+
request=req,
|
1095
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1096
|
+
retry_config=retry_config,
|
1097
|
+
)
|
1098
|
+
|
1099
|
+
data: Any = None
|
1100
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1101
|
+
return utils.unmarshal_json(
|
1102
|
+
http_res.text,
|
1103
|
+
models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost,
|
1104
|
+
)
|
1105
|
+
if utils.match_response(
|
1106
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
1107
|
+
):
|
1108
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1109
|
+
raise models.ErrorResponse(data=data)
|
1110
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1111
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1112
|
+
raise models.HTTPValidationError(data=data)
|
1113
|
+
if utils.match_response(http_res, "500", "application/json"):
|
1114
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1115
|
+
raise models.ErrorResponse(data=data)
|
1116
|
+
if utils.match_response(http_res, "4XX", "*"):
|
1117
|
+
http_res_text = utils.stream_to_text(http_res)
|
1118
|
+
raise models.APIError(
|
1119
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1120
|
+
)
|
1121
|
+
if utils.match_response(http_res, "5XX", "*"):
|
1122
|
+
http_res_text = utils.stream_to_text(http_res)
|
1123
|
+
raise models.APIError(
|
1124
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1125
|
+
)
|
1126
|
+
|
1127
|
+
content_type = http_res.headers.get("Content-Type")
|
1128
|
+
http_res_text = utils.stream_to_text(http_res)
|
1129
|
+
raise models.APIError(
|
1130
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1131
|
+
http_res.status_code,
|
1132
|
+
http_res_text,
|
1133
|
+
http_res,
|
1134
|
+
)
|
1135
|
+
|
1136
|
+
async def search_async(
|
1137
|
+
self,
|
1138
|
+
*,
|
1139
|
+
collections: List[str],
|
1140
|
+
offset_position: OptionalNullable[int] = UNSET,
|
1141
|
+
page_size: Optional[int] = 10,
|
1142
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
1143
|
+
queries: OptionalNullable[
|
1144
|
+
Union[
|
1145
|
+
List[models.SearchModelSearchQuery],
|
1146
|
+
List[models.SearchModelSearchQueryTypedDict],
|
1147
|
+
]
|
1148
|
+
] = UNSET,
|
1149
|
+
filters: OptionalNullable[
|
1150
|
+
Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
|
1151
|
+
] = UNSET,
|
1152
|
+
group_by: OptionalNullable[
|
1153
|
+
Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
|
1154
|
+
] = UNSET,
|
1155
|
+
sort: OptionalNullable[
|
1156
|
+
Union[models.SortOption, models.SortOptionTypedDict]
|
1157
|
+
] = UNSET,
|
1158
|
+
select: OptionalNullable[List[str]] = UNSET,
|
1159
|
+
reranking_options: OptionalNullable[
|
1160
|
+
Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
|
1161
|
+
] = UNSET,
|
1162
|
+
session_id: OptionalNullable[str] = UNSET,
|
1163
|
+
return_url: OptionalNullable[bool] = UNSET,
|
1164
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1165
|
+
server_url: Optional[str] = None,
|
1166
|
+
timeout_ms: Optional[int] = None,
|
1167
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1168
|
+
) -> models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost:
|
1169
|
+
r"""Search Features
|
1170
|
+
|
1171
|
+
This endpoint allows you to search features.
|
1172
|
+
|
1173
|
+
:param collections: List of Collection names to search within, required
|
1174
|
+
:param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
|
1175
|
+
:param page_size: Number of results to return per page.
|
1176
|
+
: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.
|
1177
|
+
: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.
|
1178
|
+
:param filters: Used for filtering across all indexes
|
1179
|
+
:param group_by: Grouping options for search results
|
1180
|
+
:param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
|
1181
|
+
:param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
|
1182
|
+
:param reranking_options: Options for ranking the search results, including weights and feedback application
|
1183
|
+
:param session_id: Identifier for tracking search session interactions
|
1184
|
+
:param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
|
1185
|
+
:param retries: Override the default retry configuration for this method
|
1186
|
+
:param server_url: Override the default server URL for this method
|
1187
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1188
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1189
|
+
"""
|
1190
|
+
base_url = None
|
1191
|
+
url_variables = None
|
1192
|
+
if timeout_ms is None:
|
1193
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1194
|
+
|
1195
|
+
if server_url is not None:
|
1196
|
+
base_url = server_url
|
1197
|
+
|
1198
|
+
request = models.SearchFeaturesV1FeaturesSearchPostRequest(
|
1199
|
+
offset_position=offset_position,
|
1200
|
+
page_size=page_size,
|
1201
|
+
x_namespace=x_namespace,
|
1202
|
+
search_request_features=models.SearchRequestFeatures(
|
1203
|
+
queries=utils.get_pydantic_model(
|
1204
|
+
queries, OptionalNullable[List[models.SearchModelSearchQuery]]
|
1205
|
+
),
|
1206
|
+
collections=collections,
|
1207
|
+
filters=utils.get_pydantic_model(
|
1208
|
+
filters, OptionalNullable[models.LogicalOperator]
|
1209
|
+
),
|
1210
|
+
group_by=utils.get_pydantic_model(
|
1211
|
+
group_by, OptionalNullable[models.GroupByOptions]
|
1212
|
+
),
|
1213
|
+
sort=utils.get_pydantic_model(
|
1214
|
+
sort, OptionalNullable[models.SortOption]
|
1215
|
+
),
|
1216
|
+
select=select,
|
1217
|
+
reranking_options=utils.get_pydantic_model(
|
1218
|
+
reranking_options, OptionalNullable[models.RerankingOptions]
|
1219
|
+
),
|
1220
|
+
session_id=session_id,
|
1221
|
+
return_url=return_url,
|
1222
|
+
),
|
1223
|
+
)
|
1224
|
+
|
1225
|
+
req = self._build_request_async(
|
1226
|
+
method="POST",
|
1227
|
+
path="/v1/features/search",
|
1228
|
+
base_url=base_url,
|
1229
|
+
url_variables=url_variables,
|
1230
|
+
request=request,
|
1231
|
+
request_body_required=True,
|
1232
|
+
request_has_path_params=False,
|
1233
|
+
request_has_query_params=True,
|
1234
|
+
user_agent_header="user-agent",
|
1235
|
+
accept_header_value="application/json",
|
1236
|
+
http_headers=http_headers,
|
1237
|
+
security=self.sdk_configuration.security,
|
1238
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
1239
|
+
request.search_request_features,
|
1240
|
+
False,
|
1241
|
+
False,
|
1242
|
+
"json",
|
1243
|
+
models.SearchRequestFeatures,
|
1244
|
+
),
|
1245
|
+
timeout_ms=timeout_ms,
|
1246
|
+
)
|
1247
|
+
|
1248
|
+
if retries == UNSET:
|
1249
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1250
|
+
retries = self.sdk_configuration.retry_config
|
1251
|
+
|
1252
|
+
retry_config = None
|
1253
|
+
if isinstance(retries, utils.RetryConfig):
|
1254
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1255
|
+
|
1256
|
+
http_res = await self.do_request_async(
|
1257
|
+
hook_ctx=HookContext(
|
1258
|
+
operation_id="search_features_v1_features_search_post",
|
1259
|
+
oauth2_scopes=[],
|
1260
|
+
security_source=get_security_from_env(
|
1261
|
+
self.sdk_configuration.security, models.Security
|
1262
|
+
),
|
1263
|
+
),
|
1264
|
+
request=req,
|
1265
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1266
|
+
retry_config=retry_config,
|
1267
|
+
)
|
1268
|
+
|
1269
|
+
data: Any = None
|
1270
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1271
|
+
return utils.unmarshal_json(
|
1272
|
+
http_res.text,
|
1273
|
+
models.SearchFeaturesV1FeaturesSearchPostResponseSearchFeaturesV1FeaturesSearchPost,
|
1274
|
+
)
|
1275
|
+
if utils.match_response(
|
1276
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
1277
|
+
):
|
1278
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1279
|
+
raise models.ErrorResponse(data=data)
|
1280
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1281
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1282
|
+
raise models.HTTPValidationError(data=data)
|
1283
|
+
if utils.match_response(http_res, "500", "application/json"):
|
1284
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1285
|
+
raise models.ErrorResponse(data=data)
|
1286
|
+
if utils.match_response(http_res, "4XX", "*"):
|
1287
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1288
|
+
raise models.APIError(
|
1289
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1290
|
+
)
|
1291
|
+
if utils.match_response(http_res, "5XX", "*"):
|
1292
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1293
|
+
raise models.APIError(
|
1294
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1295
|
+
)
|
1296
|
+
|
1297
|
+
content_type = http_res.headers.get("Content-Type")
|
1298
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1299
|
+
raise models.APIError(
|
1300
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1301
|
+
http_res.status_code,
|
1302
|
+
http_res_text,
|
1303
|
+
http_res,
|
1304
|
+
)
|