plato-sdk-v2 2.0.50__py3-none-any.whl → 2.2.4__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.
- plato/__init__.py +7 -6
- plato/_generated/__init__.py +1 -1
- plato/_generated/api/v1/env/evaluate_session.py +3 -3
- plato/_generated/api/v1/env/log_state_mutation.py +4 -4
- plato/_generated/api/v1/sandbox/checkpoint_vm.py +3 -3
- plato/_generated/api/v1/sandbox/save_vm_snapshot.py +3 -3
- plato/_generated/api/v1/sandbox/setup_sandbox.py +8 -8
- plato/_generated/api/v1/session/__init__.py +2 -0
- plato/_generated/api/v1/session/get_sessions_for_archival.py +100 -0
- plato/_generated/api/v1/testcases/__init__.py +6 -2
- plato/_generated/api/v1/testcases/get_mutation_groups_for_testcase.py +98 -0
- plato/_generated/api/v1/testcases/{get_next_output_testcase_for_scoring.py → get_next_testcase_for_scoring.py} +23 -10
- plato/_generated/api/v1/testcases/get_testcase_metadata_for_scoring.py +74 -0
- plato/_generated/api/v2/__init__.py +2 -1
- plato/_generated/api/v2/jobs/__init__.py +4 -0
- plato/_generated/api/v2/jobs/checkpoint.py +3 -3
- plato/_generated/api/v2/jobs/disk_snapshot.py +3 -3
- plato/_generated/api/v2/jobs/log_for_job.py +4 -39
- plato/_generated/api/v2/jobs/make.py +4 -4
- plato/_generated/api/v2/jobs/setup_sandbox.py +97 -0
- plato/_generated/api/v2/jobs/snapshot.py +3 -3
- plato/_generated/api/v2/jobs/snapshot_store.py +91 -0
- plato/_generated/api/v2/sessions/__init__.py +4 -0
- plato/_generated/api/v2/sessions/checkpoint.py +3 -3
- plato/_generated/api/v2/sessions/disk_snapshot.py +3 -3
- plato/_generated/api/v2/sessions/evaluate.py +3 -3
- plato/_generated/api/v2/sessions/log_job_mutation.py +4 -39
- plato/_generated/api/v2/sessions/make.py +4 -4
- plato/_generated/api/v2/sessions/setup_sandbox.py +98 -0
- plato/_generated/api/v2/sessions/snapshot.py +3 -3
- plato/_generated/api/v2/sessions/snapshot_store.py +94 -0
- plato/_generated/api/v2/user/__init__.py +7 -0
- plato/_generated/api/v2/user/get_current_user.py +76 -0
- plato/_generated/models/__init__.py +174 -23
- plato/_sims_generator/__init__.py +19 -4
- plato/_sims_generator/instruction.py +203 -0
- plato/_sims_generator/templates/instruction/helpers.py.jinja +161 -0
- plato/_sims_generator/templates/instruction/init.py.jinja +43 -0
- plato/agents/__init__.py +107 -517
- plato/agents/base.py +145 -0
- plato/agents/build.py +61 -0
- plato/agents/config.py +160 -0
- plato/agents/logging.py +401 -0
- plato/agents/runner.py +161 -0
- plato/agents/trajectory.py +266 -0
- plato/chronos/__init__.py +37 -0
- plato/chronos/api/__init__.py +3 -0
- plato/chronos/api/agents/__init__.py +13 -0
- plato/chronos/api/agents/create_agent.py +63 -0
- plato/chronos/api/agents/delete_agent.py +61 -0
- plato/chronos/api/agents/get_agent.py +62 -0
- plato/chronos/api/agents/get_agent_schema.py +72 -0
- plato/chronos/api/agents/get_agent_versions.py +62 -0
- plato/chronos/api/agents/list_agents.py +57 -0
- plato/chronos/api/agents/lookup_agent.py +74 -0
- plato/chronos/api/auth/__init__.py +9 -0
- plato/chronos/api/auth/debug_auth_api_auth_debug_get.py +43 -0
- plato/chronos/api/auth/get_auth_status_api_auth_status_get.py +61 -0
- plato/chronos/api/auth/get_current_user_route_api_auth_me_get.py +60 -0
- plato/chronos/api/callback/__init__.py +11 -0
- plato/chronos/api/callback/push_agent_logs.py +61 -0
- plato/chronos/api/callback/update_agent_status.py +57 -0
- plato/chronos/api/callback/upload_artifacts.py +59 -0
- plato/chronos/api/callback/upload_logs_zip.py +57 -0
- plato/chronos/api/callback/upload_trajectory.py +57 -0
- plato/chronos/api/default/__init__.py +7 -0
- plato/chronos/api/default/health.py +43 -0
- plato/chronos/api/jobs/__init__.py +7 -0
- plato/chronos/api/jobs/launch_job.py +63 -0
- plato/chronos/api/registry/__init__.py +19 -0
- plato/chronos/api/registry/get_agent_schema_api_registry_agents__agent_name__schema_get.py +62 -0
- plato/chronos/api/registry/get_agent_versions_api_registry_agents__agent_name__versions_get.py +52 -0
- plato/chronos/api/registry/get_world_schema_api_registry_worlds__package_name__schema_get.py +68 -0
- plato/chronos/api/registry/get_world_versions_api_registry_worlds__package_name__versions_get.py +52 -0
- plato/chronos/api/registry/list_registry_agents_api_registry_agents_get.py +44 -0
- plato/chronos/api/registry/list_registry_worlds_api_registry_worlds_get.py +44 -0
- plato/chronos/api/runtimes/__init__.py +11 -0
- plato/chronos/api/runtimes/create_runtime.py +63 -0
- plato/chronos/api/runtimes/delete_runtime.py +61 -0
- plato/chronos/api/runtimes/get_runtime.py +62 -0
- plato/chronos/api/runtimes/list_runtimes.py +57 -0
- plato/chronos/api/runtimes/test_runtime.py +67 -0
- plato/chronos/api/secrets/__init__.py +11 -0
- plato/chronos/api/secrets/create_secret.py +63 -0
- plato/chronos/api/secrets/delete_secret.py +61 -0
- plato/chronos/api/secrets/get_secret.py +62 -0
- plato/chronos/api/secrets/list_secrets.py +57 -0
- plato/chronos/api/secrets/update_secret.py +68 -0
- plato/chronos/api/sessions/__init__.py +10 -0
- plato/chronos/api/sessions/get_session.py +62 -0
- plato/chronos/api/sessions/get_session_logs.py +72 -0
- plato/chronos/api/sessions/get_session_logs_download.py +62 -0
- plato/chronos/api/sessions/list_sessions.py +57 -0
- plato/chronos/api/status/__init__.py +8 -0
- plato/chronos/api/status/get_status_api_status_get.py +44 -0
- plato/chronos/api/status/get_version_info_api_version_get.py +44 -0
- plato/chronos/api/templates/__init__.py +11 -0
- plato/chronos/api/templates/create_template.py +63 -0
- plato/chronos/api/templates/delete_template.py +61 -0
- plato/chronos/api/templates/get_template.py +62 -0
- plato/chronos/api/templates/list_templates.py +57 -0
- plato/chronos/api/templates/update_template.py +68 -0
- plato/chronos/api/trajectories/__init__.py +8 -0
- plato/chronos/api/trajectories/get_trajectory.py +62 -0
- plato/chronos/api/trajectories/list_trajectories.py +62 -0
- plato/chronos/api/worlds/__init__.py +10 -0
- plato/chronos/api/worlds/create_world.py +63 -0
- plato/chronos/api/worlds/delete_world.py +61 -0
- plato/chronos/api/worlds/get_world.py +62 -0
- plato/chronos/api/worlds/list_worlds.py +57 -0
- plato/chronos/client.py +171 -0
- plato/chronos/errors.py +141 -0
- plato/chronos/models/__init__.py +647 -0
- plato/chronos/py.typed +0 -0
- plato/sims/cli.py +299 -123
- plato/sims/registry.py +77 -4
- plato/v1/cli/agent.py +88 -84
- plato/v1/cli/main.py +2 -0
- plato/v1/cli/pm.py +441 -119
- plato/v1/cli/sandbox.py +747 -191
- plato/v1/cli/sim.py +11 -0
- plato/v1/cli/verify.py +1269 -0
- plato/v1/cli/world.py +3 -0
- plato/v1/flow_executor.py +21 -17
- plato/v1/models/env.py +11 -11
- plato/v1/sdk.py +2 -2
- plato/v1/sync_env.py +11 -11
- plato/v1/sync_flow_executor.py +21 -17
- plato/v1/sync_sdk.py +4 -2
- plato/v2/__init__.py +2 -0
- plato/v2/async_/environment.py +20 -1
- plato/v2/async_/session.py +54 -3
- plato/v2/sync/environment.py +2 -1
- plato/v2/sync/session.py +52 -2
- plato/worlds/README.md +218 -0
- plato/worlds/__init__.py +54 -18
- plato/worlds/base.py +304 -93
- plato/worlds/config.py +239 -73
- plato/worlds/runner.py +391 -80
- {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/METADATA +1 -3
- {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/RECORD +143 -68
- {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/entry_points.txt +1 -0
- plato/_generated/api/v2/interfaces/__init__.py +0 -27
- plato/_generated/api/v2/interfaces/v2_interface_browser_create.py +0 -68
- plato/_generated/api/v2/interfaces/v2_interface_cdp_url.py +0 -65
- plato/_generated/api/v2/interfaces/v2_interface_click.py +0 -64
- plato/_generated/api/v2/interfaces/v2_interface_close.py +0 -59
- plato/_generated/api/v2/interfaces/v2_interface_computer_create.py +0 -68
- plato/_generated/api/v2/interfaces/v2_interface_cursor.py +0 -64
- plato/_generated/api/v2/interfaces/v2_interface_key.py +0 -68
- plato/_generated/api/v2/interfaces/v2_interface_screenshot.py +0 -65
- plato/_generated/api/v2/interfaces/v2_interface_scroll.py +0 -70
- plato/_generated/api/v2/interfaces/v2_interface_type.py +0 -64
- plato/world/__init__.py +0 -44
- plato/world/base.py +0 -267
- plato/world/config.py +0 -139
- plato/world/types.py +0 -47
- {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/WHEEL +0 -0
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"""Close Interface"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
import httpx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def sync(
|
|
11
|
-
client: httpx.Client,
|
|
12
|
-
job_id: str,
|
|
13
|
-
authorization: str | None = None,
|
|
14
|
-
x_internal_service: str | None = None,
|
|
15
|
-
) -> dict[str, Any]:
|
|
16
|
-
"""Close an interface."""
|
|
17
|
-
|
|
18
|
-
url = f"/api/v2/interface/{job_id}/close"
|
|
19
|
-
|
|
20
|
-
headers: dict[str, str] = {}
|
|
21
|
-
if authorization is not None:
|
|
22
|
-
headers["authorization"] = authorization
|
|
23
|
-
if x_internal_service is not None:
|
|
24
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
25
|
-
|
|
26
|
-
response = client.request(
|
|
27
|
-
"POST",
|
|
28
|
-
url,
|
|
29
|
-
headers=headers,
|
|
30
|
-
)
|
|
31
|
-
response.raise_for_status()
|
|
32
|
-
|
|
33
|
-
return response.json()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
async def asyncio(
|
|
37
|
-
client: httpx.AsyncClient,
|
|
38
|
-
job_id: str,
|
|
39
|
-
authorization: str | None = None,
|
|
40
|
-
x_internal_service: str | None = None,
|
|
41
|
-
) -> dict[str, Any]:
|
|
42
|
-
"""Close an interface."""
|
|
43
|
-
|
|
44
|
-
url = f"/api/v2/interface/{job_id}/close"
|
|
45
|
-
|
|
46
|
-
headers: dict[str, str] = {}
|
|
47
|
-
if authorization is not None:
|
|
48
|
-
headers["authorization"] = authorization
|
|
49
|
-
if x_internal_service is not None:
|
|
50
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
51
|
-
|
|
52
|
-
response = await client.request(
|
|
53
|
-
"POST",
|
|
54
|
-
url,
|
|
55
|
-
headers=headers,
|
|
56
|
-
)
|
|
57
|
-
response.raise_for_status()
|
|
58
|
-
|
|
59
|
-
return response.json()
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"""Create Computer Interface"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.computer_interface_option import ComputerInterfaceOption
|
|
8
|
-
from plato._generated.models.interface_info import InterfaceInfo
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def sync(
|
|
12
|
-
client: httpx.Client,
|
|
13
|
-
body: ComputerInterfaceOption,
|
|
14
|
-
authorization: str | None = None,
|
|
15
|
-
x_internal_service: str | None = None,
|
|
16
|
-
) -> InterfaceInfo:
|
|
17
|
-
"""Create a computer interface.
|
|
18
|
-
|
|
19
|
-
Computer interfaces provide click, type, screenshot, and keyboard/mouse
|
|
20
|
-
control for computer-use scenarios."""
|
|
21
|
-
|
|
22
|
-
url = "/api/v2/interface/computer/create"
|
|
23
|
-
|
|
24
|
-
headers: dict[str, str] = {}
|
|
25
|
-
if authorization is not None:
|
|
26
|
-
headers["authorization"] = authorization
|
|
27
|
-
if x_internal_service is not None:
|
|
28
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
29
|
-
|
|
30
|
-
response = client.request(
|
|
31
|
-
"POST",
|
|
32
|
-
url,
|
|
33
|
-
json=body.to_dict(),
|
|
34
|
-
headers=headers,
|
|
35
|
-
)
|
|
36
|
-
response.raise_for_status()
|
|
37
|
-
|
|
38
|
-
return InterfaceInfo.from_dict(response.json())
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
async def asyncio(
|
|
42
|
-
client: httpx.AsyncClient,
|
|
43
|
-
body: ComputerInterfaceOption,
|
|
44
|
-
authorization: str | None = None,
|
|
45
|
-
x_internal_service: str | None = None,
|
|
46
|
-
) -> InterfaceInfo:
|
|
47
|
-
"""Create a computer interface.
|
|
48
|
-
|
|
49
|
-
Computer interfaces provide click, type, screenshot, and keyboard/mouse
|
|
50
|
-
control for computer-use scenarios."""
|
|
51
|
-
|
|
52
|
-
url = "/api/v2/interface/computer/create"
|
|
53
|
-
|
|
54
|
-
headers: dict[str, str] = {}
|
|
55
|
-
if authorization is not None:
|
|
56
|
-
headers["authorization"] = authorization
|
|
57
|
-
if x_internal_service is not None:
|
|
58
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
59
|
-
|
|
60
|
-
response = await client.request(
|
|
61
|
-
"POST",
|
|
62
|
-
url,
|
|
63
|
-
json=body.to_dict(),
|
|
64
|
-
headers=headers,
|
|
65
|
-
)
|
|
66
|
-
response.raise_for_status()
|
|
67
|
-
|
|
68
|
-
return InterfaceInfo.from_dict(response.json())
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"""Interface Cursor"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.cursor_position_request import CursorPositionRequest
|
|
8
|
-
from plato._generated.models.cursor_position_response import CursorPositionResponse
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def sync(
|
|
12
|
-
client: httpx.Client,
|
|
13
|
-
job_id: str,
|
|
14
|
-
body: CursorPositionRequest,
|
|
15
|
-
authorization: str | None = None,
|
|
16
|
-
x_internal_service: str | None = None,
|
|
17
|
-
) -> CursorPositionResponse:
|
|
18
|
-
"""Move the cursor to a position without clicking."""
|
|
19
|
-
|
|
20
|
-
url = f"/api/v2/interface/{job_id}/cursor"
|
|
21
|
-
|
|
22
|
-
headers: dict[str, str] = {}
|
|
23
|
-
if authorization is not None:
|
|
24
|
-
headers["authorization"] = authorization
|
|
25
|
-
if x_internal_service is not None:
|
|
26
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
27
|
-
|
|
28
|
-
response = client.request(
|
|
29
|
-
"POST",
|
|
30
|
-
url,
|
|
31
|
-
json=body.to_dict(),
|
|
32
|
-
headers=headers,
|
|
33
|
-
)
|
|
34
|
-
response.raise_for_status()
|
|
35
|
-
|
|
36
|
-
return CursorPositionResponse.from_dict(response.json())
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
async def asyncio(
|
|
40
|
-
client: httpx.AsyncClient,
|
|
41
|
-
job_id: str,
|
|
42
|
-
body: CursorPositionRequest,
|
|
43
|
-
authorization: str | None = None,
|
|
44
|
-
x_internal_service: str | None = None,
|
|
45
|
-
) -> CursorPositionResponse:
|
|
46
|
-
"""Move the cursor to a position without clicking."""
|
|
47
|
-
|
|
48
|
-
url = f"/api/v2/interface/{job_id}/cursor"
|
|
49
|
-
|
|
50
|
-
headers: dict[str, str] = {}
|
|
51
|
-
if authorization is not None:
|
|
52
|
-
headers["authorization"] = authorization
|
|
53
|
-
if x_internal_service is not None:
|
|
54
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
55
|
-
|
|
56
|
-
response = await client.request(
|
|
57
|
-
"POST",
|
|
58
|
-
url,
|
|
59
|
-
json=body.to_dict(),
|
|
60
|
-
headers=headers,
|
|
61
|
-
)
|
|
62
|
-
response.raise_for_status()
|
|
63
|
-
|
|
64
|
-
return CursorPositionResponse.from_dict(response.json())
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"""Interface Key"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.key_request import KeyRequest
|
|
8
|
-
from plato._generated.models.key_response import KeyResponse
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def sync(
|
|
12
|
-
client: httpx.Client,
|
|
13
|
-
job_id: str,
|
|
14
|
-
body: KeyRequest,
|
|
15
|
-
authorization: str | None = None,
|
|
16
|
-
x_internal_service: str | None = None,
|
|
17
|
-
) -> KeyResponse:
|
|
18
|
-
"""Press a key or key combination.
|
|
19
|
-
|
|
20
|
-
Examples: 'Enter', 'Tab', 'ctrl+c', 'alt+tab', 'shift+a'"""
|
|
21
|
-
|
|
22
|
-
url = f"/api/v2/interface/{job_id}/key"
|
|
23
|
-
|
|
24
|
-
headers: dict[str, str] = {}
|
|
25
|
-
if authorization is not None:
|
|
26
|
-
headers["authorization"] = authorization
|
|
27
|
-
if x_internal_service is not None:
|
|
28
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
29
|
-
|
|
30
|
-
response = client.request(
|
|
31
|
-
"POST",
|
|
32
|
-
url,
|
|
33
|
-
json=body.to_dict(),
|
|
34
|
-
headers=headers,
|
|
35
|
-
)
|
|
36
|
-
response.raise_for_status()
|
|
37
|
-
|
|
38
|
-
return KeyResponse.from_dict(response.json())
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
async def asyncio(
|
|
42
|
-
client: httpx.AsyncClient,
|
|
43
|
-
job_id: str,
|
|
44
|
-
body: KeyRequest,
|
|
45
|
-
authorization: str | None = None,
|
|
46
|
-
x_internal_service: str | None = None,
|
|
47
|
-
) -> KeyResponse:
|
|
48
|
-
"""Press a key or key combination.
|
|
49
|
-
|
|
50
|
-
Examples: 'Enter', 'Tab', 'ctrl+c', 'alt+tab', 'shift+a'"""
|
|
51
|
-
|
|
52
|
-
url = f"/api/v2/interface/{job_id}/key"
|
|
53
|
-
|
|
54
|
-
headers: dict[str, str] = {}
|
|
55
|
-
if authorization is not None:
|
|
56
|
-
headers["authorization"] = authorization
|
|
57
|
-
if x_internal_service is not None:
|
|
58
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
59
|
-
|
|
60
|
-
response = await client.request(
|
|
61
|
-
"POST",
|
|
62
|
-
url,
|
|
63
|
-
json=body.to_dict(),
|
|
64
|
-
headers=headers,
|
|
65
|
-
)
|
|
66
|
-
response.raise_for_status()
|
|
67
|
-
|
|
68
|
-
return KeyResponse.from_dict(response.json())
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"""Interface Screenshot"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.screenshot_response import ScreenshotResponse
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def sync(
|
|
11
|
-
client: httpx.Client,
|
|
12
|
-
job_id: str,
|
|
13
|
-
authorization: str | None = None,
|
|
14
|
-
x_internal_service: str | None = None,
|
|
15
|
-
) -> ScreenshotResponse:
|
|
16
|
-
"""Take a screenshot of the interface.
|
|
17
|
-
|
|
18
|
-
Available for both browser and computer interfaces.
|
|
19
|
-
Returns base64 encoded PNG image."""
|
|
20
|
-
|
|
21
|
-
url = f"/api/v2/interface/{job_id}/screenshot"
|
|
22
|
-
|
|
23
|
-
headers: dict[str, str] = {}
|
|
24
|
-
if authorization is not None:
|
|
25
|
-
headers["authorization"] = authorization
|
|
26
|
-
if x_internal_service is not None:
|
|
27
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
28
|
-
|
|
29
|
-
response = client.request(
|
|
30
|
-
"GET",
|
|
31
|
-
url,
|
|
32
|
-
headers=headers,
|
|
33
|
-
)
|
|
34
|
-
response.raise_for_status()
|
|
35
|
-
|
|
36
|
-
return ScreenshotResponse.from_dict(response.json())
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
async def asyncio(
|
|
40
|
-
client: httpx.AsyncClient,
|
|
41
|
-
job_id: str,
|
|
42
|
-
authorization: str | None = None,
|
|
43
|
-
x_internal_service: str | None = None,
|
|
44
|
-
) -> ScreenshotResponse:
|
|
45
|
-
"""Take a screenshot of the interface.
|
|
46
|
-
|
|
47
|
-
Available for both browser and computer interfaces.
|
|
48
|
-
Returns base64 encoded PNG image."""
|
|
49
|
-
|
|
50
|
-
url = f"/api/v2/interface/{job_id}/screenshot"
|
|
51
|
-
|
|
52
|
-
headers: dict[str, str] = {}
|
|
53
|
-
if authorization is not None:
|
|
54
|
-
headers["authorization"] = authorization
|
|
55
|
-
if x_internal_service is not None:
|
|
56
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
57
|
-
|
|
58
|
-
response = await client.request(
|
|
59
|
-
"GET",
|
|
60
|
-
url,
|
|
61
|
-
headers=headers,
|
|
62
|
-
)
|
|
63
|
-
response.raise_for_status()
|
|
64
|
-
|
|
65
|
-
return ScreenshotResponse.from_dict(response.json())
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"""Interface Scroll"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.scroll_request import ScrollRequest
|
|
8
|
-
from plato._generated.models.scroll_response import ScrollResponse
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def sync(
|
|
12
|
-
client: httpx.Client,
|
|
13
|
-
job_id: str,
|
|
14
|
-
body: ScrollRequest,
|
|
15
|
-
authorization: str | None = None,
|
|
16
|
-
x_internal_service: str | None = None,
|
|
17
|
-
) -> ScrollResponse:
|
|
18
|
-
"""Scroll the interface.
|
|
19
|
-
|
|
20
|
-
Positive y scrolls down, negative y scrolls up.
|
|
21
|
-
Positive x scrolls right, negative x scrolls left."""
|
|
22
|
-
|
|
23
|
-
url = f"/api/v2/interface/{job_id}/scroll"
|
|
24
|
-
|
|
25
|
-
headers: dict[str, str] = {}
|
|
26
|
-
if authorization is not None:
|
|
27
|
-
headers["authorization"] = authorization
|
|
28
|
-
if x_internal_service is not None:
|
|
29
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
30
|
-
|
|
31
|
-
response = client.request(
|
|
32
|
-
"POST",
|
|
33
|
-
url,
|
|
34
|
-
json=body.to_dict(),
|
|
35
|
-
headers=headers,
|
|
36
|
-
)
|
|
37
|
-
response.raise_for_status()
|
|
38
|
-
|
|
39
|
-
return ScrollResponse.from_dict(response.json())
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
async def asyncio(
|
|
43
|
-
client: httpx.AsyncClient,
|
|
44
|
-
job_id: str,
|
|
45
|
-
body: ScrollRequest,
|
|
46
|
-
authorization: str | None = None,
|
|
47
|
-
x_internal_service: str | None = None,
|
|
48
|
-
) -> ScrollResponse:
|
|
49
|
-
"""Scroll the interface.
|
|
50
|
-
|
|
51
|
-
Positive y scrolls down, negative y scrolls up.
|
|
52
|
-
Positive x scrolls right, negative x scrolls left."""
|
|
53
|
-
|
|
54
|
-
url = f"/api/v2/interface/{job_id}/scroll"
|
|
55
|
-
|
|
56
|
-
headers: dict[str, str] = {}
|
|
57
|
-
if authorization is not None:
|
|
58
|
-
headers["authorization"] = authorization
|
|
59
|
-
if x_internal_service is not None:
|
|
60
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
61
|
-
|
|
62
|
-
response = await client.request(
|
|
63
|
-
"POST",
|
|
64
|
-
url,
|
|
65
|
-
json=body.to_dict(),
|
|
66
|
-
headers=headers,
|
|
67
|
-
)
|
|
68
|
-
response.raise_for_status()
|
|
69
|
-
|
|
70
|
-
return ScrollResponse.from_dict(response.json())
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"""Interface Type"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from plato._generated.models.type_request import TypeRequest
|
|
8
|
-
from plato._generated.models.type_response import TypeResponse
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def sync(
|
|
12
|
-
client: httpx.Client,
|
|
13
|
-
job_id: str,
|
|
14
|
-
body: TypeRequest,
|
|
15
|
-
authorization: str | None = None,
|
|
16
|
-
x_internal_service: str | None = None,
|
|
17
|
-
) -> TypeResponse:
|
|
18
|
-
"""Type text on the interface."""
|
|
19
|
-
|
|
20
|
-
url = f"/api/v2/interface/{job_id}/type"
|
|
21
|
-
|
|
22
|
-
headers: dict[str, str] = {}
|
|
23
|
-
if authorization is not None:
|
|
24
|
-
headers["authorization"] = authorization
|
|
25
|
-
if x_internal_service is not None:
|
|
26
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
27
|
-
|
|
28
|
-
response = client.request(
|
|
29
|
-
"POST",
|
|
30
|
-
url,
|
|
31
|
-
json=body.to_dict(),
|
|
32
|
-
headers=headers,
|
|
33
|
-
)
|
|
34
|
-
response.raise_for_status()
|
|
35
|
-
|
|
36
|
-
return TypeResponse.from_dict(response.json())
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
async def asyncio(
|
|
40
|
-
client: httpx.AsyncClient,
|
|
41
|
-
job_id: str,
|
|
42
|
-
body: TypeRequest,
|
|
43
|
-
authorization: str | None = None,
|
|
44
|
-
x_internal_service: str | None = None,
|
|
45
|
-
) -> TypeResponse:
|
|
46
|
-
"""Type text on the interface."""
|
|
47
|
-
|
|
48
|
-
url = f"/api/v2/interface/{job_id}/type"
|
|
49
|
-
|
|
50
|
-
headers: dict[str, str] = {}
|
|
51
|
-
if authorization is not None:
|
|
52
|
-
headers["authorization"] = authorization
|
|
53
|
-
if x_internal_service is not None:
|
|
54
|
-
headers["X-Internal-Service"] = x_internal_service
|
|
55
|
-
|
|
56
|
-
response = await client.request(
|
|
57
|
-
"POST",
|
|
58
|
-
url,
|
|
59
|
-
json=body.to_dict(),
|
|
60
|
-
headers=headers,
|
|
61
|
-
)
|
|
62
|
-
response.raise_for_status()
|
|
63
|
-
|
|
64
|
-
return TypeResponse.from_dict(response.json())
|
plato/world/__init__.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""World module - OpenAI Gym-like interface for Plato simulators.
|
|
2
|
-
|
|
3
|
-
Provides an abstract World base class that manages Plato sessions and
|
|
4
|
-
exposes simulator URLs for agents to interact with via plato.sims SDK.
|
|
5
|
-
|
|
6
|
-
Usage:
|
|
7
|
-
from plato.world import World, WorldConfig, EnvSpec, Observation, StepResult
|
|
8
|
-
|
|
9
|
-
class MyWorld(World):
|
|
10
|
-
async def _on_reset(self) -> Observation:
|
|
11
|
-
return Observation(step=0, date=self.config.start_date, data={})
|
|
12
|
-
|
|
13
|
-
async def _on_step(self) -> StepResult:
|
|
14
|
-
return StepResult(observation=obs, reward=100.0)
|
|
15
|
-
|
|
16
|
-
def get_prompt(self) -> str:
|
|
17
|
-
return f"Day {self._current_step}: Do something..."
|
|
18
|
-
|
|
19
|
-
config = WorldConfig(
|
|
20
|
-
name="my-world",
|
|
21
|
-
envs=[EnvSpec(alias="store", simulator="spree")],
|
|
22
|
-
num_steps=30,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
async with MyWorld(config) as world:
|
|
26
|
-
obs = await world.reset()
|
|
27
|
-
for _ in range(config.num_steps):
|
|
28
|
-
# Agent takes turn using world.get_env_vars()
|
|
29
|
-
result = await world.step()
|
|
30
|
-
if result.done:
|
|
31
|
-
break
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
from plato.world.base import World
|
|
35
|
-
from plato.world.config import EnvSpec, WorldConfig
|
|
36
|
-
from plato.world.types import Observation, StepResult
|
|
37
|
-
|
|
38
|
-
__all__ = [
|
|
39
|
-
"World",
|
|
40
|
-
"WorldConfig",
|
|
41
|
-
"EnvSpec",
|
|
42
|
-
"Observation",
|
|
43
|
-
"StepResult",
|
|
44
|
-
]
|