mixpeek 0.20.20__py3-none-any.whl → 0.21.6__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 (228) hide show
  1. mixpeek/_version.py +3 -3
  2. mixpeek/{assets.py → bucketobjects.py} +309 -793
  3. mixpeek/buckets.py +1292 -0
  4. mixpeek/clusters.py +306 -0
  5. mixpeek/collectioncache.py +820 -0
  6. mixpeek/{taxonomyentities.py → collectiondocuments.py} +305 -559
  7. mixpeek/collections.py +120 -994
  8. mixpeek/features.py +45 -991
  9. mixpeek/models/__init__.py +625 -570
  10. mixpeek/models/aggregationtype.py +13 -0
  11. mixpeek/models/apikeyupdate.py +1 -1
  12. mixpeek/models/attributebasedconfig.py +21 -0
  13. mixpeek/models/automaticnaming.py +29 -0
  14. mixpeek/models/basicfeatureextractor.py +35 -0
  15. mixpeek/models/{classify_features_v1_entities_taxonomies_taxonomy_classify_postop.py → batch_delete_documents_v1_collections_collection_identifier_documents_batch_deleteop.py} +17 -15
  16. mixpeek/models/{update_collection_v1_collections_collection_putop.py → batch_update_documents_v1_collections_collection_identifier_documents_batch_putop.py} +29 -19
  17. mixpeek/models/blobdetails.py +72 -0
  18. mixpeek/models/blobmodel.py +107 -0
  19. mixpeek/models/bucketcreaterequest.py +75 -0
  20. mixpeek/models/bucketresponse.py +90 -0
  21. mixpeek/models/bucketschema_input.py +37 -0
  22. mixpeek/models/bucketschema_output.py +37 -0
  23. mixpeek/models/{featureresponse.py → bucketschemafield_input.py} +45 -18
  24. mixpeek/models/bucketschemafield_output.py +101 -0
  25. mixpeek/models/bucketschemafieldtype.py +29 -0
  26. mixpeek/models/bucketupdaterequest.py +68 -0
  27. mixpeek/models/cachestats.py +40 -0
  28. mixpeek/models/{list_collections_v1_collections_getop.py → cleanup_cache_v1_collections_cache_cleanup_postop.py} +23 -12
  29. mixpeek/models/{inputtype.py → clusteringmethod.py} +3 -5
  30. mixpeek/models/clustertype.py +9 -0
  31. mixpeek/models/collectioncacheconfig_input.py +92 -0
  32. mixpeek/models/collectioncacheconfig_output.py +92 -0
  33. mixpeek/models/collectionconfig.py +32 -0
  34. mixpeek/models/collectionmodel.py +79 -8
  35. mixpeek/models/{create_taxonomy_v1_entities_taxonomies_postop.py → create_bucket_v1_buckets_create_postop.py} +7 -7
  36. mixpeek/models/{search_assets_v1_assets_search_postop.py → create_cluster_v1_clusters_postop.py} +7 -7
  37. mixpeek/models/{create_collection_v1_collections_postop.py → create_collection_v1_collections_create_postop.py} +3 -3
  38. mixpeek/models/{ingest_video_url_v1_ingest_videos_url_postop.py → create_interaction_v1_retrievers_interactions_postop.py} +7 -7
  39. mixpeek/models/{partial_asset_update_v1_assets_asset_id_patchop.py → create_object_v1_buckets_bucket_identifier_objects_create_postop.py} +11 -9
  40. mixpeek/models/{ingest_text_v1_ingest_text_postop.py → create_retriever_v1_retrievers_retrievers_postop.py} +10 -7
  41. mixpeek/models/{ingest_image_url_v1_ingest_images_url_postop.py → create_taxonomy_v1_taxonomies_postop.py} +7 -7
  42. mixpeek/models/createblobrequest.py +80 -0
  43. mixpeek/models/createclusterrequest.py +74 -0
  44. mixpeek/models/createcollectionrequest.py +72 -3
  45. mixpeek/models/createnamespacerequest.py +14 -8
  46. mixpeek/models/createobjectrequest.py +75 -0
  47. mixpeek/models/createretrieverrequest.py +90 -0
  48. mixpeek/models/{taxonomyupdate.py → createtaxonomyrequest.py} +15 -13
  49. mixpeek/models/{delete_asset_v1_assets_asset_id_deleteop.py → delete_bucket_v1_buckets_bucket_identifier_deleteop.py} +5 -5
  50. mixpeek/models/{delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_deleteop.py → delete_document_v1_collections_collection_identifier_documents_document_id_deleteop.py} +11 -11
  51. mixpeek/models/{get_taxonomy_v1_entities_taxonomies_taxonomy_getop.py → delete_interaction_v1_retrievers_interactions_interaction_id_deleteop.py} +7 -7
  52. mixpeek/models/delete_object_v1_buckets_bucket_identifier_objects_object_identifier_deleteop.py +70 -0
  53. mixpeek/models/{featureextractionembeddingrequest.py → documenthandlingconfig.py} +12 -15
  54. mixpeek/models/documentinputhandling.py +11 -0
  55. mixpeek/models/{jsontextoutputsettings.py → documentlistresponse.py} +15 -14
  56. mixpeek/models/documentoutputhandling.py +10 -0
  57. mixpeek/models/documentoutputtype.py +11 -0
  58. mixpeek/models/documentresponse.py +87 -0
  59. mixpeek/models/{nodeupdate.py → documentupdate.py} +22 -13
  60. mixpeek/models/enrichmentfield.py +25 -0
  61. mixpeek/models/errordetail.py +1 -1
  62. mixpeek/models/{update_node_v1_entities_taxonomies_nodes_node_patchop.py → execute_retriever_v1_retrievers_retrievers_retriever_id_execute_postop.py} +11 -11
  63. mixpeek/models/featureextractorconfig.py +116 -0
  64. mixpeek/models/featureextractordefinition.py +192 -0
  65. mixpeek/models/filtercondition.py +25 -25
  66. mixpeek/models/filteroperator.py +24 -0
  67. mixpeek/models/generativemodels.py +10 -0
  68. mixpeek/models/{delete_feature_v1_features_feature_id_deleteop.py → get_bucket_v1_buckets_bucket_identifier_getop.py} +5 -5
  69. mixpeek/models/{list_taxonomies_v1_entities_taxonomies_getop.py → get_cache_stats_v1_collections_cache_stats_getop.py} +16 -14
  70. mixpeek/models/get_collection_v1_collections_collection_id_getop.py +59 -0
  71. mixpeek/models/get_document_v1_collections_collection_identifier_documents_document_id_getop.py +70 -0
  72. mixpeek/models/get_feature_extractor_v1_features_extractors_feature_id_getop.py +16 -0
  73. mixpeek/models/get_interaction_v1_retrievers_interactions_interaction_id_getop.py +57 -0
  74. mixpeek/models/{delete_collection_v1_collections_collection_deleteop.py → get_object_v1_buckets_bucket_identifier_objects_object_identifier_getop.py} +16 -7
  75. mixpeek/models/get_research_v1_research_getop.py +52 -0
  76. mixpeek/models/get_retriever_stages_v1_retrievers_stages_getop.py +52 -0
  77. mixpeek/models/{delete_taxonomy_v1_entities_taxonomies_taxonomy_deleteop.py → get_retriever_v1_retrievers_retrievers_retriever_id_getop.py} +5 -7
  78. mixpeek/models/get_task_v1_tasks_task_id_getop.py +1 -1
  79. mixpeek/models/getusagerequestmodel.py +91 -0
  80. mixpeek/models/hdbscanparameters.py +26 -0
  81. mixpeek/models/interactionresponse.py +86 -0
  82. mixpeek/models/interactiontype.py +22 -0
  83. mixpeek/models/{search_features_v1_features_search_postop.py → invalidate_cache_v1_collections_cache_invalidate_postop.py} +60 -34
  84. mixpeek/models/invalidationevent.py +67 -0
  85. mixpeek/models/invalidationstrategy.py +12 -0
  86. mixpeek/models/kill_task_v1_tasks_task_id_deleteop.py +1 -1
  87. mixpeek/models/list_active_tasks_v1_tasks_getop.py +1 -1
  88. mixpeek/models/{list_assets_v1_assets_postop.py → list_buckets_v1_buckets_postop.py} +18 -18
  89. mixpeek/models/{list_features_v1_features_postop.py → list_documents_v1_collections_collection_identifier_documents_getop.py} +54 -19
  90. mixpeek/models/list_interactions_v1_retrievers_interactions_getop.py +96 -0
  91. mixpeek/models/{list_classifications_v1_entities_taxonomies_taxonomy_classifications_postop.py → list_objects_v1_buckets_bucket_identifier_objects_postop.py} +22 -29
  92. mixpeek/models/{groupbyoptionsasset.py → listbucketsrequest.py} +19 -28
  93. mixpeek/models/listbucketsresponse.py +23 -0
  94. mixpeek/models/{groupbyoptions.py → listobjectsrequest.py} +19 -28
  95. mixpeek/models/listobjectsresponse.py +25 -0
  96. mixpeek/models/listtasksresponse.py +3 -6
  97. mixpeek/models/{logicaloperator.py → logicaloperator_input.py} +42 -24
  98. mixpeek/models/logicaloperator_output.py +121 -0
  99. mixpeek/models/multivectorindex.py +25 -0
  100. mixpeek/models/namespaceresponse.py +1 -1
  101. mixpeek/models/namespaceusage.py +45 -0
  102. mixpeek/models/namingmethod.py +8 -0
  103. mixpeek/models/objectresponse.py +124 -0
  104. mixpeek/models/{db_model_paginationresponse.py → paginationresponse.py} +3 -3
  105. mixpeek/models/payloadindexconfig.py +1 -1
  106. mixpeek/models/plan.py +82 -0
  107. mixpeek/models/recomputestrategy.py +12 -0
  108. mixpeek/models/resourcetotals.py +39 -0
  109. mixpeek/models/{jsonvideooutputsettings.py → retrieverbinding.py} +19 -11
  110. mixpeek/models/{logodetectsettings.py → retrievercacheconfig.py} +20 -11
  111. mixpeek/models/retrievermodel.py +95 -0
  112. mixpeek/models/retrieverqueryrequest.py +114 -0
  113. mixpeek/models/retrieverresponse.py +24 -0
  114. mixpeek/models/searchinteraction.py +81 -0
  115. mixpeek/models/singlelineageentry.py +99 -0
  116. mixpeek/models/sortdirection.py +11 -0
  117. mixpeek/models/sortoption.py +20 -12
  118. mixpeek/models/sourceconfig_input.py +72 -0
  119. mixpeek/models/sourceconfig_output.py +75 -0
  120. mixpeek/models/sourcetype.py +11 -0
  121. mixpeek/models/stageconfig_input.py +111 -0
  122. mixpeek/models/stageconfig_output.py +114 -0
  123. mixpeek/models/stagedefinition.py +110 -0
  124. mixpeek/models/{jsonimageoutputsettings.py → stageresponse.py} +21 -11
  125. mixpeek/models/taskresponse.py +1 -1
  126. mixpeek/models/taskstatus.py +1 -0
  127. mixpeek/models/{assetfeatures.py → taxonomyapplicationconfig.py} +23 -15
  128. mixpeek/models/taxonomyconfig.py +19 -0
  129. mixpeek/models/timeseriesdatapoint.py +25 -0
  130. mixpeek/models/timeseriesusage.py +36 -0
  131. mixpeek/models/{full_asset_update_v1_assets_asset_id_putop.py → update_bucket_v1_buckets_bucket_identifier_putop.py} +9 -9
  132. mixpeek/models/{update_taxonomy_v1_entities_taxonomies_taxonomy_patchop.py → update_document_v1_collections_collection_identifier_documents_document_id_putop.py} +25 -13
  133. mixpeek/models/{full_feature_update_v1_features_feature_id_putop.py → update_object_v1_buckets_bucket_identifier_objects_object_identifier_putop.py} +20 -9
  134. mixpeek/models/updatenamespacerequest.py +1 -1
  135. mixpeek/models/updateobjectrequest.py +75 -0
  136. mixpeek/models/usageresponse.py +86 -0
  137. mixpeek/models/usagesummary.py +39 -0
  138. mixpeek/models/usagetimerange.py +16 -0
  139. mixpeek/models/usermodel_input.py +3 -0
  140. mixpeek/models/usermodel_output.py +3 -0
  141. mixpeek/models/vectorbasedconfig.py +60 -0
  142. mixpeek/models/{collectionresult.py → vectorindex.py} +20 -15
  143. mixpeek/models/vectorindexdefinition.py +43 -0
  144. mixpeek/models/vectortype.py +4 -1
  145. mixpeek/namespaces.py +26 -480
  146. mixpeek/organizationnotifications.py +214 -0
  147. mixpeek/organizations.py +6 -210
  148. mixpeek/{featureextractors.py → organizationsusage.py} +31 -39
  149. mixpeek/research.py +228 -0
  150. mixpeek/retrieverinteractions.py +1036 -0
  151. mixpeek/{ingestassets.py → retrievers.py} +209 -271
  152. mixpeek/retrieverstages.py +232 -0
  153. mixpeek/sdk.py +40 -23
  154. mixpeek/taxonomies.py +43 -513
  155. mixpeek/types/basemodel.py +3 -3
  156. mixpeek/utils/enums.py +67 -27
  157. {mixpeek-0.20.20.dist-info → mixpeek-0.21.6.dist-info}/METADATA +68 -50
  158. mixpeek-0.21.6.dist-info/RECORD +216 -0
  159. {mixpeek-0.20.20.dist-info → mixpeek-0.21.6.dist-info}/WHEEL +1 -1
  160. mixpeek/models/actionusage.py +0 -16
  161. mixpeek/models/assetresponse.py +0 -166
  162. mixpeek/models/assets_model_searchquery.py +0 -21
  163. mixpeek/models/assetupdate.py +0 -28
  164. mixpeek/models/assignmentconfig.py +0 -67
  165. mixpeek/models/assignmentmode.py +0 -11
  166. mixpeek/models/availablemodels.py +0 -16
  167. mixpeek/models/availablemodelsresponse.py +0 -27
  168. mixpeek/models/classificationmatch.py +0 -77
  169. mixpeek/models/classificationwithfeature.py +0 -73
  170. mixpeek/models/collectiondetailsresponse.py +0 -83
  171. mixpeek/models/dateusage.py +0 -22
  172. mixpeek/models/denseembedding.py +0 -16
  173. mixpeek/models/discoverrequest.py +0 -64
  174. mixpeek/models/embeddingconfig.py +0 -33
  175. mixpeek/models/embeddingrequest.py +0 -92
  176. mixpeek/models/embeddingresponse.py +0 -64
  177. mixpeek/models/entitysettings.py +0 -50
  178. mixpeek/models/featureoptions.py +0 -25
  179. mixpeek/models/features_model_paginationresponse.py +0 -59
  180. mixpeek/models/featureupdaterequest.py +0 -21
  181. mixpeek/models/get_asset_v1_assets_asset_id_getop.py +0 -73
  182. mixpeek/models/get_asset_with_features_v1_assets_asset_id_features_getop.py +0 -73
  183. mixpeek/models/get_collection_details_v1_collections_collection_details_getop.py +0 -59
  184. mixpeek/models/get_collection_details_v1_collections_collection_getop.py +0 -59
  185. mixpeek/models/get_feature_v1_features_feature_id_getop.py +0 -70
  186. mixpeek/models/get_taxonomy_node_v1_entities_taxonomies_nodes_node_getop.py +0 -59
  187. mixpeek/models/groupedassetdata.py +0 -18
  188. mixpeek/models/imagedescribesettings.py +0 -82
  189. mixpeek/models/imagedetectsettings.py +0 -47
  190. mixpeek/models/imagereadsettings.py +0 -71
  191. mixpeek/models/imagesettings.py +0 -92
  192. mixpeek/models/listassetsrequest.py +0 -75
  193. mixpeek/models/listassetsresponse.py +0 -22
  194. mixpeek/models/listclassificationsrequest.py +0 -69
  195. mixpeek/models/listclassificationsresponse.py +0 -31
  196. mixpeek/models/listcollectionsresponse.py +0 -22
  197. mixpeek/models/listfeaturesrequest.py +0 -77
  198. mixpeek/models/listfeaturesresponse.py +0 -22
  199. mixpeek/models/listtaxonomiesresponse.py +0 -24
  200. mixpeek/models/modality.py +0 -13
  201. mixpeek/models/modeldetails.py +0 -61
  202. mixpeek/models/nodeoptions.py +0 -16
  203. mixpeek/models/patch_namespace_v1_namespaces_namespace_patchop.py +0 -28
  204. mixpeek/models/payloadindextype.py +0 -17
  205. mixpeek/models/processimageurlinput.py +0 -87
  206. mixpeek/models/processtextinput.py +0 -82
  207. mixpeek/models/processvideourlinput.py +0 -87
  208. mixpeek/models/querysettings.py +0 -56
  209. mixpeek/models/rerankingoptions.py +0 -47
  210. mixpeek/models/search_model_searchquery.py +0 -76
  211. mixpeek/models/searchassetsrequest.py +0 -78
  212. mixpeek/models/searchrequestfeatures.py +0 -153
  213. mixpeek/models/sparseembedding.py +0 -21
  214. mixpeek/models/taxonomycreate.py +0 -20
  215. mixpeek/models/taxonomyextractionconfig.py +0 -26
  216. mixpeek/models/taxonomymodel.py +0 -27
  217. mixpeek/models/taxonomynode.py +0 -101
  218. mixpeek/models/taxonomynodecreate.py +0 -63
  219. mixpeek/models/textsettings.py +0 -67
  220. mixpeek/models/updateassetrequest.py +0 -60
  221. mixpeek/models/usage.py +0 -18
  222. mixpeek/models/vectormodel.py +0 -15
  223. mixpeek/models/videodescribesettings.py +0 -82
  224. mixpeek/models/videodetectsettings.py +0 -47
  225. mixpeek/models/videoreadsettings.py +0 -71
  226. mixpeek/models/videosettings.py +0 -115
  227. mixpeek/models/videotranscriptionsettings.py +0 -69
  228. mixpeek-0.20.20.dist-info/RECORD +0 -201
@@ -0,0 +1,820 @@
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, Dict, List, Mapping, Optional
9
+
10
+
11
+ class CollectionCache(BaseSDK):
12
+ def invalidate(
13
+ self,
14
+ *,
15
+ collection_id: str,
16
+ action: str,
17
+ internal_id: str,
18
+ retriever_id: OptionalNullable[str] = UNSET,
19
+ recompute_strategy: Optional[models.RecomputeStrategy] = None,
20
+ redis_url: OptionalNullable[str] = UNSET,
21
+ prefix: OptionalNullable[str] = UNSET,
22
+ x_namespace: OptionalNullable[str] = UNSET,
23
+ request_body: OptionalNullable[List[str]] = UNSET,
24
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
25
+ server_url: Optional[str] = None,
26
+ timeout_ms: Optional[int] = None,
27
+ http_headers: Optional[Mapping[str, str]] = None,
28
+ ) -> Dict[str, bool]:
29
+ r"""Invalidate Cache
30
+
31
+ Invalidate cache entries for a collection.
32
+
33
+ Args:
34
+ collection_id: ID of the collection to invalidate
35
+ action: Action that triggered invalidation (create, update, delete)
36
+ document_ids: Optional list of specific document IDs to invalidate
37
+ retriever_id: Optional retriever ID for retriever-specific invalidation
38
+ recompute_strategy: Strategy for recomputing invalidated entries
39
+ cache_service: Cache service instance
40
+
41
+ Returns:
42
+ Success status
43
+
44
+ :param collection_id:
45
+ :param action:
46
+ :param internal_id:
47
+ :param retriever_id:
48
+ :param recompute_strategy: Strategies for recomputing cache entries
49
+ :param redis_url:
50
+ :param prefix:
51
+ :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.
52
+ :param request_body:
53
+ :param retries: Override the default retry configuration for this method
54
+ :param server_url: Override the default server URL for this method
55
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
56
+ :param http_headers: Additional headers to set or replace on requests.
57
+ """
58
+ base_url = None
59
+ url_variables = None
60
+ if timeout_ms is None:
61
+ timeout_ms = self.sdk_configuration.timeout_ms
62
+
63
+ if server_url is not None:
64
+ base_url = server_url
65
+ else:
66
+ base_url = self._get_url(base_url, url_variables)
67
+
68
+ request = models.InvalidateCacheV1CollectionsCacheInvalidatePostRequest(
69
+ collection_id=collection_id,
70
+ action=action,
71
+ retriever_id=retriever_id,
72
+ recompute_strategy=recompute_strategy,
73
+ internal_id=internal_id,
74
+ redis_url=redis_url,
75
+ prefix=prefix,
76
+ x_namespace=x_namespace,
77
+ request_body=request_body,
78
+ )
79
+
80
+ req = self._build_request(
81
+ method="POST",
82
+ path="/v1/collections/cache/invalidate",
83
+ base_url=base_url,
84
+ url_variables=url_variables,
85
+ request=request,
86
+ request_body_required=False,
87
+ request_has_path_params=False,
88
+ request_has_query_params=True,
89
+ user_agent_header="user-agent",
90
+ accept_header_value="application/json",
91
+ http_headers=http_headers,
92
+ security=self.sdk_configuration.security,
93
+ get_serialized_body=lambda: utils.serialize_request_body(
94
+ request.request_body, True, True, "json", OptionalNullable[List[str]]
95
+ ),
96
+ timeout_ms=timeout_ms,
97
+ )
98
+
99
+ if retries == UNSET:
100
+ if self.sdk_configuration.retry_config is not UNSET:
101
+ retries = self.sdk_configuration.retry_config
102
+
103
+ retry_config = None
104
+ if isinstance(retries, utils.RetryConfig):
105
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
106
+
107
+ http_res = self.do_request(
108
+ hook_ctx=HookContext(
109
+ base_url=base_url or "",
110
+ operation_id="invalidate_cache_v1_collections_cache_invalidate_post",
111
+ oauth2_scopes=[],
112
+ security_source=get_security_from_env(
113
+ self.sdk_configuration.security, models.Security
114
+ ),
115
+ ),
116
+ request=req,
117
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
118
+ retry_config=retry_config,
119
+ )
120
+
121
+ response_data: Any = None
122
+ if utils.match_response(http_res, "200", "application/json"):
123
+ return utils.unmarshal_json(http_res.text, Dict[str, bool])
124
+ if utils.match_response(
125
+ http_res, ["400", "401", "403", "404"], "application/json"
126
+ ):
127
+ response_data = utils.unmarshal_json(
128
+ http_res.text, models.ErrorResponseData
129
+ )
130
+ raise models.ErrorResponse(data=response_data)
131
+ if utils.match_response(http_res, "422", "application/json"):
132
+ response_data = utils.unmarshal_json(
133
+ http_res.text, models.HTTPValidationErrorData
134
+ )
135
+ raise models.HTTPValidationError(data=response_data)
136
+ if utils.match_response(http_res, "500", "application/json"):
137
+ response_data = utils.unmarshal_json(
138
+ http_res.text, models.ErrorResponseData
139
+ )
140
+ raise models.ErrorResponse(data=response_data)
141
+ if utils.match_response(http_res, "4XX", "*"):
142
+ http_res_text = utils.stream_to_text(http_res)
143
+ raise models.APIError(
144
+ "API error occurred", http_res.status_code, http_res_text, http_res
145
+ )
146
+ if utils.match_response(http_res, "5XX", "*"):
147
+ http_res_text = utils.stream_to_text(http_res)
148
+ raise models.APIError(
149
+ "API error occurred", http_res.status_code, http_res_text, http_res
150
+ )
151
+
152
+ content_type = http_res.headers.get("Content-Type")
153
+ http_res_text = utils.stream_to_text(http_res)
154
+ raise models.APIError(
155
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
156
+ http_res.status_code,
157
+ http_res_text,
158
+ http_res,
159
+ )
160
+
161
+ async def invalidate_async(
162
+ self,
163
+ *,
164
+ collection_id: str,
165
+ action: str,
166
+ internal_id: str,
167
+ retriever_id: OptionalNullable[str] = UNSET,
168
+ recompute_strategy: Optional[models.RecomputeStrategy] = None,
169
+ redis_url: OptionalNullable[str] = UNSET,
170
+ prefix: OptionalNullable[str] = UNSET,
171
+ x_namespace: OptionalNullable[str] = UNSET,
172
+ request_body: OptionalNullable[List[str]] = UNSET,
173
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
174
+ server_url: Optional[str] = None,
175
+ timeout_ms: Optional[int] = None,
176
+ http_headers: Optional[Mapping[str, str]] = None,
177
+ ) -> Dict[str, bool]:
178
+ r"""Invalidate Cache
179
+
180
+ Invalidate cache entries for a collection.
181
+
182
+ Args:
183
+ collection_id: ID of the collection to invalidate
184
+ action: Action that triggered invalidation (create, update, delete)
185
+ document_ids: Optional list of specific document IDs to invalidate
186
+ retriever_id: Optional retriever ID for retriever-specific invalidation
187
+ recompute_strategy: Strategy for recomputing invalidated entries
188
+ cache_service: Cache service instance
189
+
190
+ Returns:
191
+ Success status
192
+
193
+ :param collection_id:
194
+ :param action:
195
+ :param internal_id:
196
+ :param retriever_id:
197
+ :param recompute_strategy: Strategies for recomputing cache entries
198
+ :param redis_url:
199
+ :param prefix:
200
+ :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.
201
+ :param request_body:
202
+ :param retries: Override the default retry configuration for this method
203
+ :param server_url: Override the default server URL for this method
204
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
205
+ :param http_headers: Additional headers to set or replace on requests.
206
+ """
207
+ base_url = None
208
+ url_variables = None
209
+ if timeout_ms is None:
210
+ timeout_ms = self.sdk_configuration.timeout_ms
211
+
212
+ if server_url is not None:
213
+ base_url = server_url
214
+ else:
215
+ base_url = self._get_url(base_url, url_variables)
216
+
217
+ request = models.InvalidateCacheV1CollectionsCacheInvalidatePostRequest(
218
+ collection_id=collection_id,
219
+ action=action,
220
+ retriever_id=retriever_id,
221
+ recompute_strategy=recompute_strategy,
222
+ internal_id=internal_id,
223
+ redis_url=redis_url,
224
+ prefix=prefix,
225
+ x_namespace=x_namespace,
226
+ request_body=request_body,
227
+ )
228
+
229
+ req = self._build_request_async(
230
+ method="POST",
231
+ path="/v1/collections/cache/invalidate",
232
+ base_url=base_url,
233
+ url_variables=url_variables,
234
+ request=request,
235
+ request_body_required=False,
236
+ request_has_path_params=False,
237
+ request_has_query_params=True,
238
+ user_agent_header="user-agent",
239
+ accept_header_value="application/json",
240
+ http_headers=http_headers,
241
+ security=self.sdk_configuration.security,
242
+ get_serialized_body=lambda: utils.serialize_request_body(
243
+ request.request_body, True, True, "json", OptionalNullable[List[str]]
244
+ ),
245
+ timeout_ms=timeout_ms,
246
+ )
247
+
248
+ if retries == UNSET:
249
+ if self.sdk_configuration.retry_config is not UNSET:
250
+ retries = self.sdk_configuration.retry_config
251
+
252
+ retry_config = None
253
+ if isinstance(retries, utils.RetryConfig):
254
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
255
+
256
+ http_res = await self.do_request_async(
257
+ hook_ctx=HookContext(
258
+ base_url=base_url or "",
259
+ operation_id="invalidate_cache_v1_collections_cache_invalidate_post",
260
+ oauth2_scopes=[],
261
+ security_source=get_security_from_env(
262
+ self.sdk_configuration.security, models.Security
263
+ ),
264
+ ),
265
+ request=req,
266
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
267
+ retry_config=retry_config,
268
+ )
269
+
270
+ response_data: Any = None
271
+ if utils.match_response(http_res, "200", "application/json"):
272
+ return utils.unmarshal_json(http_res.text, Dict[str, bool])
273
+ if utils.match_response(
274
+ http_res, ["400", "401", "403", "404"], "application/json"
275
+ ):
276
+ response_data = utils.unmarshal_json(
277
+ http_res.text, models.ErrorResponseData
278
+ )
279
+ raise models.ErrorResponse(data=response_data)
280
+ if utils.match_response(http_res, "422", "application/json"):
281
+ response_data = utils.unmarshal_json(
282
+ http_res.text, models.HTTPValidationErrorData
283
+ )
284
+ raise models.HTTPValidationError(data=response_data)
285
+ if utils.match_response(http_res, "500", "application/json"):
286
+ response_data = utils.unmarshal_json(
287
+ http_res.text, models.ErrorResponseData
288
+ )
289
+ raise models.ErrorResponse(data=response_data)
290
+ if utils.match_response(http_res, "4XX", "*"):
291
+ http_res_text = await utils.stream_to_text_async(http_res)
292
+ raise models.APIError(
293
+ "API error occurred", http_res.status_code, http_res_text, http_res
294
+ )
295
+ if utils.match_response(http_res, "5XX", "*"):
296
+ http_res_text = await utils.stream_to_text_async(http_res)
297
+ raise models.APIError(
298
+ "API error occurred", http_res.status_code, http_res_text, http_res
299
+ )
300
+
301
+ content_type = http_res.headers.get("Content-Type")
302
+ http_res_text = await utils.stream_to_text_async(http_res)
303
+ raise models.APIError(
304
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
305
+ http_res.status_code,
306
+ http_res_text,
307
+ http_res,
308
+ )
309
+
310
+ def get_stats(
311
+ self,
312
+ *,
313
+ internal_id: str,
314
+ redis_url: OptionalNullable[str] = UNSET,
315
+ prefix: OptionalNullable[str] = UNSET,
316
+ x_namespace: OptionalNullable[str] = UNSET,
317
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
318
+ server_url: Optional[str] = None,
319
+ timeout_ms: Optional[int] = None,
320
+ http_headers: Optional[Mapping[str, str]] = None,
321
+ ) -> models.CacheStats:
322
+ r"""Get Cache Stats
323
+
324
+ Get cache statistics.
325
+
326
+ Args:
327
+ cache_service: Cache service instance
328
+
329
+ Returns:
330
+ Cache statistics
331
+
332
+ :param internal_id:
333
+ :param redis_url:
334
+ :param prefix:
335
+ :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.
336
+ :param retries: Override the default retry configuration for this method
337
+ :param server_url: Override the default server URL for this method
338
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
339
+ :param http_headers: Additional headers to set or replace on requests.
340
+ """
341
+ base_url = None
342
+ url_variables = None
343
+ if timeout_ms is None:
344
+ timeout_ms = self.sdk_configuration.timeout_ms
345
+
346
+ if server_url is not None:
347
+ base_url = server_url
348
+ else:
349
+ base_url = self._get_url(base_url, url_variables)
350
+
351
+ request = models.GetCacheStatsV1CollectionsCacheStatsGetRequest(
352
+ internal_id=internal_id,
353
+ redis_url=redis_url,
354
+ prefix=prefix,
355
+ x_namespace=x_namespace,
356
+ )
357
+
358
+ req = self._build_request(
359
+ method="GET",
360
+ path="/v1/collections/cache/stats",
361
+ base_url=base_url,
362
+ url_variables=url_variables,
363
+ request=request,
364
+ request_body_required=False,
365
+ request_has_path_params=False,
366
+ request_has_query_params=True,
367
+ user_agent_header="user-agent",
368
+ accept_header_value="application/json",
369
+ http_headers=http_headers,
370
+ security=self.sdk_configuration.security,
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
+ base_url=base_url or "",
385
+ operation_id="get_cache_stats_v1_collections_cache_stats_get",
386
+ oauth2_scopes=[],
387
+ security_source=get_security_from_env(
388
+ self.sdk_configuration.security, models.Security
389
+ ),
390
+ ),
391
+ request=req,
392
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
393
+ retry_config=retry_config,
394
+ )
395
+
396
+ response_data: Any = None
397
+ if utils.match_response(http_res, "200", "application/json"):
398
+ return utils.unmarshal_json(http_res.text, models.CacheStats)
399
+ if utils.match_response(
400
+ http_res, ["400", "401", "403", "404"], "application/json"
401
+ ):
402
+ response_data = utils.unmarshal_json(
403
+ http_res.text, models.ErrorResponseData
404
+ )
405
+ raise models.ErrorResponse(data=response_data)
406
+ if utils.match_response(http_res, "422", "application/json"):
407
+ response_data = utils.unmarshal_json(
408
+ http_res.text, models.HTTPValidationErrorData
409
+ )
410
+ raise models.HTTPValidationError(data=response_data)
411
+ if utils.match_response(http_res, "500", "application/json"):
412
+ response_data = utils.unmarshal_json(
413
+ http_res.text, models.ErrorResponseData
414
+ )
415
+ raise models.ErrorResponse(data=response_data)
416
+ if utils.match_response(http_res, "4XX", "*"):
417
+ http_res_text = utils.stream_to_text(http_res)
418
+ raise models.APIError(
419
+ "API error occurred", http_res.status_code, http_res_text, http_res
420
+ )
421
+ if utils.match_response(http_res, "5XX", "*"):
422
+ http_res_text = utils.stream_to_text(http_res)
423
+ raise models.APIError(
424
+ "API error occurred", http_res.status_code, http_res_text, http_res
425
+ )
426
+
427
+ content_type = http_res.headers.get("Content-Type")
428
+ http_res_text = utils.stream_to_text(http_res)
429
+ raise models.APIError(
430
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
431
+ http_res.status_code,
432
+ http_res_text,
433
+ http_res,
434
+ )
435
+
436
+ async def get_stats_async(
437
+ self,
438
+ *,
439
+ internal_id: str,
440
+ redis_url: OptionalNullable[str] = UNSET,
441
+ prefix: OptionalNullable[str] = UNSET,
442
+ x_namespace: OptionalNullable[str] = UNSET,
443
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
444
+ server_url: Optional[str] = None,
445
+ timeout_ms: Optional[int] = None,
446
+ http_headers: Optional[Mapping[str, str]] = None,
447
+ ) -> models.CacheStats:
448
+ r"""Get Cache Stats
449
+
450
+ Get cache statistics.
451
+
452
+ Args:
453
+ cache_service: Cache service instance
454
+
455
+ Returns:
456
+ Cache statistics
457
+
458
+ :param internal_id:
459
+ :param redis_url:
460
+ :param prefix:
461
+ :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.
462
+ :param retries: Override the default retry configuration for this method
463
+ :param server_url: Override the default server URL for this method
464
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
465
+ :param http_headers: Additional headers to set or replace on requests.
466
+ """
467
+ base_url = None
468
+ url_variables = None
469
+ if timeout_ms is None:
470
+ timeout_ms = self.sdk_configuration.timeout_ms
471
+
472
+ if server_url is not None:
473
+ base_url = server_url
474
+ else:
475
+ base_url = self._get_url(base_url, url_variables)
476
+
477
+ request = models.GetCacheStatsV1CollectionsCacheStatsGetRequest(
478
+ internal_id=internal_id,
479
+ redis_url=redis_url,
480
+ prefix=prefix,
481
+ x_namespace=x_namespace,
482
+ )
483
+
484
+ req = self._build_request_async(
485
+ method="GET",
486
+ path="/v1/collections/cache/stats",
487
+ base_url=base_url,
488
+ url_variables=url_variables,
489
+ request=request,
490
+ request_body_required=False,
491
+ request_has_path_params=False,
492
+ request_has_query_params=True,
493
+ user_agent_header="user-agent",
494
+ accept_header_value="application/json",
495
+ http_headers=http_headers,
496
+ security=self.sdk_configuration.security,
497
+ timeout_ms=timeout_ms,
498
+ )
499
+
500
+ if retries == UNSET:
501
+ if self.sdk_configuration.retry_config is not UNSET:
502
+ retries = self.sdk_configuration.retry_config
503
+
504
+ retry_config = None
505
+ if isinstance(retries, utils.RetryConfig):
506
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
507
+
508
+ http_res = await self.do_request_async(
509
+ hook_ctx=HookContext(
510
+ base_url=base_url or "",
511
+ operation_id="get_cache_stats_v1_collections_cache_stats_get",
512
+ oauth2_scopes=[],
513
+ security_source=get_security_from_env(
514
+ self.sdk_configuration.security, models.Security
515
+ ),
516
+ ),
517
+ request=req,
518
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
519
+ retry_config=retry_config,
520
+ )
521
+
522
+ response_data: Any = None
523
+ if utils.match_response(http_res, "200", "application/json"):
524
+ return utils.unmarshal_json(http_res.text, models.CacheStats)
525
+ if utils.match_response(
526
+ http_res, ["400", "401", "403", "404"], "application/json"
527
+ ):
528
+ response_data = utils.unmarshal_json(
529
+ http_res.text, models.ErrorResponseData
530
+ )
531
+ raise models.ErrorResponse(data=response_data)
532
+ if utils.match_response(http_res, "422", "application/json"):
533
+ response_data = utils.unmarshal_json(
534
+ http_res.text, models.HTTPValidationErrorData
535
+ )
536
+ raise models.HTTPValidationError(data=response_data)
537
+ if utils.match_response(http_res, "500", "application/json"):
538
+ response_data = utils.unmarshal_json(
539
+ http_res.text, models.ErrorResponseData
540
+ )
541
+ raise models.ErrorResponse(data=response_data)
542
+ if utils.match_response(http_res, "4XX", "*"):
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
+ if utils.match_response(http_res, "5XX", "*"):
548
+ http_res_text = await utils.stream_to_text_async(http_res)
549
+ raise models.APIError(
550
+ "API error occurred", http_res.status_code, http_res_text, http_res
551
+ )
552
+
553
+ content_type = http_res.headers.get("Content-Type")
554
+ http_res_text = await utils.stream_to_text_async(http_res)
555
+ raise models.APIError(
556
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
557
+ http_res.status_code,
558
+ http_res_text,
559
+ http_res,
560
+ )
561
+
562
+ def cleanup(
563
+ self,
564
+ *,
565
+ internal_id: str,
566
+ batch_size: Optional[int] = 1000,
567
+ redis_url: OptionalNullable[str] = UNSET,
568
+ prefix: OptionalNullable[str] = UNSET,
569
+ x_namespace: OptionalNullable[str] = UNSET,
570
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
571
+ server_url: Optional[str] = None,
572
+ timeout_ms: Optional[int] = None,
573
+ http_headers: Optional[Mapping[str, str]] = None,
574
+ ) -> Dict[str, int]:
575
+ r"""Cleanup Cache
576
+
577
+ Cleanup expired cache entries.
578
+
579
+ Args:
580
+ batch_size: Number of keys to process per batch
581
+ cache_service: Cache service instance
582
+
583
+ Returns:
584
+ Number of keys deleted
585
+
586
+ :param internal_id:
587
+ :param batch_size:
588
+ :param redis_url:
589
+ :param prefix:
590
+ :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.
591
+ :param retries: Override the default retry configuration for this method
592
+ :param server_url: Override the default server URL for this method
593
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
594
+ :param http_headers: Additional headers to set or replace on requests.
595
+ """
596
+ base_url = None
597
+ url_variables = None
598
+ if timeout_ms is None:
599
+ timeout_ms = self.sdk_configuration.timeout_ms
600
+
601
+ if server_url is not None:
602
+ base_url = server_url
603
+ else:
604
+ base_url = self._get_url(base_url, url_variables)
605
+
606
+ request = models.CleanupCacheV1CollectionsCacheCleanupPostRequest(
607
+ batch_size=batch_size,
608
+ internal_id=internal_id,
609
+ redis_url=redis_url,
610
+ prefix=prefix,
611
+ x_namespace=x_namespace,
612
+ )
613
+
614
+ req = self._build_request(
615
+ method="POST",
616
+ path="/v1/collections/cache/cleanup",
617
+ base_url=base_url,
618
+ url_variables=url_variables,
619
+ request=request,
620
+ request_body_required=False,
621
+ request_has_path_params=False,
622
+ request_has_query_params=True,
623
+ user_agent_header="user-agent",
624
+ accept_header_value="application/json",
625
+ http_headers=http_headers,
626
+ security=self.sdk_configuration.security,
627
+ timeout_ms=timeout_ms,
628
+ )
629
+
630
+ if retries == UNSET:
631
+ if self.sdk_configuration.retry_config is not UNSET:
632
+ retries = self.sdk_configuration.retry_config
633
+
634
+ retry_config = None
635
+ if isinstance(retries, utils.RetryConfig):
636
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
637
+
638
+ http_res = self.do_request(
639
+ hook_ctx=HookContext(
640
+ base_url=base_url or "",
641
+ operation_id="cleanup_cache_v1_collections_cache_cleanup_post",
642
+ oauth2_scopes=[],
643
+ security_source=get_security_from_env(
644
+ self.sdk_configuration.security, models.Security
645
+ ),
646
+ ),
647
+ request=req,
648
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
649
+ retry_config=retry_config,
650
+ )
651
+
652
+ response_data: Any = None
653
+ if utils.match_response(http_res, "200", "application/json"):
654
+ return utils.unmarshal_json(http_res.text, Dict[str, int])
655
+ if utils.match_response(
656
+ http_res, ["400", "401", "403", "404"], "application/json"
657
+ ):
658
+ response_data = utils.unmarshal_json(
659
+ http_res.text, models.ErrorResponseData
660
+ )
661
+ raise models.ErrorResponse(data=response_data)
662
+ if utils.match_response(http_res, "422", "application/json"):
663
+ response_data = utils.unmarshal_json(
664
+ http_res.text, models.HTTPValidationErrorData
665
+ )
666
+ raise models.HTTPValidationError(data=response_data)
667
+ if utils.match_response(http_res, "500", "application/json"):
668
+ response_data = utils.unmarshal_json(
669
+ http_res.text, models.ErrorResponseData
670
+ )
671
+ raise models.ErrorResponse(data=response_data)
672
+ if utils.match_response(http_res, "4XX", "*"):
673
+ http_res_text = utils.stream_to_text(http_res)
674
+ raise models.APIError(
675
+ "API error occurred", http_res.status_code, http_res_text, http_res
676
+ )
677
+ if utils.match_response(http_res, "5XX", "*"):
678
+ http_res_text = utils.stream_to_text(http_res)
679
+ raise models.APIError(
680
+ "API error occurred", http_res.status_code, http_res_text, http_res
681
+ )
682
+
683
+ content_type = http_res.headers.get("Content-Type")
684
+ http_res_text = utils.stream_to_text(http_res)
685
+ raise models.APIError(
686
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
687
+ http_res.status_code,
688
+ http_res_text,
689
+ http_res,
690
+ )
691
+
692
+ async def cleanup_async(
693
+ self,
694
+ *,
695
+ internal_id: str,
696
+ batch_size: Optional[int] = 1000,
697
+ redis_url: OptionalNullable[str] = UNSET,
698
+ prefix: OptionalNullable[str] = UNSET,
699
+ x_namespace: OptionalNullable[str] = UNSET,
700
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
701
+ server_url: Optional[str] = None,
702
+ timeout_ms: Optional[int] = None,
703
+ http_headers: Optional[Mapping[str, str]] = None,
704
+ ) -> Dict[str, int]:
705
+ r"""Cleanup Cache
706
+
707
+ Cleanup expired cache entries.
708
+
709
+ Args:
710
+ batch_size: Number of keys to process per batch
711
+ cache_service: Cache service instance
712
+
713
+ Returns:
714
+ Number of keys deleted
715
+
716
+ :param internal_id:
717
+ :param batch_size:
718
+ :param redis_url:
719
+ :param prefix:
720
+ :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.
721
+ :param retries: Override the default retry configuration for this method
722
+ :param server_url: Override the default server URL for this method
723
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
724
+ :param http_headers: Additional headers to set or replace on requests.
725
+ """
726
+ base_url = None
727
+ url_variables = None
728
+ if timeout_ms is None:
729
+ timeout_ms = self.sdk_configuration.timeout_ms
730
+
731
+ if server_url is not None:
732
+ base_url = server_url
733
+ else:
734
+ base_url = self._get_url(base_url, url_variables)
735
+
736
+ request = models.CleanupCacheV1CollectionsCacheCleanupPostRequest(
737
+ batch_size=batch_size,
738
+ internal_id=internal_id,
739
+ redis_url=redis_url,
740
+ prefix=prefix,
741
+ x_namespace=x_namespace,
742
+ )
743
+
744
+ req = self._build_request_async(
745
+ method="POST",
746
+ path="/v1/collections/cache/cleanup",
747
+ base_url=base_url,
748
+ url_variables=url_variables,
749
+ request=request,
750
+ request_body_required=False,
751
+ request_has_path_params=False,
752
+ request_has_query_params=True,
753
+ user_agent_header="user-agent",
754
+ accept_header_value="application/json",
755
+ http_headers=http_headers,
756
+ security=self.sdk_configuration.security,
757
+ timeout_ms=timeout_ms,
758
+ )
759
+
760
+ if retries == UNSET:
761
+ if self.sdk_configuration.retry_config is not UNSET:
762
+ retries = self.sdk_configuration.retry_config
763
+
764
+ retry_config = None
765
+ if isinstance(retries, utils.RetryConfig):
766
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
767
+
768
+ http_res = await self.do_request_async(
769
+ hook_ctx=HookContext(
770
+ base_url=base_url or "",
771
+ operation_id="cleanup_cache_v1_collections_cache_cleanup_post",
772
+ oauth2_scopes=[],
773
+ security_source=get_security_from_env(
774
+ self.sdk_configuration.security, models.Security
775
+ ),
776
+ ),
777
+ request=req,
778
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
779
+ retry_config=retry_config,
780
+ )
781
+
782
+ response_data: Any = None
783
+ if utils.match_response(http_res, "200", "application/json"):
784
+ return utils.unmarshal_json(http_res.text, Dict[str, int])
785
+ if utils.match_response(
786
+ http_res, ["400", "401", "403", "404"], "application/json"
787
+ ):
788
+ response_data = utils.unmarshal_json(
789
+ http_res.text, models.ErrorResponseData
790
+ )
791
+ raise models.ErrorResponse(data=response_data)
792
+ if utils.match_response(http_res, "422", "application/json"):
793
+ response_data = utils.unmarshal_json(
794
+ http_res.text, models.HTTPValidationErrorData
795
+ )
796
+ raise models.HTTPValidationError(data=response_data)
797
+ if utils.match_response(http_res, "500", "application/json"):
798
+ response_data = utils.unmarshal_json(
799
+ http_res.text, models.ErrorResponseData
800
+ )
801
+ raise models.ErrorResponse(data=response_data)
802
+ if utils.match_response(http_res, "4XX", "*"):
803
+ http_res_text = await utils.stream_to_text_async(http_res)
804
+ raise models.APIError(
805
+ "API error occurred", http_res.status_code, http_res_text, http_res
806
+ )
807
+ if utils.match_response(http_res, "5XX", "*"):
808
+ http_res_text = await utils.stream_to_text_async(http_res)
809
+ raise models.APIError(
810
+ "API error occurred", http_res.status_code, http_res_text, http_res
811
+ )
812
+
813
+ content_type = http_res.headers.get("Content-Type")
814
+ http_res_text = await utils.stream_to_text_async(http_res)
815
+ raise models.APIError(
816
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
817
+ http_res.status_code,
818
+ http_res_text,
819
+ http_res,
820
+ )