mapleflow 0.8.1__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.
- mapleflow-0.8.1/.gitignore +5 -0
- mapleflow-0.8.1/PKG-INFO +54 -0
- mapleflow-0.8.1/README.md +30 -0
- mapleflow-0.8.1/config.yml +2 -0
- mapleflow-0.8.1/mapleflow/__init__.py +8 -0
- mapleflow-0.8.1/mapleflow/api/__init__.py +1 -0
- mapleflow-0.8.1/mapleflow/api/ai/__init__.py +1 -0
- mapleflow-0.8.1/mapleflow/api/ai/post_ai_chat.py +195 -0
- mapleflow-0.8.1/mapleflow/api/ai/post_ai_embeddings.py +191 -0
- mapleflow-0.8.1/mapleflow/api/ai/post_ai_images.py +195 -0
- mapleflow-0.8.1/mapleflow/api/ai/post_ai_speech.py +191 -0
- mapleflow-0.8.1/mapleflow/api/ai/post_ai_transcribe.py +189 -0
- mapleflow-0.8.1/mapleflow/api/images/__init__.py +1 -0
- mapleflow-0.8.1/mapleflow/api/images/post_images_bg_remove.py +235 -0
- mapleflow-0.8.1/mapleflow/api/utility/__init__.py +1 -0
- mapleflow-0.8.1/mapleflow/api/utility/get_currency.py +253 -0
- mapleflow-0.8.1/mapleflow/api/utility/get_weather.py +277 -0
- mapleflow-0.8.1/mapleflow/api/utility/post_translate.py +206 -0
- mapleflow-0.8.1/mapleflow/api/verify/__init__.py +1 -0
- mapleflow-0.8.1/mapleflow/api/verify/post_verify_face.py +190 -0
- mapleflow-0.8.1/mapleflow/api/verify/post_verify_labels.py +190 -0
- mapleflow-0.8.1/mapleflow/client.py +282 -0
- mapleflow-0.8.1/mapleflow/errors.py +16 -0
- mapleflow-0.8.1/mapleflow/models/__init__.py +99 -0
- mapleflow-0.8.1/mapleflow/models/get_currency_response_200.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_currency_response_400.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_currency_response_404.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_currency_response_502.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_weather_response_200.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_weather_response_400.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_weather_response_404.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_weather_response_502.py +81 -0
- mapleflow-0.8.1/mapleflow/models/get_weather_units.py +9 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_chat_body.py +104 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_chat_body_messages_item.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_chat_body_model.py +9 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_chat_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_chat_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_embeddings_body.py +98 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_embeddings_body_model.py +8 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_embeddings_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_embeddings_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_images_body.py +90 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_images_body_model.py +9 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_images_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_images_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_speech_body.py +80 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_speech_body_model.py +8 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_speech_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_speech_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_transcribe_body.py +81 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_transcribe_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_ai_transcribe_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_files_body.py +93 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_json_body.py +70 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_response_502.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_images_bg_remove_response_504.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_translate_body.py +89 -0
- mapleflow-0.8.1/mapleflow/models/post_translate_response_200.py +81 -0
- mapleflow-0.8.1/mapleflow/models/post_translate_response_400.py +81 -0
- mapleflow-0.8.1/mapleflow/models/post_translate_response_402.py +81 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_face_files_body.py +100 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_face_json_body.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_face_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_face_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_labels_files_body.py +81 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_labels_json_body.py +61 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_labels_response_200.py +72 -0
- mapleflow-0.8.1/mapleflow/models/post_verify_labels_response_400.py +69 -0
- mapleflow-0.8.1/mapleflow/types.py +54 -0
- mapleflow-0.8.1/pyproject.toml +33 -0
mapleflow-0.8.1/PKG-INFO
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mapleflow
|
|
3
|
+
Version: 0.8.1
|
|
4
|
+
Summary: Official Python SDK for the MapleFlow API platform — auto-generated from OpenAPI spec
|
|
5
|
+
Project-URL: Homepage, https://mapleflow.io
|
|
6
|
+
Project-URL: Repository, https://github.com/mapleflow/sdk-python
|
|
7
|
+
Project-URL: Documentation, https://mapleflow.io/docs
|
|
8
|
+
Author-email: MapleFlow <hello@mapleflow.io>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: ai,api,mapleflow,sdk,translate,weather
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Requires-Dist: httpx>=0.24.0
|
|
18
|
+
Requires-Dist: microsoft-kiota-abstractions>=1.0.0
|
|
19
|
+
Requires-Dist: microsoft-kiota-authentication-azure>=1.0.0
|
|
20
|
+
Requires-Dist: microsoft-kiota-http>=1.0.0
|
|
21
|
+
Requires-Dist: microsoft-kiota-serialization-json>=1.0.0
|
|
22
|
+
Requires-Dist: microsoft-kiota-serialization-text>=1.0.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# mapleflow
|
|
26
|
+
|
|
27
|
+
Official Python SDK for the [MapleFlow](https://mapleflow.io) API platform. Auto-generated from OpenAPI spec using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install mapleflow
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from mapleflow import Client
|
|
39
|
+
|
|
40
|
+
client = Client(
|
|
41
|
+
base_url="https://mapleflow.io",
|
|
42
|
+
headers={"X-API-Key": "sk_live_..."},
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Regenerate SDK
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
openapi-python-client generate --path ../../src/openapi.json --config config.yml --meta none --overwrite
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# mapleflow
|
|
2
|
+
|
|
3
|
+
Official Python SDK for the [MapleFlow](https://mapleflow.io) API platform. Auto-generated from OpenAPI spec using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install mapleflow
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from mapleflow import Client
|
|
15
|
+
|
|
16
|
+
client = Client(
|
|
17
|
+
base_url="https://mapleflow.io",
|
|
18
|
+
headers={"X-API-Key": "sk_live_..."},
|
|
19
|
+
)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Regenerate SDK
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
openapi-python-client generate --path ../../src/openapi.json --config config.yml --meta none --overwrite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.post_ai_chat_body import PostAiChatBody
|
|
9
|
+
from ...models.post_ai_chat_response_200 import PostAiChatResponse200
|
|
10
|
+
from ...models.post_ai_chat_response_400 import PostAiChatResponse400
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: PostAiChatBody | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/ai/chat",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if not isinstance(body, Unset):
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> PostAiChatResponse200 | PostAiChatResponse400 | None:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = PostAiChatResponse200.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
|
|
42
|
+
if response.status_code == 400:
|
|
43
|
+
response_400 = PostAiChatResponse400.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_400
|
|
46
|
+
|
|
47
|
+
if client.raise_on_unexpected_status:
|
|
48
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
49
|
+
else:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _build_response(
|
|
54
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
55
|
+
) -> Response[PostAiChatResponse200 | PostAiChatResponse400]:
|
|
56
|
+
return Response(
|
|
57
|
+
status_code=HTTPStatus(response.status_code),
|
|
58
|
+
content=response.content,
|
|
59
|
+
headers=response.headers,
|
|
60
|
+
parsed=_parse_response(client=client, response=response),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sync_detailed(
|
|
65
|
+
*,
|
|
66
|
+
client: AuthenticatedClient | Client,
|
|
67
|
+
body: PostAiChatBody | Unset = UNSET,
|
|
68
|
+
) -> Response[PostAiChatResponse200 | PostAiChatResponse400]:
|
|
69
|
+
"""Chat completion
|
|
70
|
+
|
|
71
|
+
Generate chat completions.
|
|
72
|
+
|
|
73
|
+
| Model | Credits |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `llama-3.1-8b` | 2 |
|
|
76
|
+
| `deepseek-r1-32b` | 5 |
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
body (PostAiChatBody | Unset):
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Response[PostAiChatResponse200 | PostAiChatResponse400]
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
body=body,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = client.get_httpx_client().request(
|
|
94
|
+
**kwargs,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return _build_response(client=client, response=response)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def sync(
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient | Client,
|
|
103
|
+
body: PostAiChatBody | Unset = UNSET,
|
|
104
|
+
) -> PostAiChatResponse200 | PostAiChatResponse400 | None:
|
|
105
|
+
"""Chat completion
|
|
106
|
+
|
|
107
|
+
Generate chat completions.
|
|
108
|
+
|
|
109
|
+
| Model | Credits |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `llama-3.1-8b` | 2 |
|
|
112
|
+
| `deepseek-r1-32b` | 5 |
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
body (PostAiChatBody | Unset):
|
|
116
|
+
|
|
117
|
+
Raises:
|
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
PostAiChatResponse200 | PostAiChatResponse400
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
return sync_detailed(
|
|
126
|
+
client=client,
|
|
127
|
+
body=body,
|
|
128
|
+
).parsed
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
async def asyncio_detailed(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient | Client,
|
|
134
|
+
body: PostAiChatBody | Unset = UNSET,
|
|
135
|
+
) -> Response[PostAiChatResponse200 | PostAiChatResponse400]:
|
|
136
|
+
"""Chat completion
|
|
137
|
+
|
|
138
|
+
Generate chat completions.
|
|
139
|
+
|
|
140
|
+
| Model | Credits |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `llama-3.1-8b` | 2 |
|
|
143
|
+
| `deepseek-r1-32b` | 5 |
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
body (PostAiChatBody | Unset):
|
|
147
|
+
|
|
148
|
+
Raises:
|
|
149
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
150
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
Response[PostAiChatResponse200 | PostAiChatResponse400]
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
kwargs = _get_kwargs(
|
|
157
|
+
body=body,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
161
|
+
|
|
162
|
+
return _build_response(client=client, response=response)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
async def asyncio(
|
|
166
|
+
*,
|
|
167
|
+
client: AuthenticatedClient | Client,
|
|
168
|
+
body: PostAiChatBody | Unset = UNSET,
|
|
169
|
+
) -> PostAiChatResponse200 | PostAiChatResponse400 | None:
|
|
170
|
+
"""Chat completion
|
|
171
|
+
|
|
172
|
+
Generate chat completions.
|
|
173
|
+
|
|
174
|
+
| Model | Credits |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `llama-3.1-8b` | 2 |
|
|
177
|
+
| `deepseek-r1-32b` | 5 |
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
body (PostAiChatBody | Unset):
|
|
181
|
+
|
|
182
|
+
Raises:
|
|
183
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
184
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
PostAiChatResponse200 | PostAiChatResponse400
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
await asyncio_detailed(
|
|
192
|
+
client=client,
|
|
193
|
+
body=body,
|
|
194
|
+
)
|
|
195
|
+
).parsed
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.post_ai_embeddings_body import PostAiEmbeddingsBody
|
|
9
|
+
from ...models.post_ai_embeddings_response_200 import PostAiEmbeddingsResponse200
|
|
10
|
+
from ...models.post_ai_embeddings_response_400 import PostAiEmbeddingsResponse400
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: PostAiEmbeddingsBody | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/ai/embeddings",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if not isinstance(body, Unset):
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400 | None:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = PostAiEmbeddingsResponse200.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
|
|
42
|
+
if response.status_code == 400:
|
|
43
|
+
response_400 = PostAiEmbeddingsResponse400.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_400
|
|
46
|
+
|
|
47
|
+
if client.raise_on_unexpected_status:
|
|
48
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
49
|
+
else:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _build_response(
|
|
54
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
55
|
+
) -> Response[PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400]:
|
|
56
|
+
return Response(
|
|
57
|
+
status_code=HTTPStatus(response.status_code),
|
|
58
|
+
content=response.content,
|
|
59
|
+
headers=response.headers,
|
|
60
|
+
parsed=_parse_response(client=client, response=response),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sync_detailed(
|
|
65
|
+
*,
|
|
66
|
+
client: AuthenticatedClient | Client,
|
|
67
|
+
body: PostAiEmbeddingsBody | Unset = UNSET,
|
|
68
|
+
) -> Response[PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400]:
|
|
69
|
+
"""Text embeddings
|
|
70
|
+
|
|
71
|
+
Generate vector embeddings from text.
|
|
72
|
+
|
|
73
|
+
| Model | Credits |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `bge-base-en` | 1 |
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
body (PostAiEmbeddingsBody | Unset):
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Response[PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400]
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
kwargs = _get_kwargs(
|
|
89
|
+
body=body,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
response = client.get_httpx_client().request(
|
|
93
|
+
**kwargs,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return _build_response(client=client, response=response)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync(
|
|
100
|
+
*,
|
|
101
|
+
client: AuthenticatedClient | Client,
|
|
102
|
+
body: PostAiEmbeddingsBody | Unset = UNSET,
|
|
103
|
+
) -> PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400 | None:
|
|
104
|
+
"""Text embeddings
|
|
105
|
+
|
|
106
|
+
Generate vector embeddings from text.
|
|
107
|
+
|
|
108
|
+
| Model | Credits |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `bge-base-en` | 1 |
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
body (PostAiEmbeddingsBody | Unset):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
return sync_detailed(
|
|
124
|
+
client=client,
|
|
125
|
+
body=body,
|
|
126
|
+
).parsed
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def asyncio_detailed(
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient | Client,
|
|
132
|
+
body: PostAiEmbeddingsBody | Unset = UNSET,
|
|
133
|
+
) -> Response[PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400]:
|
|
134
|
+
"""Text embeddings
|
|
135
|
+
|
|
136
|
+
Generate vector embeddings from text.
|
|
137
|
+
|
|
138
|
+
| Model | Credits |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `bge-base-en` | 1 |
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
body (PostAiEmbeddingsBody | Unset):
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
147
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Response[PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400]
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
kwargs = _get_kwargs(
|
|
154
|
+
body=body,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
158
|
+
|
|
159
|
+
return _build_response(client=client, response=response)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio(
|
|
163
|
+
*,
|
|
164
|
+
client: AuthenticatedClient | Client,
|
|
165
|
+
body: PostAiEmbeddingsBody | Unset = UNSET,
|
|
166
|
+
) -> PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400 | None:
|
|
167
|
+
"""Text embeddings
|
|
168
|
+
|
|
169
|
+
Generate vector embeddings from text.
|
|
170
|
+
|
|
171
|
+
| Model | Credits |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `bge-base-en` | 1 |
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
body (PostAiEmbeddingsBody | Unset):
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
180
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
PostAiEmbeddingsResponse200 | PostAiEmbeddingsResponse400
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
await asyncio_detailed(
|
|
188
|
+
client=client,
|
|
189
|
+
body=body,
|
|
190
|
+
)
|
|
191
|
+
).parsed
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.post_ai_images_body import PostAiImagesBody
|
|
9
|
+
from ...models.post_ai_images_response_200 import PostAiImagesResponse200
|
|
10
|
+
from ...models.post_ai_images_response_400 import PostAiImagesResponse400
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: PostAiImagesBody | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/ai/images",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if not isinstance(body, Unset):
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> PostAiImagesResponse200 | PostAiImagesResponse400 | None:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = PostAiImagesResponse200.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
|
|
42
|
+
if response.status_code == 400:
|
|
43
|
+
response_400 = PostAiImagesResponse400.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_400
|
|
46
|
+
|
|
47
|
+
if client.raise_on_unexpected_status:
|
|
48
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
49
|
+
else:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _build_response(
|
|
54
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
55
|
+
) -> Response[PostAiImagesResponse200 | PostAiImagesResponse400]:
|
|
56
|
+
return Response(
|
|
57
|
+
status_code=HTTPStatus(response.status_code),
|
|
58
|
+
content=response.content,
|
|
59
|
+
headers=response.headers,
|
|
60
|
+
parsed=_parse_response(client=client, response=response),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sync_detailed(
|
|
65
|
+
*,
|
|
66
|
+
client: AuthenticatedClient | Client,
|
|
67
|
+
body: PostAiImagesBody | Unset = UNSET,
|
|
68
|
+
) -> Response[PostAiImagesResponse200 | PostAiImagesResponse400]:
|
|
69
|
+
"""Image generation
|
|
70
|
+
|
|
71
|
+
Generate images from text prompts.
|
|
72
|
+
|
|
73
|
+
| Model | Credits |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `flux-schnell` | 5 |
|
|
76
|
+
| `flux-dev` | 5 |
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
body (PostAiImagesBody | Unset):
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Response[PostAiImagesResponse200 | PostAiImagesResponse400]
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
body=body,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = client.get_httpx_client().request(
|
|
94
|
+
**kwargs,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return _build_response(client=client, response=response)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def sync(
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient | Client,
|
|
103
|
+
body: PostAiImagesBody | Unset = UNSET,
|
|
104
|
+
) -> PostAiImagesResponse200 | PostAiImagesResponse400 | None:
|
|
105
|
+
"""Image generation
|
|
106
|
+
|
|
107
|
+
Generate images from text prompts.
|
|
108
|
+
|
|
109
|
+
| Model | Credits |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `flux-schnell` | 5 |
|
|
112
|
+
| `flux-dev` | 5 |
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
body (PostAiImagesBody | Unset):
|
|
116
|
+
|
|
117
|
+
Raises:
|
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
PostAiImagesResponse200 | PostAiImagesResponse400
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
return sync_detailed(
|
|
126
|
+
client=client,
|
|
127
|
+
body=body,
|
|
128
|
+
).parsed
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
async def asyncio_detailed(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient | Client,
|
|
134
|
+
body: PostAiImagesBody | Unset = UNSET,
|
|
135
|
+
) -> Response[PostAiImagesResponse200 | PostAiImagesResponse400]:
|
|
136
|
+
"""Image generation
|
|
137
|
+
|
|
138
|
+
Generate images from text prompts.
|
|
139
|
+
|
|
140
|
+
| Model | Credits |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `flux-schnell` | 5 |
|
|
143
|
+
| `flux-dev` | 5 |
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
body (PostAiImagesBody | Unset):
|
|
147
|
+
|
|
148
|
+
Raises:
|
|
149
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
150
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
Response[PostAiImagesResponse200 | PostAiImagesResponse400]
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
kwargs = _get_kwargs(
|
|
157
|
+
body=body,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
161
|
+
|
|
162
|
+
return _build_response(client=client, response=response)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
async def asyncio(
|
|
166
|
+
*,
|
|
167
|
+
client: AuthenticatedClient | Client,
|
|
168
|
+
body: PostAiImagesBody | Unset = UNSET,
|
|
169
|
+
) -> PostAiImagesResponse200 | PostAiImagesResponse400 | None:
|
|
170
|
+
"""Image generation
|
|
171
|
+
|
|
172
|
+
Generate images from text prompts.
|
|
173
|
+
|
|
174
|
+
| Model | Credits |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `flux-schnell` | 5 |
|
|
177
|
+
| `flux-dev` | 5 |
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
body (PostAiImagesBody | Unset):
|
|
181
|
+
|
|
182
|
+
Raises:
|
|
183
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
184
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
PostAiImagesResponse200 | PostAiImagesResponse400
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
await asyncio_detailed(
|
|
192
|
+
client=client,
|
|
193
|
+
body=body,
|
|
194
|
+
)
|
|
195
|
+
).parsed
|