mixpeek 0.6.2__py3-none-any.whl → 0.6.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. mixpeek/__init__.py +12 -8
  2. mixpeek/base_client.py +857 -23
  3. mixpeek/client.py +7 -7
  4. mixpeek/core/client_wrapper.py +1 -1
  5. mixpeek/{pipelines → pipeline}/client.py +26 -20
  6. mixpeek/storage/__init__.py +3 -0
  7. mixpeek/storage/client.py +7 -112
  8. mixpeek/{embed → storage/sample}/client.py +61 -129
  9. mixpeek/types/__init__.py +8 -0
  10. mixpeek/types/configs_response.py +14 -3
  11. mixpeek/types/destination.py +14 -3
  12. mixpeek/types/embedding_response.py +6 -2
  13. mixpeek/types/extract_response.py +35 -0
  14. mixpeek/types/generation_response.py +6 -4
  15. mixpeek/types/message.py +9 -2
  16. mixpeek/types/metadata.py +0 -2
  17. mixpeek/types/modality.py +1 -1
  18. mixpeek/types/model.py +9 -2
  19. mixpeek/types/pipeline_response.py +49 -0
  20. mixpeek/types/pipeline_task_response.py +32 -0
  21. mixpeek/types/source.py +14 -3
  22. mixpeek/types/source_destination_mapping.py +14 -3
  23. mixpeek/types/workflow_code_response.py +29 -0
  24. mixpeek/{users → user}/client.py +10 -10
  25. mixpeek/{workflows → workflow}/client.py +14 -15
  26. {mixpeek-0.6.2.dist-info → mixpeek-0.6.6.dist-info}/METADATA +1 -1
  27. {mixpeek-0.6.2.dist-info → mixpeek-0.6.6.dist-info}/RECORD +33 -36
  28. mixpeek/extract/client.py +0 -347
  29. mixpeek/generators/client.py +0 -237
  30. mixpeek/parse/client.py +0 -111
  31. mixpeek/parse_client.py +0 -14
  32. mixpeek/pipelines/__init__.py +0 -2
  33. mixpeek/users/__init__.py +0 -2
  34. mixpeek/workflows/__init__.py +0 -2
  35. /mixpeek/{embed → pipeline}/__init__.py +0 -0
  36. /mixpeek/{extract → storage/sample}/__init__.py +0 -0
  37. /mixpeek/{generators → user}/__init__.py +0 -0
  38. /mixpeek/{parse → workflow}/__init__.py +0 -0
  39. {mixpeek-0.6.2.dist-info → mixpeek-0.6.6.dist-info}/LICENSE +0 -0
  40. {mixpeek-0.6.2.dist-info → mixpeek-0.6.6.dist-info}/WHEEL +0 -0
mixpeek/client.py CHANGED
@@ -1,9 +1,7 @@
1
-
2
1
  import typing
3
2
  import httpx
4
3
 
5
- from .base_client import BaseMixpeek, \
6
- AsyncBaseMixpeek
4
+ from .base_client import BaseMixpeek, AsyncBaseMixpeek
7
5
  from .types.message import Message
8
6
  from .types.model import Model
9
7
  from .types.settings import Settings
@@ -15,7 +13,7 @@ from .core.request_options import RequestOptions
15
13
  OMIT = typing.cast(typing.Any, ...)
16
14
 
17
15
 
18
- class Mixpeek(BaseMixpeek):
16
+ class Mixpeek(BaseMixpeek):
19
17
 
20
18
  def generate(
21
19
  self,
@@ -30,7 +28,8 @@ class Mixpeek(BaseMixpeek):
30
28
  ) -> GenerationResponse:
31
29
  if response_format is not None:
32
30
  response_format = response_format.model_json_schema()
33
- return self.generators.generate(
31
+
32
+ return self.base_generate(
34
33
  model=model,
35
34
  response_format=response_format,
36
35
  context=context,
@@ -55,11 +54,12 @@ class AsyncMixpeek(AsyncBaseMixpeek):
55
54
  ) -> GenerationResponse:
56
55
  if response_format is not None:
57
56
  response_format = response_format.model_json_schema()
58
- return await self.generators.generate(
57
+
58
+ return await self.base_generate(
59
59
  model=model,
60
60
  response_format=response_format,
61
61
  context=context,
62
62
  messages=messages,
63
63
  settings=settings,
64
64
  request_options=request_options,
65
- )
65
+ )
@@ -27,7 +27,7 @@ class BaseClientWrapper:
27
27
  headers: typing.Dict[str, str] = {
28
28
  "X-Fern-Language": "Python",
29
29
  "X-Fern-SDK-Name": "mixpeek",
30
- "X-Fern-SDK-Version": "0.6.2",
30
+ "X-Fern-SDK-Version": "0.6.6",
31
31
  }
32
32
  if self._authorization is not None:
33
33
  headers["Authorization"] = self._authorization
@@ -17,6 +17,8 @@ from ..errors.unauthorized_error import UnauthorizedError
17
17
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
18
18
  from ..types.error_response import ErrorResponse
19
19
  from ..types.http_validation_error import HttpValidationError
20
+ from ..types.pipeline_response import PipelineResponse
21
+ from ..types.pipeline_task_response import PipelineTaskResponse
20
22
  from ..types.source_destination_mapping import SourceDestinationMapping
21
23
 
22
24
  try:
@@ -28,11 +30,13 @@ except ImportError:
28
30
  OMIT = typing.cast(typing.Any, ...)
29
31
 
30
32
 
31
- class PipelinesClient:
33
+ class PipelineClient:
32
34
  def __init__(self, *, client_wrapper: SyncClientWrapper):
33
35
  self._client_wrapper = client_wrapper
34
36
 
35
- def invoke(self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
37
+ def invoke(
38
+ self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
39
+ ) -> PipelineTaskResponse:
36
40
  """
37
41
  Parameters:
38
42
  - pipeline_id: str.
@@ -46,7 +50,7 @@ class PipelinesClient:
46
50
  index_id="YOUR_INDEX_ID",
47
51
  api_key="YOUR_API_KEY",
48
52
  )
49
- client.pipelines.invoke(
53
+ client.pipeline.invoke(
50
54
  pipeline_id="pipeline_id",
51
55
  )
52
56
  """
@@ -76,7 +80,7 @@ class PipelinesClient:
76
80
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
77
81
  )
78
82
  if 200 <= _response.status_code < 300:
79
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
83
+ return pydantic.parse_obj_as(PipelineTaskResponse, _response.json()) # type: ignore
80
84
  if _response.status_code == 400:
81
85
  raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
82
86
  if _response.status_code == 401:
@@ -101,10 +105,10 @@ class PipelinesClient:
101
105
  source_destination_mappings: typing.Sequence[SourceDestinationMapping],
102
106
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
103
107
  request_options: typing.Optional[RequestOptions] = None,
104
- ) -> typing.Any:
108
+ ) -> PipelineResponse:
105
109
  """
106
110
  Parameters:
107
- - source_destination_mappings: typing.Sequence[SourceDestinationMapping].
111
+ - source_destination_mappings: typing.Sequence[SourceDestinationMapping]. The source-destination mappings
108
112
 
109
113
  - metadata: typing.Optional[typing.Dict[str, typing.Any]].
110
114
 
@@ -118,7 +122,7 @@ class PipelinesClient:
118
122
  index_id="YOUR_INDEX_ID",
119
123
  api_key="YOUR_API_KEY",
120
124
  )
121
- client.pipelines.create(
125
+ client.pipeline.create(
122
126
  source_destination_mappings=[
123
127
  SourceDestinationMapping(
124
128
  embedding_model="embedding_model",
@@ -166,7 +170,7 @@ class PipelinesClient:
166
170
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
167
171
  )
168
172
  if 200 <= _response.status_code < 300:
169
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
173
+ return pydantic.parse_obj_as(PipelineResponse, _response.json()) # type: ignore
170
174
  if _response.status_code == 400:
171
175
  raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
172
176
  if _response.status_code == 401:
@@ -185,7 +189,7 @@ class PipelinesClient:
185
189
  raise ApiError(status_code=_response.status_code, body=_response.text)
186
190
  raise ApiError(status_code=_response.status_code, body=_response_json)
187
191
 
188
- def get_status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
192
+ def status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
189
193
  """
190
194
  Query tasks status.
191
195
 
@@ -201,7 +205,7 @@ class PipelinesClient:
201
205
  index_id="YOUR_INDEX_ID",
202
206
  api_key="YOUR_API_KEY",
203
207
  )
204
- client.pipelines.get_status(
208
+ client.pipeline.status(
205
209
  task_id="task_id",
206
210
  )
207
211
  """
@@ -248,11 +252,13 @@ class PipelinesClient:
248
252
  raise ApiError(status_code=_response.status_code, body=_response_json)
249
253
 
250
254
 
251
- class AsyncPipelinesClient:
255
+ class AsyncPipelineClient:
252
256
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
253
257
  self._client_wrapper = client_wrapper
254
258
 
255
- async def invoke(self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
259
+ async def invoke(
260
+ self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
261
+ ) -> PipelineTaskResponse:
256
262
  """
257
263
  Parameters:
258
264
  - pipeline_id: str.
@@ -266,7 +272,7 @@ class AsyncPipelinesClient:
266
272
  index_id="YOUR_INDEX_ID",
267
273
  api_key="YOUR_API_KEY",
268
274
  )
269
- await client.pipelines.invoke(
275
+ await client.pipeline.invoke(
270
276
  pipeline_id="pipeline_id",
271
277
  )
272
278
  """
@@ -296,7 +302,7 @@ class AsyncPipelinesClient:
296
302
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
297
303
  )
298
304
  if 200 <= _response.status_code < 300:
299
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
305
+ return pydantic.parse_obj_as(PipelineTaskResponse, _response.json()) # type: ignore
300
306
  if _response.status_code == 400:
301
307
  raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
302
308
  if _response.status_code == 401:
@@ -321,10 +327,10 @@ class AsyncPipelinesClient:
321
327
  source_destination_mappings: typing.Sequence[SourceDestinationMapping],
322
328
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
323
329
  request_options: typing.Optional[RequestOptions] = None,
324
- ) -> typing.Any:
330
+ ) -> PipelineResponse:
325
331
  """
326
332
  Parameters:
327
- - source_destination_mappings: typing.Sequence[SourceDestinationMapping].
333
+ - source_destination_mappings: typing.Sequence[SourceDestinationMapping]. The source-destination mappings
328
334
 
329
335
  - metadata: typing.Optional[typing.Dict[str, typing.Any]].
330
336
 
@@ -338,7 +344,7 @@ class AsyncPipelinesClient:
338
344
  index_id="YOUR_INDEX_ID",
339
345
  api_key="YOUR_API_KEY",
340
346
  )
341
- await client.pipelines.create(
347
+ await client.pipeline.create(
342
348
  source_destination_mappings=[
343
349
  SourceDestinationMapping(
344
350
  embedding_model="embedding_model",
@@ -386,7 +392,7 @@ class AsyncPipelinesClient:
386
392
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
387
393
  )
388
394
  if 200 <= _response.status_code < 300:
389
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
395
+ return pydantic.parse_obj_as(PipelineResponse, _response.json()) # type: ignore
390
396
  if _response.status_code == 400:
391
397
  raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
392
398
  if _response.status_code == 401:
@@ -405,7 +411,7 @@ class AsyncPipelinesClient:
405
411
  raise ApiError(status_code=_response.status_code, body=_response.text)
406
412
  raise ApiError(status_code=_response.status_code, body=_response_json)
407
413
 
408
- async def get_status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
414
+ async def status(self, task_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
409
415
  """
410
416
  Query tasks status.
411
417
 
@@ -421,7 +427,7 @@ class AsyncPipelinesClient:
421
427
  index_id="YOUR_INDEX_ID",
422
428
  api_key="YOUR_API_KEY",
423
429
  )
424
- await client.pipelines.get_status(
430
+ await client.pipeline.status(
425
431
  task_id="task_id",
426
432
  )
427
433
  """
@@ -1,2 +1,5 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from . import sample
4
+
5
+ __all__ = ["sample"]
mixpeek/storage/client.py CHANGED
@@ -17,6 +17,7 @@ from ..errors.unauthorized_error import UnauthorizedError
17
17
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
18
18
  from ..types.error_response import ErrorResponse
19
19
  from ..types.http_validation_error import HttpValidationError
20
+ from .sample.client import AsyncSampleClient, SampleClient
20
21
 
21
22
  try:
22
23
  import pydantic.v1 as pydantic # type: ignore
@@ -27,8 +28,9 @@ except ImportError:
27
28
  class StorageClient:
28
29
  def __init__(self, *, client_wrapper: SyncClientWrapper):
29
30
  self._client_wrapper = client_wrapper
31
+ self.sample = SampleClient(client_wrapper=self._client_wrapper)
30
32
 
31
- def test_connection(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
33
+ def connect(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
32
34
  """
33
35
  Parameters:
34
36
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
@@ -40,7 +42,7 @@ class StorageClient:
40
42
  index_id="YOUR_INDEX_ID",
41
43
  api_key="YOUR_API_KEY",
42
44
  )
43
- client.storage.test_connection()
45
+ client.storage.connect()
44
46
  """
45
47
  _response = self._client_wrapper.httpx_client.request(
46
48
  "GET",
@@ -82,66 +84,13 @@ class StorageClient:
82
84
  raise ApiError(status_code=_response.status_code, body=_response.text)
83
85
  raise ApiError(status_code=_response.status_code, body=_response_json)
84
86
 
85
- def sample_database(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
86
- """
87
- Parameters:
88
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
89
- ---
90
- from mixpeek.client import Mixpeek
91
-
92
- client = Mixpeek(
93
- authorization="YOUR_AUTHORIZATION",
94
- index_id="YOUR_INDEX_ID",
95
- api_key="YOUR_API_KEY",
96
- )
97
- client.storage.sample_database()
98
- """
99
- _response = self._client_wrapper.httpx_client.request(
100
- "GET",
101
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "storage/sample/database"),
102
- params=jsonable_encoder(
103
- request_options.get("additional_query_parameters") if request_options is not None else None
104
- ),
105
- headers=jsonable_encoder(
106
- remove_none_from_dict(
107
- {
108
- **self._client_wrapper.get_headers(),
109
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
110
- }
111
- )
112
- ),
113
- timeout=request_options.get("timeout_in_seconds")
114
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
115
- else self._client_wrapper.get_timeout(),
116
- retries=0,
117
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
118
- )
119
- if 200 <= _response.status_code < 300:
120
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
121
- if _response.status_code == 400:
122
- raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
123
- if _response.status_code == 401:
124
- raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
125
- if _response.status_code == 403:
126
- raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
127
- if _response.status_code == 404:
128
- raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
129
- if _response.status_code == 422:
130
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
131
- if _response.status_code == 500:
132
- raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
133
- try:
134
- _response_json = _response.json()
135
- except JSONDecodeError:
136
- raise ApiError(status_code=_response.status_code, body=_response.text)
137
- raise ApiError(status_code=_response.status_code, body=_response_json)
138
-
139
87
 
140
88
  class AsyncStorageClient:
141
89
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
142
90
  self._client_wrapper = client_wrapper
91
+ self.sample = AsyncSampleClient(client_wrapper=self._client_wrapper)
143
92
 
144
- async def test_connection(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
93
+ async def connect(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
145
94
  """
146
95
  Parameters:
147
96
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
@@ -153,7 +102,7 @@ class AsyncStorageClient:
153
102
  index_id="YOUR_INDEX_ID",
154
103
  api_key="YOUR_API_KEY",
155
104
  )
156
- await client.storage.test_connection()
105
+ await client.storage.connect()
157
106
  """
158
107
  _response = await self._client_wrapper.httpx_client.request(
159
108
  "GET",
@@ -194,57 +143,3 @@ class AsyncStorageClient:
194
143
  except JSONDecodeError:
195
144
  raise ApiError(status_code=_response.status_code, body=_response.text)
196
145
  raise ApiError(status_code=_response.status_code, body=_response_json)
197
-
198
- async def sample_database(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
199
- """
200
- Parameters:
201
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
202
- ---
203
- from mixpeek.client import AsyncMixpeek
204
-
205
- client = AsyncMixpeek(
206
- authorization="YOUR_AUTHORIZATION",
207
- index_id="YOUR_INDEX_ID",
208
- api_key="YOUR_API_KEY",
209
- )
210
- await client.storage.sample_database()
211
- """
212
- _response = await self._client_wrapper.httpx_client.request(
213
- "GET",
214
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "storage/sample/database"),
215
- params=jsonable_encoder(
216
- request_options.get("additional_query_parameters") if request_options is not None else None
217
- ),
218
- headers=jsonable_encoder(
219
- remove_none_from_dict(
220
- {
221
- **self._client_wrapper.get_headers(),
222
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
223
- }
224
- )
225
- ),
226
- timeout=request_options.get("timeout_in_seconds")
227
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
228
- else self._client_wrapper.get_timeout(),
229
- retries=0,
230
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
231
- )
232
- if 200 <= _response.status_code < 300:
233
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
234
- if _response.status_code == 400:
235
- raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
236
- if _response.status_code == 401:
237
- raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
238
- if _response.status_code == 403:
239
- raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
240
- if _response.status_code == 404:
241
- raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
242
- if _response.status_code == 422:
243
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
244
- if _response.status_code == 500:
245
- raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
246
- try:
247
- _response_json = _response.json()
248
- except JSONDecodeError:
249
- raise ApiError(status_code=_response.status_code, body=_response.text)
250
- raise ApiError(status_code=_response.status_code, body=_response_json)