mixpeek 0.21.8__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 (82) 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 +744 -596
  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 +3 -11
  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 +3 -11
  42. mixpeek/models/retrieverqueryrequest.py +3 -11
  43. mixpeek/models/retrieverschemafield_input.py +6 -26
  44. mixpeek/models/retrieverschemafield_output.py +6 -26
  45. mixpeek/models/searchinteraction.py +3 -11
  46. mixpeek/models/stageconfig_input.py +8 -16
  47. mixpeek/models/stageconfig_output.py +8 -16
  48. mixpeek/models/stagedefinition.py +28 -17
  49. mixpeek/models/stageresponse.py +3 -11
  50. mixpeek/models/updateobjectrequest.py +3 -11
  51. mixpeek/models/usermodel_input.py +3 -11
  52. mixpeek/models/usermodel_output.py +3 -11
  53. mixpeek/namespaces.py +28 -22
  54. mixpeek/organizationnotifications.py +2 -0
  55. mixpeek/organizations.py +13 -13
  56. mixpeek/organizationsusage.py +2 -0
  57. mixpeek/research.py +2 -0
  58. mixpeek/retrieverinteractions.py +13 -19
  59. mixpeek/retrievers.py +15 -33
  60. mixpeek/retrieverstages.py +2 -0
  61. mixpeek/sdk.py +94 -65
  62. mixpeek/sdkconfiguration.py +0 -7
  63. mixpeek/tasks.py +6 -0
  64. mixpeek/taxonomies.py +2 -0
  65. mixpeek/users.py +6 -0
  66. mixpeek/utils/__init__.py +131 -45
  67. mixpeek/utils/datetimes.py +23 -0
  68. mixpeek/utils/serializers.py +32 -3
  69. {mixpeek-0.21.8.dist-info → mixpeek-0.22.0.dist-info}/METADATA +3 -15
  70. {mixpeek-0.21.8.dist-info → mixpeek-0.22.0.dist-info}/RECORD +71 -77
  71. {mixpeek-0.21.8.dist-info → mixpeek-0.22.0.dist-info}/WHEEL +1 -1
  72. mixpeek/collectiondocuments.py +0 -1564
  73. mixpeek/models/batch_delete_documents_v1_collections_collection_identifier_documents_batch_deleteop.py +0 -75
  74. mixpeek/models/batch_update_documents_v1_collections_collection_identifier_documents_batch_putop.py +0 -84
  75. mixpeek/models/delete_document_v1_collections_collection_identifier_documents_document_id_deleteop.py +0 -70
  76. mixpeek/models/documentlistresponse.py +0 -56
  77. mixpeek/models/documentresponse.py +0 -87
  78. mixpeek/models/documentupdate.py +0 -60
  79. mixpeek/models/genericsuccessresponse.py +0 -17
  80. mixpeek/models/get_document_v1_collections_collection_identifier_documents_document_id_getop.py +0 -70
  81. mixpeek/models/list_documents_v1_collections_collection_identifier_documents_getop.py +0 -114
  82. mixpeek/models/update_document_v1_collections_collection_identifier_documents_document_id_putop.py +0 -83
@@ -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=[],
mixpeek/utils/__init__.py CHANGED
@@ -1,51 +1,56 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from .annotations import get_discriminator
4
- from .enums import OpenEnumMeta
5
- from .headers import get_headers, get_response_headers
6
- from .metadata import (
7
- FieldMetadata,
8
- find_metadata,
9
- FormMetadata,
10
- HeaderMetadata,
11
- MultipartFormMetadata,
12
- PathParamMetadata,
13
- QueryParamMetadata,
14
- RequestMetadata,
15
- SecurityMetadata,
16
- )
17
- from .queryparams import get_query_params
18
- from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
19
- from .requestbodies import serialize_request_body, SerializedRequestBody
20
- from .security import get_security, get_security_from_env
3
+ from typing import TYPE_CHECKING
4
+ from importlib import import_module
21
5
 
22
- from .serializers import (
23
- get_pydantic_model,
24
- marshal_json,
25
- unmarshal,
26
- unmarshal_json,
27
- serialize_decimal,
28
- serialize_float,
29
- serialize_int,
30
- stream_to_text,
31
- stream_to_text_async,
32
- stream_to_bytes,
33
- stream_to_bytes_async,
34
- validate_const,
35
- validate_decimal,
36
- validate_float,
37
- validate_int,
38
- validate_open_enum,
39
- )
40
- from .url import generate_url, template_url, remove_suffix
41
- from .values import (
42
- get_global_from_env,
43
- match_content_type,
44
- match_status_codes,
45
- match_response,
46
- cast_partial,
47
- )
48
- from .logger import Logger, get_body_content, get_default_logger
6
+ if TYPE_CHECKING:
7
+ from .annotations import get_discriminator
8
+ from .datetimes import parse_datetime
9
+ from .enums import OpenEnumMeta
10
+ from .headers import get_headers, get_response_headers
11
+ from .metadata import (
12
+ FieldMetadata,
13
+ find_metadata,
14
+ FormMetadata,
15
+ HeaderMetadata,
16
+ MultipartFormMetadata,
17
+ PathParamMetadata,
18
+ QueryParamMetadata,
19
+ RequestMetadata,
20
+ SecurityMetadata,
21
+ )
22
+ from .queryparams import get_query_params
23
+ from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
24
+ from .requestbodies import serialize_request_body, SerializedRequestBody
25
+ from .security import get_security, get_security_from_env
26
+
27
+ from .serializers import (
28
+ get_pydantic_model,
29
+ marshal_json,
30
+ unmarshal,
31
+ unmarshal_json,
32
+ serialize_decimal,
33
+ serialize_float,
34
+ serialize_int,
35
+ stream_to_text,
36
+ stream_to_text_async,
37
+ stream_to_bytes,
38
+ stream_to_bytes_async,
39
+ validate_const,
40
+ validate_decimal,
41
+ validate_float,
42
+ validate_int,
43
+ validate_open_enum,
44
+ )
45
+ from .url import generate_url, template_url, remove_suffix
46
+ from .values import (
47
+ get_global_from_env,
48
+ match_content_type,
49
+ match_status_codes,
50
+ match_response,
51
+ cast_partial,
52
+ )
53
+ from .logger import Logger, get_body_content, get_default_logger
49
54
 
50
55
  __all__ = [
51
56
  "BackoffStrategy",
@@ -56,6 +61,7 @@ __all__ = [
56
61
  "get_body_content",
57
62
  "get_default_logger",
58
63
  "get_discriminator",
64
+ "parse_datetime",
59
65
  "get_global_from_env",
60
66
  "get_headers",
61
67
  "get_pydantic_model",
@@ -99,3 +105,83 @@ __all__ = [
99
105
  "validate_open_enum",
100
106
  "cast_partial",
101
107
  ]
108
+
109
+ _dynamic_imports: dict[str, str] = {
110
+ "BackoffStrategy": ".retries",
111
+ "FieldMetadata": ".metadata",
112
+ "find_metadata": ".metadata",
113
+ "FormMetadata": ".metadata",
114
+ "generate_url": ".url",
115
+ "get_body_content": ".logger",
116
+ "get_default_logger": ".logger",
117
+ "get_discriminator": ".annotations",
118
+ "parse_datetime": ".datetimes",
119
+ "get_global_from_env": ".values",
120
+ "get_headers": ".headers",
121
+ "get_pydantic_model": ".serializers",
122
+ "get_query_params": ".queryparams",
123
+ "get_response_headers": ".headers",
124
+ "get_security": ".security",
125
+ "get_security_from_env": ".security",
126
+ "HeaderMetadata": ".metadata",
127
+ "Logger": ".logger",
128
+ "marshal_json": ".serializers",
129
+ "match_content_type": ".values",
130
+ "match_status_codes": ".values",
131
+ "match_response": ".values",
132
+ "MultipartFormMetadata": ".metadata",
133
+ "OpenEnumMeta": ".enums",
134
+ "PathParamMetadata": ".metadata",
135
+ "QueryParamMetadata": ".metadata",
136
+ "remove_suffix": ".url",
137
+ "Retries": ".retries",
138
+ "retry": ".retries",
139
+ "retry_async": ".retries",
140
+ "RetryConfig": ".retries",
141
+ "RequestMetadata": ".metadata",
142
+ "SecurityMetadata": ".metadata",
143
+ "serialize_decimal": ".serializers",
144
+ "serialize_float": ".serializers",
145
+ "serialize_int": ".serializers",
146
+ "serialize_request_body": ".requestbodies",
147
+ "SerializedRequestBody": ".requestbodies",
148
+ "stream_to_text": ".serializers",
149
+ "stream_to_text_async": ".serializers",
150
+ "stream_to_bytes": ".serializers",
151
+ "stream_to_bytes_async": ".serializers",
152
+ "template_url": ".url",
153
+ "unmarshal": ".serializers",
154
+ "unmarshal_json": ".serializers",
155
+ "validate_decimal": ".serializers",
156
+ "validate_const": ".serializers",
157
+ "validate_float": ".serializers",
158
+ "validate_int": ".serializers",
159
+ "validate_open_enum": ".serializers",
160
+ "cast_partial": ".values",
161
+ }
162
+
163
+
164
+ def __getattr__(attr_name: str) -> object:
165
+ module_name = _dynamic_imports.get(attr_name)
166
+ if module_name is None:
167
+ raise AttributeError(
168
+ f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
169
+ )
170
+
171
+ try:
172
+ module = import_module(module_name, __package__)
173
+ result = getattr(module, attr_name)
174
+ return result
175
+ except ImportError as e:
176
+ raise ImportError(
177
+ f"Failed to import {attr_name} from {module_name}: {e}"
178
+ ) from e
179
+ except AttributeError as e:
180
+ raise AttributeError(
181
+ f"Failed to get {attr_name} from {module_name}: {e}"
182
+ ) from e
183
+
184
+
185
+ def __dir__():
186
+ lazy_attrs = list(_dynamic_imports.keys())
187
+ return sorted(lazy_attrs)
@@ -0,0 +1,23 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from datetime import datetime
4
+ import sys
5
+
6
+
7
+ def parse_datetime(datetime_string: str) -> datetime:
8
+ """
9
+ Convert a RFC 3339 / ISO 8601 formatted string into a datetime object.
10
+ Python versions 3.11 and later support parsing RFC 3339 directly with
11
+ datetime.fromisoformat(), but for earlier versions, this function
12
+ encapsulates the necessary extra logic.
13
+ """
14
+ # Python 3.11 and later can parse RFC 3339 directly
15
+ if sys.version_info >= (3, 11):
16
+ return datetime.fromisoformat(datetime_string)
17
+
18
+ # For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix,
19
+ # so fix that upfront.
20
+ if datetime_string.endswith("Z"):
21
+ datetime_string = datetime_string[:-1] + "+00:00"
22
+
23
+ return datetime.fromisoformat(datetime_string)
@@ -1,13 +1,16 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from decimal import Decimal
4
+ import functools
4
5
  import json
5
- from typing import Any, Dict, List, Union, get_args
6
- import httpx
6
+ import typing
7
+ from typing import Any, Dict, List, Tuple, Union, get_args
8
+ import typing_extensions
7
9
  from typing_extensions import get_origin
10
+
11
+ import httpx
8
12
  from pydantic import ConfigDict, create_model
9
13
  from pydantic_core import from_json
10
- from typing_inspection.typing_objects import is_union
11
14
 
12
15
  from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
13
16
 
@@ -185,6 +188,13 @@ def is_nullable(field):
185
188
  return False
186
189
 
187
190
 
191
+ def is_union(obj: object) -> bool:
192
+ """
193
+ Returns True if the given object is a typing.Union or typing_extensions.Union.
194
+ """
195
+ return any(obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union"))
196
+
197
+
188
198
  def stream_to_text(stream: httpx.Response) -> str:
189
199
  return "".join(stream.iter_text())
190
200
 
@@ -217,3 +227,22 @@ def _contains_pydantic_model(data: Any) -> bool:
217
227
  return any(_contains_pydantic_model(value) for value in data.values())
218
228
 
219
229
  return False
230
+
231
+
232
+ @functools.cache
233
+ def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]:
234
+ """
235
+ Get typing objects by name from typing and typing_extensions.
236
+ Reference: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types
237
+ """
238
+ result = tuple(
239
+ getattr(module, name)
240
+ for module in (typing, typing_extensions)
241
+ if hasattr(module, name)
242
+ )
243
+ if not result:
244
+ raise ValueError(
245
+ f"Neither typing nor typing_extensions has an object called {name!r}"
246
+ )
247
+ return result
248
+
@@ -1,20 +1,17 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mixpeek
3
- Version: 0.21.8
3
+ Version: 0.22.0
4
4
  Summary: Python Client SDK Generated by Speakeasy.
5
5
  Author: Speakeasy
6
- Requires-Python: >=3.9
6
+ Requires-Python: >=3.9.2
7
7
  Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.9
9
8
  Classifier: Programming Language :: Python :: 3.10
10
9
  Classifier: Programming Language :: Python :: 3.11
11
10
  Classifier: Programming Language :: Python :: 3.12
12
11
  Classifier: Programming Language :: Python :: 3.13
13
- Requires-Dist: eval-type-backport (>=0.2.0)
12
+ Requires-Dist: httpcore (>=1.0.9)
14
13
  Requires-Dist: httpx (>=0.28.1)
15
14
  Requires-Dist: pydantic (>=2.11.2)
16
- Requires-Dist: python-dateutil (>=2.8.2)
17
- Requires-Dist: typing-inspection (>=0.4.0)
18
15
  Project-URL: Repository, https://github.com/mixpeek/python-sdk.git
19
16
  Description-Content-Type: text/markdown
20
17
 
@@ -223,15 +220,6 @@ with Mixpeek(
223
220
  * [get_stats](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectioncache/README.md#get_stats) - Get Cache Stats
224
221
  * [cleanup](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectioncache/README.md#cleanup) - Cleanup Cache
225
222
 
226
- ### [collection_documents](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md)
227
-
228
- * [get](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#get) - Get Document
229
- * [update](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#update) - Update Document
230
- * [delete](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#delete) - Delete Document
231
- * [list](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#list) - List Documents
232
- * [batch_update](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#batch_update) - Batch Update Documents
233
- * [batch_delete](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collectiondocuments/README.md#batch_delete) - Batch Delete Documents
234
-
235
223
  ### [collections](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collections/README.md)
236
224
 
237
225
  * [create](https://github.com/mixpeek/python-sdk/blob/master/docs/sdks/collections/README.md#create) - Create Collection