mixpeek 0.2__tar.gz → 0.6.2__tar.gz

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 (90) hide show
  1. mixpeek-0.2/LICENSE.rst → mixpeek-0.6.2/LICENSE +10 -9
  2. mixpeek-0.6.2/PKG-INFO +145 -0
  3. mixpeek-0.6.2/README.md +129 -0
  4. mixpeek-0.6.2/pyproject.toml +33 -0
  5. mixpeek-0.6.2/src/mixpeek/__init__.py +102 -0
  6. mixpeek-0.6.2/src/mixpeek/base_client.py +155 -0
  7. mixpeek-0.6.2/src/mixpeek/client.py +65 -0
  8. mixpeek-0.6.2/src/mixpeek/core/__init__.py +25 -0
  9. mixpeek-0.6.2/src/mixpeek/core/api_error.py +15 -0
  10. mixpeek-0.6.2/src/mixpeek/core/client_wrapper.py +83 -0
  11. mixpeek-0.6.2/src/mixpeek/core/datetime_utils.py +28 -0
  12. mixpeek-0.6.2/src/mixpeek/core/file.py +38 -0
  13. mixpeek-0.6.2/src/mixpeek/core/http_client.py +130 -0
  14. mixpeek-0.6.2/src/mixpeek/core/jsonable_encoder.py +103 -0
  15. mixpeek-0.6.2/src/mixpeek/core/remove_none_from_dict.py +11 -0
  16. mixpeek-0.6.2/src/mixpeek/core/request_options.py +32 -0
  17. mixpeek-0.6.2/src/mixpeek/embed/__init__.py +2 -0
  18. mixpeek-0.6.2/src/mixpeek/embed/client.py +350 -0
  19. mixpeek-0.6.2/src/mixpeek/environment.py +7 -0
  20. mixpeek-0.6.2/src/mixpeek/errors/__init__.py +17 -0
  21. mixpeek-0.6.2/src/mixpeek/errors/bad_request_error.py +9 -0
  22. mixpeek-0.6.2/src/mixpeek/errors/forbidden_error.py +9 -0
  23. mixpeek-0.6.2/src/mixpeek/errors/internal_server_error.py +9 -0
  24. mixpeek-0.6.2/src/mixpeek/errors/not_found_error.py +9 -0
  25. mixpeek-0.6.2/src/mixpeek/errors/unauthorized_error.py +9 -0
  26. mixpeek-0.6.2/src/mixpeek/errors/unprocessable_entity_error.py +9 -0
  27. mixpeek-0.6.2/src/mixpeek/extract/__init__.py +2 -0
  28. mixpeek-0.6.2/src/mixpeek/extract/client.py +347 -0
  29. mixpeek-0.6.2/src/mixpeek/generators/__init__.py +2 -0
  30. mixpeek-0.6.2/src/mixpeek/generators/client.py +237 -0
  31. mixpeek-0.6.2/src/mixpeek/parse/__init__.py +2 -0
  32. mixpeek-0.6.2/src/mixpeek/parse/client.py +111 -0
  33. mixpeek-0.6.2/src/mixpeek/parse_client.py +14 -0
  34. mixpeek-0.6.2/src/mixpeek/pipelines/__init__.py +2 -0
  35. mixpeek-0.6.2/src/mixpeek/pipelines/client.py +468 -0
  36. mixpeek-0.6.2/src/mixpeek/py.typed +0 -0
  37. mixpeek-0.6.2/src/mixpeek/storage/__init__.py +2 -0
  38. mixpeek-0.6.2/src/mixpeek/storage/client.py +250 -0
  39. mixpeek-0.6.2/src/mixpeek/types/__init__.py +73 -0
  40. mixpeek-0.6.2/src/mixpeek/types/api_key.py +31 -0
  41. mixpeek-0.6.2/src/mixpeek/types/audio_params.py +29 -0
  42. mixpeek-0.6.2/src/mixpeek/types/configs_response.py +31 -0
  43. mixpeek-0.6.2/src/mixpeek/types/connection.py +36 -0
  44. mixpeek-0.6.2/src/mixpeek/types/connection_engine.py +5 -0
  45. mixpeek-0.6.2/src/mixpeek/types/csv_params.py +29 -0
  46. mixpeek-0.6.2/src/mixpeek/types/destination.py +31 -0
  47. mixpeek-0.6.2/src/mixpeek/types/embedding_response.py +30 -0
  48. mixpeek-0.6.2/src/mixpeek/types/error_message.py +29 -0
  49. mixpeek-0.6.2/src/mixpeek/types/error_response.py +30 -0
  50. mixpeek-0.6.2/src/mixpeek/types/field_type.py +5 -0
  51. mixpeek-0.6.2/src/mixpeek/types/generation_response.py +34 -0
  52. mixpeek-0.6.2/src/mixpeek/types/html_params.py +29 -0
  53. mixpeek-0.6.2/src/mixpeek/types/http_validation_error.py +30 -0
  54. mixpeek-0.6.2/src/mixpeek/types/image_params.py +32 -0
  55. mixpeek-0.6.2/src/mixpeek/types/message.py +30 -0
  56. mixpeek-0.6.2/src/mixpeek/types/metadata.py +34 -0
  57. mixpeek-0.6.2/src/mixpeek/types/modality.py +5 -0
  58. mixpeek-0.6.2/src/mixpeek/types/model.py +31 -0
  59. mixpeek-0.6.2/src/mixpeek/types/models.py +5 -0
  60. mixpeek-0.6.2/src/mixpeek/types/pdf_params.py +41 -0
  61. mixpeek-0.6.2/src/mixpeek/types/ppt_params.py +27 -0
  62. mixpeek-0.6.2/src/mixpeek/types/pptx_params.py +27 -0
  63. mixpeek-0.6.2/src/mixpeek/types/settings.py +35 -0
  64. mixpeek-0.6.2/src/mixpeek/types/source.py +32 -0
  65. mixpeek-0.6.2/src/mixpeek/types/source_destination_mapping.py +33 -0
  66. mixpeek-0.6.2/src/mixpeek/types/txt_params.py +27 -0
  67. mixpeek-0.6.2/src/mixpeek/types/user.py +36 -0
  68. mixpeek-0.6.2/src/mixpeek/types/validation_error.py +32 -0
  69. mixpeek-0.6.2/src/mixpeek/types/validation_error_loc_item.py +5 -0
  70. mixpeek-0.6.2/src/mixpeek/types/video_params.py +27 -0
  71. mixpeek-0.6.2/src/mixpeek/types/workflow_response.py +32 -0
  72. mixpeek-0.6.2/src/mixpeek/types/workflow_settings.py +30 -0
  73. mixpeek-0.6.2/src/mixpeek/types/xlsx_params.py +29 -0
  74. mixpeek-0.6.2/src/mixpeek/users/__init__.py +2 -0
  75. mixpeek-0.6.2/src/mixpeek/users/client.py +308 -0
  76. mixpeek-0.6.2/src/mixpeek/version.py +4 -0
  77. mixpeek-0.6.2/src/mixpeek/workflows/__init__.py +2 -0
  78. mixpeek-0.6.2/src/mixpeek/workflows/client.py +536 -0
  79. mixpeek-0.2/MANIFEST.in +0 -1
  80. mixpeek-0.2/PKG-INFO +0 -11
  81. mixpeek-0.2/README.md +0 -196
  82. mixpeek-0.2/mixpeek/__init__.py +0 -73
  83. mixpeek-0.2/mixpeek.egg-info/PKG-INFO +0 -11
  84. mixpeek-0.2/mixpeek.egg-info/SOURCES.txt +0 -12
  85. mixpeek-0.2/mixpeek.egg-info/dependency_links.txt +0 -1
  86. mixpeek-0.2/mixpeek.egg-info/requires.txt +0 -1
  87. mixpeek-0.2/mixpeek.egg-info/top_level.txt +0 -1
  88. mixpeek-0.2/pyproject.toml +0 -19
  89. mixpeek-0.2/setup.cfg +0 -8
  90. mixpeek-0.2/setup.py +0 -15
@@ -1,5 +1,6 @@
1
- The MIT License (MIT)
2
- Copyright (c) 2021 mixpeek
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mixpeek.
3
4
 
4
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
6
  of this software and associated documentation files (the "Software"), to deal
@@ -11,10 +12,10 @@ furnished to do so, subject to the following conditions:
11
12
  The above copyright notice and this permission notice shall be included in all
12
13
  copies or substantial portions of the Software.
13
14
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
20
- OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mixpeek-0.6.2/PKG-INFO ADDED
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.1
2
+ Name: mixpeek
3
+ Version: 0.6.2
4
+ Summary:
5
+ Requires-Python: >=3.8,<4.0
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.8
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Requires-Dist: httpx (>=0.21.2)
12
+ Requires-Dist: pydantic (>=1.9.2)
13
+ Requires-Dist: typing_extensions (>=4.0.0)
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Mixpeek Python Library
17
+
18
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
19
+
20
+ The Mixpeek Python Library provides convenient access to the Mixpeek API from applications written in Python.
21
+
22
+ ## Installation
23
+ Add this dependency to your project's build file:
24
+
25
+ ```bash
26
+ pip install mixpeek
27
+ # or
28
+ poetry add mixpeek
29
+ ```
30
+
31
+ ## Usage
32
+ Simply import `Mixpeek` and start making calls to our API.
33
+
34
+ ```python
35
+ from mixpeek.client import Mixpeek
36
+
37
+ client = Mixpeek(
38
+ api_key="..."
39
+ )
40
+ ```
41
+
42
+ ## Async Client
43
+
44
+ The SDK also exports an async client so that you can make non-blocking
45
+ calls to our API.
46
+
47
+ ```python
48
+ from mixpeek.client import AsymcMixpeek
49
+
50
+ client = AsyncMixpeek(
51
+ api_key="..."
52
+ )
53
+ ```
54
+
55
+ ## Exception Handling
56
+ All errors thrown by the SDK will be subclasses of [`ApiError`](./src/mixpeek/core/api_error.py).
57
+
58
+ ```python
59
+ import mixpeek
60
+
61
+ try:
62
+ client.search(...)
63
+ except mixpeek.core.ApiError as e: # Handle all errors
64
+ print(e.status_code)
65
+ print(e.body)
66
+ ```
67
+
68
+ ## Advanced
69
+
70
+ ### Retries
71
+ The Mixpeek SDK is instrumented with automatic retries with exponential backoff. A request will be
72
+ retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
73
+ than the configured retry limit.
74
+
75
+ A request is deemed retriable when any of the following HTTP status codes is returned:
76
+
77
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
78
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
79
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
80
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
81
+
82
+ Use the `max_retries` request option to configure this behavior.
83
+
84
+ ```python
85
+ from mixpeek.client import Mixpeek
86
+
87
+ client = Mixpeek(...)
88
+
89
+ # Override retries for a specific method
90
+ client.search(..., {
91
+ max_retries=5
92
+ })
93
+ ```
94
+
95
+ ### Timeouts
96
+ By default, requests time out after 60 seconds. You can configure this with a
97
+ timeout option at the client or request level.
98
+
99
+ ```python
100
+ from mixpeek.client import Mixpeek
101
+
102
+ client = Mixpeek(
103
+ # All timeouts are 20 seconds
104
+ timeout=20.0,
105
+ )
106
+
107
+ # Override timeout for a specific method
108
+ client.search(..., {
109
+ timeout_in_seconds=20.0
110
+ })
111
+ ```
112
+
113
+ ### Custom HTTP client
114
+ You can override the httpx client to customize it for your use-case. Some common use-cases
115
+ include support for proxies and transports.
116
+
117
+ ```python
118
+ import httpx
119
+
120
+ from mixpeek.client import Mixpeek
121
+
122
+ client = Mixpeek(
123
+ http_client=httpx.Client(
124
+ proxies="http://my.test.proxy.example.com",
125
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
126
+ ),
127
+ )
128
+ ```
129
+
130
+ ## Beta Status
131
+
132
+ This SDK is in beta, and there may be breaking changes between versions without a major
133
+ version update. Therefore, we recommend pinning the package version to a specific version.
134
+ This way, you can install the same version each time without breaking changes.
135
+
136
+ ## Contributing
137
+
138
+ While we value open-source contributions to this SDK, this library is generated programmatically.
139
+ Additions made directly to this library would have to be moved over to our generation code,
140
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
141
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
142
+ an issue first to discuss with us!
143
+
144
+ On the other hand, contributions to the README are always very welcome!
145
+
@@ -0,0 +1,129 @@
1
+ # Mixpeek Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
4
+
5
+ The Mixpeek Python Library provides convenient access to the Mixpeek API from applications written in Python.
6
+
7
+ ## Installation
8
+ Add this dependency to your project's build file:
9
+
10
+ ```bash
11
+ pip install mixpeek
12
+ # or
13
+ poetry add mixpeek
14
+ ```
15
+
16
+ ## Usage
17
+ Simply import `Mixpeek` and start making calls to our API.
18
+
19
+ ```python
20
+ from mixpeek.client import Mixpeek
21
+
22
+ client = Mixpeek(
23
+ api_key="..."
24
+ )
25
+ ```
26
+
27
+ ## Async Client
28
+
29
+ The SDK also exports an async client so that you can make non-blocking
30
+ calls to our API.
31
+
32
+ ```python
33
+ from mixpeek.client import AsymcMixpeek
34
+
35
+ client = AsyncMixpeek(
36
+ api_key="..."
37
+ )
38
+ ```
39
+
40
+ ## Exception Handling
41
+ All errors thrown by the SDK will be subclasses of [`ApiError`](./src/mixpeek/core/api_error.py).
42
+
43
+ ```python
44
+ import mixpeek
45
+
46
+ try:
47
+ client.search(...)
48
+ except mixpeek.core.ApiError as e: # Handle all errors
49
+ print(e.status_code)
50
+ print(e.body)
51
+ ```
52
+
53
+ ## Advanced
54
+
55
+ ### Retries
56
+ The Mixpeek SDK is instrumented with automatic retries with exponential backoff. A request will be
57
+ retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
58
+ than the configured retry limit.
59
+
60
+ A request is deemed retriable when any of the following HTTP status codes is returned:
61
+
62
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
63
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
64
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
65
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
66
+
67
+ Use the `max_retries` request option to configure this behavior.
68
+
69
+ ```python
70
+ from mixpeek.client import Mixpeek
71
+
72
+ client = Mixpeek(...)
73
+
74
+ # Override retries for a specific method
75
+ client.search(..., {
76
+ max_retries=5
77
+ })
78
+ ```
79
+
80
+ ### Timeouts
81
+ By default, requests time out after 60 seconds. You can configure this with a
82
+ timeout option at the client or request level.
83
+
84
+ ```python
85
+ from mixpeek.client import Mixpeek
86
+
87
+ client = Mixpeek(
88
+ # All timeouts are 20 seconds
89
+ timeout=20.0,
90
+ )
91
+
92
+ # Override timeout for a specific method
93
+ client.search(..., {
94
+ timeout_in_seconds=20.0
95
+ })
96
+ ```
97
+
98
+ ### Custom HTTP client
99
+ You can override the httpx client to customize it for your use-case. Some common use-cases
100
+ include support for proxies and transports.
101
+
102
+ ```python
103
+ import httpx
104
+
105
+ from mixpeek.client import Mixpeek
106
+
107
+ client = Mixpeek(
108
+ http_client=httpx.Client(
109
+ proxies="http://my.test.proxy.example.com",
110
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
111
+ ),
112
+ )
113
+ ```
114
+
115
+ ## Beta Status
116
+
117
+ This SDK is in beta, and there may be breaking changes between versions without a major
118
+ version update. Therefore, we recommend pinning the package version to a specific version.
119
+ This way, you can install the same version each time without breaking changes.
120
+
121
+ ## Contributing
122
+
123
+ While we value open-source contributions to this SDK, this library is generated programmatically.
124
+ Additions made directly to this library would have to be moved over to our generation code,
125
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
126
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
127
+ an issue first to discuss with us!
128
+
129
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,33 @@
1
+ [tool.poetry]
2
+ name = "mixpeek"
3
+ version = "0.6.2"
4
+ description = ""
5
+ readme = "README.md"
6
+ authors = []
7
+ packages = [
8
+ { include = "mixpeek", from = "src"}
9
+ ]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.8"
13
+ httpx = ">=0.21.2"
14
+ pydantic = ">= 1.9.2"
15
+ typing_extensions = ">= 4.0.0"
16
+
17
+ [tool.poetry.dev-dependencies]
18
+ mypy = "^1.8.0"
19
+ pytest = "^7.4.0"
20
+ pytest-asyncio = "^0.23.5"
21
+ python-dateutil = "^2.9.0"
22
+
23
+ [tool.pytest.ini_options]
24
+ testpaths = [ "tests" ]
25
+ asyncio_mode = "auto"
26
+
27
+ [tool.mypy]
28
+ plugins = ["pydantic.mypy"]
29
+
30
+
31
+ [build-system]
32
+ requires = ["poetry-core"]
33
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,102 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import (
4
+ ApiKey,
5
+ AudioParams,
6
+ ConfigsResponse,
7
+ Connection,
8
+ ConnectionEngine,
9
+ CsvParams,
10
+ Destination,
11
+ EmbeddingResponse,
12
+ ErrorMessage,
13
+ ErrorResponse,
14
+ FieldType,
15
+ GenerationResponse,
16
+ HtmlParams,
17
+ HttpValidationError,
18
+ ImageParams,
19
+ Message,
20
+ Metadata,
21
+ Modality,
22
+ Model,
23
+ Models,
24
+ PdfParams,
25
+ PptParams,
26
+ PptxParams,
27
+ Settings,
28
+ Source,
29
+ SourceDestinationMapping,
30
+ TxtParams,
31
+ User,
32
+ ValidationError,
33
+ ValidationErrorLocItem,
34
+ VideoParams,
35
+ WorkflowResponse,
36
+ WorkflowSettings,
37
+ XlsxParams,
38
+ )
39
+ from .errors import (
40
+ BadRequestError,
41
+ ForbiddenError,
42
+ InternalServerError,
43
+ NotFoundError,
44
+ UnauthorizedError,
45
+ UnprocessableEntityError,
46
+ )
47
+ from . import embed, extract, generators, parse, pipelines, storage, users, workflows
48
+ from .environment import MixpeekEnvironment
49
+ from .version import __version__
50
+
51
+ __all__ = [
52
+ "ApiKey",
53
+ "AudioParams",
54
+ "BadRequestError",
55
+ "ConfigsResponse",
56
+ "Connection",
57
+ "ConnectionEngine",
58
+ "CsvParams",
59
+ "Destination",
60
+ "EmbeddingResponse",
61
+ "ErrorMessage",
62
+ "ErrorResponse",
63
+ "FieldType",
64
+ "ForbiddenError",
65
+ "GenerationResponse",
66
+ "HtmlParams",
67
+ "HttpValidationError",
68
+ "ImageParams",
69
+ "InternalServerError",
70
+ "Message",
71
+ "Metadata",
72
+ "MixpeekEnvironment",
73
+ "Modality",
74
+ "Model",
75
+ "Models",
76
+ "NotFoundError",
77
+ "PdfParams",
78
+ "PptParams",
79
+ "PptxParams",
80
+ "Settings",
81
+ "Source",
82
+ "SourceDestinationMapping",
83
+ "TxtParams",
84
+ "UnauthorizedError",
85
+ "UnprocessableEntityError",
86
+ "User",
87
+ "ValidationError",
88
+ "ValidationErrorLocItem",
89
+ "VideoParams",
90
+ "WorkflowResponse",
91
+ "WorkflowSettings",
92
+ "XlsxParams",
93
+ "__version__",
94
+ "embed",
95
+ "extract",
96
+ "generators",
97
+ "parse",
98
+ "pipelines",
99
+ "storage",
100
+ "users",
101
+ "workflows",
102
+ ]
@@ -0,0 +1,155 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import os
4
+ import typing
5
+
6
+ import httpx
7
+
8
+ from .core.api_error import ApiError
9
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
+ from .embed.client import AsyncEmbedClient, EmbedClient
11
+ from .environment import MixpeekEnvironment
12
+ from .extract.client import AsyncExtractClient, ExtractClient
13
+ from .generators.client import AsyncGeneratorsClient, GeneratorsClient
14
+ from .parse.client import AsyncParseClient, ParseClient
15
+ from .pipelines.client import AsyncPipelinesClient, PipelinesClient
16
+ from .storage.client import AsyncStorageClient, StorageClient
17
+ from .users.client import AsyncUsersClient, UsersClient
18
+ from .workflows.client import AsyncWorkflowsClient, WorkflowsClient
19
+
20
+
21
+ class BaseMixpeek:
22
+ """
23
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
24
+
25
+ Parameters:
26
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
27
+
28
+ - environment: MixpeekEnvironment. The environment to use for requests from the client. from .environment import MixpeekEnvironment
29
+
30
+ Defaults to MixpeekEnvironment.DEFAULT
31
+
32
+ - authorization: typing.Optional[str].
33
+
34
+ - index_id: typing.Optional[str].
35
+
36
+ - api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
37
+
38
+ - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
39
+
40
+ - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
41
+ ---
42
+ from mixpeek.client import Mixpeek
43
+
44
+ client = Mixpeek(
45
+ authorization="YOUR_AUTHORIZATION",
46
+ index_id="YOUR_INDEX_ID",
47
+ api_key="YOUR_API_KEY",
48
+ )
49
+ """
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ base_url: typing.Optional[str] = None,
55
+ environment: MixpeekEnvironment = MixpeekEnvironment.DEFAULT,
56
+ authorization: typing.Optional[str] = None,
57
+ index_id: typing.Optional[str] = None,
58
+ api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("MIXPEEK_API_KEY"),
59
+ timeout: typing.Optional[float] = None,
60
+ httpx_client: typing.Optional[httpx.Client] = None
61
+ ):
62
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
63
+ if api_key is None:
64
+ raise ApiError(
65
+ body="The client must be instantiated be either passing in api_key or setting MIXPEEK_API_KEY"
66
+ )
67
+ self._client_wrapper = SyncClientWrapper(
68
+ base_url=_get_base_url(base_url=base_url, environment=environment),
69
+ authorization=authorization,
70
+ index_id=index_id,
71
+ api_key=api_key,
72
+ httpx_client=httpx.Client(timeout=_defaulted_timeout) if httpx_client is None else httpx_client,
73
+ timeout=_defaulted_timeout,
74
+ )
75
+ self.users = UsersClient(client_wrapper=self._client_wrapper)
76
+ self.extract = ExtractClient(client_wrapper=self._client_wrapper)
77
+ self.generators = GeneratorsClient(client_wrapper=self._client_wrapper)
78
+ self.embed = EmbedClient(client_wrapper=self._client_wrapper)
79
+ self.pipelines = PipelinesClient(client_wrapper=self._client_wrapper)
80
+ self.workflows = WorkflowsClient(client_wrapper=self._client_wrapper)
81
+ self.storage = StorageClient(client_wrapper=self._client_wrapper)
82
+ self.parse = ParseClient(client_wrapper=self._client_wrapper)
83
+
84
+
85
+ class AsyncBaseMixpeek:
86
+ """
87
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
88
+
89
+ Parameters:
90
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
91
+
92
+ - environment: MixpeekEnvironment. The environment to use for requests from the client. from .environment import MixpeekEnvironment
93
+
94
+ Defaults to MixpeekEnvironment.DEFAULT
95
+
96
+ - authorization: typing.Optional[str].
97
+
98
+ - index_id: typing.Optional[str].
99
+
100
+ - api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
101
+
102
+ - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
103
+
104
+ - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
105
+ ---
106
+ from mixpeek.client import AsyncMixpeek
107
+
108
+ client = AsyncMixpeek(
109
+ authorization="YOUR_AUTHORIZATION",
110
+ index_id="YOUR_INDEX_ID",
111
+ api_key="YOUR_API_KEY",
112
+ )
113
+ """
114
+
115
+ def __init__(
116
+ self,
117
+ *,
118
+ base_url: typing.Optional[str] = None,
119
+ environment: MixpeekEnvironment = MixpeekEnvironment.DEFAULT,
120
+ authorization: typing.Optional[str] = None,
121
+ index_id: typing.Optional[str] = None,
122
+ api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("MIXPEEK_API_KEY"),
123
+ timeout: typing.Optional[float] = None,
124
+ httpx_client: typing.Optional[httpx.AsyncClient] = None
125
+ ):
126
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
127
+ if api_key is None:
128
+ raise ApiError(
129
+ body="The client must be instantiated be either passing in api_key or setting MIXPEEK_API_KEY"
130
+ )
131
+ self._client_wrapper = AsyncClientWrapper(
132
+ base_url=_get_base_url(base_url=base_url, environment=environment),
133
+ authorization=authorization,
134
+ index_id=index_id,
135
+ api_key=api_key,
136
+ httpx_client=httpx.AsyncClient(timeout=_defaulted_timeout) if httpx_client is None else httpx_client,
137
+ timeout=_defaulted_timeout,
138
+ )
139
+ self.users = AsyncUsersClient(client_wrapper=self._client_wrapper)
140
+ self.extract = AsyncExtractClient(client_wrapper=self._client_wrapper)
141
+ self.generators = AsyncGeneratorsClient(client_wrapper=self._client_wrapper)
142
+ self.embed = AsyncEmbedClient(client_wrapper=self._client_wrapper)
143
+ self.pipelines = AsyncPipelinesClient(client_wrapper=self._client_wrapper)
144
+ self.workflows = AsyncWorkflowsClient(client_wrapper=self._client_wrapper)
145
+ self.storage = AsyncStorageClient(client_wrapper=self._client_wrapper)
146
+ self.parse = AsyncParseClient(client_wrapper=self._client_wrapper)
147
+
148
+
149
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: MixpeekEnvironment) -> str:
150
+ if base_url is not None:
151
+ return base_url
152
+ elif environment is not None:
153
+ return environment.value
154
+ else:
155
+ raise Exception("Please pass in either base_url or environment to construct the client")
@@ -0,0 +1,65 @@
1
+
2
+ import typing
3
+ import httpx
4
+
5
+ from .base_client import BaseMixpeek, \
6
+ AsyncBaseMixpeek
7
+ from .types.message import Message
8
+ from .types.model import Model
9
+ from .types.settings import Settings
10
+ from .types.generation_response import GenerationResponse
11
+ from .core.request_options import RequestOptions
12
+
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class Mixpeek(BaseMixpeek):
19
+
20
+ def generate(
21
+ self,
22
+ *,
23
+ model: Model,
24
+ # Pydantic model that represents the JSON schema of the response
25
+ response_format: typing.Optional[typing.Any],
26
+ context: typing.Optional[str] = OMIT,
27
+ messages: typing.Sequence[Message],
28
+ settings: typing.Optional[Settings] = OMIT,
29
+ request_options: typing.Optional[RequestOptions] = None,
30
+ ) -> GenerationResponse:
31
+ if response_format is not None:
32
+ response_format = response_format.model_json_schema()
33
+ return self.generators.generate(
34
+ model=model,
35
+ response_format=response_format,
36
+ context=context,
37
+ messages=messages,
38
+ settings=settings,
39
+ request_options=request_options,
40
+ )
41
+
42
+
43
+ class AsyncMixpeek(AsyncBaseMixpeek):
44
+
45
+ async def generate(
46
+ self,
47
+ *,
48
+ model: Model,
49
+ # Pydantic model that represents the JSON schema of the response
50
+ response_format: typing.Optional[typing.Any],
51
+ context: typing.Optional[str] = OMIT,
52
+ messages: typing.Sequence[Message],
53
+ settings: typing.Optional[Settings] = OMIT,
54
+ request_options: typing.Optional[RequestOptions] = None,
55
+ ) -> GenerationResponse:
56
+ if response_format is not None:
57
+ response_format = response_format.model_json_schema()
58
+ return await self.generators.generate(
59
+ model=model,
60
+ response_format=response_format,
61
+ context=context,
62
+ messages=messages,
63
+ settings=settings,
64
+ request_options=request_options,
65
+ )
@@ -0,0 +1,25 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .api_error import ApiError
4
+ from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
5
+ from .datetime_utils import serialize_datetime
6
+ from .file import File, convert_file_dict_to_httpx_tuples
7
+ from .http_client import AsyncHttpClient, HttpClient
8
+ from .jsonable_encoder import jsonable_encoder
9
+ from .remove_none_from_dict import remove_none_from_dict
10
+ from .request_options import RequestOptions
11
+
12
+ __all__ = [
13
+ "ApiError",
14
+ "AsyncClientWrapper",
15
+ "AsyncHttpClient",
16
+ "BaseClientWrapper",
17
+ "File",
18
+ "HttpClient",
19
+ "RequestOptions",
20
+ "SyncClientWrapper",
21
+ "convert_file_dict_to_httpx_tuples",
22
+ "jsonable_encoder",
23
+ "remove_none_from_dict",
24
+ "serialize_datetime",
25
+ ]
@@ -0,0 +1,15 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+
6
+ class ApiError(Exception):
7
+ status_code: typing.Optional[int]
8
+ body: typing.Any
9
+
10
+ def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None):
11
+ self.status_code = status_code
12
+ self.body = body
13
+
14
+ def __str__(self) -> str:
15
+ return f"status_code: {self.status_code}, body: {self.body}"