anyformat 0.1.2__tar.gz → 0.3.0__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.
- anyformat-0.3.0/.release-please-manifest.json +3 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/CHANGELOG.md +26 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/PKG-INFO +1 -1
- {anyformat-0.1.2 → anyformat-0.3.0}/api.md +0 -10
- {anyformat-0.1.2 → anyformat-0.3.0}/pyproject.toml +1 -1
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_files.py +53 -3
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/__init__.py +0 -1
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_utils.py +0 -15
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_version.py +1 -1
- anyformat-0.3.0/src/anyformat/resources/files.py +169 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/resources/workflows.py +1 -133
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/__init__.py +0 -5
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_run_params.py +0 -6
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_upload_params.py +0 -6
- anyformat-0.3.0/tests/api_resources/test_files.py +106 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/api_resources/test_workflows.py +0 -116
- anyformat-0.3.0/tests/test_files.py +148 -0
- anyformat-0.1.2/.release-please-manifest.json +0 -3
- anyformat-0.1.2/src/anyformat/resources/files.py +0 -454
- anyformat-0.1.2/src/anyformat/types/file_create_params.py +0 -15
- anyformat-0.1.2/src/anyformat/types/file_create_response.py +0 -27
- anyformat-0.1.2/src/anyformat/types/file_list_params.py +0 -16
- anyformat-0.1.2/src/anyformat/types/file_list_response.py +0 -32
- anyformat-0.1.2/src/anyformat/types/workflow_results_params.py +0 -14
- anyformat-0.1.2/tests/api_resources/test_files.py +0 -342
- anyformat-0.1.2/tests/test_deepcopy.py +0 -58
- anyformat-0.1.2/tests/test_files.py +0 -51
- {anyformat-0.1.2 → anyformat-0.3.0}/.gitignore +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/CONTRIBUTING.md +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/LICENSE +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/README.md +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/SECURITY.md +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/bin/check-release-environment +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/bin/publish-pypi +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/examples/.keep +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/release-please-config.json +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/requirements-dev.lock +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/__init__.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_base_client.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_client.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_compat.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_constants.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_exceptions.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_models.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_qs.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_resource.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_streaming.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_types.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_compat.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_datetime_parse.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_json.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_logs.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_path.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_proxy.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_reflection.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_resources_proxy.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_streams.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_sync.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_transform.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/_utils/_typing.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/lib/.keep +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/py.typed +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/resources/__init__.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/resources/health.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/resources/webhooks.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/webhook_create_params.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/webhook_create_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/webhook_list_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_list_params.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_list_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_list_runs_params.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_list_runs_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_run_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/src/anyformat/types/workflow_upload_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/__init__.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/api_resources/__init__.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/api_resources/test_health.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/api_resources/test_webhooks.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/conftest.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/sample_file.txt +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_client.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_extract_files.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_models.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_qs.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_required_args.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_response.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_streaming.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_transform.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_utils/test_json.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_utils/test_path.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_utils/test_proxy.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/test_utils/test_typing.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/tests/utils.py +0 -0
- {anyformat-0.1.2 → anyformat-0.3.0}/uv.lock +0 -0
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2026-04-20)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/anyformat-ai/anyformat-python/compare/v0.2.0...v0.3.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([7a801c6](https://github.com/anyformat-ai/anyformat-python/commit/7a801c6fe3aaa1c5f74c1508634bfbc06bd29910))
|
|
10
|
+
|
|
11
|
+
## 0.2.0 (2026-04-18)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.1.2...v0.2.0](https://github.com/anyformat-ai/anyformat-python/compare/v0.1.2...v0.2.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** rename anyformat-ai-mcp to anyformat-mcp ([1088738](https://github.com/anyformat-ai/anyformat-python/commit/10887383a482a459098ca2647bb549db77bc0461))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Performance Improvements
|
|
21
|
+
|
|
22
|
+
* **client:** optimize file structure copying in multipart requests ([352741e](https://github.com/anyformat-ai/anyformat-python/commit/352741eaf6df138f58aabe0db3d286c2845232cb))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Chores
|
|
26
|
+
|
|
27
|
+
* configure new SDK language ([9808ea5](https://github.com/anyformat-ai/anyformat-python/commit/9808ea5a96eae3c76548a57115ef40a592d56fc3))
|
|
28
|
+
|
|
3
29
|
## 0.1.2 (2026-04-13)
|
|
4
30
|
|
|
5
31
|
Full Changelog: [v0.1.1...v0.1.2](https://github.com/anyformat-ai/anyformat-python/compare/v0.1.1...v0.1.2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: anyformat
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: The official Python library for the anyformat API
|
|
5
5
|
Project-URL: Homepage, https://github.com/anyformat-ai/anyformat-python
|
|
6
6
|
Project-URL: Repository, https://github.com/anyformat-ai/anyformat-python
|
|
@@ -20,18 +20,9 @@ Methods:
|
|
|
20
20
|
|
|
21
21
|
# Files
|
|
22
22
|
|
|
23
|
-
Types:
|
|
24
|
-
|
|
25
|
-
```python
|
|
26
|
-
from anyformat.types import FileCreateResponse, FileListResponse
|
|
27
|
-
```
|
|
28
|
-
|
|
29
23
|
Methods:
|
|
30
24
|
|
|
31
|
-
- <code title="post /v2/files/">client.files.<a href="./src/anyformat/resources/files.py">create</a>(\*\*<a href="src/anyformat/types/file_create_params.py">params</a>) -> <a href="./src/anyformat/types/file_create_response.py">FileCreateResponse</a></code>
|
|
32
|
-
- <code title="get /v2/files/">client.files.<a href="./src/anyformat/resources/files.py">list</a>(\*\*<a href="src/anyformat/types/file_list_params.py">params</a>) -> <a href="./src/anyformat/types/file_list_response.py">FileListResponse</a></code>
|
|
33
25
|
- <code title="delete /v2/files/{collection_id}/">client.files.<a href="./src/anyformat/resources/files.py">delete</a>(collection_id) -> None</code>
|
|
34
|
-
- <code title="get /v2/files/{collection_id}/extraction/">client.files.<a href="./src/anyformat/resources/files.py">get_extraction_results</a>(collection_id) -> object</code>
|
|
35
26
|
|
|
36
27
|
# Workflows
|
|
37
28
|
|
|
@@ -54,6 +45,5 @@ Methods:
|
|
|
54
45
|
- <code title="get /v2/workflows/">client.workflows.<a href="./src/anyformat/resources/workflows.py">list</a>(\*\*<a href="src/anyformat/types/workflow_list_params.py">params</a>) -> <a href="./src/anyformat/types/workflow_list_response.py">WorkflowListResponse</a></code>
|
|
55
46
|
- <code title="delete /v2/workflows/{workflow_id}/">client.workflows.<a href="./src/anyformat/resources/workflows.py">delete</a>(workflow_id) -> None</code>
|
|
56
47
|
- <code title="get /v2/workflows/{workflow_id}/runs/">client.workflows.<a href="./src/anyformat/resources/workflows.py">list_runs</a>(workflow_id, \*\*<a href="src/anyformat/types/workflow_list_runs_params.py">params</a>) -> <a href="./src/anyformat/types/workflow_list_runs_response.py">WorkflowListRunsResponse</a></code>
|
|
57
|
-
- <code title="get /v2/workflows/{workflow_id}/results/">client.workflows.<a href="./src/anyformat/resources/workflows.py">results</a>(workflow_id, \*\*<a href="src/anyformat/types/workflow_results_params.py">params</a>) -> object</code>
|
|
58
48
|
- <code title="post /v2/workflows/{workflow_id}/run/">client.workflows.<a href="./src/anyformat/resources/workflows.py">run</a>(workflow_id, \*\*<a href="src/anyformat/types/workflow_run_params.py">params</a>) -> <a href="./src/anyformat/types/workflow_run_response.py">WorkflowRunResponse</a></code>
|
|
59
49
|
- <code title="post /v2/workflows/{workflow_id}/upload/">client.workflows.<a href="./src/anyformat/resources/workflows.py">upload</a>(workflow_id, \*\*<a href="src/anyformat/types/workflow_upload_params.py">params</a>) -> <a href="./src/anyformat/types/workflow_upload_response.py">WorkflowUploadResponse</a></code>
|
|
@@ -3,8 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import io
|
|
4
4
|
import os
|
|
5
5
|
import pathlib
|
|
6
|
-
from typing import overload
|
|
7
|
-
from typing_extensions import TypeGuard
|
|
6
|
+
from typing import Sequence, cast, overload
|
|
7
|
+
from typing_extensions import TypeVar, TypeGuard
|
|
8
8
|
|
|
9
9
|
import anyio
|
|
10
10
|
|
|
@@ -17,7 +17,9 @@ from ._types import (
|
|
|
17
17
|
HttpxFileContent,
|
|
18
18
|
HttpxRequestFiles,
|
|
19
19
|
)
|
|
20
|
-
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
|
|
20
|
+
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t
|
|
21
|
+
|
|
22
|
+
_T = TypeVar("_T")
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
|
|
@@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
|
121
123
|
return await anyio.Path(file).read_bytes()
|
|
122
124
|
|
|
123
125
|
return file
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
|
|
129
|
+
"""Copy only the containers along the given paths.
|
|
130
|
+
|
|
131
|
+
Used to guard against mutation by extract_files without copying the entire structure.
|
|
132
|
+
Only dicts and lists that lie on a path are copied; everything else
|
|
133
|
+
is returned by reference.
|
|
134
|
+
|
|
135
|
+
For example, given paths=[["foo", "files", "file"]] and the structure:
|
|
136
|
+
{
|
|
137
|
+
"foo": {
|
|
138
|
+
"bar": {"baz": {}},
|
|
139
|
+
"files": {"file": <content>}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
The root dict, "foo", and "files" are copied (they lie on the path).
|
|
143
|
+
"bar" and "baz" are returned by reference (off the path).
|
|
144
|
+
"""
|
|
145
|
+
return _deepcopy_with_paths(item, paths, 0)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
|
|
149
|
+
if not paths:
|
|
150
|
+
return item
|
|
151
|
+
if is_mapping(item):
|
|
152
|
+
key_to_paths: dict[str, list[Sequence[str]]] = {}
|
|
153
|
+
for path in paths:
|
|
154
|
+
if index < len(path):
|
|
155
|
+
key_to_paths.setdefault(path[index], []).append(path)
|
|
156
|
+
|
|
157
|
+
# if no path continues through this mapping, it won't be mutated and copying it is redundant
|
|
158
|
+
if not key_to_paths:
|
|
159
|
+
return item
|
|
160
|
+
|
|
161
|
+
result = dict(item)
|
|
162
|
+
for key, subpaths in key_to_paths.items():
|
|
163
|
+
if key in result:
|
|
164
|
+
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
|
|
165
|
+
return cast(_T, result)
|
|
166
|
+
if is_list(item):
|
|
167
|
+
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]
|
|
168
|
+
|
|
169
|
+
# if no path expects a list here, nothing will be mutated inside it - return by reference
|
|
170
|
+
if not array_paths:
|
|
171
|
+
return cast(_T, item)
|
|
172
|
+
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
|
|
173
|
+
return item
|
|
@@ -24,7 +24,6 @@ from ._utils import (
|
|
|
24
24
|
coerce_integer as coerce_integer,
|
|
25
25
|
file_from_path as file_from_path,
|
|
26
26
|
strip_not_given as strip_not_given,
|
|
27
|
-
deepcopy_minimal as deepcopy_minimal,
|
|
28
27
|
get_async_library as get_async_library,
|
|
29
28
|
maybe_coerce_float as maybe_coerce_float,
|
|
30
29
|
get_required_header as get_required_header,
|
|
@@ -177,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
|
|
|
177
177
|
return isinstance(obj, Iterable)
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
def deepcopy_minimal(item: _T) -> _T:
|
|
181
|
-
"""Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
|
|
182
|
-
|
|
183
|
-
- mappings, e.g. `dict`
|
|
184
|
-
- list
|
|
185
|
-
|
|
186
|
-
This is done for performance reasons.
|
|
187
|
-
"""
|
|
188
|
-
if is_mapping(item):
|
|
189
|
-
return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
|
|
190
|
-
if is_list(item):
|
|
191
|
-
return cast(_T, [deepcopy_minimal(entry) for entry in item])
|
|
192
|
-
return item
|
|
193
|
-
|
|
194
|
-
|
|
195
180
|
# copied from https://github.com/Rapptz/RoboDanny
|
|
196
181
|
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
|
|
197
182
|
size = len(seq)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from .._types import Body, Query, Headers, NoneType, NotGiven, not_given
|
|
8
|
+
from .._utils import path_template
|
|
9
|
+
from .._compat import cached_property
|
|
10
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
11
|
+
from .._response import (
|
|
12
|
+
to_raw_response_wrapper,
|
|
13
|
+
to_streamed_response_wrapper,
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
)
|
|
17
|
+
from .._base_client import make_request_options
|
|
18
|
+
|
|
19
|
+
__all__ = ["FilesResource", "AsyncFilesResource"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FilesResource(SyncAPIResource):
|
|
23
|
+
"""File collection management."""
|
|
24
|
+
|
|
25
|
+
@cached_property
|
|
26
|
+
def with_raw_response(self) -> FilesResourceWithRawResponse:
|
|
27
|
+
"""
|
|
28
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
29
|
+
the raw response object instead of the parsed content.
|
|
30
|
+
|
|
31
|
+
For more information, see https://www.github.com/anyformat-ai/anyformat-python#accessing-raw-response-data-eg-headers
|
|
32
|
+
"""
|
|
33
|
+
return FilesResourceWithRawResponse(self)
|
|
34
|
+
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_streaming_response(self) -> FilesResourceWithStreamingResponse:
|
|
37
|
+
"""
|
|
38
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/anyformat-ai/anyformat-python#with_streaming_response
|
|
41
|
+
"""
|
|
42
|
+
return FilesResourceWithStreamingResponse(self)
|
|
43
|
+
|
|
44
|
+
def delete(
|
|
45
|
+
self,
|
|
46
|
+
collection_id: str,
|
|
47
|
+
*,
|
|
48
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
49
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
50
|
+
extra_headers: Headers | None = None,
|
|
51
|
+
extra_query: Query | None = None,
|
|
52
|
+
extra_body: Body | None = None,
|
|
53
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
54
|
+
) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Delete a file collection and all its files.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
extra_headers: Send extra headers
|
|
60
|
+
|
|
61
|
+
extra_query: Add additional query parameters to the request
|
|
62
|
+
|
|
63
|
+
extra_body: Add additional JSON properties to the request
|
|
64
|
+
|
|
65
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
66
|
+
"""
|
|
67
|
+
if not collection_id:
|
|
68
|
+
raise ValueError(f"Expected a non-empty value for `collection_id` but received {collection_id!r}")
|
|
69
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
70
|
+
return self._delete(
|
|
71
|
+
path_template("/v2/files/{collection_id}/", collection_id=collection_id),
|
|
72
|
+
options=make_request_options(
|
|
73
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
74
|
+
),
|
|
75
|
+
cast_to=NoneType,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class AsyncFilesResource(AsyncAPIResource):
|
|
80
|
+
"""File collection management."""
|
|
81
|
+
|
|
82
|
+
@cached_property
|
|
83
|
+
def with_raw_response(self) -> AsyncFilesResourceWithRawResponse:
|
|
84
|
+
"""
|
|
85
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
86
|
+
the raw response object instead of the parsed content.
|
|
87
|
+
|
|
88
|
+
For more information, see https://www.github.com/anyformat-ai/anyformat-python#accessing-raw-response-data-eg-headers
|
|
89
|
+
"""
|
|
90
|
+
return AsyncFilesResourceWithRawResponse(self)
|
|
91
|
+
|
|
92
|
+
@cached_property
|
|
93
|
+
def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse:
|
|
94
|
+
"""
|
|
95
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
96
|
+
|
|
97
|
+
For more information, see https://www.github.com/anyformat-ai/anyformat-python#with_streaming_response
|
|
98
|
+
"""
|
|
99
|
+
return AsyncFilesResourceWithStreamingResponse(self)
|
|
100
|
+
|
|
101
|
+
async def delete(
|
|
102
|
+
self,
|
|
103
|
+
collection_id: str,
|
|
104
|
+
*,
|
|
105
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
106
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
107
|
+
extra_headers: Headers | None = None,
|
|
108
|
+
extra_query: Query | None = None,
|
|
109
|
+
extra_body: Body | None = None,
|
|
110
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
111
|
+
) -> None:
|
|
112
|
+
"""
|
|
113
|
+
Delete a file collection and all its files.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
extra_headers: Send extra headers
|
|
117
|
+
|
|
118
|
+
extra_query: Add additional query parameters to the request
|
|
119
|
+
|
|
120
|
+
extra_body: Add additional JSON properties to the request
|
|
121
|
+
|
|
122
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
|
+
"""
|
|
124
|
+
if not collection_id:
|
|
125
|
+
raise ValueError(f"Expected a non-empty value for `collection_id` but received {collection_id!r}")
|
|
126
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
127
|
+
return await self._delete(
|
|
128
|
+
path_template("/v2/files/{collection_id}/", collection_id=collection_id),
|
|
129
|
+
options=make_request_options(
|
|
130
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
131
|
+
),
|
|
132
|
+
cast_to=NoneType,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class FilesResourceWithRawResponse:
|
|
137
|
+
def __init__(self, files: FilesResource) -> None:
|
|
138
|
+
self._files = files
|
|
139
|
+
|
|
140
|
+
self.delete = to_raw_response_wrapper(
|
|
141
|
+
files.delete,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class AsyncFilesResourceWithRawResponse:
|
|
146
|
+
def __init__(self, files: AsyncFilesResource) -> None:
|
|
147
|
+
self._files = files
|
|
148
|
+
|
|
149
|
+
self.delete = async_to_raw_response_wrapper(
|
|
150
|
+
files.delete,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class FilesResourceWithStreamingResponse:
|
|
155
|
+
def __init__(self, files: FilesResource) -> None:
|
|
156
|
+
self._files = files
|
|
157
|
+
|
|
158
|
+
self.delete = to_streamed_response_wrapper(
|
|
159
|
+
files.delete,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class AsyncFilesResourceWithStreamingResponse:
|
|
164
|
+
def __init__(self, files: AsyncFilesResource) -> None:
|
|
165
|
+
self._files = files
|
|
166
|
+
|
|
167
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
168
|
+
files.delete,
|
|
169
|
+
)
|
|
@@ -6,13 +6,7 @@ from typing import Optional
|
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
|
-
from ..types import
|
|
10
|
-
workflow_run_params,
|
|
11
|
-
workflow_list_params,
|
|
12
|
-
workflow_upload_params,
|
|
13
|
-
workflow_results_params,
|
|
14
|
-
workflow_list_runs_params,
|
|
15
|
-
)
|
|
9
|
+
from ..types import workflow_run_params, workflow_list_params, workflow_upload_params, workflow_list_runs_params
|
|
16
10
|
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
|
|
17
11
|
from .._utils import path_template, maybe_transform, async_maybe_transform
|
|
18
12
|
from .._compat import cached_property
|
|
@@ -234,59 +228,11 @@ class WorkflowsResource(SyncAPIResource):
|
|
|
234
228
|
cast_to=WorkflowListRunsResponse,
|
|
235
229
|
)
|
|
236
230
|
|
|
237
|
-
def results(
|
|
238
|
-
self,
|
|
239
|
-
workflow_id: str,
|
|
240
|
-
*,
|
|
241
|
-
as_lists: Optional[str] | Omit = omit,
|
|
242
|
-
output_format: str | Omit = omit,
|
|
243
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
244
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
245
|
-
extra_headers: Headers | None = None,
|
|
246
|
-
extra_query: Query | None = None,
|
|
247
|
-
extra_body: Body | None = None,
|
|
248
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
249
|
-
) -> object:
|
|
250
|
-
"""
|
|
251
|
-
Get workflow results.
|
|
252
|
-
|
|
253
|
-
Args:
|
|
254
|
-
extra_headers: Send extra headers
|
|
255
|
-
|
|
256
|
-
extra_query: Add additional query parameters to the request
|
|
257
|
-
|
|
258
|
-
extra_body: Add additional JSON properties to the request
|
|
259
|
-
|
|
260
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
261
|
-
"""
|
|
262
|
-
if not workflow_id:
|
|
263
|
-
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
264
|
-
return self._get(
|
|
265
|
-
path_template("/v2/workflows/{workflow_id}/results/", workflow_id=workflow_id),
|
|
266
|
-
options=make_request_options(
|
|
267
|
-
extra_headers=extra_headers,
|
|
268
|
-
extra_query=extra_query,
|
|
269
|
-
extra_body=extra_body,
|
|
270
|
-
timeout=timeout,
|
|
271
|
-
query=maybe_transform(
|
|
272
|
-
{
|
|
273
|
-
"as_lists": as_lists,
|
|
274
|
-
"output_format": output_format,
|
|
275
|
-
},
|
|
276
|
-
workflow_results_params.WorkflowResultsParams,
|
|
277
|
-
),
|
|
278
|
-
),
|
|
279
|
-
cast_to=object,
|
|
280
|
-
)
|
|
281
|
-
|
|
282
231
|
def run(
|
|
283
232
|
self,
|
|
284
233
|
workflow_id: str,
|
|
285
234
|
*,
|
|
286
|
-
content_type: Optional[str] | Omit = omit,
|
|
287
235
|
file: Optional[str] | Omit = omit,
|
|
288
|
-
file_base64: Optional[str] | Omit = omit,
|
|
289
|
-
filename: Optional[str] | Omit = omit,
|
|
290
236
|
text: Optional[str] | Omit = omit,
|
|
291
237
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
292
238
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -317,10 +263,7 @@ class WorkflowsResource(SyncAPIResource):
|
|
|
317
263
|
path_template("/v2/workflows/{workflow_id}/run/", workflow_id=workflow_id),
|
|
318
264
|
body=maybe_transform(
|
|
319
265
|
{
|
|
320
|
-
"content_type": content_type,
|
|
321
266
|
"file": file,
|
|
322
|
-
"file_base64": file_base64,
|
|
323
|
-
"filename": filename,
|
|
324
267
|
"text": text,
|
|
325
268
|
},
|
|
326
269
|
workflow_run_params.WorkflowRunParams,
|
|
@@ -335,10 +278,7 @@ class WorkflowsResource(SyncAPIResource):
|
|
|
335
278
|
self,
|
|
336
279
|
workflow_id: str,
|
|
337
280
|
*,
|
|
338
|
-
content_type: Optional[str] | Omit = omit,
|
|
339
281
|
file: Optional[str] | Omit = omit,
|
|
340
|
-
file_base64: Optional[str] | Omit = omit,
|
|
341
|
-
filename: Optional[str] | Omit = omit,
|
|
342
282
|
text: Optional[str] | Omit = omit,
|
|
343
283
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
344
284
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -369,10 +309,7 @@ class WorkflowsResource(SyncAPIResource):
|
|
|
369
309
|
path_template("/v2/workflows/{workflow_id}/upload/", workflow_id=workflow_id),
|
|
370
310
|
body=maybe_transform(
|
|
371
311
|
{
|
|
372
|
-
"content_type": content_type,
|
|
373
312
|
"file": file,
|
|
374
|
-
"file_base64": file_base64,
|
|
375
|
-
"filename": filename,
|
|
376
313
|
"text": text,
|
|
377
314
|
},
|
|
378
315
|
workflow_upload_params.WorkflowUploadParams,
|
|
@@ -585,59 +522,11 @@ class AsyncWorkflowsResource(AsyncAPIResource):
|
|
|
585
522
|
cast_to=WorkflowListRunsResponse,
|
|
586
523
|
)
|
|
587
524
|
|
|
588
|
-
async def results(
|
|
589
|
-
self,
|
|
590
|
-
workflow_id: str,
|
|
591
|
-
*,
|
|
592
|
-
as_lists: Optional[str] | Omit = omit,
|
|
593
|
-
output_format: str | Omit = omit,
|
|
594
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
595
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
596
|
-
extra_headers: Headers | None = None,
|
|
597
|
-
extra_query: Query | None = None,
|
|
598
|
-
extra_body: Body | None = None,
|
|
599
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
600
|
-
) -> object:
|
|
601
|
-
"""
|
|
602
|
-
Get workflow results.
|
|
603
|
-
|
|
604
|
-
Args:
|
|
605
|
-
extra_headers: Send extra headers
|
|
606
|
-
|
|
607
|
-
extra_query: Add additional query parameters to the request
|
|
608
|
-
|
|
609
|
-
extra_body: Add additional JSON properties to the request
|
|
610
|
-
|
|
611
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
612
|
-
"""
|
|
613
|
-
if not workflow_id:
|
|
614
|
-
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
615
|
-
return await self._get(
|
|
616
|
-
path_template("/v2/workflows/{workflow_id}/results/", workflow_id=workflow_id),
|
|
617
|
-
options=make_request_options(
|
|
618
|
-
extra_headers=extra_headers,
|
|
619
|
-
extra_query=extra_query,
|
|
620
|
-
extra_body=extra_body,
|
|
621
|
-
timeout=timeout,
|
|
622
|
-
query=await async_maybe_transform(
|
|
623
|
-
{
|
|
624
|
-
"as_lists": as_lists,
|
|
625
|
-
"output_format": output_format,
|
|
626
|
-
},
|
|
627
|
-
workflow_results_params.WorkflowResultsParams,
|
|
628
|
-
),
|
|
629
|
-
),
|
|
630
|
-
cast_to=object,
|
|
631
|
-
)
|
|
632
|
-
|
|
633
525
|
async def run(
|
|
634
526
|
self,
|
|
635
527
|
workflow_id: str,
|
|
636
528
|
*,
|
|
637
|
-
content_type: Optional[str] | Omit = omit,
|
|
638
529
|
file: Optional[str] | Omit = omit,
|
|
639
|
-
file_base64: Optional[str] | Omit = omit,
|
|
640
|
-
filename: Optional[str] | Omit = omit,
|
|
641
530
|
text: Optional[str] | Omit = omit,
|
|
642
531
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
643
532
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -668,10 +557,7 @@ class AsyncWorkflowsResource(AsyncAPIResource):
|
|
|
668
557
|
path_template("/v2/workflows/{workflow_id}/run/", workflow_id=workflow_id),
|
|
669
558
|
body=await async_maybe_transform(
|
|
670
559
|
{
|
|
671
|
-
"content_type": content_type,
|
|
672
560
|
"file": file,
|
|
673
|
-
"file_base64": file_base64,
|
|
674
|
-
"filename": filename,
|
|
675
561
|
"text": text,
|
|
676
562
|
},
|
|
677
563
|
workflow_run_params.WorkflowRunParams,
|
|
@@ -686,10 +572,7 @@ class AsyncWorkflowsResource(AsyncAPIResource):
|
|
|
686
572
|
self,
|
|
687
573
|
workflow_id: str,
|
|
688
574
|
*,
|
|
689
|
-
content_type: Optional[str] | Omit = omit,
|
|
690
575
|
file: Optional[str] | Omit = omit,
|
|
691
|
-
file_base64: Optional[str] | Omit = omit,
|
|
692
|
-
filename: Optional[str] | Omit = omit,
|
|
693
576
|
text: Optional[str] | Omit = omit,
|
|
694
577
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
695
578
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -720,10 +603,7 @@ class AsyncWorkflowsResource(AsyncAPIResource):
|
|
|
720
603
|
path_template("/v2/workflows/{workflow_id}/upload/", workflow_id=workflow_id),
|
|
721
604
|
body=await async_maybe_transform(
|
|
722
605
|
{
|
|
723
|
-
"content_type": content_type,
|
|
724
606
|
"file": file,
|
|
725
|
-
"file_base64": file_base64,
|
|
726
|
-
"filename": filename,
|
|
727
607
|
"text": text,
|
|
728
608
|
},
|
|
729
609
|
workflow_upload_params.WorkflowUploadParams,
|
|
@@ -754,9 +634,6 @@ class WorkflowsResourceWithRawResponse:
|
|
|
754
634
|
self.list_runs = to_raw_response_wrapper(
|
|
755
635
|
workflows.list_runs,
|
|
756
636
|
)
|
|
757
|
-
self.results = to_raw_response_wrapper(
|
|
758
|
-
workflows.results,
|
|
759
|
-
)
|
|
760
637
|
self.run = to_raw_response_wrapper(
|
|
761
638
|
workflows.run,
|
|
762
639
|
)
|
|
@@ -784,9 +661,6 @@ class AsyncWorkflowsResourceWithRawResponse:
|
|
|
784
661
|
self.list_runs = async_to_raw_response_wrapper(
|
|
785
662
|
workflows.list_runs,
|
|
786
663
|
)
|
|
787
|
-
self.results = async_to_raw_response_wrapper(
|
|
788
|
-
workflows.results,
|
|
789
|
-
)
|
|
790
664
|
self.run = async_to_raw_response_wrapper(
|
|
791
665
|
workflows.run,
|
|
792
666
|
)
|
|
@@ -814,9 +688,6 @@ class WorkflowsResourceWithStreamingResponse:
|
|
|
814
688
|
self.list_runs = to_streamed_response_wrapper(
|
|
815
689
|
workflows.list_runs,
|
|
816
690
|
)
|
|
817
|
-
self.results = to_streamed_response_wrapper(
|
|
818
|
-
workflows.results,
|
|
819
|
-
)
|
|
820
691
|
self.run = to_streamed_response_wrapper(
|
|
821
692
|
workflows.run,
|
|
822
693
|
)
|
|
@@ -844,9 +715,6 @@ class AsyncWorkflowsResourceWithStreamingResponse:
|
|
|
844
715
|
self.list_runs = async_to_streamed_response_wrapper(
|
|
845
716
|
workflows.list_runs,
|
|
846
717
|
)
|
|
847
|
-
self.results = async_to_streamed_response_wrapper(
|
|
848
|
-
workflows.results,
|
|
849
|
-
)
|
|
850
718
|
self.run = async_to_streamed_response_wrapper(
|
|
851
719
|
workflows.run,
|
|
852
720
|
)
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from .workflow import Workflow as Workflow
|
|
6
|
-
from .file_list_params import FileListParams as FileListParams
|
|
7
|
-
from .file_create_params import FileCreateParams as FileCreateParams
|
|
8
|
-
from .file_list_response import FileListResponse as FileListResponse
|
|
9
6
|
from .workflow_run_params import WorkflowRunParams as WorkflowRunParams
|
|
10
|
-
from .file_create_response import FileCreateResponse as FileCreateResponse
|
|
11
7
|
from .workflow_list_params import WorkflowListParams as WorkflowListParams
|
|
12
8
|
from .webhook_create_params import WebhookCreateParams as WebhookCreateParams
|
|
13
9
|
from .webhook_list_response import WebhookListResponse as WebhookListResponse
|
|
@@ -15,7 +11,6 @@ from .workflow_run_response import WorkflowRunResponse as WorkflowRunResponse
|
|
|
15
11
|
from .workflow_list_response import WorkflowListResponse as WorkflowListResponse
|
|
16
12
|
from .workflow_upload_params import WorkflowUploadParams as WorkflowUploadParams
|
|
17
13
|
from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse
|
|
18
|
-
from .workflow_results_params import WorkflowResultsParams as WorkflowResultsParams
|
|
19
14
|
from .workflow_upload_response import WorkflowUploadResponse as WorkflowUploadResponse
|
|
20
15
|
from .workflow_list_runs_params import WorkflowListRunsParams as WorkflowListRunsParams
|
|
21
16
|
from .workflow_list_runs_response import WorkflowListRunsResponse as WorkflowListRunsResponse
|