mixpeek 0.6.8__tar.gz → 0.6.17__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 (94) hide show
  1. mixpeek-0.6.17/MANIFEST.in +1 -0
  2. mixpeek-0.6.17/PKG-INFO +68 -0
  3. mixpeek-0.6.17/README.md +55 -0
  4. mixpeek-0.6.17/mixpeek/__init__.py +1 -0
  5. mixpeek-0.6.17/mixpeek/client.py +21 -0
  6. mixpeek-0.6.17/mixpeek/endpoints/connections.py +16 -0
  7. mixpeek-0.6.17/mixpeek/endpoints/embed.py +50 -0
  8. mixpeek-0.6.17/mixpeek/endpoints/extract.py +16 -0
  9. mixpeek-0.6.17/mixpeek/endpoints/generate.py +17 -0
  10. mixpeek-0.6.17/mixpeek/endpoints/tools.py +23 -0
  11. mixpeek-0.6.17/mixpeek/exceptions.py +13 -0
  12. mixpeek-0.6.17/mixpeek.egg-info/PKG-INFO +68 -0
  13. mixpeek-0.6.17/mixpeek.egg-info/SOURCES.txt +17 -0
  14. mixpeek-0.6.17/mixpeek.egg-info/dependency_links.txt +1 -0
  15. mixpeek-0.6.17/mixpeek.egg-info/top_level.txt +1 -0
  16. mixpeek-0.6.17/requirements.txt +2 -0
  17. mixpeek-0.6.17/setup.cfg +4 -0
  18. mixpeek-0.6.17/setup.py +19 -0
  19. mixpeek-0.6.8/LICENSE +0 -21
  20. mixpeek-0.6.8/PKG-INFO +0 -145
  21. mixpeek-0.6.8/README.md +0 -129
  22. mixpeek-0.6.8/pyproject.toml +0 -33
  23. mixpeek-0.6.8/src/mixpeek/__init__.py +0 -106
  24. mixpeek-0.6.8/src/mixpeek/base_client.py +0 -1015
  25. mixpeek-0.6.8/src/mixpeek/client.py +0 -65
  26. mixpeek-0.6.8/src/mixpeek/core/__init__.py +0 -27
  27. mixpeek-0.6.8/src/mixpeek/core/api_error.py +0 -15
  28. mixpeek-0.6.8/src/mixpeek/core/client_wrapper.py +0 -83
  29. mixpeek-0.6.8/src/mixpeek/core/datetime_utils.py +0 -28
  30. mixpeek-0.6.8/src/mixpeek/core/file.py +0 -38
  31. mixpeek-0.6.8/src/mixpeek/core/http_client.py +0 -130
  32. mixpeek-0.6.8/src/mixpeek/core/jsonable_encoder.py +0 -99
  33. mixpeek-0.6.8/src/mixpeek/core/pydantic_utilities.py +0 -12
  34. mixpeek-0.6.8/src/mixpeek/core/remove_none_from_dict.py +0 -11
  35. mixpeek-0.6.8/src/mixpeek/core/request_options.py +0 -32
  36. mixpeek-0.6.8/src/mixpeek/environment.py +0 -7
  37. mixpeek-0.6.8/src/mixpeek/errors/__init__.py +0 -17
  38. mixpeek-0.6.8/src/mixpeek/errors/bad_request_error.py +0 -9
  39. mixpeek-0.6.8/src/mixpeek/errors/forbidden_error.py +0 -9
  40. mixpeek-0.6.8/src/mixpeek/errors/internal_server_error.py +0 -9
  41. mixpeek-0.6.8/src/mixpeek/errors/not_found_error.py +0 -9
  42. mixpeek-0.6.8/src/mixpeek/errors/unauthorized_error.py +0 -9
  43. mixpeek-0.6.8/src/mixpeek/errors/unprocessable_entity_error.py +0 -9
  44. mixpeek-0.6.8/src/mixpeek/pipeline/__init__.py +0 -2
  45. mixpeek-0.6.8/src/mixpeek/pipeline/client.py +0 -482
  46. mixpeek-0.6.8/src/mixpeek/storage/__init__.py +0 -5
  47. mixpeek-0.6.8/src/mixpeek/storage/client.py +0 -145
  48. mixpeek-0.6.8/src/mixpeek/storage/sample/__init__.py +0 -2
  49. mixpeek-0.6.8/src/mixpeek/storage/sample/client.py +0 -286
  50. mixpeek-0.6.8/src/mixpeek/types/__init__.py +0 -81
  51. mixpeek-0.6.8/src/mixpeek/types/api_key.py +0 -27
  52. mixpeek-0.6.8/src/mixpeek/types/audio_params.py +0 -25
  53. mixpeek-0.6.8/src/mixpeek/types/configs_response.py +0 -38
  54. mixpeek-0.6.8/src/mixpeek/types/connection.py +0 -32
  55. mixpeek-0.6.8/src/mixpeek/types/connection_engine.py +0 -5
  56. mixpeek-0.6.8/src/mixpeek/types/csv_params.py +0 -25
  57. mixpeek-0.6.8/src/mixpeek/types/destination.py +0 -38
  58. mixpeek-0.6.8/src/mixpeek/types/embedding_response.py +0 -30
  59. mixpeek-0.6.8/src/mixpeek/types/error_message.py +0 -25
  60. mixpeek-0.6.8/src/mixpeek/types/error_response.py +0 -26
  61. mixpeek-0.6.8/src/mixpeek/types/extract_response.py +0 -31
  62. mixpeek-0.6.8/src/mixpeek/types/field_type.py +0 -5
  63. mixpeek-0.6.8/src/mixpeek/types/generation_response.py +0 -32
  64. mixpeek-0.6.8/src/mixpeek/types/html_params.py +0 -25
  65. mixpeek-0.6.8/src/mixpeek/types/http_validation_error.py +0 -26
  66. mixpeek-0.6.8/src/mixpeek/types/image_params.py +0 -28
  67. mixpeek-0.6.8/src/mixpeek/types/message.py +0 -33
  68. mixpeek-0.6.8/src/mixpeek/types/metadata.py +0 -28
  69. mixpeek-0.6.8/src/mixpeek/types/modality.py +0 -5
  70. mixpeek-0.6.8/src/mixpeek/types/model.py +0 -34
  71. mixpeek-0.6.8/src/mixpeek/types/models.py +0 -5
  72. mixpeek-0.6.8/src/mixpeek/types/pdf_params.py +0 -37
  73. mixpeek-0.6.8/src/mixpeek/types/pipeline_response.py +0 -45
  74. mixpeek-0.6.8/src/mixpeek/types/pipeline_task_response.py +0 -28
  75. mixpeek-0.6.8/src/mixpeek/types/ppt_params.py +0 -23
  76. mixpeek-0.6.8/src/mixpeek/types/pptx_params.py +0 -23
  77. mixpeek-0.6.8/src/mixpeek/types/settings.py +0 -31
  78. mixpeek-0.6.8/src/mixpeek/types/source.py +0 -39
  79. mixpeek-0.6.8/src/mixpeek/types/source_destination_mapping.py +0 -40
  80. mixpeek-0.6.8/src/mixpeek/types/txt_params.py +0 -23
  81. mixpeek-0.6.8/src/mixpeek/types/user.py +0 -32
  82. mixpeek-0.6.8/src/mixpeek/types/validation_error.py +0 -28
  83. mixpeek-0.6.8/src/mixpeek/types/validation_error_loc_item.py +0 -5
  84. mixpeek-0.6.8/src/mixpeek/types/video_params.py +0 -23
  85. mixpeek-0.6.8/src/mixpeek/types/workflow_code_response.py +0 -25
  86. mixpeek-0.6.8/src/mixpeek/types/workflow_response.py +0 -28
  87. mixpeek-0.6.8/src/mixpeek/types/workflow_settings.py +0 -26
  88. mixpeek-0.6.8/src/mixpeek/types/xlsx_params.py +0 -25
  89. mixpeek-0.6.8/src/mixpeek/user/__init__.py +0 -2
  90. mixpeek-0.6.8/src/mixpeek/user/client.py +0 -312
  91. mixpeek-0.6.8/src/mixpeek/version.py +0 -4
  92. mixpeek-0.6.8/src/mixpeek/workflow/__init__.py +0 -2
  93. mixpeek-0.6.8/src/mixpeek/workflow/client.py +0 -543
  94. /mixpeek-0.6.8/src/mixpeek/py.typed → /mixpeek-0.6.17/mixpeek/endpoints/__init__.py +0 -0
@@ -0,0 +1 @@
1
+ include requirements.txt
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: mixpeek
3
+ Version: 0.6.17
4
+ Summary: Mixpeek Python SDK
5
+ Home-page: https://github.com/mixpeek/mixpeek-python
6
+ Author: Ethan Steininger
7
+ Author-email: ethan@mixpeek.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Mixpeek SDK
15
+
16
+ A Python SDK for the Mixpeek API.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install mixpeek
22
+ ```
23
+
24
+ ```python
25
+ from mixpeek import Mixpeek
26
+ from pydantic import BaseModel
27
+
28
+ mixpeek = Mixpeek("YOUR_API_KEY")
29
+
30
+ # Example usage
31
+ extraction = mixpeek.extract.text(
32
+ input="s3://document.pdf",
33
+ input_type="url"
34
+ )
35
+
36
+ embedding = mixpeek.embed.video(
37
+ model="mixpeek/vuse-generic-v1",
38
+ input="s3://waving_boy.mp4",
39
+ input_type="url"
40
+ )
41
+
42
+ class ResponseFormat(BaseModel):
43
+ city: int
44
+ weather: float
45
+
46
+ generated_content = mixpeek.generate.text(
47
+ response_format=ResponseFormat,
48
+ context="Please tell me the weather and make sure to respond in the provided JSON schema"
49
+ )
50
+
51
+ mixpeek.connections.create(
52
+ alias="my-mongo-test",
53
+ engine="mongodb",
54
+ details={
55
+ "host": "your_host_address",
56
+ "database": "your_database_name",
57
+ "username": "your_username",
58
+ "password": "your_password"
59
+ }
60
+ )
61
+
62
+ response = mixpeek.tools.video.process(
63
+ url="https://s3/video.mp4",
64
+ frame_interval=5,
65
+ resolution=[720, 1280],
66
+ return_base64=True
67
+ )
68
+ ```
@@ -0,0 +1,55 @@
1
+ # Mixpeek SDK
2
+
3
+ A Python SDK for the Mixpeek API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install mixpeek
9
+ ```
10
+
11
+ ```python
12
+ from mixpeek import Mixpeek
13
+ from pydantic import BaseModel
14
+
15
+ mixpeek = Mixpeek("YOUR_API_KEY")
16
+
17
+ # Example usage
18
+ extraction = mixpeek.extract.text(
19
+ input="s3://document.pdf",
20
+ input_type="url"
21
+ )
22
+
23
+ embedding = mixpeek.embed.video(
24
+ model="mixpeek/vuse-generic-v1",
25
+ input="s3://waving_boy.mp4",
26
+ input_type="url"
27
+ )
28
+
29
+ class ResponseFormat(BaseModel):
30
+ city: int
31
+ weather: float
32
+
33
+ generated_content = mixpeek.generate.text(
34
+ response_format=ResponseFormat,
35
+ context="Please tell me the weather and make sure to respond in the provided JSON schema"
36
+ )
37
+
38
+ mixpeek.connections.create(
39
+ alias="my-mongo-test",
40
+ engine="mongodb",
41
+ details={
42
+ "host": "your_host_address",
43
+ "database": "your_database_name",
44
+ "username": "your_username",
45
+ "password": "your_password"
46
+ }
47
+ )
48
+
49
+ response = mixpeek.tools.video.process(
50
+ url="https://s3/video.mp4",
51
+ frame_interval=5,
52
+ resolution=[720, 1280],
53
+ return_base64=True
54
+ )
55
+ ```
@@ -0,0 +1 @@
1
+ from .client import Mixpeek
@@ -0,0 +1,21 @@
1
+ import requests
2
+
3
+ from .endpoints.extract import Extract
4
+ from .endpoints.embed import Embed
5
+ from .endpoints.generate import Generate
6
+ from .endpoints.connections import Connections
7
+ from .endpoints.tools import Tools
8
+
9
+ class Mixpeek:
10
+ def __init__(self, api_key: str):
11
+ self.api_key = api_key
12
+ self.base_url = "https://api.mixpeek.com/"
13
+ self.headers = {
14
+ "Authorization": f"Bearer {self.api_key}",
15
+ "Content-Type": "application/json"
16
+ }
17
+ self.extract = Extract(self.base_url, self.headers)
18
+ self.embed = Embed(self.base_url, self.headers)
19
+ self.generate = Generate(self.base_url, self.headers)
20
+ self.connections = Connections(self.base_url, self.headers)
21
+ self.tools = Tools(self.base_url, self.headers)
@@ -0,0 +1,16 @@
1
+ import requests
2
+
3
+ class Connections:
4
+ def __init__(self, base_url, headers):
5
+ self.base_url = base_url
6
+ self.headers = headers
7
+
8
+ def create(self, alias: str, engine: str, details: dict):
9
+ url = f"{self.base_url}connections/"
10
+ data = {
11
+ "alias": alias,
12
+ "engine": engine,
13
+ "details": details
14
+ }
15
+ response = requests.post(url, json=data, headers=self.headers)
16
+ return response.json()
@@ -0,0 +1,50 @@
1
+ import requests
2
+
3
+ class Embed:
4
+ def __init__(self, base_url, headers):
5
+ self.base_url = base_url
6
+ self.headers = headers
7
+
8
+ def video(self, model: str, input: str, input_type: str):
9
+ url = f"{self.base_url}embed/"
10
+ data = {
11
+ "modality": "video",
12
+ "model": model,
13
+ "input": input,
14
+ "input_type": input_type
15
+ }
16
+ response = requests.post(url, json=data, headers=self.headers)
17
+ return response.json()
18
+
19
+ def text(self, model: str, input: str, input_type: str):
20
+ url = f"{self.base_url}embed/"
21
+ data = {
22
+ "modality": "text",
23
+ "model": model,
24
+ "input": input,
25
+ "input_type": input_type
26
+ }
27
+ response = requests.post(url, json=data, headers=self.headers)
28
+ return response.json()
29
+
30
+ def image(self, model: str, input: str, input_type: str):
31
+ url = f"{self.base_url}embed/"
32
+ data = {
33
+ "modality": "image",
34
+ "model": model,
35
+ "input": input,
36
+ "input_type": input_type
37
+ }
38
+ response = requests.post(url, json=data, headers=self.headers)
39
+ return response.json()
40
+
41
+ def audio(self, model: str, input: str, input_type: str):
42
+ url = f"{self.base_url}embed/"
43
+ data = {
44
+ "modality": "audio",
45
+ "model": model,
46
+ "input": input,
47
+ "input_type": input_type
48
+ }
49
+ response = requests.post(url, json=data, headers=self.headers)
50
+ return response.json()
@@ -0,0 +1,16 @@
1
+ import requests
2
+
3
+ class Extract:
4
+ def __init__(self, base_url, headers):
5
+ self.base_url = base_url
6
+ self.headers = headers
7
+
8
+ def extract(self, modality: str, input: str, input_type: str):
9
+ url = f"{self.base_url}extract/"
10
+ data = {
11
+ "modality": modality,
12
+ "input": input,
13
+ "input_type": input_type
14
+ }
15
+ response = requests.post(url, json=data, headers=self.headers)
16
+ return response.json()
@@ -0,0 +1,17 @@
1
+ import requests
2
+ from pydantic import BaseModel
3
+
4
+ class Generate:
5
+ def __init__(self, base_url, headers):
6
+ self.base_url = base_url
7
+ self.headers = headers
8
+
9
+ def generate(self, response_format: BaseModel, context: str):
10
+ url = f"{self.base_url}generate/text"
11
+ data = {
12
+ "response_format": response_format.model_json_schema(),
13
+ "context": context
14
+ }
15
+ response = requests.post(url, json=data, headers=self.headers)
16
+ return response.json()
17
+
@@ -0,0 +1,23 @@
1
+ import requests
2
+
3
+ class Tools:
4
+ def __init__(self, base_url, headers):
5
+ self.base_url = base_url
6
+ self.headers = headers
7
+ self.video = self.Video(self)
8
+
9
+ class Video:
10
+ def __init__(self, parent):
11
+ self.base_url = parent.base_url
12
+ self.headers = parent.headers
13
+
14
+ def process(self, url: str, frame_interval: int, resolution: list, return_base64: bool):
15
+ endpoint = f"{self.base_url}tools/video/process"
16
+ data = {
17
+ "url": url,
18
+ "frame_interval": frame_interval,
19
+ "resolution": resolution,
20
+ "use_base64": return_base64
21
+ }
22
+ response = requests.post(endpoint, json=data, headers=self.headers)
23
+ return response.json()
@@ -0,0 +1,13 @@
1
+ class MixpeekException(Exception):
2
+ pass
3
+
4
+ class AuthenticationError(MixpeekException):
5
+ pass
6
+
7
+ class BadRequestError(MixpeekException):
8
+ pass
9
+
10
+ class NotFoundError(MixpeekException):
11
+ pass
12
+
13
+ # Define more exceptions as needed
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: mixpeek
3
+ Version: 0.6.17
4
+ Summary: Mixpeek Python SDK
5
+ Home-page: https://github.com/mixpeek/mixpeek-python
6
+ Author: Ethan Steininger
7
+ Author-email: ethan@mixpeek.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Mixpeek SDK
15
+
16
+ A Python SDK for the Mixpeek API.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install mixpeek
22
+ ```
23
+
24
+ ```python
25
+ from mixpeek import Mixpeek
26
+ from pydantic import BaseModel
27
+
28
+ mixpeek = Mixpeek("YOUR_API_KEY")
29
+
30
+ # Example usage
31
+ extraction = mixpeek.extract.text(
32
+ input="s3://document.pdf",
33
+ input_type="url"
34
+ )
35
+
36
+ embedding = mixpeek.embed.video(
37
+ model="mixpeek/vuse-generic-v1",
38
+ input="s3://waving_boy.mp4",
39
+ input_type="url"
40
+ )
41
+
42
+ class ResponseFormat(BaseModel):
43
+ city: int
44
+ weather: float
45
+
46
+ generated_content = mixpeek.generate.text(
47
+ response_format=ResponseFormat,
48
+ context="Please tell me the weather and make sure to respond in the provided JSON schema"
49
+ )
50
+
51
+ mixpeek.connections.create(
52
+ alias="my-mongo-test",
53
+ engine="mongodb",
54
+ details={
55
+ "host": "your_host_address",
56
+ "database": "your_database_name",
57
+ "username": "your_username",
58
+ "password": "your_password"
59
+ }
60
+ )
61
+
62
+ response = mixpeek.tools.video.process(
63
+ url="https://s3/video.mp4",
64
+ frame_interval=5,
65
+ resolution=[720, 1280],
66
+ return_base64=True
67
+ )
68
+ ```
@@ -0,0 +1,17 @@
1
+ MANIFEST.in
2
+ README.md
3
+ requirements.txt
4
+ setup.py
5
+ mixpeek/__init__.py
6
+ mixpeek/client.py
7
+ mixpeek/exceptions.py
8
+ mixpeek.egg-info/PKG-INFO
9
+ mixpeek.egg-info/SOURCES.txt
10
+ mixpeek.egg-info/dependency_links.txt
11
+ mixpeek.egg-info/top_level.txt
12
+ mixpeek/endpoints/__init__.py
13
+ mixpeek/endpoints/connections.py
14
+ mixpeek/endpoints/embed.py
15
+ mixpeek/endpoints/extract.py
16
+ mixpeek/endpoints/generate.py
17
+ mixpeek/endpoints/tools.py
@@ -0,0 +1 @@
1
+ mixpeek
@@ -0,0 +1,2 @@
1
+ requests==2.32.3
2
+ pydantic==2.7.3
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='mixpeek',
5
+ version='0.6.17',
6
+ author='Ethan Steininger',
7
+ author_email='ethan@mixpeek.com',
8
+ description='Mixpeek Python SDK',
9
+ long_description=open('README.md').read(),
10
+ long_description_content_type='text/markdown',
11
+ url='https://github.com/mixpeek/mixpeek-python',
12
+ packages=find_packages(),
13
+ classifiers=[
14
+ 'Programming Language :: Python :: 3',
15
+ 'License :: OSI Approved :: MIT License',
16
+ 'Operating System :: OS Independent',
17
+ ],
18
+ python_requires='>=3.6',
19
+ )
mixpeek-0.6.8/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Mixpeek.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
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
13
- copies or substantial portions of the Software.
14
-
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.8/PKG-INFO DELETED
@@ -1,145 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: mixpeek
3
- Version: 0.6.8
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
-