mixpeek 0.20.19__py3-none-any.whl → 0.21.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 (228) hide show
  1. mixpeek/_version.py +3 -3
  2. mixpeek/{assets.py → bucket_objects.py} +309 -793
  3. mixpeek/buckets.py +1292 -0
  4. mixpeek/clusters.py +306 -0
  5. mixpeek/collection_cache.py +820 -0
  6. mixpeek/{taxonomyentities.py → collection_documents.py} +305 -559
  7. mixpeek/collections.py +122 -996
  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/organization_notifications.py +214 -0
  147. mixpeek/organizations.py +6 -210
  148. mixpeek/{featureextractors.py → organizations_usage.py} +31 -39
  149. mixpeek/research.py +228 -0
  150. mixpeek/retriever_interactions.py +1036 -0
  151. mixpeek/retriever_stages.py +232 -0
  152. mixpeek/{ingestassets.py → retrievers.py} +209 -271
  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.19.dist-info → mixpeek-0.21.1.dist-info}/METADATA +68 -50
  158. mixpeek-0.21.1.dist-info/RECORD +216 -0
  159. {mixpeek-0.20.19.dist-info → mixpeek-0.21.1.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.19.dist-info/RECORD +0 -201
@@ -0,0 +1,1036 @@
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 RetrieverInteractions(BaseSDK):
12
+ def create_interaction_v1_retrievers_interactions_post(
13
+ self,
14
+ *,
15
+ feature_id: str,
16
+ interaction_type: List[models.InteractionType],
17
+ x_namespace: OptionalNullable[str] = UNSET,
18
+ position: OptionalNullable[int] = UNSET,
19
+ metadata: OptionalNullable[
20
+ Union[
21
+ models.SearchInteractionMetadata,
22
+ models.SearchInteractionMetadataTypedDict,
23
+ ]
24
+ ] = UNSET,
25
+ user_id: OptionalNullable[str] = UNSET,
26
+ session_id: OptionalNullable[str] = UNSET,
27
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
28
+ server_url: Optional[str] = None,
29
+ timeout_ms: Optional[int] = None,
30
+ http_headers: Optional[Mapping[str, str]] = None,
31
+ ) -> models.InteractionResponse:
32
+ r"""Create Interaction
33
+
34
+ Record a search interaction (view, click, feedback, etc.)
35
+
36
+ **Requirements:**
37
+ - Required permissions: write
38
+
39
+ :param feature_id: ID of the item that was interacted with
40
+ :param interaction_type: Type of interaction or feedback
41
+ :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.
42
+ :param position: Position in search results where interaction occurred
43
+ :param metadata: Additional context about the interaction
44
+ :param user_id: Customer's authenticated user identifier - persists across sessions
45
+ :param session_id: Temporary identifier for a single search journey/session (typically 30min-1hr) - tracks anonymous and authenticated users
46
+ :param retries: Override the default retry configuration for this method
47
+ :param server_url: Override the default server URL for this method
48
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
49
+ :param http_headers: Additional headers to set or replace on requests.
50
+ """
51
+ base_url = None
52
+ url_variables = None
53
+ if timeout_ms is None:
54
+ timeout_ms = self.sdk_configuration.timeout_ms
55
+
56
+ if server_url is not None:
57
+ base_url = server_url
58
+ else:
59
+ base_url = self._get_url(base_url, url_variables)
60
+
61
+ request = models.CreateInteractionV1RetrieversInteractionsPostRequest(
62
+ x_namespace=x_namespace,
63
+ search_interaction=models.SearchInteraction(
64
+ feature_id=feature_id,
65
+ interaction_type=interaction_type,
66
+ position=position,
67
+ metadata=utils.get_pydantic_model(
68
+ metadata, OptionalNullable[models.SearchInteractionMetadata]
69
+ ),
70
+ user_id=user_id,
71
+ session_id=session_id,
72
+ ),
73
+ )
74
+
75
+ req = self._build_request(
76
+ method="POST",
77
+ path="/v1/retrievers/interactions",
78
+ base_url=base_url,
79
+ url_variables=url_variables,
80
+ request=request,
81
+ request_body_required=True,
82
+ request_has_path_params=False,
83
+ request_has_query_params=True,
84
+ user_agent_header="user-agent",
85
+ accept_header_value="application/json",
86
+ http_headers=http_headers,
87
+ security=self.sdk_configuration.security,
88
+ get_serialized_body=lambda: utils.serialize_request_body(
89
+ request.search_interaction,
90
+ False,
91
+ False,
92
+ "json",
93
+ models.SearchInteraction,
94
+ ),
95
+ timeout_ms=timeout_ms,
96
+ )
97
+
98
+ if retries == UNSET:
99
+ if self.sdk_configuration.retry_config is not UNSET:
100
+ retries = self.sdk_configuration.retry_config
101
+
102
+ retry_config = None
103
+ if isinstance(retries, utils.RetryConfig):
104
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
105
+
106
+ http_res = self.do_request(
107
+ hook_ctx=HookContext(
108
+ base_url=base_url or "",
109
+ operation_id="create_interaction_v1_retrievers_interactions_post",
110
+ oauth2_scopes=[],
111
+ security_source=get_security_from_env(
112
+ self.sdk_configuration.security, models.Security
113
+ ),
114
+ ),
115
+ request=req,
116
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
117
+ retry_config=retry_config,
118
+ )
119
+
120
+ response_data: Any = None
121
+ if utils.match_response(http_res, "200", "application/json"):
122
+ return utils.unmarshal_json(http_res.text, models.InteractionResponse)
123
+ if utils.match_response(
124
+ http_res, ["400", "401", "403", "404"], "application/json"
125
+ ):
126
+ response_data = utils.unmarshal_json(
127
+ http_res.text, models.ErrorResponseData
128
+ )
129
+ raise models.ErrorResponse(data=response_data)
130
+ if utils.match_response(http_res, "422", "application/json"):
131
+ response_data = utils.unmarshal_json(
132
+ http_res.text, models.HTTPValidationErrorData
133
+ )
134
+ raise models.HTTPValidationError(data=response_data)
135
+ if utils.match_response(http_res, "500", "application/json"):
136
+ response_data = utils.unmarshal_json(
137
+ http_res.text, models.ErrorResponseData
138
+ )
139
+ raise models.ErrorResponse(data=response_data)
140
+ if utils.match_response(http_res, "4XX", "*"):
141
+ http_res_text = utils.stream_to_text(http_res)
142
+ raise models.APIError(
143
+ "API error occurred", http_res.status_code, http_res_text, http_res
144
+ )
145
+ if utils.match_response(http_res, "5XX", "*"):
146
+ http_res_text = utils.stream_to_text(http_res)
147
+ raise models.APIError(
148
+ "API error occurred", http_res.status_code, http_res_text, http_res
149
+ )
150
+
151
+ content_type = http_res.headers.get("Content-Type")
152
+ http_res_text = utils.stream_to_text(http_res)
153
+ raise models.APIError(
154
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
155
+ http_res.status_code,
156
+ http_res_text,
157
+ http_res,
158
+ )
159
+
160
+ async def create_interaction_v1_retrievers_interactions_post_async(
161
+ self,
162
+ *,
163
+ feature_id: str,
164
+ interaction_type: List[models.InteractionType],
165
+ x_namespace: OptionalNullable[str] = UNSET,
166
+ position: OptionalNullable[int] = UNSET,
167
+ metadata: OptionalNullable[
168
+ Union[
169
+ models.SearchInteractionMetadata,
170
+ models.SearchInteractionMetadataTypedDict,
171
+ ]
172
+ ] = UNSET,
173
+ user_id: OptionalNullable[str] = UNSET,
174
+ session_id: OptionalNullable[str] = UNSET,
175
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
176
+ server_url: Optional[str] = None,
177
+ timeout_ms: Optional[int] = None,
178
+ http_headers: Optional[Mapping[str, str]] = None,
179
+ ) -> models.InteractionResponse:
180
+ r"""Create Interaction
181
+
182
+ Record a search interaction (view, click, feedback, etc.)
183
+
184
+ **Requirements:**
185
+ - Required permissions: write
186
+
187
+ :param feature_id: ID of the item that was interacted with
188
+ :param interaction_type: Type of interaction or feedback
189
+ :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.
190
+ :param position: Position in search results where interaction occurred
191
+ :param metadata: Additional context about the interaction
192
+ :param user_id: Customer's authenticated user identifier - persists across sessions
193
+ :param session_id: Temporary identifier for a single search journey/session (typically 30min-1hr) - tracks anonymous and authenticated users
194
+ :param retries: Override the default retry configuration for this method
195
+ :param server_url: Override the default server URL for this method
196
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
197
+ :param http_headers: Additional headers to set or replace on requests.
198
+ """
199
+ base_url = None
200
+ url_variables = None
201
+ if timeout_ms is None:
202
+ timeout_ms = self.sdk_configuration.timeout_ms
203
+
204
+ if server_url is not None:
205
+ base_url = server_url
206
+ else:
207
+ base_url = self._get_url(base_url, url_variables)
208
+
209
+ request = models.CreateInteractionV1RetrieversInteractionsPostRequest(
210
+ x_namespace=x_namespace,
211
+ search_interaction=models.SearchInteraction(
212
+ feature_id=feature_id,
213
+ interaction_type=interaction_type,
214
+ position=position,
215
+ metadata=utils.get_pydantic_model(
216
+ metadata, OptionalNullable[models.SearchInteractionMetadata]
217
+ ),
218
+ user_id=user_id,
219
+ session_id=session_id,
220
+ ),
221
+ )
222
+
223
+ req = self._build_request_async(
224
+ method="POST",
225
+ path="/v1/retrievers/interactions",
226
+ base_url=base_url,
227
+ url_variables=url_variables,
228
+ request=request,
229
+ request_body_required=True,
230
+ request_has_path_params=False,
231
+ request_has_query_params=True,
232
+ user_agent_header="user-agent",
233
+ accept_header_value="application/json",
234
+ http_headers=http_headers,
235
+ security=self.sdk_configuration.security,
236
+ get_serialized_body=lambda: utils.serialize_request_body(
237
+ request.search_interaction,
238
+ False,
239
+ False,
240
+ "json",
241
+ models.SearchInteraction,
242
+ ),
243
+ timeout_ms=timeout_ms,
244
+ )
245
+
246
+ if retries == UNSET:
247
+ if self.sdk_configuration.retry_config is not UNSET:
248
+ retries = self.sdk_configuration.retry_config
249
+
250
+ retry_config = None
251
+ if isinstance(retries, utils.RetryConfig):
252
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
253
+
254
+ http_res = await self.do_request_async(
255
+ hook_ctx=HookContext(
256
+ base_url=base_url or "",
257
+ operation_id="create_interaction_v1_retrievers_interactions_post",
258
+ oauth2_scopes=[],
259
+ security_source=get_security_from_env(
260
+ self.sdk_configuration.security, models.Security
261
+ ),
262
+ ),
263
+ request=req,
264
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
265
+ retry_config=retry_config,
266
+ )
267
+
268
+ response_data: Any = None
269
+ if utils.match_response(http_res, "200", "application/json"):
270
+ return utils.unmarshal_json(http_res.text, models.InteractionResponse)
271
+ if utils.match_response(
272
+ http_res, ["400", "401", "403", "404"], "application/json"
273
+ ):
274
+ response_data = utils.unmarshal_json(
275
+ http_res.text, models.ErrorResponseData
276
+ )
277
+ raise models.ErrorResponse(data=response_data)
278
+ if utils.match_response(http_res, "422", "application/json"):
279
+ response_data = utils.unmarshal_json(
280
+ http_res.text, models.HTTPValidationErrorData
281
+ )
282
+ raise models.HTTPValidationError(data=response_data)
283
+ if utils.match_response(http_res, "500", "application/json"):
284
+ response_data = utils.unmarshal_json(
285
+ http_res.text, models.ErrorResponseData
286
+ )
287
+ raise models.ErrorResponse(data=response_data)
288
+ if utils.match_response(http_res, "4XX", "*"):
289
+ http_res_text = await utils.stream_to_text_async(http_res)
290
+ raise models.APIError(
291
+ "API error occurred", http_res.status_code, http_res_text, http_res
292
+ )
293
+ if utils.match_response(http_res, "5XX", "*"):
294
+ http_res_text = await utils.stream_to_text_async(http_res)
295
+ raise models.APIError(
296
+ "API error occurred", http_res.status_code, http_res_text, http_res
297
+ )
298
+
299
+ content_type = http_res.headers.get("Content-Type")
300
+ http_res_text = await utils.stream_to_text_async(http_res)
301
+ raise models.APIError(
302
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
303
+ http_res.status_code,
304
+ http_res_text,
305
+ http_res,
306
+ )
307
+
308
+ def list_interactions_v1_retrievers_interactions_get(
309
+ self,
310
+ *,
311
+ feature_id: OptionalNullable[str] = UNSET,
312
+ interaction_type: OptionalNullable[str] = UNSET,
313
+ session_id: OptionalNullable[str] = UNSET,
314
+ page: OptionalNullable[int] = UNSET,
315
+ page_size: Optional[int] = 10,
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
+ ) -> List[models.InteractionResponse]:
322
+ r"""List Interactions
323
+
324
+ List interactions with optional filters and pagination
325
+
326
+ **Requirements:**
327
+ - Required permissions: read
328
+
329
+ :param feature_id:
330
+ :param interaction_type:
331
+ :param session_id:
332
+ :param page:
333
+ :param page_size:
334
+ :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.
335
+ :param retries: Override the default retry configuration for this method
336
+ :param server_url: Override the default server URL for this method
337
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
338
+ :param http_headers: Additional headers to set or replace on requests.
339
+ """
340
+ base_url = None
341
+ url_variables = None
342
+ if timeout_ms is None:
343
+ timeout_ms = self.sdk_configuration.timeout_ms
344
+
345
+ if server_url is not None:
346
+ base_url = server_url
347
+ else:
348
+ base_url = self._get_url(base_url, url_variables)
349
+
350
+ request = models.ListInteractionsV1RetrieversInteractionsGetRequest(
351
+ feature_id=feature_id,
352
+ interaction_type=interaction_type,
353
+ session_id=session_id,
354
+ page=page,
355
+ page_size=page_size,
356
+ x_namespace=x_namespace,
357
+ )
358
+
359
+ req = self._build_request(
360
+ method="GET",
361
+ path="/v1/retrievers/interactions",
362
+ base_url=base_url,
363
+ url_variables=url_variables,
364
+ request=request,
365
+ request_body_required=False,
366
+ request_has_path_params=False,
367
+ request_has_query_params=True,
368
+ user_agent_header="user-agent",
369
+ accept_header_value="application/json",
370
+ http_headers=http_headers,
371
+ security=self.sdk_configuration.security,
372
+ timeout_ms=timeout_ms,
373
+ )
374
+
375
+ if retries == UNSET:
376
+ if self.sdk_configuration.retry_config is not UNSET:
377
+ retries = self.sdk_configuration.retry_config
378
+
379
+ retry_config = None
380
+ if isinstance(retries, utils.RetryConfig):
381
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
382
+
383
+ http_res = self.do_request(
384
+ hook_ctx=HookContext(
385
+ base_url=base_url or "",
386
+ operation_id="list_interactions_v1_retrievers_interactions_get",
387
+ oauth2_scopes=[],
388
+ security_source=get_security_from_env(
389
+ self.sdk_configuration.security, models.Security
390
+ ),
391
+ ),
392
+ request=req,
393
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
394
+ retry_config=retry_config,
395
+ )
396
+
397
+ response_data: Any = None
398
+ if utils.match_response(http_res, "200", "application/json"):
399
+ return utils.unmarshal_json(http_res.text, List[models.InteractionResponse])
400
+ if utils.match_response(
401
+ http_res, ["400", "401", "403", "404"], "application/json"
402
+ ):
403
+ response_data = utils.unmarshal_json(
404
+ http_res.text, models.ErrorResponseData
405
+ )
406
+ raise models.ErrorResponse(data=response_data)
407
+ if utils.match_response(http_res, "422", "application/json"):
408
+ response_data = utils.unmarshal_json(
409
+ http_res.text, models.HTTPValidationErrorData
410
+ )
411
+ raise models.HTTPValidationError(data=response_data)
412
+ if utils.match_response(http_res, "500", "application/json"):
413
+ response_data = utils.unmarshal_json(
414
+ http_res.text, models.ErrorResponseData
415
+ )
416
+ raise models.ErrorResponse(data=response_data)
417
+ if utils.match_response(http_res, "4XX", "*"):
418
+ http_res_text = utils.stream_to_text(http_res)
419
+ raise models.APIError(
420
+ "API error occurred", http_res.status_code, http_res_text, http_res
421
+ )
422
+ if utils.match_response(http_res, "5XX", "*"):
423
+ http_res_text = utils.stream_to_text(http_res)
424
+ raise models.APIError(
425
+ "API error occurred", http_res.status_code, http_res_text, http_res
426
+ )
427
+
428
+ content_type = http_res.headers.get("Content-Type")
429
+ http_res_text = utils.stream_to_text(http_res)
430
+ raise models.APIError(
431
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
432
+ http_res.status_code,
433
+ http_res_text,
434
+ http_res,
435
+ )
436
+
437
+ async def list_interactions_v1_retrievers_interactions_get_async(
438
+ self,
439
+ *,
440
+ feature_id: OptionalNullable[str] = UNSET,
441
+ interaction_type: OptionalNullable[str] = UNSET,
442
+ session_id: OptionalNullable[str] = UNSET,
443
+ page: OptionalNullable[int] = UNSET,
444
+ page_size: Optional[int] = 10,
445
+ x_namespace: OptionalNullable[str] = UNSET,
446
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
447
+ server_url: Optional[str] = None,
448
+ timeout_ms: Optional[int] = None,
449
+ http_headers: Optional[Mapping[str, str]] = None,
450
+ ) -> List[models.InteractionResponse]:
451
+ r"""List Interactions
452
+
453
+ List interactions with optional filters and pagination
454
+
455
+ **Requirements:**
456
+ - Required permissions: read
457
+
458
+ :param feature_id:
459
+ :param interaction_type:
460
+ :param session_id:
461
+ :param page:
462
+ :param page_size:
463
+ :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.
464
+ :param retries: Override the default retry configuration for this method
465
+ :param server_url: Override the default server URL for this method
466
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
467
+ :param http_headers: Additional headers to set or replace on requests.
468
+ """
469
+ base_url = None
470
+ url_variables = None
471
+ if timeout_ms is None:
472
+ timeout_ms = self.sdk_configuration.timeout_ms
473
+
474
+ if server_url is not None:
475
+ base_url = server_url
476
+ else:
477
+ base_url = self._get_url(base_url, url_variables)
478
+
479
+ request = models.ListInteractionsV1RetrieversInteractionsGetRequest(
480
+ feature_id=feature_id,
481
+ interaction_type=interaction_type,
482
+ session_id=session_id,
483
+ page=page,
484
+ page_size=page_size,
485
+ x_namespace=x_namespace,
486
+ )
487
+
488
+ req = self._build_request_async(
489
+ method="GET",
490
+ path="/v1/retrievers/interactions",
491
+ base_url=base_url,
492
+ url_variables=url_variables,
493
+ request=request,
494
+ request_body_required=False,
495
+ request_has_path_params=False,
496
+ request_has_query_params=True,
497
+ user_agent_header="user-agent",
498
+ accept_header_value="application/json",
499
+ http_headers=http_headers,
500
+ security=self.sdk_configuration.security,
501
+ timeout_ms=timeout_ms,
502
+ )
503
+
504
+ if retries == UNSET:
505
+ if self.sdk_configuration.retry_config is not UNSET:
506
+ retries = self.sdk_configuration.retry_config
507
+
508
+ retry_config = None
509
+ if isinstance(retries, utils.RetryConfig):
510
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
511
+
512
+ http_res = await self.do_request_async(
513
+ hook_ctx=HookContext(
514
+ base_url=base_url or "",
515
+ operation_id="list_interactions_v1_retrievers_interactions_get",
516
+ oauth2_scopes=[],
517
+ security_source=get_security_from_env(
518
+ self.sdk_configuration.security, models.Security
519
+ ),
520
+ ),
521
+ request=req,
522
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
523
+ retry_config=retry_config,
524
+ )
525
+
526
+ response_data: Any = None
527
+ if utils.match_response(http_res, "200", "application/json"):
528
+ return utils.unmarshal_json(http_res.text, List[models.InteractionResponse])
529
+ if utils.match_response(
530
+ http_res, ["400", "401", "403", "404"], "application/json"
531
+ ):
532
+ response_data = utils.unmarshal_json(
533
+ http_res.text, models.ErrorResponseData
534
+ )
535
+ raise models.ErrorResponse(data=response_data)
536
+ if utils.match_response(http_res, "422", "application/json"):
537
+ response_data = utils.unmarshal_json(
538
+ http_res.text, models.HTTPValidationErrorData
539
+ )
540
+ raise models.HTTPValidationError(data=response_data)
541
+ if utils.match_response(http_res, "500", "application/json"):
542
+ response_data = utils.unmarshal_json(
543
+ http_res.text, models.ErrorResponseData
544
+ )
545
+ raise models.ErrorResponse(data=response_data)
546
+ if utils.match_response(http_res, "4XX", "*"):
547
+ http_res_text = await utils.stream_to_text_async(http_res)
548
+ raise models.APIError(
549
+ "API error occurred", http_res.status_code, http_res_text, http_res
550
+ )
551
+ if utils.match_response(http_res, "5XX", "*"):
552
+ http_res_text = await utils.stream_to_text_async(http_res)
553
+ raise models.APIError(
554
+ "API error occurred", http_res.status_code, http_res_text, http_res
555
+ )
556
+
557
+ content_type = http_res.headers.get("Content-Type")
558
+ http_res_text = await utils.stream_to_text_async(http_res)
559
+ raise models.APIError(
560
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
561
+ http_res.status_code,
562
+ http_res_text,
563
+ http_res,
564
+ )
565
+
566
+ def get_interaction_v1_retrievers_interactions_interaction_id_get(
567
+ self,
568
+ *,
569
+ interaction_id: str,
570
+ x_namespace: OptionalNullable[str] = UNSET,
571
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
572
+ server_url: Optional[str] = None,
573
+ timeout_ms: Optional[int] = None,
574
+ http_headers: Optional[Mapping[str, str]] = None,
575
+ ) -> models.InteractionResponse:
576
+ r"""Get Interaction
577
+
578
+ Get a specific interaction
579
+
580
+ **Requirements:**
581
+ - Required permissions: read
582
+
583
+ :param interaction_id:
584
+ :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.
585
+ :param retries: Override the default retry configuration for this method
586
+ :param server_url: Override the default server URL for this method
587
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
588
+ :param http_headers: Additional headers to set or replace on requests.
589
+ """
590
+ base_url = None
591
+ url_variables = None
592
+ if timeout_ms is None:
593
+ timeout_ms = self.sdk_configuration.timeout_ms
594
+
595
+ if server_url is not None:
596
+ base_url = server_url
597
+ else:
598
+ base_url = self._get_url(base_url, url_variables)
599
+
600
+ request = models.GetInteractionV1RetrieversInteractionsInteractionIDGetRequest(
601
+ interaction_id=interaction_id,
602
+ x_namespace=x_namespace,
603
+ )
604
+
605
+ req = self._build_request(
606
+ method="GET",
607
+ path="/v1/retrievers/interactions/{interaction_id}",
608
+ base_url=base_url,
609
+ url_variables=url_variables,
610
+ request=request,
611
+ request_body_required=False,
612
+ request_has_path_params=True,
613
+ request_has_query_params=True,
614
+ user_agent_header="user-agent",
615
+ accept_header_value="application/json",
616
+ http_headers=http_headers,
617
+ security=self.sdk_configuration.security,
618
+ timeout_ms=timeout_ms,
619
+ )
620
+
621
+ if retries == UNSET:
622
+ if self.sdk_configuration.retry_config is not UNSET:
623
+ retries = self.sdk_configuration.retry_config
624
+
625
+ retry_config = None
626
+ if isinstance(retries, utils.RetryConfig):
627
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
628
+
629
+ http_res = self.do_request(
630
+ hook_ctx=HookContext(
631
+ base_url=base_url or "",
632
+ operation_id="get_interaction_v1_retrievers_interactions__interaction_id__get",
633
+ oauth2_scopes=[],
634
+ security_source=get_security_from_env(
635
+ self.sdk_configuration.security, models.Security
636
+ ),
637
+ ),
638
+ request=req,
639
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
640
+ retry_config=retry_config,
641
+ )
642
+
643
+ response_data: Any = None
644
+ if utils.match_response(http_res, "200", "application/json"):
645
+ return utils.unmarshal_json(http_res.text, models.InteractionResponse)
646
+ if utils.match_response(
647
+ http_res, ["400", "401", "403", "404"], "application/json"
648
+ ):
649
+ response_data = utils.unmarshal_json(
650
+ http_res.text, models.ErrorResponseData
651
+ )
652
+ raise models.ErrorResponse(data=response_data)
653
+ if utils.match_response(http_res, "422", "application/json"):
654
+ response_data = utils.unmarshal_json(
655
+ http_res.text, models.HTTPValidationErrorData
656
+ )
657
+ raise models.HTTPValidationError(data=response_data)
658
+ if utils.match_response(http_res, "500", "application/json"):
659
+ response_data = utils.unmarshal_json(
660
+ http_res.text, models.ErrorResponseData
661
+ )
662
+ raise models.ErrorResponse(data=response_data)
663
+ if utils.match_response(http_res, "4XX", "*"):
664
+ http_res_text = utils.stream_to_text(http_res)
665
+ raise models.APIError(
666
+ "API error occurred", http_res.status_code, http_res_text, http_res
667
+ )
668
+ if utils.match_response(http_res, "5XX", "*"):
669
+ http_res_text = utils.stream_to_text(http_res)
670
+ raise models.APIError(
671
+ "API error occurred", http_res.status_code, http_res_text, http_res
672
+ )
673
+
674
+ content_type = http_res.headers.get("Content-Type")
675
+ http_res_text = utils.stream_to_text(http_res)
676
+ raise models.APIError(
677
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
678
+ http_res.status_code,
679
+ http_res_text,
680
+ http_res,
681
+ )
682
+
683
+ async def get_interaction_v1_retrievers_interactions_interaction_id_get_async(
684
+ self,
685
+ *,
686
+ interaction_id: str,
687
+ x_namespace: OptionalNullable[str] = UNSET,
688
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
689
+ server_url: Optional[str] = None,
690
+ timeout_ms: Optional[int] = None,
691
+ http_headers: Optional[Mapping[str, str]] = None,
692
+ ) -> models.InteractionResponse:
693
+ r"""Get Interaction
694
+
695
+ Get a specific interaction
696
+
697
+ **Requirements:**
698
+ - Required permissions: read
699
+
700
+ :param interaction_id:
701
+ :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.
702
+ :param retries: Override the default retry configuration for this method
703
+ :param server_url: Override the default server URL for this method
704
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
705
+ :param http_headers: Additional headers to set or replace on requests.
706
+ """
707
+ base_url = None
708
+ url_variables = None
709
+ if timeout_ms is None:
710
+ timeout_ms = self.sdk_configuration.timeout_ms
711
+
712
+ if server_url is not None:
713
+ base_url = server_url
714
+ else:
715
+ base_url = self._get_url(base_url, url_variables)
716
+
717
+ request = models.GetInteractionV1RetrieversInteractionsInteractionIDGetRequest(
718
+ interaction_id=interaction_id,
719
+ x_namespace=x_namespace,
720
+ )
721
+
722
+ req = self._build_request_async(
723
+ method="GET",
724
+ path="/v1/retrievers/interactions/{interaction_id}",
725
+ base_url=base_url,
726
+ url_variables=url_variables,
727
+ request=request,
728
+ request_body_required=False,
729
+ request_has_path_params=True,
730
+ request_has_query_params=True,
731
+ user_agent_header="user-agent",
732
+ accept_header_value="application/json",
733
+ http_headers=http_headers,
734
+ security=self.sdk_configuration.security,
735
+ timeout_ms=timeout_ms,
736
+ )
737
+
738
+ if retries == UNSET:
739
+ if self.sdk_configuration.retry_config is not UNSET:
740
+ retries = self.sdk_configuration.retry_config
741
+
742
+ retry_config = None
743
+ if isinstance(retries, utils.RetryConfig):
744
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
745
+
746
+ http_res = await self.do_request_async(
747
+ hook_ctx=HookContext(
748
+ base_url=base_url or "",
749
+ operation_id="get_interaction_v1_retrievers_interactions__interaction_id__get",
750
+ oauth2_scopes=[],
751
+ security_source=get_security_from_env(
752
+ self.sdk_configuration.security, models.Security
753
+ ),
754
+ ),
755
+ request=req,
756
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
757
+ retry_config=retry_config,
758
+ )
759
+
760
+ response_data: Any = None
761
+ if utils.match_response(http_res, "200", "application/json"):
762
+ return utils.unmarshal_json(http_res.text, models.InteractionResponse)
763
+ if utils.match_response(
764
+ http_res, ["400", "401", "403", "404"], "application/json"
765
+ ):
766
+ response_data = utils.unmarshal_json(
767
+ http_res.text, models.ErrorResponseData
768
+ )
769
+ raise models.ErrorResponse(data=response_data)
770
+ if utils.match_response(http_res, "422", "application/json"):
771
+ response_data = utils.unmarshal_json(
772
+ http_res.text, models.HTTPValidationErrorData
773
+ )
774
+ raise models.HTTPValidationError(data=response_data)
775
+ if utils.match_response(http_res, "500", "application/json"):
776
+ response_data = utils.unmarshal_json(
777
+ http_res.text, models.ErrorResponseData
778
+ )
779
+ raise models.ErrorResponse(data=response_data)
780
+ if utils.match_response(http_res, "4XX", "*"):
781
+ http_res_text = await utils.stream_to_text_async(http_res)
782
+ raise models.APIError(
783
+ "API error occurred", http_res.status_code, http_res_text, http_res
784
+ )
785
+ if utils.match_response(http_res, "5XX", "*"):
786
+ http_res_text = await utils.stream_to_text_async(http_res)
787
+ raise models.APIError(
788
+ "API error occurred", http_res.status_code, http_res_text, http_res
789
+ )
790
+
791
+ content_type = http_res.headers.get("Content-Type")
792
+ http_res_text = await utils.stream_to_text_async(http_res)
793
+ raise models.APIError(
794
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
795
+ http_res.status_code,
796
+ http_res_text,
797
+ http_res,
798
+ )
799
+
800
+ def delete_interaction_v1_retrievers_interactions_interaction_id_delete(
801
+ self,
802
+ *,
803
+ interaction_id: str,
804
+ x_namespace: OptionalNullable[str] = UNSET,
805
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
806
+ server_url: Optional[str] = None,
807
+ timeout_ms: Optional[int] = None,
808
+ http_headers: Optional[Mapping[str, str]] = None,
809
+ ) -> Any:
810
+ r"""Delete Interaction
811
+
812
+ Delete a specific interaction
813
+
814
+ **Requirements:**
815
+ - Required permissions: write
816
+
817
+ :param interaction_id:
818
+ :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.
819
+ :param retries: Override the default retry configuration for this method
820
+ :param server_url: Override the default server URL for this method
821
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
822
+ :param http_headers: Additional headers to set or replace on requests.
823
+ """
824
+ base_url = None
825
+ url_variables = None
826
+ if timeout_ms is None:
827
+ timeout_ms = self.sdk_configuration.timeout_ms
828
+
829
+ if server_url is not None:
830
+ base_url = server_url
831
+ else:
832
+ base_url = self._get_url(base_url, url_variables)
833
+
834
+ request = (
835
+ models.DeleteInteractionV1RetrieversInteractionsInteractionIDDeleteRequest(
836
+ interaction_id=interaction_id,
837
+ x_namespace=x_namespace,
838
+ )
839
+ )
840
+
841
+ req = self._build_request(
842
+ method="DELETE",
843
+ path="/v1/retrievers/interactions/{interaction_id}",
844
+ base_url=base_url,
845
+ url_variables=url_variables,
846
+ request=request,
847
+ request_body_required=False,
848
+ request_has_path_params=True,
849
+ request_has_query_params=True,
850
+ user_agent_header="user-agent",
851
+ accept_header_value="application/json",
852
+ http_headers=http_headers,
853
+ security=self.sdk_configuration.security,
854
+ timeout_ms=timeout_ms,
855
+ )
856
+
857
+ if retries == UNSET:
858
+ if self.sdk_configuration.retry_config is not UNSET:
859
+ retries = self.sdk_configuration.retry_config
860
+
861
+ retry_config = None
862
+ if isinstance(retries, utils.RetryConfig):
863
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
864
+
865
+ http_res = self.do_request(
866
+ hook_ctx=HookContext(
867
+ base_url=base_url or "",
868
+ operation_id="delete_interaction_v1_retrievers_interactions__interaction_id__delete",
869
+ oauth2_scopes=[],
870
+ security_source=get_security_from_env(
871
+ self.sdk_configuration.security, models.Security
872
+ ),
873
+ ),
874
+ request=req,
875
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
876
+ retry_config=retry_config,
877
+ )
878
+
879
+ response_data: Any = None
880
+ if utils.match_response(http_res, "200", "application/json"):
881
+ return utils.unmarshal_json(http_res.text, Any)
882
+ if utils.match_response(
883
+ http_res, ["400", "401", "403", "404"], "application/json"
884
+ ):
885
+ response_data = utils.unmarshal_json(
886
+ http_res.text, models.ErrorResponseData
887
+ )
888
+ raise models.ErrorResponse(data=response_data)
889
+ if utils.match_response(http_res, "422", "application/json"):
890
+ response_data = utils.unmarshal_json(
891
+ http_res.text, models.HTTPValidationErrorData
892
+ )
893
+ raise models.HTTPValidationError(data=response_data)
894
+ if utils.match_response(http_res, "500", "application/json"):
895
+ response_data = utils.unmarshal_json(
896
+ http_res.text, models.ErrorResponseData
897
+ )
898
+ raise models.ErrorResponse(data=response_data)
899
+ if utils.match_response(http_res, "4XX", "*"):
900
+ http_res_text = utils.stream_to_text(http_res)
901
+ raise models.APIError(
902
+ "API error occurred", http_res.status_code, http_res_text, http_res
903
+ )
904
+ if utils.match_response(http_res, "5XX", "*"):
905
+ http_res_text = utils.stream_to_text(http_res)
906
+ raise models.APIError(
907
+ "API error occurred", http_res.status_code, http_res_text, http_res
908
+ )
909
+
910
+ content_type = http_res.headers.get("Content-Type")
911
+ http_res_text = utils.stream_to_text(http_res)
912
+ raise models.APIError(
913
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
914
+ http_res.status_code,
915
+ http_res_text,
916
+ http_res,
917
+ )
918
+
919
+ async def delete_interaction_v1_retrievers_interactions_interaction_id_delete_async(
920
+ self,
921
+ *,
922
+ interaction_id: str,
923
+ x_namespace: OptionalNullable[str] = UNSET,
924
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
925
+ server_url: Optional[str] = None,
926
+ timeout_ms: Optional[int] = None,
927
+ http_headers: Optional[Mapping[str, str]] = None,
928
+ ) -> Any:
929
+ r"""Delete Interaction
930
+
931
+ Delete a specific interaction
932
+
933
+ **Requirements:**
934
+ - Required permissions: write
935
+
936
+ :param interaction_id:
937
+ :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.
938
+ :param retries: Override the default retry configuration for this method
939
+ :param server_url: Override the default server URL for this method
940
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
941
+ :param http_headers: Additional headers to set or replace on requests.
942
+ """
943
+ base_url = None
944
+ url_variables = None
945
+ if timeout_ms is None:
946
+ timeout_ms = self.sdk_configuration.timeout_ms
947
+
948
+ if server_url is not None:
949
+ base_url = server_url
950
+ else:
951
+ base_url = self._get_url(base_url, url_variables)
952
+
953
+ request = (
954
+ models.DeleteInteractionV1RetrieversInteractionsInteractionIDDeleteRequest(
955
+ interaction_id=interaction_id,
956
+ x_namespace=x_namespace,
957
+ )
958
+ )
959
+
960
+ req = self._build_request_async(
961
+ method="DELETE",
962
+ path="/v1/retrievers/interactions/{interaction_id}",
963
+ base_url=base_url,
964
+ url_variables=url_variables,
965
+ request=request,
966
+ request_body_required=False,
967
+ request_has_path_params=True,
968
+ request_has_query_params=True,
969
+ user_agent_header="user-agent",
970
+ accept_header_value="application/json",
971
+ http_headers=http_headers,
972
+ security=self.sdk_configuration.security,
973
+ timeout_ms=timeout_ms,
974
+ )
975
+
976
+ if retries == UNSET:
977
+ if self.sdk_configuration.retry_config is not UNSET:
978
+ retries = self.sdk_configuration.retry_config
979
+
980
+ retry_config = None
981
+ if isinstance(retries, utils.RetryConfig):
982
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
983
+
984
+ http_res = await self.do_request_async(
985
+ hook_ctx=HookContext(
986
+ base_url=base_url or "",
987
+ operation_id="delete_interaction_v1_retrievers_interactions__interaction_id__delete",
988
+ oauth2_scopes=[],
989
+ security_source=get_security_from_env(
990
+ self.sdk_configuration.security, models.Security
991
+ ),
992
+ ),
993
+ request=req,
994
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
995
+ retry_config=retry_config,
996
+ )
997
+
998
+ response_data: Any = None
999
+ if utils.match_response(http_res, "200", "application/json"):
1000
+ return utils.unmarshal_json(http_res.text, Any)
1001
+ if utils.match_response(
1002
+ http_res, ["400", "401", "403", "404"], "application/json"
1003
+ ):
1004
+ response_data = utils.unmarshal_json(
1005
+ http_res.text, models.ErrorResponseData
1006
+ )
1007
+ raise models.ErrorResponse(data=response_data)
1008
+ if utils.match_response(http_res, "422", "application/json"):
1009
+ response_data = utils.unmarshal_json(
1010
+ http_res.text, models.HTTPValidationErrorData
1011
+ )
1012
+ raise models.HTTPValidationError(data=response_data)
1013
+ if utils.match_response(http_res, "500", "application/json"):
1014
+ response_data = utils.unmarshal_json(
1015
+ http_res.text, models.ErrorResponseData
1016
+ )
1017
+ raise models.ErrorResponse(data=response_data)
1018
+ if utils.match_response(http_res, "4XX", "*"):
1019
+ http_res_text = await utils.stream_to_text_async(http_res)
1020
+ raise models.APIError(
1021
+ "API error occurred", http_res.status_code, http_res_text, http_res
1022
+ )
1023
+ if utils.match_response(http_res, "5XX", "*"):
1024
+ http_res_text = await utils.stream_to_text_async(http_res)
1025
+ raise models.APIError(
1026
+ "API error occurred", http_res.status_code, http_res_text, http_res
1027
+ )
1028
+
1029
+ content_type = http_res.headers.get("Content-Type")
1030
+ http_res_text = await utils.stream_to_text_async(http_res)
1031
+ raise models.APIError(
1032
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1033
+ http_res.status_code,
1034
+ http_res_text,
1035
+ http_res,
1036
+ )