mixpeek 0.6.8__py3-none-any.whl → 0.6.9__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.
- mixpeek/__init__.py +1 -106
- mixpeek/client.py +21 -65
- mixpeek/endpoints/connections.py +16 -0
- mixpeek/endpoints/embed.py +50 -0
- mixpeek/endpoints/extract.py +16 -0
- mixpeek/endpoints/generate.py +17 -0
- mixpeek/endpoints/tools.py +23 -0
- mixpeek/exceptions.py +13 -0
- mixpeek-0.6.9.dist-info/METADATA +68 -0
- mixpeek-0.6.9.dist-info/RECORD +13 -0
- {mixpeek-0.6.8.dist-info → mixpeek-0.6.9.dist-info}/WHEEL +2 -1
- mixpeek-0.6.9.dist-info/top_level.txt +1 -0
- mixpeek/base_client.py +0 -1015
- mixpeek/core/__init__.py +0 -27
- mixpeek/core/api_error.py +0 -15
- mixpeek/core/client_wrapper.py +0 -83
- mixpeek/core/datetime_utils.py +0 -28
- mixpeek/core/file.py +0 -38
- mixpeek/core/http_client.py +0 -130
- mixpeek/core/jsonable_encoder.py +0 -99
- mixpeek/core/pydantic_utilities.py +0 -12
- mixpeek/core/remove_none_from_dict.py +0 -11
- mixpeek/core/request_options.py +0 -32
- mixpeek/environment.py +0 -7
- mixpeek/errors/__init__.py +0 -17
- mixpeek/errors/bad_request_error.py +0 -9
- mixpeek/errors/forbidden_error.py +0 -9
- mixpeek/errors/internal_server_error.py +0 -9
- mixpeek/errors/not_found_error.py +0 -9
- mixpeek/errors/unauthorized_error.py +0 -9
- mixpeek/errors/unprocessable_entity_error.py +0 -9
- mixpeek/pipeline/__init__.py +0 -2
- mixpeek/pipeline/client.py +0 -482
- mixpeek/storage/__init__.py +0 -5
- mixpeek/storage/client.py +0 -145
- mixpeek/storage/sample/__init__.py +0 -2
- mixpeek/storage/sample/client.py +0 -286
- mixpeek/types/__init__.py +0 -81
- mixpeek/types/api_key.py +0 -27
- mixpeek/types/audio_params.py +0 -25
- mixpeek/types/configs_response.py +0 -38
- mixpeek/types/connection.py +0 -32
- mixpeek/types/connection_engine.py +0 -5
- mixpeek/types/csv_params.py +0 -25
- mixpeek/types/destination.py +0 -38
- mixpeek/types/embedding_response.py +0 -30
- mixpeek/types/error_message.py +0 -25
- mixpeek/types/error_response.py +0 -26
- mixpeek/types/extract_response.py +0 -31
- mixpeek/types/field_type.py +0 -5
- mixpeek/types/generation_response.py +0 -32
- mixpeek/types/html_params.py +0 -25
- mixpeek/types/http_validation_error.py +0 -26
- mixpeek/types/image_params.py +0 -28
- mixpeek/types/message.py +0 -33
- mixpeek/types/metadata.py +0 -28
- mixpeek/types/modality.py +0 -5
- mixpeek/types/model.py +0 -34
- mixpeek/types/models.py +0 -5
- mixpeek/types/pdf_params.py +0 -37
- mixpeek/types/pipeline_response.py +0 -45
- mixpeek/types/pipeline_task_response.py +0 -28
- mixpeek/types/ppt_params.py +0 -23
- mixpeek/types/pptx_params.py +0 -23
- mixpeek/types/settings.py +0 -31
- mixpeek/types/source.py +0 -39
- mixpeek/types/source_destination_mapping.py +0 -40
- mixpeek/types/txt_params.py +0 -23
- mixpeek/types/user.py +0 -32
- mixpeek/types/validation_error.py +0 -28
- mixpeek/types/validation_error_loc_item.py +0 -5
- mixpeek/types/video_params.py +0 -23
- mixpeek/types/workflow_code_response.py +0 -25
- mixpeek/types/workflow_response.py +0 -28
- mixpeek/types/workflow_settings.py +0 -26
- mixpeek/types/xlsx_params.py +0 -25
- mixpeek/user/__init__.py +0 -2
- mixpeek/user/client.py +0 -312
- mixpeek/version.py +0 -4
- mixpeek/workflow/__init__.py +0 -2
- mixpeek/workflow/client.py +0 -543
- mixpeek-0.6.8.dist-info/LICENSE +0 -21
- mixpeek-0.6.8.dist-info/METADATA +0 -145
- mixpeek-0.6.8.dist-info/RECORD +0 -76
- /mixpeek/{py.typed → endpoints/__init__.py} +0 -0
mixpeek/__init__.py
CHANGED
@@ -1,106 +1 @@
|
|
1
|
-
|
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
|
-
ExtractResponse,
|
15
|
-
FieldType,
|
16
|
-
GenerationResponse,
|
17
|
-
HtmlParams,
|
18
|
-
HttpValidationError,
|
19
|
-
ImageParams,
|
20
|
-
Message,
|
21
|
-
Metadata,
|
22
|
-
Modality,
|
23
|
-
Model,
|
24
|
-
Models,
|
25
|
-
PdfParams,
|
26
|
-
PipelineResponse,
|
27
|
-
PipelineTaskResponse,
|
28
|
-
PptParams,
|
29
|
-
PptxParams,
|
30
|
-
Settings,
|
31
|
-
Source,
|
32
|
-
SourceDestinationMapping,
|
33
|
-
TxtParams,
|
34
|
-
User,
|
35
|
-
ValidationError,
|
36
|
-
ValidationErrorLocItem,
|
37
|
-
VideoParams,
|
38
|
-
WorkflowCodeResponse,
|
39
|
-
WorkflowResponse,
|
40
|
-
WorkflowSettings,
|
41
|
-
XlsxParams,
|
42
|
-
)
|
43
|
-
from .errors import (
|
44
|
-
BadRequestError,
|
45
|
-
ForbiddenError,
|
46
|
-
InternalServerError,
|
47
|
-
NotFoundError,
|
48
|
-
UnauthorizedError,
|
49
|
-
UnprocessableEntityError,
|
50
|
-
)
|
51
|
-
from . import pipeline, storage, user, workflow
|
52
|
-
from .environment import MixpeekEnvironment
|
53
|
-
from .version import __version__
|
54
|
-
|
55
|
-
__all__ = [
|
56
|
-
"ApiKey",
|
57
|
-
"AudioParams",
|
58
|
-
"BadRequestError",
|
59
|
-
"ConfigsResponse",
|
60
|
-
"Connection",
|
61
|
-
"ConnectionEngine",
|
62
|
-
"CsvParams",
|
63
|
-
"Destination",
|
64
|
-
"EmbeddingResponse",
|
65
|
-
"ErrorMessage",
|
66
|
-
"ErrorResponse",
|
67
|
-
"ExtractResponse",
|
68
|
-
"FieldType",
|
69
|
-
"ForbiddenError",
|
70
|
-
"GenerationResponse",
|
71
|
-
"HtmlParams",
|
72
|
-
"HttpValidationError",
|
73
|
-
"ImageParams",
|
74
|
-
"InternalServerError",
|
75
|
-
"Message",
|
76
|
-
"Metadata",
|
77
|
-
"MixpeekEnvironment",
|
78
|
-
"Modality",
|
79
|
-
"Model",
|
80
|
-
"Models",
|
81
|
-
"NotFoundError",
|
82
|
-
"PdfParams",
|
83
|
-
"PipelineResponse",
|
84
|
-
"PipelineTaskResponse",
|
85
|
-
"PptParams",
|
86
|
-
"PptxParams",
|
87
|
-
"Settings",
|
88
|
-
"Source",
|
89
|
-
"SourceDestinationMapping",
|
90
|
-
"TxtParams",
|
91
|
-
"UnauthorizedError",
|
92
|
-
"UnprocessableEntityError",
|
93
|
-
"User",
|
94
|
-
"ValidationError",
|
95
|
-
"ValidationErrorLocItem",
|
96
|
-
"VideoParams",
|
97
|
-
"WorkflowCodeResponse",
|
98
|
-
"WorkflowResponse",
|
99
|
-
"WorkflowSettings",
|
100
|
-
"XlsxParams",
|
101
|
-
"__version__",
|
102
|
-
"pipeline",
|
103
|
-
"storage",
|
104
|
-
"user",
|
105
|
-
"workflow",
|
106
|
-
]
|
1
|
+
from .client import Mixpeek
|
mixpeek/client.py
CHANGED
@@ -1,65 +1,21 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
4
|
-
from .
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from .
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
self,
|
20
|
-
|
21
|
-
|
22
|
-
# Pydantic model that represents the JSON schema of the response
|
23
|
-
response_format: typing.Optional[typing.Any],
|
24
|
-
context: typing.Optional[str] = OMIT,
|
25
|
-
messages: typing.Sequence[Message],
|
26
|
-
settings: typing.Optional[Settings] = OMIT,
|
27
|
-
request_options: typing.Optional[RequestOptions] = None,
|
28
|
-
) -> GenerationResponse:
|
29
|
-
if response_format is not None:
|
30
|
-
response_format = response_format.model_json_schema()
|
31
|
-
|
32
|
-
return self.base_generate(
|
33
|
-
model=model,
|
34
|
-
response_format=response_format,
|
35
|
-
context=context,
|
36
|
-
messages=messages,
|
37
|
-
settings=settings,
|
38
|
-
request_options=request_options,
|
39
|
-
)
|
40
|
-
|
41
|
-
|
42
|
-
class AsyncMixpeek(AsyncBaseMixpeek):
|
43
|
-
|
44
|
-
async def generate(
|
45
|
-
self,
|
46
|
-
*,
|
47
|
-
model: Model,
|
48
|
-
# Pydantic model that represents the JSON schema of the response
|
49
|
-
response_format: typing.Optional[typing.Any],
|
50
|
-
context: typing.Optional[str] = OMIT,
|
51
|
-
messages: typing.Sequence[Message],
|
52
|
-
settings: typing.Optional[Settings] = OMIT,
|
53
|
-
request_options: typing.Optional[RequestOptions] = None,
|
54
|
-
) -> GenerationResponse:
|
55
|
-
if response_format is not None:
|
56
|
-
response_format = response_format.model_json_schema()
|
57
|
-
|
58
|
-
return await self.base_generate(
|
59
|
-
model=model,
|
60
|
-
response_format=response_format,
|
61
|
-
context=context,
|
62
|
-
messages=messages,
|
63
|
-
settings=settings,
|
64
|
-
request_options=request_options,
|
65
|
-
)
|
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_connection(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()
|
mixpeek/exceptions.py
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: mixpeek
|
3
|
+
Version: 0.6.9
|
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.create_connection(
|
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,13 @@
|
|
1
|
+
mixpeek/__init__.py,sha256=XDdcK7wTEOEcF1cp-GeWmgPJ21Ny1R9pB0PPNrdDTMo,28
|
2
|
+
mixpeek/client.py,sha256=h-YSg18sjAoKgZFMMlRJGkuanpa7zQ5K0JPMhJP0aDg,789
|
3
|
+
mixpeek/exceptions.py,sha256=Orhdo5UFLn3fcWVJtlgkznW8Iy5ndL96h0qTY8zOlDA,235
|
4
|
+
mixpeek/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
mixpeek/endpoints/connections.py,sha256=N7Zr97lI68HOanvB8OkVRjQhecNXfNPdnvonCnPvxj4,480
|
6
|
+
mixpeek/endpoints/embed.py,sha256=D_xOYllx4cdPZZVXejRYhfvPOyJylum5aJ5gki-lbVQ,1562
|
7
|
+
mixpeek/endpoints/extract.py,sha256=1KWxvgbQanRwYcFPWGthyv32LVj2gAhxDERwY3QgHUg,476
|
8
|
+
mixpeek/endpoints/generate.py,sha256=TAJ79KCchwHYQBWZSnOZBFeXprXBZqAb2mNrQrT8VWM,513
|
9
|
+
mixpeek/endpoints/tools.py,sha256=Yw6mvBqbrREY79l_BM6ek_CjxDPbFUdkmZqiaZcYSe8,787
|
10
|
+
mixpeek-0.6.9.dist-info/METADATA,sha256=48gx6ElLMusQYUiLguxXyv_4kN0zYSM6sghtFRT9DCE,1482
|
11
|
+
mixpeek-0.6.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
12
|
+
mixpeek-0.6.9.dist-info/top_level.txt,sha256=EJ8Jc4IhqyUwnUlBwKbs498Ju4O9a-IDh2kXc_lo6Vg,8
|
13
|
+
mixpeek-0.6.9.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
mixpeek
|