mixpeek 0.21.7__py3-none-any.whl → 0.22.0__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 (84) hide show
  1. mixpeek/_hooks/types.py +7 -0
  2. mixpeek/_version.py +3 -3
  3. mixpeek/basesdk.py +12 -20
  4. mixpeek/bucketobjects.py +19 -37
  5. mixpeek/buckets.py +19 -31
  6. mixpeek/clusters.py +2 -0
  7. mixpeek/collectioncache.py +6 -0
  8. mixpeek/collections.py +13 -19
  9. mixpeek/features.py +4 -0
  10. mixpeek/health.py +2 -0
  11. mixpeek/httpclient.py +6 -16
  12. mixpeek/models/__init__.py +752 -583
  13. mixpeek/models/blobmodel.py +3 -11
  14. mixpeek/models/bucketcreaterequest.py +3 -11
  15. mixpeek/models/bucketresponse.py +3 -11
  16. mixpeek/models/bucketschemafield_input.py +6 -22
  17. mixpeek/models/bucketschemafield_output.py +6 -22
  18. mixpeek/models/bucketschemafieldbase.py +81 -0
  19. mixpeek/models/bucketschemafieldtype.py +1 -0
  20. mixpeek/models/bucketupdaterequest.py +3 -10
  21. mixpeek/models/collectionmodel.py +3 -11
  22. mixpeek/models/createblobrequest.py +3 -11
  23. mixpeek/models/createcollectionrequest.py +3 -11
  24. mixpeek/models/createnamespacerequest.py +9 -9
  25. mixpeek/models/createobjectrequest.py +3 -11
  26. mixpeek/models/createretrieverrequest.py +8 -16
  27. mixpeek/models/errordetail.py +3 -10
  28. mixpeek/models/featureextractorconfig.py +3 -11
  29. mixpeek/models/featureextractordefinition.py +26 -46
  30. mixpeek/models/interactionresponse.py +3 -11
  31. mixpeek/models/internal/__init__.py +35 -1
  32. mixpeek/models/logicaloperator_input.py +30 -36
  33. mixpeek/models/logicaloperator_output.py +39 -45
  34. mixpeek/models/logicaloperatorbase_input.py +74 -0
  35. mixpeek/models/logicaloperatorbase_output.py +74 -0
  36. mixpeek/models/namespaceresponse.py +17 -6
  37. mixpeek/models/namespacestatus.py +10 -0
  38. mixpeek/models/objectresponse.py +3 -11
  39. mixpeek/models/organizationmodel.py +3 -11
  40. mixpeek/models/retrieverbinding.py +3 -10
  41. mixpeek/models/retrievermodel.py +11 -16
  42. mixpeek/models/retrieverqueryrequest.py +3 -11
  43. mixpeek/models/retrieverschema_input.py +37 -0
  44. mixpeek/models/retrieverschema_output.py +37 -0
  45. mixpeek/models/retrieverschemafield_input.py +91 -0
  46. mixpeek/models/retrieverschemafield_output.py +91 -0
  47. mixpeek/models/searchinteraction.py +3 -11
  48. mixpeek/models/stageconfig_input.py +8 -16
  49. mixpeek/models/stageconfig_output.py +8 -16
  50. mixpeek/models/stagedefinition.py +28 -17
  51. mixpeek/models/stageresponse.py +3 -11
  52. mixpeek/models/updateobjectrequest.py +3 -11
  53. mixpeek/models/usermodel_input.py +3 -11
  54. mixpeek/models/usermodel_output.py +3 -11
  55. mixpeek/namespaces.py +28 -22
  56. mixpeek/organizationnotifications.py +2 -0
  57. mixpeek/organizations.py +13 -13
  58. mixpeek/organizationsusage.py +2 -0
  59. mixpeek/research.py +2 -0
  60. mixpeek/retrieverinteractions.py +13 -19
  61. mixpeek/retrievers.py +21 -39
  62. mixpeek/retrieverstages.py +2 -0
  63. mixpeek/sdk.py +94 -65
  64. mixpeek/sdkconfiguration.py +0 -7
  65. mixpeek/tasks.py +6 -0
  66. mixpeek/taxonomies.py +2 -0
  67. mixpeek/users.py +6 -0
  68. mixpeek/utils/__init__.py +131 -45
  69. mixpeek/utils/datetimes.py +23 -0
  70. mixpeek/utils/serializers.py +32 -3
  71. {mixpeek-0.21.7.dist-info → mixpeek-0.22.0.dist-info}/METADATA +3 -15
  72. {mixpeek-0.21.7.dist-info → mixpeek-0.22.0.dist-info}/RECORD +73 -75
  73. {mixpeek-0.21.7.dist-info → mixpeek-0.22.0.dist-info}/WHEEL +1 -1
  74. mixpeek/collectiondocuments.py +0 -1564
  75. mixpeek/models/batch_delete_documents_v1_collections_collection_identifier_documents_batch_deleteop.py +0 -75
  76. mixpeek/models/batch_update_documents_v1_collections_collection_identifier_documents_batch_putop.py +0 -84
  77. mixpeek/models/delete_document_v1_collections_collection_identifier_documents_document_id_deleteop.py +0 -70
  78. mixpeek/models/documentlistresponse.py +0 -56
  79. mixpeek/models/documentresponse.py +0 -87
  80. mixpeek/models/documentupdate.py +0 -60
  81. mixpeek/models/genericsuccessresponse.py +0 -17
  82. mixpeek/models/get_document_v1_collections_collection_identifier_documents_document_id_getop.py +0 -70
  83. mixpeek/models/list_documents_v1_collections_collection_identifier_documents_getop.py +0 -114
  84. mixpeek/models/update_document_v1_collections_collection_identifier_documents_document_id_putop.py +0 -83
@@ -5,7 +5,7 @@ from mixpeek import models, utils
5
5
  from mixpeek._hooks import HookContext
6
6
  from mixpeek.types import OptionalNullable, UNSET
7
7
  from mixpeek.utils import get_security_from_env
8
- from typing import Any, List, Mapping, Optional, Union
8
+ from typing import Any, Dict, List, Mapping, Optional
9
9
 
10
10
 
11
11
  class RetrieverInteractions(BaseSDK):
@@ -16,12 +16,7 @@ class RetrieverInteractions(BaseSDK):
16
16
  interaction_type: List[models.InteractionType],
17
17
  x_namespace: OptionalNullable[str] = UNSET,
18
18
  position: OptionalNullable[int] = UNSET,
19
- metadata: OptionalNullable[
20
- Union[
21
- models.SearchInteractionMetadata,
22
- models.SearchInteractionMetadataTypedDict,
23
- ]
24
- ] = UNSET,
19
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
25
20
  user_id: OptionalNullable[str] = UNSET,
26
21
  session_id: OptionalNullable[str] = UNSET,
27
22
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -64,9 +59,7 @@ class RetrieverInteractions(BaseSDK):
64
59
  feature_id=feature_id,
65
60
  interaction_type=interaction_type,
66
61
  position=position,
67
- metadata=utils.get_pydantic_model(
68
- metadata, OptionalNullable[models.SearchInteractionMetadata]
69
- ),
62
+ metadata=metadata,
70
63
  user_id=user_id,
71
64
  session_id=session_id,
72
65
  ),
@@ -105,6 +98,7 @@ class RetrieverInteractions(BaseSDK):
105
98
 
106
99
  http_res = self.do_request(
107
100
  hook_ctx=HookContext(
101
+ config=self.sdk_configuration,
108
102
  base_url=base_url or "",
109
103
  operation_id="create_interaction_v1_retrievers_interactions_post",
110
104
  oauth2_scopes=[],
@@ -164,12 +158,7 @@ class RetrieverInteractions(BaseSDK):
164
158
  interaction_type: List[models.InteractionType],
165
159
  x_namespace: OptionalNullable[str] = UNSET,
166
160
  position: OptionalNullable[int] = UNSET,
167
- metadata: OptionalNullable[
168
- Union[
169
- models.SearchInteractionMetadata,
170
- models.SearchInteractionMetadataTypedDict,
171
- ]
172
- ] = UNSET,
161
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
173
162
  user_id: OptionalNullable[str] = UNSET,
174
163
  session_id: OptionalNullable[str] = UNSET,
175
164
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -212,9 +201,7 @@ class RetrieverInteractions(BaseSDK):
212
201
  feature_id=feature_id,
213
202
  interaction_type=interaction_type,
214
203
  position=position,
215
- metadata=utils.get_pydantic_model(
216
- metadata, OptionalNullable[models.SearchInteractionMetadata]
217
- ),
204
+ metadata=metadata,
218
205
  user_id=user_id,
219
206
  session_id=session_id,
220
207
  ),
@@ -253,6 +240,7 @@ class RetrieverInteractions(BaseSDK):
253
240
 
254
241
  http_res = await self.do_request_async(
255
242
  hook_ctx=HookContext(
243
+ config=self.sdk_configuration,
256
244
  base_url=base_url or "",
257
245
  operation_id="create_interaction_v1_retrievers_interactions_post",
258
246
  oauth2_scopes=[],
@@ -382,6 +370,7 @@ class RetrieverInteractions(BaseSDK):
382
370
 
383
371
  http_res = self.do_request(
384
372
  hook_ctx=HookContext(
373
+ config=self.sdk_configuration,
385
374
  base_url=base_url or "",
386
375
  operation_id="list_interactions_v1_retrievers_interactions_get",
387
376
  oauth2_scopes=[],
@@ -511,6 +500,7 @@ class RetrieverInteractions(BaseSDK):
511
500
 
512
501
  http_res = await self.do_request_async(
513
502
  hook_ctx=HookContext(
503
+ config=self.sdk_configuration,
514
504
  base_url=base_url or "",
515
505
  operation_id="list_interactions_v1_retrievers_interactions_get",
516
506
  oauth2_scopes=[],
@@ -628,6 +618,7 @@ class RetrieverInteractions(BaseSDK):
628
618
 
629
619
  http_res = self.do_request(
630
620
  hook_ctx=HookContext(
621
+ config=self.sdk_configuration,
631
622
  base_url=base_url or "",
632
623
  operation_id="get_interaction_v1_retrievers_interactions__interaction_id__get",
633
624
  oauth2_scopes=[],
@@ -745,6 +736,7 @@ class RetrieverInteractions(BaseSDK):
745
736
 
746
737
  http_res = await self.do_request_async(
747
738
  hook_ctx=HookContext(
739
+ config=self.sdk_configuration,
748
740
  base_url=base_url or "",
749
741
  operation_id="get_interaction_v1_retrievers_interactions__interaction_id__get",
750
742
  oauth2_scopes=[],
@@ -864,6 +856,7 @@ class RetrieverInteractions(BaseSDK):
864
856
 
865
857
  http_res = self.do_request(
866
858
  hook_ctx=HookContext(
859
+ config=self.sdk_configuration,
867
860
  base_url=base_url or "",
868
861
  operation_id="delete_interaction_v1_retrievers_interactions__interaction_id__delete",
869
862
  oauth2_scopes=[],
@@ -983,6 +976,7 @@ class RetrieverInteractions(BaseSDK):
983
976
 
984
977
  http_res = await self.do_request_async(
985
978
  hook_ctx=HookContext(
979
+ config=self.sdk_configuration,
986
980
  base_url=base_url or "",
987
981
  operation_id="delete_interaction_v1_retrievers_interactions__interaction_id__delete",
988
982
  oauth2_scopes=[],
mixpeek/retrievers.py CHANGED
@@ -5,7 +5,7 @@ from mixpeek import models, utils
5
5
  from mixpeek._hooks import HookContext
6
6
  from mixpeek.types import OptionalNullable, UNSET
7
7
  from mixpeek.utils import get_security_from_env
8
- from typing import Any, List, Mapping, Optional, Union
8
+ from typing import Any, Dict, List, Mapping, Optional, Union
9
9
 
10
10
 
11
11
  class Retrievers(BaseSDK):
@@ -14,7 +14,7 @@ class Retrievers(BaseSDK):
14
14
  *,
15
15
  retriever_name: str,
16
16
  input_schema: Union[
17
- models.BucketSchemaInput, models.BucketSchemaInputTypedDict
17
+ models.RetrieverSchemaInput, models.RetrieverSchemaInputTypedDict
18
18
  ],
19
19
  collection_ids: List[str],
20
20
  stages: Union[
@@ -22,12 +22,7 @@ class Retrievers(BaseSDK):
22
22
  ],
23
23
  x_namespace: OptionalNullable[str] = UNSET,
24
24
  description: OptionalNullable[str] = UNSET,
25
- metadata: Optional[
26
- Union[
27
- models.CreateRetrieverRequestMetadata,
28
- models.CreateRetrieverRequestMetadataTypedDict,
29
- ]
30
- ] = None,
25
+ metadata: Optional[Dict[str, Any]] = None,
31
26
  cache_config: OptionalNullable[
32
27
  Union[models.RetrieverCacheConfig, models.RetrieverCacheConfigTypedDict]
33
28
  ] = UNSET,
@@ -39,7 +34,7 @@ class Retrievers(BaseSDK):
39
34
  r"""Create Retriever
40
35
 
41
36
  :param retriever_name: Name of the retriever
42
- :param input_schema: Schema definition for bucket objects
37
+ :param input_schema: Schema definition for retriever inputs
43
38
  :param collection_ids: List of collection IDs to search in
44
39
  :param stages: List of stages to execute in order
45
40
  :param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
@@ -67,13 +62,11 @@ class Retrievers(BaseSDK):
67
62
  retriever_name=retriever_name,
68
63
  description=description,
69
64
  input_schema=utils.get_pydantic_model(
70
- input_schema, models.BucketSchemaInput
65
+ input_schema, models.RetrieverSchemaInput
71
66
  ),
72
67
  collection_ids=collection_ids,
73
68
  stages=utils.get_pydantic_model(stages, List[models.StageConfigInput]),
74
- metadata=utils.get_pydantic_model(
75
- metadata, Optional[models.CreateRetrieverRequestMetadata]
76
- ),
69
+ metadata=metadata,
77
70
  cache_config=utils.get_pydantic_model(
78
71
  cache_config, OptionalNullable[models.RetrieverCacheConfig]
79
72
  ),
@@ -113,6 +106,7 @@ class Retrievers(BaseSDK):
113
106
 
114
107
  http_res = self.do_request(
115
108
  hook_ctx=HookContext(
109
+ config=self.sdk_configuration,
116
110
  base_url=base_url or "",
117
111
  operation_id="create_retriever_v1_retrievers_retrievers_post",
118
112
  oauth2_scopes=[],
@@ -170,7 +164,7 @@ class Retrievers(BaseSDK):
170
164
  *,
171
165
  retriever_name: str,
172
166
  input_schema: Union[
173
- models.BucketSchemaInput, models.BucketSchemaInputTypedDict
167
+ models.RetrieverSchemaInput, models.RetrieverSchemaInputTypedDict
174
168
  ],
175
169
  collection_ids: List[str],
176
170
  stages: Union[
@@ -178,12 +172,7 @@ class Retrievers(BaseSDK):
178
172
  ],
179
173
  x_namespace: OptionalNullable[str] = UNSET,
180
174
  description: OptionalNullable[str] = UNSET,
181
- metadata: Optional[
182
- Union[
183
- models.CreateRetrieverRequestMetadata,
184
- models.CreateRetrieverRequestMetadataTypedDict,
185
- ]
186
- ] = None,
175
+ metadata: Optional[Dict[str, Any]] = None,
187
176
  cache_config: OptionalNullable[
188
177
  Union[models.RetrieverCacheConfig, models.RetrieverCacheConfigTypedDict]
189
178
  ] = UNSET,
@@ -195,7 +184,7 @@ class Retrievers(BaseSDK):
195
184
  r"""Create Retriever
196
185
 
197
186
  :param retriever_name: Name of the retriever
198
- :param input_schema: Schema definition for bucket objects
187
+ :param input_schema: Schema definition for retriever inputs
199
188
  :param collection_ids: List of collection IDs to search in
200
189
  :param stages: List of stages to execute in order
201
190
  :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.
@@ -223,13 +212,11 @@ class Retrievers(BaseSDK):
223
212
  retriever_name=retriever_name,
224
213
  description=description,
225
214
  input_schema=utils.get_pydantic_model(
226
- input_schema, models.BucketSchemaInput
215
+ input_schema, models.RetrieverSchemaInput
227
216
  ),
228
217
  collection_ids=collection_ids,
229
218
  stages=utils.get_pydantic_model(stages, List[models.StageConfigInput]),
230
- metadata=utils.get_pydantic_model(
231
- metadata, Optional[models.CreateRetrieverRequestMetadata]
232
- ),
219
+ metadata=metadata,
233
220
  cache_config=utils.get_pydantic_model(
234
221
  cache_config, OptionalNullable[models.RetrieverCacheConfig]
235
222
  ),
@@ -269,6 +256,7 @@ class Retrievers(BaseSDK):
269
256
 
270
257
  http_res = await self.do_request_async(
271
258
  hook_ctx=HookContext(
259
+ config=self.sdk_configuration,
272
260
  base_url=base_url or "",
273
261
  operation_id="create_retriever_v1_retrievers_retrievers_post",
274
262
  oauth2_scopes=[],
@@ -381,6 +369,7 @@ class Retrievers(BaseSDK):
381
369
 
382
370
  http_res = self.do_request(
383
371
  hook_ctx=HookContext(
372
+ config=self.sdk_configuration,
384
373
  base_url=base_url or "",
385
374
  operation_id="get_retriever_v1_retrievers_retrievers__retriever_id__get",
386
375
  oauth2_scopes=[],
@@ -493,6 +482,7 @@ class Retrievers(BaseSDK):
493
482
 
494
483
  http_res = await self.do_request_async(
495
484
  hook_ctx=HookContext(
485
+ config=self.sdk_configuration,
496
486
  base_url=base_url or "",
497
487
  operation_id="get_retriever_v1_retrievers_retrievers__retriever_id__get",
498
488
  oauth2_scopes=[],
@@ -549,10 +539,7 @@ class Retrievers(BaseSDK):
549
539
  self,
550
540
  *,
551
541
  retriever_id: str,
552
- inputs: Union[
553
- models.RetrieverQueryRequestInputs,
554
- models.RetrieverQueryRequestInputsTypedDict,
555
- ],
542
+ inputs: Dict[str, Any],
556
543
  x_namespace: OptionalNullable[str] = UNSET,
557
544
  filters: OptionalNullable[
558
545
  Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
@@ -602,9 +589,7 @@ class Retrievers(BaseSDK):
602
589
  retriever_id=retriever_id,
603
590
  x_namespace=x_namespace,
604
591
  retriever_query_request=models.RetrieverQueryRequest(
605
- inputs=utils.get_pydantic_model(
606
- inputs, models.RetrieverQueryRequestInputs
607
- ),
592
+ inputs=inputs,
608
593
  filters=utils.get_pydantic_model(
609
594
  filters, OptionalNullable[models.LogicalOperatorInput]
610
595
  ),
@@ -653,6 +638,7 @@ class Retrievers(BaseSDK):
653
638
 
654
639
  http_res = self.do_request(
655
640
  hook_ctx=HookContext(
641
+ config=self.sdk_configuration,
656
642
  base_url=base_url or "",
657
643
  operation_id="execute_retriever_v1_retrievers_retrievers__retriever_id__execute_post",
658
644
  oauth2_scopes=[],
@@ -709,10 +695,7 @@ class Retrievers(BaseSDK):
709
695
  self,
710
696
  *,
711
697
  retriever_id: str,
712
- inputs: Union[
713
- models.RetrieverQueryRequestInputs,
714
- models.RetrieverQueryRequestInputsTypedDict,
715
- ],
698
+ inputs: Dict[str, Any],
716
699
  x_namespace: OptionalNullable[str] = UNSET,
717
700
  filters: OptionalNullable[
718
701
  Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
@@ -762,9 +745,7 @@ class Retrievers(BaseSDK):
762
745
  retriever_id=retriever_id,
763
746
  x_namespace=x_namespace,
764
747
  retriever_query_request=models.RetrieverQueryRequest(
765
- inputs=utils.get_pydantic_model(
766
- inputs, models.RetrieverQueryRequestInputs
767
- ),
748
+ inputs=inputs,
768
749
  filters=utils.get_pydantic_model(
769
750
  filters, OptionalNullable[models.LogicalOperatorInput]
770
751
  ),
@@ -813,6 +794,7 @@ class Retrievers(BaseSDK):
813
794
 
814
795
  http_res = await self.do_request_async(
815
796
  hook_ctx=HookContext(
797
+ config=self.sdk_configuration,
816
798
  base_url=base_url or "",
817
799
  operation_id="execute_retriever_v1_retrievers_retrievers__retriever_id__execute_post",
818
800
  oauth2_scopes=[],
@@ -68,6 +68,7 @@ class RetrieverStages(BaseSDK):
68
68
 
69
69
  http_res = self.do_request(
70
70
  hook_ctx=HookContext(
71
+ config=self.sdk_configuration,
71
72
  base_url=base_url or "",
72
73
  operation_id="get_retriever_stages_v1_retrievers_stages_get",
73
74
  oauth2_scopes=[],
@@ -179,6 +180,7 @@ class RetrieverStages(BaseSDK):
179
180
 
180
181
  http_res = await self.do_request_async(
181
182
  hook_ctx=HookContext(
183
+ config=self.sdk_configuration,
182
184
  base_url=base_url or "",
183
185
  operation_id="get_retriever_stages_v1_retrievers_stages_get",
184
186
  oauth2_scopes=[],
mixpeek/sdk.py CHANGED
@@ -6,55 +6,82 @@ from .sdkconfiguration import SDKConfiguration
6
6
  from .utils.logger import Logger, get_default_logger
7
7
  from .utils.retries import RetryConfig
8
8
  import httpx
9
+ import importlib
9
10
  from mixpeek import models, utils
10
11
  from mixpeek._hooks import SDKHooks
11
- from mixpeek.bucketobjects import BucketObjects
12
- from mixpeek.buckets import Buckets
13
- from mixpeek.clusters import Clusters
14
- from mixpeek.collectioncache import CollectionCache
15
- from mixpeek.collectiondocuments import CollectionDocuments
16
- from mixpeek.collections import Collections
17
- from mixpeek.features import Features
18
- from mixpeek.health import Health
19
12
  from mixpeek.models import internal
20
- from mixpeek.namespaces import Namespaces
21
- from mixpeek.organizationnotifications import OrganizationNotifications
22
- from mixpeek.organizations import Organizations
23
- from mixpeek.organizationsusage import OrganizationsUsage
24
- from mixpeek.research import Research
25
- from mixpeek.retrieverinteractions import RetrieverInteractions
26
- from mixpeek.retrievers import Retrievers
27
- from mixpeek.retrieverstages import RetrieverStages
28
- from mixpeek.tasks import Tasks
29
- from mixpeek.taxonomies import Taxonomies
30
13
  from mixpeek.types import OptionalNullable, UNSET
31
- from mixpeek.users import Users
32
- from typing import Any, Callable, Dict, Optional, Union, cast
14
+ from typing import Any, Callable, Dict, Optional, TYPE_CHECKING, Union, cast
33
15
  import weakref
34
16
 
17
+ if TYPE_CHECKING:
18
+ from mixpeek.bucketobjects import BucketObjects
19
+ from mixpeek.buckets import Buckets
20
+ from mixpeek.clusters import Clusters
21
+ from mixpeek.collectioncache import CollectionCache
22
+ from mixpeek.collections import Collections
23
+ from mixpeek.features import Features
24
+ from mixpeek.health import Health
25
+ from mixpeek.namespaces import Namespaces
26
+ from mixpeek.organizationnotifications import OrganizationNotifications
27
+ from mixpeek.organizations import Organizations
28
+ from mixpeek.organizationsusage import OrganizationsUsage
29
+ from mixpeek.research import Research
30
+ from mixpeek.retrieverinteractions import RetrieverInteractions
31
+ from mixpeek.retrievers import Retrievers
32
+ from mixpeek.retrieverstages import RetrieverStages
33
+ from mixpeek.tasks import Tasks
34
+ from mixpeek.taxonomies import Taxonomies
35
+ from mixpeek.users import Users
36
+
35
37
 
36
38
  class Mixpeek(BaseSDK):
37
39
  r"""Mixpeek API: This is the Mixpeek API, providing access to various endpoints for data processing and retrieval."""
38
40
 
39
- health: Health
40
- organizations: Organizations
41
- users: Users
42
- organizations_usage: OrganizationsUsage
43
- organization_notifications: OrganizationNotifications
44
- namespaces: Namespaces
45
- buckets: Buckets
46
- bucket_objects: BucketObjects
47
- collections: Collections
48
- collection_cache: CollectionCache
49
- collection_documents: CollectionDocuments
50
- features: Features
51
- retrievers: Retrievers
52
- retriever_stages: RetrieverStages
53
- retriever_interactions: RetrieverInteractions
54
- tasks: Tasks
55
- research: Research
56
- taxonomies: Taxonomies
57
- clusters: Clusters
41
+ health: "Health"
42
+ organizations: "Organizations"
43
+ users: "Users"
44
+ organizations_usage: "OrganizationsUsage"
45
+ organization_notifications: "OrganizationNotifications"
46
+ namespaces: "Namespaces"
47
+ buckets: "Buckets"
48
+ bucket_objects: "BucketObjects"
49
+ collections: "Collections"
50
+ collection_cache: "CollectionCache"
51
+ features: "Features"
52
+ retrievers: "Retrievers"
53
+ retriever_stages: "RetrieverStages"
54
+ retriever_interactions: "RetrieverInteractions"
55
+ tasks: "Tasks"
56
+ research: "Research"
57
+ taxonomies: "Taxonomies"
58
+ clusters: "Clusters"
59
+ _sub_sdk_map = {
60
+ "health": ("mixpeek.health", "Health"),
61
+ "organizations": ("mixpeek.organizations", "Organizations"),
62
+ "users": ("mixpeek.users", "Users"),
63
+ "organizations_usage": ("mixpeek.organizationsusage", "OrganizationsUsage"),
64
+ "organization_notifications": (
65
+ "mixpeek.organizationnotifications",
66
+ "OrganizationNotifications",
67
+ ),
68
+ "namespaces": ("mixpeek.namespaces", "Namespaces"),
69
+ "buckets": ("mixpeek.buckets", "Buckets"),
70
+ "bucket_objects": ("mixpeek.bucketobjects", "BucketObjects"),
71
+ "collections": ("mixpeek.collections", "Collections"),
72
+ "collection_cache": ("mixpeek.collectioncache", "CollectionCache"),
73
+ "features": ("mixpeek.features", "Features"),
74
+ "retrievers": ("mixpeek.retrievers", "Retrievers"),
75
+ "retriever_stages": ("mixpeek.retrieverstages", "RetrieverStages"),
76
+ "retriever_interactions": (
77
+ "mixpeek.retrieverinteractions",
78
+ "RetrieverInteractions",
79
+ ),
80
+ "tasks": ("mixpeek.tasks", "Tasks"),
81
+ "research": ("mixpeek.research", "Research"),
82
+ "taxonomies": ("mixpeek.taxonomies", "Taxonomies"),
83
+ "clusters": ("mixpeek.clusters", "Clusters"),
84
+ }
58
85
 
59
86
  def __init__(
60
87
  self,
@@ -138,6 +165,9 @@ class Mixpeek(BaseSDK):
138
165
 
139
166
  hooks = SDKHooks()
140
167
 
168
+ # pylint: disable=protected-access
169
+ self.sdk_configuration.__dict__["_hooks"] = hooks
170
+
141
171
  current_server_url, *_ = self.sdk_configuration.get_server_details()
142
172
  server_url, self.sdk_configuration.client = hooks.sdk_init(
143
173
  current_server_url, client
@@ -145,9 +175,6 @@ class Mixpeek(BaseSDK):
145
175
  if current_server_url != server_url:
146
176
  self.sdk_configuration.server_url = server_url
147
177
 
148
- # pylint: disable=protected-access
149
- self.sdk_configuration.__dict__["_hooks"] = hooks
150
-
151
178
  weakref.finalize(
152
179
  self,
153
180
  close_clients,
@@ -158,30 +185,32 @@ class Mixpeek(BaseSDK):
158
185
  self.sdk_configuration.async_client_supplied,
159
186
  )
160
187
 
161
- self._init_sdks()
162
-
163
- def _init_sdks(self):
164
- self.health = Health(self.sdk_configuration)
165
- self.organizations = Organizations(self.sdk_configuration)
166
- self.users = Users(self.sdk_configuration)
167
- self.organizations_usage = OrganizationsUsage(self.sdk_configuration)
168
- self.organization_notifications = OrganizationNotifications(
169
- self.sdk_configuration
188
+ def __getattr__(self, name: str):
189
+ if name in self._sub_sdk_map:
190
+ module_path, class_name = self._sub_sdk_map[name]
191
+ try:
192
+ module = importlib.import_module(module_path)
193
+ klass = getattr(module, class_name)
194
+ instance = klass(self.sdk_configuration)
195
+ setattr(self, name, instance)
196
+ return instance
197
+ except ImportError as e:
198
+ raise AttributeError(
199
+ f"Failed to import module {module_path} for attribute {name}: {e}"
200
+ ) from e
201
+ except AttributeError as e:
202
+ raise AttributeError(
203
+ f"Failed to find class {class_name} in module {module_path} for attribute {name}: {e}"
204
+ ) from e
205
+
206
+ raise AttributeError(
207
+ f"'{type(self).__name__}' object has no attribute '{name}'"
170
208
  )
171
- self.namespaces = Namespaces(self.sdk_configuration)
172
- self.buckets = Buckets(self.sdk_configuration)
173
- self.bucket_objects = BucketObjects(self.sdk_configuration)
174
- self.collections = Collections(self.sdk_configuration)
175
- self.collection_cache = CollectionCache(self.sdk_configuration)
176
- self.collection_documents = CollectionDocuments(self.sdk_configuration)
177
- self.features = Features(self.sdk_configuration)
178
- self.retrievers = Retrievers(self.sdk_configuration)
179
- self.retriever_stages = RetrieverStages(self.sdk_configuration)
180
- self.retriever_interactions = RetrieverInteractions(self.sdk_configuration)
181
- self.tasks = Tasks(self.sdk_configuration)
182
- self.research = Research(self.sdk_configuration)
183
- self.taxonomies = Taxonomies(self.sdk_configuration)
184
- self.clusters = Clusters(self.sdk_configuration)
209
+
210
+ def __dir__(self):
211
+ default_attrs = list(super().__dir__())
212
+ lazy_attrs = list(self._sub_sdk_map.keys())
213
+ return sorted(list(set(default_attrs + lazy_attrs)))
185
214
 
186
215
  def __enter__(self):
187
216
  return self
@@ -1,6 +1,5 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from ._hooks import SDKHooks
4
3
  from ._version import (
5
4
  __gen_version__,
6
5
  __openapi_doc_version__,
@@ -42,9 +41,6 @@ class SDKConfiguration:
42
41
  retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
43
42
  timeout_ms: Optional[int] = None
44
43
 
45
- def __post_init__(self):
46
- self._hooks = SDKHooks()
47
-
48
44
  def get_server_details(self) -> Tuple[str, Dict[str, str]]:
49
45
  if self.server_url is not None and self.server_url:
50
46
  return remove_suffix(self.server_url, "/"), {}
@@ -52,6 +48,3 @@ class SDKConfiguration:
52
48
  self.server_idx = 0
53
49
 
54
50
  return SERVERS[self.server_idx], {}
55
-
56
- def get_hooks(self) -> SDKHooks:
57
- return self._hooks
mixpeek/tasks.py CHANGED
@@ -72,6 +72,7 @@ class Tasks(BaseSDK):
72
72
 
73
73
  http_res = self.do_request(
74
74
  hook_ctx=HookContext(
75
+ config=self.sdk_configuration,
75
76
  base_url=base_url or "",
76
77
  operation_id="kill_task_v1_tasks__task_id__delete",
77
78
  oauth2_scopes=[],
@@ -187,6 +188,7 @@ class Tasks(BaseSDK):
187
188
 
188
189
  http_res = await self.do_request_async(
189
190
  hook_ctx=HookContext(
191
+ config=self.sdk_configuration,
190
192
  base_url=base_url or "",
191
193
  operation_id="kill_task_v1_tasks__task_id__delete",
192
194
  oauth2_scopes=[],
@@ -304,6 +306,7 @@ class Tasks(BaseSDK):
304
306
 
305
307
  http_res = self.do_request(
306
308
  hook_ctx=HookContext(
309
+ config=self.sdk_configuration,
307
310
  base_url=base_url or "",
308
311
  operation_id="get_task_v1_tasks__task_id__get",
309
312
  oauth2_scopes=[],
@@ -421,6 +424,7 @@ class Tasks(BaseSDK):
421
424
 
422
425
  http_res = await self.do_request_async(
423
426
  hook_ctx=HookContext(
427
+ config=self.sdk_configuration,
424
428
  base_url=base_url or "",
425
429
  operation_id="get_task_v1_tasks__task_id__get",
426
430
  oauth2_scopes=[],
@@ -538,6 +542,7 @@ class Tasks(BaseSDK):
538
542
 
539
543
  http_res = self.do_request(
540
544
  hook_ctx=HookContext(
545
+ config=self.sdk_configuration,
541
546
  base_url=base_url or "",
542
547
  operation_id="list_active_tasks_v1_tasks_get",
543
548
  oauth2_scopes=[],
@@ -655,6 +660,7 @@ class Tasks(BaseSDK):
655
660
 
656
661
  http_res = await self.do_request_async(
657
662
  hook_ctx=HookContext(
663
+ config=self.sdk_configuration,
658
664
  base_url=base_url or "",
659
665
  operation_id="list_active_tasks_v1_tasks_get",
660
666
  oauth2_scopes=[],
mixpeek/taxonomies.py CHANGED
@@ -87,6 +87,7 @@ class Taxonomies(BaseSDK):
87
87
 
88
88
  http_res = self.do_request(
89
89
  hook_ctx=HookContext(
90
+ config=self.sdk_configuration,
90
91
  base_url=base_url or "",
91
92
  operation_id="create_taxonomy_v1_taxonomies_post",
92
93
  oauth2_scopes=[],
@@ -217,6 +218,7 @@ class Taxonomies(BaseSDK):
217
218
 
218
219
  http_res = await self.do_request_async(
219
220
  hook_ctx=HookContext(
221
+ config=self.sdk_configuration,
220
222
  base_url=base_url or "",
221
223
  operation_id="create_taxonomy_v1_taxonomies_post",
222
224
  oauth2_scopes=[],
mixpeek/users.py CHANGED
@@ -66,6 +66,7 @@ class Users(BaseSDK):
66
66
 
67
67
  http_res = self.do_request(
68
68
  hook_ctx=HookContext(
69
+ config=self.sdk_configuration,
69
70
  base_url=base_url or "",
70
71
  operation_id="get_user_v1_organizations_users__user_email__get",
71
72
  oauth2_scopes=[],
@@ -175,6 +176,7 @@ class Users(BaseSDK):
175
176
 
176
177
  http_res = await self.do_request_async(
177
178
  hook_ctx=HookContext(
179
+ config=self.sdk_configuration,
178
180
  base_url=base_url or "",
179
181
  operation_id="get_user_v1_organizations_users__user_email__get",
180
182
  oauth2_scopes=[],
@@ -287,6 +289,7 @@ class Users(BaseSDK):
287
289
 
288
290
  http_res = self.do_request(
289
291
  hook_ctx=HookContext(
292
+ config=self.sdk_configuration,
290
293
  base_url=base_url or "",
291
294
  operation_id="delete_user_v1_organizations_users__user_email__delete",
292
295
  oauth2_scopes=[],
@@ -399,6 +402,7 @@ class Users(BaseSDK):
399
402
 
400
403
  http_res = await self.do_request_async(
401
404
  hook_ctx=HookContext(
405
+ config=self.sdk_configuration,
402
406
  base_url=base_url or "",
403
407
  operation_id="delete_user_v1_organizations_users__user_email__delete",
404
408
  oauth2_scopes=[],
@@ -513,6 +517,7 @@ class Users(BaseSDK):
513
517
 
514
518
  http_res = self.do_request(
515
519
  hook_ctx=HookContext(
520
+ config=self.sdk_configuration,
516
521
  base_url=base_url or "",
517
522
  operation_id="create_api_key_v1_organizations_users__user_email__api_keys_post",
518
523
  oauth2_scopes=[],
@@ -627,6 +632,7 @@ class Users(BaseSDK):
627
632
 
628
633
  http_res = await self.do_request_async(
629
634
  hook_ctx=HookContext(
635
+ config=self.sdk_configuration,
630
636
  base_url=base_url or "",
631
637
  operation_id="create_api_key_v1_organizations_users__user_email__api_keys_post",
632
638
  oauth2_scopes=[],