mixpeek 0.8.41__py3-none-any.whl → 0.9.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 (86) hide show
  1. mixpeek-0.9.0.dist-info/METADATA +356 -0
  2. mixpeek-0.9.0.dist-info/RECORD +73 -0
  3. {mixpeek-0.8.41.dist-info → mixpeek-0.9.0.dist-info}/WHEEL +1 -2
  4. mixpeek-0.9.0.dist-info/licenses/LICENSE +201 -0
  5. mixpeek_sdk/__init__.py +93 -0
  6. mixpeek_sdk/_base_client.py +2041 -0
  7. mixpeek_sdk/_client.py +444 -0
  8. mixpeek_sdk/_compat.py +219 -0
  9. mixpeek_sdk/_constants.py +14 -0
  10. mixpeek_sdk/_exceptions.py +108 -0
  11. mixpeek_sdk/_files.py +123 -0
  12. mixpeek_sdk/_models.py +785 -0
  13. mixpeek_sdk/_qs.py +150 -0
  14. mixpeek_sdk/_resource.py +43 -0
  15. mixpeek_sdk/_response.py +826 -0
  16. mixpeek_sdk/_streaming.py +333 -0
  17. mixpeek_sdk/_types.py +217 -0
  18. mixpeek_sdk/_utils/__init__.py +55 -0
  19. mixpeek_sdk/_utils/_logs.py +25 -0
  20. mixpeek_sdk/_utils/_proxy.py +62 -0
  21. mixpeek_sdk/_utils/_reflection.py +42 -0
  22. mixpeek_sdk/_utils/_streams.py +12 -0
  23. mixpeek_sdk/_utils/_sync.py +81 -0
  24. mixpeek_sdk/_utils/_transform.py +382 -0
  25. mixpeek_sdk/_utils/_typing.py +120 -0
  26. mixpeek_sdk/_utils/_utils.py +397 -0
  27. mixpeek_sdk/_version.py +4 -0
  28. mixpeek_sdk/lib/.keep +4 -0
  29. mixpeek_sdk/resources/__init__.py +159 -0
  30. mixpeek_sdk/resources/accounts/__init__.py +33 -0
  31. mixpeek_sdk/resources/accounts/accounts.py +102 -0
  32. mixpeek_sdk/resources/accounts/private.py +232 -0
  33. mixpeek_sdk/resources/agent/__init__.py +33 -0
  34. mixpeek_sdk/resources/agent/agent.py +225 -0
  35. mixpeek_sdk/resources/agent/task.py +189 -0
  36. mixpeek_sdk/resources/collections/__init__.py +33 -0
  37. mixpeek_sdk/resources/collections/collections.py +459 -0
  38. mixpeek_sdk/resources/collections/files.py +679 -0
  39. mixpeek_sdk/resources/describe.py +338 -0
  40. mixpeek_sdk/resources/embed.py +234 -0
  41. mixpeek_sdk/resources/indexes.py +506 -0
  42. mixpeek_sdk/resources/read.py +183 -0
  43. mixpeek_sdk/resources/recognize.py +183 -0
  44. mixpeek_sdk/resources/search.py +542 -0
  45. mixpeek_sdk/resources/tasks.py +294 -0
  46. mixpeek_sdk/resources/transcribe.py +192 -0
  47. mixpeek_sdk/types/__init__.py +19 -0
  48. mixpeek_sdk/types/accounts/__init__.py +6 -0
  49. mixpeek_sdk/types/accounts/private_update_params.py +25 -0
  50. mixpeek_sdk/types/accounts/user.py +32 -0
  51. mixpeek_sdk/types/agent/__init__.py +3 -0
  52. mixpeek_sdk/types/agent_create_params.py +18 -0
  53. mixpeek_sdk/types/agentresponse.py +11 -0
  54. mixpeek_sdk/types/collection_search_params.py +29 -0
  55. mixpeek_sdk/types/collections/__init__.py +9 -0
  56. mixpeek_sdk/types/collections/file_create_params.py +31 -0
  57. mixpeek_sdk/types/collections/file_full_params.py +22 -0
  58. mixpeek_sdk/types/collections/file_update_params.py +18 -0
  59. mixpeek_sdk/types/collections/fileresponse.py +23 -0
  60. mixpeek_sdk/types/collections/groupedfiledata.py +38 -0
  61. mixpeek_sdk/types/describe_upload_params.py +21 -0
  62. mixpeek_sdk/types/describe_url_params.py +20 -0
  63. mixpeek_sdk/types/embed_create_params.py +29 -0
  64. mixpeek_sdk/types/embeddingresponse.py +15 -0
  65. mixpeek_sdk/types/index_face_params.py +23 -0
  66. mixpeek_sdk/types/index_upload_params.py +27 -0
  67. mixpeek_sdk/types/index_url_params.py +159 -0
  68. mixpeek_sdk/types/search_text_params.py +45 -0
  69. mixpeek_sdk/types/search_upload_params.py +25 -0
  70. mixpeek_sdk/types/search_url_params.py +45 -0
  71. mixpeek_sdk/types/taskresponse.py +15 -0
  72. mixpeek_sdk/types/transcribe_url_params.py +18 -0
  73. mixpeek/__init__.py +0 -1
  74. mixpeek/client.py +0 -27
  75. mixpeek/endpoints/collections.py +0 -86
  76. mixpeek/endpoints/embed.py +0 -66
  77. mixpeek/endpoints/index.py +0 -51
  78. mixpeek/endpoints/register.py +0 -34
  79. mixpeek/endpoints/search.py +0 -67
  80. mixpeek/endpoints/tasks.py +0 -26
  81. mixpeek/endpoints/tools.py +0 -138
  82. mixpeek/exceptions.py +0 -13
  83. mixpeek-0.8.41.dist-info/METADATA +0 -375
  84. mixpeek-0.8.41.dist-info/RECORD +0 -15
  85. mixpeek-0.8.41.dist-info/top_level.txt +0 -1
  86. /mixpeek/endpoints/__init__.py → /mixpeek_sdk/py.typed +0 -0
mixpeek_sdk/_client.py ADDED
@@ -0,0 +1,444 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import Any, Union, Mapping
7
+ from typing_extensions import Self, override
8
+
9
+ import httpx
10
+
11
+ from . import resources, _exceptions
12
+ from ._qs import Querystring
13
+ from ._types import (
14
+ NOT_GIVEN,
15
+ Omit,
16
+ Timeout,
17
+ NotGiven,
18
+ Transport,
19
+ ProxiesTypes,
20
+ RequestOptions,
21
+ )
22
+ from ._utils import (
23
+ is_given,
24
+ get_async_library,
25
+ )
26
+ from ._version import __version__
27
+ from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28
+ from ._exceptions import APIStatusError
29
+ from ._base_client import (
30
+ DEFAULT_MAX_RETRIES,
31
+ SyncAPIClient,
32
+ AsyncAPIClient,
33
+ )
34
+
35
+ __all__ = [
36
+ "Timeout",
37
+ "Transport",
38
+ "ProxiesTypes",
39
+ "RequestOptions",
40
+ "resources",
41
+ "MixpeekSDK",
42
+ "AsyncMixpeekSDK",
43
+ "Client",
44
+ "AsyncClient",
45
+ ]
46
+
47
+
48
+ class MixpeekSDK(SyncAPIClient):
49
+ accounts: resources.AccountsResource
50
+ describe: resources.DescribeResource
51
+ embed: resources.EmbedResource
52
+ transcribe: resources.TranscribeResource
53
+ read: resources.ReadResource
54
+ recognize: resources.RecognizeResource
55
+ agent: resources.AgentResource
56
+ indexes: resources.IndexesResource
57
+ search: resources.SearchResource
58
+ collections: resources.CollectionsResource
59
+ tasks: resources.TasksResource
60
+ with_raw_response: MixpeekSDKWithRawResponse
61
+ with_streaming_response: MixpeekSDKWithStreamedResponse
62
+
63
+ # client options
64
+
65
+ def __init__(
66
+ self,
67
+ *,
68
+ base_url: str | httpx.URL | None = None,
69
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
70
+ max_retries: int = DEFAULT_MAX_RETRIES,
71
+ default_headers: Mapping[str, str] | None = None,
72
+ default_query: Mapping[str, object] | None = None,
73
+ # Configure a custom httpx client.
74
+ # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
75
+ # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
76
+ http_client: httpx.Client | None = None,
77
+ # Enable or disable schema validation for data returned by the API.
78
+ # When enabled an error APIResponseValidationError is raised
79
+ # if the API responds with invalid data for the expected schema.
80
+ #
81
+ # This parameter may be removed or changed in the future.
82
+ # If you rely on this feature, please open a GitHub issue
83
+ # outlining your use-case to help us decide if it should be
84
+ # part of our public interface in the future.
85
+ _strict_response_validation: bool = False,
86
+ ) -> None:
87
+ """Construct a new synchronous mixpeek-sdk client instance."""
88
+ if base_url is None:
89
+ base_url = os.environ.get("MIXPEEK_SDK_BASE_URL")
90
+ if base_url is None:
91
+ base_url = f"https://api.mixpeek.com/"
92
+
93
+ super().__init__(
94
+ version=__version__,
95
+ base_url=base_url,
96
+ max_retries=max_retries,
97
+ timeout=timeout,
98
+ http_client=http_client,
99
+ custom_headers=default_headers,
100
+ custom_query=default_query,
101
+ _strict_response_validation=_strict_response_validation,
102
+ )
103
+
104
+ self.accounts = resources.AccountsResource(self)
105
+ self.describe = resources.DescribeResource(self)
106
+ self.embed = resources.EmbedResource(self)
107
+ self.transcribe = resources.TranscribeResource(self)
108
+ self.read = resources.ReadResource(self)
109
+ self.recognize = resources.RecognizeResource(self)
110
+ self.agent = resources.AgentResource(self)
111
+ self.indexes = resources.IndexesResource(self)
112
+ self.search = resources.SearchResource(self)
113
+ self.collections = resources.CollectionsResource(self)
114
+ self.tasks = resources.TasksResource(self)
115
+ self.with_raw_response = MixpeekSDKWithRawResponse(self)
116
+ self.with_streaming_response = MixpeekSDKWithStreamedResponse(self)
117
+
118
+ @property
119
+ @override
120
+ def qs(self) -> Querystring:
121
+ return Querystring(array_format="comma")
122
+
123
+ @property
124
+ @override
125
+ def default_headers(self) -> dict[str, str | Omit]:
126
+ return {
127
+ **super().default_headers,
128
+ "X-Stainless-Async": "false",
129
+ **self._custom_headers,
130
+ }
131
+
132
+ def copy(
133
+ self,
134
+ *,
135
+ base_url: str | httpx.URL | None = None,
136
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
137
+ http_client: httpx.Client | None = None,
138
+ max_retries: int | NotGiven = NOT_GIVEN,
139
+ default_headers: Mapping[str, str] | None = None,
140
+ set_default_headers: Mapping[str, str] | None = None,
141
+ default_query: Mapping[str, object] | None = None,
142
+ set_default_query: Mapping[str, object] | None = None,
143
+ _extra_kwargs: Mapping[str, Any] = {},
144
+ ) -> Self:
145
+ """
146
+ Create a new client instance re-using the same options given to the current client with optional overriding.
147
+ """
148
+ if default_headers is not None and set_default_headers is not None:
149
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
150
+
151
+ if default_query is not None and set_default_query is not None:
152
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
153
+
154
+ headers = self._custom_headers
155
+ if default_headers is not None:
156
+ headers = {**headers, **default_headers}
157
+ elif set_default_headers is not None:
158
+ headers = set_default_headers
159
+
160
+ params = self._custom_query
161
+ if default_query is not None:
162
+ params = {**params, **default_query}
163
+ elif set_default_query is not None:
164
+ params = set_default_query
165
+
166
+ http_client = http_client or self._client
167
+ return self.__class__(
168
+ base_url=base_url or self.base_url,
169
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
170
+ http_client=http_client,
171
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
172
+ default_headers=headers,
173
+ default_query=params,
174
+ **_extra_kwargs,
175
+ )
176
+
177
+ # Alias for `copy` for nicer inline usage, e.g.
178
+ # client.with_options(timeout=10).foo.create(...)
179
+ with_options = copy
180
+
181
+ @override
182
+ def _make_status_error(
183
+ self,
184
+ err_msg: str,
185
+ *,
186
+ body: object,
187
+ response: httpx.Response,
188
+ ) -> APIStatusError:
189
+ if response.status_code == 400:
190
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
191
+
192
+ if response.status_code == 401:
193
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
194
+
195
+ if response.status_code == 403:
196
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
197
+
198
+ if response.status_code == 404:
199
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
200
+
201
+ if response.status_code == 409:
202
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
203
+
204
+ if response.status_code == 422:
205
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
206
+
207
+ if response.status_code == 429:
208
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
209
+
210
+ if response.status_code >= 500:
211
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
212
+ return APIStatusError(err_msg, response=response, body=body)
213
+
214
+
215
+ class AsyncMixpeekSDK(AsyncAPIClient):
216
+ accounts: resources.AsyncAccountsResource
217
+ describe: resources.AsyncDescribeResource
218
+ embed: resources.AsyncEmbedResource
219
+ transcribe: resources.AsyncTranscribeResource
220
+ read: resources.AsyncReadResource
221
+ recognize: resources.AsyncRecognizeResource
222
+ agent: resources.AsyncAgentResource
223
+ indexes: resources.AsyncIndexesResource
224
+ search: resources.AsyncSearchResource
225
+ collections: resources.AsyncCollectionsResource
226
+ tasks: resources.AsyncTasksResource
227
+ with_raw_response: AsyncMixpeekSDKWithRawResponse
228
+ with_streaming_response: AsyncMixpeekSDKWithStreamedResponse
229
+
230
+ # client options
231
+
232
+ def __init__(
233
+ self,
234
+ *,
235
+ base_url: str | httpx.URL | None = None,
236
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
237
+ max_retries: int = DEFAULT_MAX_RETRIES,
238
+ default_headers: Mapping[str, str] | None = None,
239
+ default_query: Mapping[str, object] | None = None,
240
+ # Configure a custom httpx client.
241
+ # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
242
+ # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
243
+ http_client: httpx.AsyncClient | None = None,
244
+ # Enable or disable schema validation for data returned by the API.
245
+ # When enabled an error APIResponseValidationError is raised
246
+ # if the API responds with invalid data for the expected schema.
247
+ #
248
+ # This parameter may be removed or changed in the future.
249
+ # If you rely on this feature, please open a GitHub issue
250
+ # outlining your use-case to help us decide if it should be
251
+ # part of our public interface in the future.
252
+ _strict_response_validation: bool = False,
253
+ ) -> None:
254
+ """Construct a new async mixpeek-sdk client instance."""
255
+ if base_url is None:
256
+ base_url = os.environ.get("MIXPEEK_SDK_BASE_URL")
257
+ if base_url is None:
258
+ base_url = f"https://api.mixpeek.com/"
259
+
260
+ super().__init__(
261
+ version=__version__,
262
+ base_url=base_url,
263
+ max_retries=max_retries,
264
+ timeout=timeout,
265
+ http_client=http_client,
266
+ custom_headers=default_headers,
267
+ custom_query=default_query,
268
+ _strict_response_validation=_strict_response_validation,
269
+ )
270
+
271
+ self.accounts = resources.AsyncAccountsResource(self)
272
+ self.describe = resources.AsyncDescribeResource(self)
273
+ self.embed = resources.AsyncEmbedResource(self)
274
+ self.transcribe = resources.AsyncTranscribeResource(self)
275
+ self.read = resources.AsyncReadResource(self)
276
+ self.recognize = resources.AsyncRecognizeResource(self)
277
+ self.agent = resources.AsyncAgentResource(self)
278
+ self.indexes = resources.AsyncIndexesResource(self)
279
+ self.search = resources.AsyncSearchResource(self)
280
+ self.collections = resources.AsyncCollectionsResource(self)
281
+ self.tasks = resources.AsyncTasksResource(self)
282
+ self.with_raw_response = AsyncMixpeekSDKWithRawResponse(self)
283
+ self.with_streaming_response = AsyncMixpeekSDKWithStreamedResponse(self)
284
+
285
+ @property
286
+ @override
287
+ def qs(self) -> Querystring:
288
+ return Querystring(array_format="comma")
289
+
290
+ @property
291
+ @override
292
+ def default_headers(self) -> dict[str, str | Omit]:
293
+ return {
294
+ **super().default_headers,
295
+ "X-Stainless-Async": f"async:{get_async_library()}",
296
+ **self._custom_headers,
297
+ }
298
+
299
+ def copy(
300
+ self,
301
+ *,
302
+ base_url: str | httpx.URL | None = None,
303
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
304
+ http_client: httpx.AsyncClient | None = None,
305
+ max_retries: int | NotGiven = NOT_GIVEN,
306
+ default_headers: Mapping[str, str] | None = None,
307
+ set_default_headers: Mapping[str, str] | None = None,
308
+ default_query: Mapping[str, object] | None = None,
309
+ set_default_query: Mapping[str, object] | None = None,
310
+ _extra_kwargs: Mapping[str, Any] = {},
311
+ ) -> Self:
312
+ """
313
+ Create a new client instance re-using the same options given to the current client with optional overriding.
314
+ """
315
+ if default_headers is not None and set_default_headers is not None:
316
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
317
+
318
+ if default_query is not None and set_default_query is not None:
319
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
320
+
321
+ headers = self._custom_headers
322
+ if default_headers is not None:
323
+ headers = {**headers, **default_headers}
324
+ elif set_default_headers is not None:
325
+ headers = set_default_headers
326
+
327
+ params = self._custom_query
328
+ if default_query is not None:
329
+ params = {**params, **default_query}
330
+ elif set_default_query is not None:
331
+ params = set_default_query
332
+
333
+ http_client = http_client or self._client
334
+ return self.__class__(
335
+ base_url=base_url or self.base_url,
336
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
337
+ http_client=http_client,
338
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
339
+ default_headers=headers,
340
+ default_query=params,
341
+ **_extra_kwargs,
342
+ )
343
+
344
+ # Alias for `copy` for nicer inline usage, e.g.
345
+ # client.with_options(timeout=10).foo.create(...)
346
+ with_options = copy
347
+
348
+ @override
349
+ def _make_status_error(
350
+ self,
351
+ err_msg: str,
352
+ *,
353
+ body: object,
354
+ response: httpx.Response,
355
+ ) -> APIStatusError:
356
+ if response.status_code == 400:
357
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
358
+
359
+ if response.status_code == 401:
360
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
361
+
362
+ if response.status_code == 403:
363
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
364
+
365
+ if response.status_code == 404:
366
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
367
+
368
+ if response.status_code == 409:
369
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
370
+
371
+ if response.status_code == 422:
372
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
373
+
374
+ if response.status_code == 429:
375
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
376
+
377
+ if response.status_code >= 500:
378
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
379
+ return APIStatusError(err_msg, response=response, body=body)
380
+
381
+
382
+ class MixpeekSDKWithRawResponse:
383
+ def __init__(self, client: MixpeekSDK) -> None:
384
+ self.accounts = resources.AccountsResourceWithRawResponse(client.accounts)
385
+ self.describe = resources.DescribeResourceWithRawResponse(client.describe)
386
+ self.embed = resources.EmbedResourceWithRawResponse(client.embed)
387
+ self.transcribe = resources.TranscribeResourceWithRawResponse(client.transcribe)
388
+ self.read = resources.ReadResourceWithRawResponse(client.read)
389
+ self.recognize = resources.RecognizeResourceWithRawResponse(client.recognize)
390
+ self.agent = resources.AgentResourceWithRawResponse(client.agent)
391
+ self.indexes = resources.IndexesResourceWithRawResponse(client.indexes)
392
+ self.search = resources.SearchResourceWithRawResponse(client.search)
393
+ self.collections = resources.CollectionsResourceWithRawResponse(client.collections)
394
+ self.tasks = resources.TasksResourceWithRawResponse(client.tasks)
395
+
396
+
397
+ class AsyncMixpeekSDKWithRawResponse:
398
+ def __init__(self, client: AsyncMixpeekSDK) -> None:
399
+ self.accounts = resources.AsyncAccountsResourceWithRawResponse(client.accounts)
400
+ self.describe = resources.AsyncDescribeResourceWithRawResponse(client.describe)
401
+ self.embed = resources.AsyncEmbedResourceWithRawResponse(client.embed)
402
+ self.transcribe = resources.AsyncTranscribeResourceWithRawResponse(client.transcribe)
403
+ self.read = resources.AsyncReadResourceWithRawResponse(client.read)
404
+ self.recognize = resources.AsyncRecognizeResourceWithRawResponse(client.recognize)
405
+ self.agent = resources.AsyncAgentResourceWithRawResponse(client.agent)
406
+ self.indexes = resources.AsyncIndexesResourceWithRawResponse(client.indexes)
407
+ self.search = resources.AsyncSearchResourceWithRawResponse(client.search)
408
+ self.collections = resources.AsyncCollectionsResourceWithRawResponse(client.collections)
409
+ self.tasks = resources.AsyncTasksResourceWithRawResponse(client.tasks)
410
+
411
+
412
+ class MixpeekSDKWithStreamedResponse:
413
+ def __init__(self, client: MixpeekSDK) -> None:
414
+ self.accounts = resources.AccountsResourceWithStreamingResponse(client.accounts)
415
+ self.describe = resources.DescribeResourceWithStreamingResponse(client.describe)
416
+ self.embed = resources.EmbedResourceWithStreamingResponse(client.embed)
417
+ self.transcribe = resources.TranscribeResourceWithStreamingResponse(client.transcribe)
418
+ self.read = resources.ReadResourceWithStreamingResponse(client.read)
419
+ self.recognize = resources.RecognizeResourceWithStreamingResponse(client.recognize)
420
+ self.agent = resources.AgentResourceWithStreamingResponse(client.agent)
421
+ self.indexes = resources.IndexesResourceWithStreamingResponse(client.indexes)
422
+ self.search = resources.SearchResourceWithStreamingResponse(client.search)
423
+ self.collections = resources.CollectionsResourceWithStreamingResponse(client.collections)
424
+ self.tasks = resources.TasksResourceWithStreamingResponse(client.tasks)
425
+
426
+
427
+ class AsyncMixpeekSDKWithStreamedResponse:
428
+ def __init__(self, client: AsyncMixpeekSDK) -> None:
429
+ self.accounts = resources.AsyncAccountsResourceWithStreamingResponse(client.accounts)
430
+ self.describe = resources.AsyncDescribeResourceWithStreamingResponse(client.describe)
431
+ self.embed = resources.AsyncEmbedResourceWithStreamingResponse(client.embed)
432
+ self.transcribe = resources.AsyncTranscribeResourceWithStreamingResponse(client.transcribe)
433
+ self.read = resources.AsyncReadResourceWithStreamingResponse(client.read)
434
+ self.recognize = resources.AsyncRecognizeResourceWithStreamingResponse(client.recognize)
435
+ self.agent = resources.AsyncAgentResourceWithStreamingResponse(client.agent)
436
+ self.indexes = resources.AsyncIndexesResourceWithStreamingResponse(client.indexes)
437
+ self.search = resources.AsyncSearchResourceWithStreamingResponse(client.search)
438
+ self.collections = resources.AsyncCollectionsResourceWithStreamingResponse(client.collections)
439
+ self.tasks = resources.AsyncTasksResourceWithStreamingResponse(client.tasks)
440
+
441
+
442
+ Client = MixpeekSDK
443
+
444
+ AsyncClient = AsyncMixpeekSDK
mixpeek_sdk/_compat.py ADDED
@@ -0,0 +1,219 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload
4
+ from datetime import date, datetime
5
+ from typing_extensions import Self
6
+
7
+ import pydantic
8
+ from pydantic.fields import FieldInfo
9
+
10
+ from ._types import IncEx, StrBytesIntFloat
11
+
12
+ _T = TypeVar("_T")
13
+ _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
14
+
15
+ # --------------- Pydantic v2 compatibility ---------------
16
+
17
+ # Pyright incorrectly reports some of our functions as overriding a method when they don't
18
+ # pyright: reportIncompatibleMethodOverride=false
19
+
20
+ PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
21
+
22
+ # v1 re-exports
23
+ if TYPE_CHECKING:
24
+
25
+ def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
26
+ ...
27
+
28
+ def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001
29
+ ...
30
+
31
+ def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001
32
+ ...
33
+
34
+ def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001
35
+ ...
36
+
37
+ def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001
38
+ ...
39
+
40
+ def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001
41
+ ...
42
+
43
+ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
44
+ ...
45
+
46
+ else:
47
+ if PYDANTIC_V2:
48
+ from pydantic.v1.typing import (
49
+ get_args as get_args,
50
+ is_union as is_union,
51
+ get_origin as get_origin,
52
+ is_typeddict as is_typeddict,
53
+ is_literal_type as is_literal_type,
54
+ )
55
+ from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
56
+ else:
57
+ from pydantic.typing import (
58
+ get_args as get_args,
59
+ is_union as is_union,
60
+ get_origin as get_origin,
61
+ is_typeddict as is_typeddict,
62
+ is_literal_type as is_literal_type,
63
+ )
64
+ from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
65
+
66
+
67
+ # refactored config
68
+ if TYPE_CHECKING:
69
+ from pydantic import ConfigDict as ConfigDict
70
+ else:
71
+ if PYDANTIC_V2:
72
+ from pydantic import ConfigDict
73
+ else:
74
+ # TODO: provide an error message here?
75
+ ConfigDict = None
76
+
77
+
78
+ # renamed methods / properties
79
+ def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
80
+ if PYDANTIC_V2:
81
+ return model.model_validate(value)
82
+ else:
83
+ return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
84
+
85
+
86
+ def field_is_required(field: FieldInfo) -> bool:
87
+ if PYDANTIC_V2:
88
+ return field.is_required()
89
+ return field.required # type: ignore
90
+
91
+
92
+ def field_get_default(field: FieldInfo) -> Any:
93
+ value = field.get_default()
94
+ if PYDANTIC_V2:
95
+ from pydantic_core import PydanticUndefined
96
+
97
+ if value == PydanticUndefined:
98
+ return None
99
+ return value
100
+ return value
101
+
102
+
103
+ def field_outer_type(field: FieldInfo) -> Any:
104
+ if PYDANTIC_V2:
105
+ return field.annotation
106
+ return field.outer_type_ # type: ignore
107
+
108
+
109
+ def get_model_config(model: type[pydantic.BaseModel]) -> Any:
110
+ if PYDANTIC_V2:
111
+ return model.model_config
112
+ return model.__config__ # type: ignore
113
+
114
+
115
+ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
116
+ if PYDANTIC_V2:
117
+ return model.model_fields
118
+ return model.__fields__ # type: ignore
119
+
120
+
121
+ def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
122
+ if PYDANTIC_V2:
123
+ return model.model_copy(deep=deep)
124
+ return model.copy(deep=deep) # type: ignore
125
+
126
+
127
+ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
128
+ if PYDANTIC_V2:
129
+ return model.model_dump_json(indent=indent)
130
+ return model.json(indent=indent) # type: ignore
131
+
132
+
133
+ def model_dump(
134
+ model: pydantic.BaseModel,
135
+ *,
136
+ exclude: IncEx = None,
137
+ exclude_unset: bool = False,
138
+ exclude_defaults: bool = False,
139
+ warnings: bool = True,
140
+ ) -> dict[str, Any]:
141
+ if PYDANTIC_V2:
142
+ return model.model_dump(
143
+ exclude=exclude,
144
+ exclude_unset=exclude_unset,
145
+ exclude_defaults=exclude_defaults,
146
+ warnings=warnings,
147
+ )
148
+ return cast(
149
+ "dict[str, Any]",
150
+ model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
151
+ exclude=exclude,
152
+ exclude_unset=exclude_unset,
153
+ exclude_defaults=exclude_defaults,
154
+ ),
155
+ )
156
+
157
+
158
+ def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
159
+ if PYDANTIC_V2:
160
+ return model.model_validate(data)
161
+ return model.parse_obj(data) # pyright: ignore[reportDeprecated]
162
+
163
+
164
+ # generic models
165
+ if TYPE_CHECKING:
166
+
167
+ class GenericModel(pydantic.BaseModel): ...
168
+
169
+ else:
170
+ if PYDANTIC_V2:
171
+ # there no longer needs to be a distinction in v2 but
172
+ # we still have to create our own subclass to avoid
173
+ # inconsistent MRO ordering errors
174
+ class GenericModel(pydantic.BaseModel): ...
175
+
176
+ else:
177
+ import pydantic.generics
178
+
179
+ class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
180
+
181
+
182
+ # cached properties
183
+ if TYPE_CHECKING:
184
+ cached_property = property
185
+
186
+ # we define a separate type (copied from typeshed)
187
+ # that represents that `cached_property` is `set`able
188
+ # at runtime, which differs from `@property`.
189
+ #
190
+ # this is a separate type as editors likely special case
191
+ # `@property` and we don't want to cause issues just to have
192
+ # more helpful internal types.
193
+
194
+ class typed_cached_property(Generic[_T]):
195
+ func: Callable[[Any], _T]
196
+ attrname: str | None
197
+
198
+ def __init__(self, func: Callable[[Any], _T]) -> None: ...
199
+
200
+ @overload
201
+ def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ...
202
+
203
+ @overload
204
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
205
+
206
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self:
207
+ raise NotImplementedError()
208
+
209
+ def __set_name__(self, owner: type[Any], name: str) -> None: ...
210
+
211
+ # __set__ is not defined at runtime, but @cached_property is designed to be settable
212
+ def __set__(self, instance: object, value: _T) -> None: ...
213
+ else:
214
+ try:
215
+ from functools import cached_property as cached_property
216
+ except ImportError:
217
+ from cached_property import cached_property as cached_property
218
+
219
+ typed_cached_property = cached_property
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import httpx
4
+
5
+ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
6
+ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
7
+
8
+ # default timeout is 1 minute
9
+ DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0)
10
+ DEFAULT_MAX_RETRIES = 2
11
+ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
12
+
13
+ INITIAL_RETRY_DELAY = 0.5
14
+ MAX_RETRY_DELAY = 8.0