plato-sdk-v2 2.3.3__py3-none-any.whl → 2.4.2__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.
@@ -1,57 +0,0 @@
1
- """Upload Logs Zip Endpoint"""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Any
6
-
7
- import httpx
8
-
9
- from plato.chronos.errors import raise_for_status
10
- from plato.chronos.models import LogsUploadRequest, LogsUploadResponse
11
-
12
-
13
- def _build_request_args(
14
- body: LogsUploadRequest,
15
- ) -> dict[str, Any]:
16
- """Build request arguments."""
17
- url = "/api/callback/logs-zip"
18
-
19
- return {
20
- "method": "POST",
21
- "url": url,
22
- "json": body.model_dump(mode="json", exclude_none=True),
23
- }
24
-
25
-
26
- def sync(
27
- client: httpx.Client,
28
- body: LogsUploadRequest,
29
- ) -> LogsUploadResponse:
30
- """Upload zipped logs for a session.
31
-
32
- Accepts base64-encoded zip file and uploads to S3."""
33
-
34
- request_args = _build_request_args(
35
- body=body,
36
- )
37
-
38
- response = client.request(**request_args)
39
- raise_for_status(response)
40
- return LogsUploadResponse.model_validate(response.json())
41
-
42
-
43
- async def asyncio(
44
- client: httpx.AsyncClient,
45
- body: LogsUploadRequest,
46
- ) -> LogsUploadResponse:
47
- """Upload zipped logs for a session.
48
-
49
- Accepts base64-encoded zip file and uploads to S3."""
50
-
51
- request_args = _build_request_args(
52
- body=body,
53
- )
54
-
55
- response = await client.request(**request_args)
56
- raise_for_status(response)
57
- return LogsUploadResponse.model_validate(response.json())
@@ -1,57 +0,0 @@
1
- """Upload Trajectory Endpoint"""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Any
6
-
7
- import httpx
8
-
9
- from plato.chronos.errors import raise_for_status
10
- from plato.chronos.models import TrajectoryUploadRequest, TrajectoryUploadResponse
11
-
12
-
13
- def _build_request_args(
14
- body: TrajectoryUploadRequest,
15
- ) -> dict[str, Any]:
16
- """Build request arguments."""
17
- url = "/api/callback/trajectory"
18
-
19
- return {
20
- "method": "POST",
21
- "url": url,
22
- "json": body.model_dump(mode="json", exclude_none=True),
23
- }
24
-
25
-
26
- def sync(
27
- client: httpx.Client,
28
- body: TrajectoryUploadRequest,
29
- ) -> TrajectoryUploadResponse:
30
- """Upload AITF trajectory for a session.
31
-
32
- Accepts an AITF-formatted trajectory and stores it in the database."""
33
-
34
- request_args = _build_request_args(
35
- body=body,
36
- )
37
-
38
- response = client.request(**request_args)
39
- raise_for_status(response)
40
- return TrajectoryUploadResponse.model_validate(response.json())
41
-
42
-
43
- async def asyncio(
44
- client: httpx.AsyncClient,
45
- body: TrajectoryUploadRequest,
46
- ) -> TrajectoryUploadResponse:
47
- """Upload AITF trajectory for a session.
48
-
49
- Accepts an AITF-formatted trajectory and stores it in the database."""
50
-
51
- request_args = _build_request_args(
52
- body=body,
53
- )
54
-
55
- response = await client.request(**request_args)
56
- raise_for_status(response)
57
- return TrajectoryUploadResponse.model_validate(response.json())