futurehouse-client 0.4.5.dev160__py3-none-any.whl → 0.5.0__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.
- futurehouse_client/clients/data_storage_methods.py +22 -4
- futurehouse_client/clients/rest_client.py +2 -2
- futurehouse_client/models/client.py +60 -4
- futurehouse_client/version.py +2 -2
- {futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/METADATA +1 -1
- {futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/RECORD +9 -9
- {futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/WHEEL +0 -0
- {futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/top_level.txt +0 -0
@@ -2492,7 +2492,11 @@ class DataStorageMethods:
|
|
2492
2492
|
return [
|
2493
2493
|
self._download_from_gcs(
|
2494
2494
|
location.storage_config.signed_url or "",
|
2495
|
-
(
|
2495
|
+
(
|
2496
|
+
Path(location.storage_config.location).name
|
2497
|
+
if location.storage_config.location
|
2498
|
+
else None
|
2499
|
+
),
|
2496
2500
|
)
|
2497
2501
|
for location in result.storage_locations
|
2498
2502
|
]
|
@@ -2508,7 +2512,12 @@ class DataStorageMethods:
|
|
2508
2512
|
)
|
2509
2513
|
|
2510
2514
|
return self._download_from_gcs(
|
2511
|
-
storage_location.storage_config.signed_url
|
2515
|
+
storage_location.storage_config.signed_url,
|
2516
|
+
(
|
2517
|
+
storage_location.storage_config.location.split("/")[-1]
|
2518
|
+
if storage_location.storage_config.location
|
2519
|
+
else None
|
2520
|
+
),
|
2512
2521
|
)
|
2513
2522
|
|
2514
2523
|
if storage_type in {"raw_content", "pg_table"}:
|
@@ -2568,7 +2577,11 @@ class DataStorageMethods:
|
|
2568
2577
|
[
|
2569
2578
|
self._adownload_from_gcs(
|
2570
2579
|
location.storage_config.signed_url or "",
|
2571
|
-
(
|
2580
|
+
(
|
2581
|
+
location.storage_config.location.split("/")[-1]
|
2582
|
+
if location.storage_config.location
|
2583
|
+
else None
|
2584
|
+
),
|
2572
2585
|
)
|
2573
2586
|
for location in result.storage_locations
|
2574
2587
|
],
|
@@ -2585,7 +2598,12 @@ class DataStorageMethods:
|
|
2585
2598
|
)
|
2586
2599
|
|
2587
2600
|
return await self._adownload_from_gcs(
|
2588
|
-
storage_location.storage_config.signed_url
|
2601
|
+
storage_location.storage_config.signed_url,
|
2602
|
+
(
|
2603
|
+
storage_location.storage_config.location.split("/")[-1]
|
2604
|
+
if storage_location.storage_config.location
|
2605
|
+
else None
|
2606
|
+
),
|
2589
2607
|
)
|
2590
2608
|
|
2591
2609
|
if storage_type in {"raw_content", "pg_table"}:
|
@@ -676,7 +676,7 @@ class RestClient(DataStorageMethods):
|
|
676
676
|
)
|
677
677
|
|
678
678
|
response = self.client.post(
|
679
|
-
"/v0.1/crows", json=task_data.model_dump(mode="json")
|
679
|
+
"/v0.1/crows", json=task_data.model_dump(mode="json", by_alias=True)
|
680
680
|
)
|
681
681
|
if response.status_code in {401, 403}:
|
682
682
|
raise PermissionError(
|
@@ -712,7 +712,7 @@ class RestClient(DataStorageMethods):
|
|
712
712
|
)
|
713
713
|
|
714
714
|
response = await self.async_client.post(
|
715
|
-
"/v0.1/crows", json=task_data.model_dump(mode="json")
|
715
|
+
"/v0.1/crows", json=task_data.model_dump(mode="json", by_alias=True)
|
716
716
|
)
|
717
717
|
if response.status_code in {401, 403}:
|
718
718
|
raise PermissionError(
|
@@ -2,10 +2,13 @@ from typing import Any, Generic, TypeAlias, TypeVar
|
|
2
2
|
|
3
3
|
from aviary.message import Message
|
4
4
|
from aviary.tools.base import Tool
|
5
|
+
from ldp.agent import Agent
|
5
6
|
from ldp.data_structures import Transition
|
6
7
|
from ldp.graph.ops import OpResult
|
7
8
|
from pydantic import BaseModel, ConfigDict, Field, field_serializer
|
8
9
|
|
10
|
+
from .app import Step
|
11
|
+
|
9
12
|
T = TypeVar("T")
|
10
13
|
|
11
14
|
|
@@ -34,10 +37,6 @@ class ASVState(BaseState, Generic[T]):
|
|
34
37
|
def serialize_action(self, action: OpResult[T]) -> dict:
|
35
38
|
return action.to_dict()
|
36
39
|
|
37
|
-
@field_serializer("next_state")
|
38
|
-
def serialize_next_state(self, state: Any) -> str:
|
39
|
-
return str(state)
|
40
|
-
|
41
40
|
|
42
41
|
class EnvResetState(BaseState):
|
43
42
|
observations: list[Message] = Field()
|
@@ -62,6 +61,62 @@ class TransitionState(BaseState):
|
|
62
61
|
}
|
63
62
|
|
64
63
|
|
64
|
+
class GlobalState(BaseState):
|
65
|
+
agent: Agent | None = None
|
66
|
+
env: Any | None = None
|
67
|
+
agent_state: Any | None = None
|
68
|
+
next_agent_state: Any | None = None
|
69
|
+
observations: list = []
|
70
|
+
action: Any | None = None
|
71
|
+
value: float = 0.0
|
72
|
+
last_step_state: Transition | None = None
|
73
|
+
|
74
|
+
def update_observations(self, obs: list[Message]) -> list[Message]:
|
75
|
+
previous_observations = self.observations or []
|
76
|
+
self.observations = obs
|
77
|
+
return previous_observations
|
78
|
+
|
79
|
+
def store_step_state(self, step_state: Transition) -> None:
|
80
|
+
self.last_step_state = step_state
|
81
|
+
|
82
|
+
def update_trajectory_data(self, **kwargs) -> None:
|
83
|
+
for key, value in kwargs.items():
|
84
|
+
setattr(self, key, value)
|
85
|
+
|
86
|
+
def _get_safe_previous_observations(
|
87
|
+
self, current_obs: list[Message] | None = None
|
88
|
+
) -> list[Message]:
|
89
|
+
if self.last_step_state and self.last_step_state.next_observation:
|
90
|
+
return self.last_step_state.next_observation
|
91
|
+
if self.observations:
|
92
|
+
return self.observations
|
93
|
+
return current_obs or []
|
94
|
+
|
95
|
+
def create_step_state(self, callback_type: Step, **kwargs) -> Transition:
|
96
|
+
defaults = {
|
97
|
+
"timestep": getattr(self.agent, "_timestep", 0) if self.agent else 0,
|
98
|
+
"agent_state": self.agent_state,
|
99
|
+
"next_agent_state": self.next_agent_state or self.agent_state,
|
100
|
+
"observation": self._get_safe_previous_observations(),
|
101
|
+
"next_observation": self.observations or [],
|
102
|
+
"action": self.action,
|
103
|
+
"reward": 0.0,
|
104
|
+
"truncated": False,
|
105
|
+
"done": False,
|
106
|
+
"value": self.value or 0.0,
|
107
|
+
"metadata": {"callback_type": callback_type},
|
108
|
+
}
|
109
|
+
|
110
|
+
for key, value in kwargs.items():
|
111
|
+
if key == "metadata" and isinstance(value, dict):
|
112
|
+
if isinstance(defaults["metadata"], dict):
|
113
|
+
defaults["metadata"].update(value)
|
114
|
+
else:
|
115
|
+
defaults[key] = value
|
116
|
+
|
117
|
+
return Transition(**defaults)
|
118
|
+
|
119
|
+
|
65
120
|
StateType: TypeAlias = (
|
66
121
|
BeforeTransitionState
|
67
122
|
| InitialState
|
@@ -69,4 +124,5 @@ StateType: TypeAlias = (
|
|
69
124
|
| EnvResetState
|
70
125
|
| EnvStepState
|
71
126
|
| TransitionState
|
127
|
+
| GlobalState
|
72
128
|
)
|
futurehouse_client/version.py
CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '0.
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
31
|
+
__version__ = version = '0.5.0'
|
32
|
+
__version_tuple__ = version_tuple = (0, 5, 0)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -1,13 +1,13 @@
|
|
1
1
|
futurehouse_client/__init__.py,sha256=q5cpcuPkhTaueXsySsgWpH0F-2EsRxcdJfP91ze6khU,991
|
2
2
|
futurehouse_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
futurehouse_client/version.py,sha256=
|
3
|
+
futurehouse_client/version.py,sha256=fvHpBU3KZKRinkriKdtAt3crenOyysELF-M9y3ozg3U,704
|
4
4
|
futurehouse_client/clients/__init__.py,sha256=-HXNj-XJ3LRO5XM6MZ709iPs29YpApss0Q2YYg1qMZw,280
|
5
|
-
futurehouse_client/clients/data_storage_methods.py,sha256=
|
5
|
+
futurehouse_client/clients/data_storage_methods.py,sha256=wnKu8CazlEX_BQauX1qvZRRw7EpbD0oofmH1wXLnDf8,120034
|
6
6
|
futurehouse_client/clients/job_client.py,sha256=b5gpzulZpxpv9R337r3UKItnMdtd6CGlI1sV3_VQJso,13985
|
7
|
-
futurehouse_client/clients/rest_client.py,sha256=
|
7
|
+
futurehouse_client/clients/rest_client.py,sha256=tLskIkiR6-Acbo2W1_UUNdIjiYfZMURaN_Mi0aJPWXg,110277
|
8
8
|
futurehouse_client/models/__init__.py,sha256=N1MwDUYonsMN9NdaShsYcJspyL7H756MYj7VWFeD3fk,978
|
9
9
|
futurehouse_client/models/app.py,sha256=UUg17I3zk6cH_7mrdojHGYvQfm_SeDkuUxsPlRyIYz0,31895
|
10
|
-
futurehouse_client/models/client.py,sha256=
|
10
|
+
futurehouse_client/models/client.py,sha256=554vp7Cr-17BTeRZtN5DhCRQesRRtr31ZPkHXUrhyCE,3835
|
11
11
|
futurehouse_client/models/data_storage_methods.py,sha256=cpF2g4y_REECaz--WhaJeLqXA_3m3keRP5XOXiL8GOI,13811
|
12
12
|
futurehouse_client/models/job_event.py,sha256=lMrx-lV7BQkKl419ErWZ6Q1EjurmhBFSns0z6zwGaVo,2766
|
13
13
|
futurehouse_client/models/rest.py,sha256=SbeXZSPUCM0lQ_gVUPa64vKzMxuUVgqmJ5YThfDWs8g,4726
|
@@ -17,8 +17,8 @@ futurehouse_client/utils/general.py,sha256=PIkGLCSA3kUvc6mwR-prEB7YnMdKILOIm6cPo
|
|
17
17
|
futurehouse_client/utils/module_utils.py,sha256=aFyd-X-pDARXz9GWpn8SSViUVYdSbuy9vSkrzcVIaGI,4955
|
18
18
|
futurehouse_client/utils/monitoring.py,sha256=UjRlufe67kI3VxRHOd5fLtJmlCbVA2Wqwpd4uZhXkQM,8728
|
19
19
|
futurehouse_client/utils/world_model_tools.py,sha256=v2krZGrco0ur2a_pcRMtnQL05SxlIoBXuJ5R1JkQNws,2921
|
20
|
-
futurehouse_client-0.
|
21
|
-
futurehouse_client-0.
|
22
|
-
futurehouse_client-0.
|
23
|
-
futurehouse_client-0.
|
24
|
-
futurehouse_client-0.
|
20
|
+
futurehouse_client-0.5.0.dist-info/licenses/LICENSE,sha256=oQ9ZHjUi-_6GfP3gs14FlPb0OlGwE1QCCKFGnJ4LD2I,11341
|
21
|
+
futurehouse_client-0.5.0.dist-info/METADATA,sha256=4lMUB0HZPj5tBCb2l5QxCwjBzk9KtOG73V_zNxui_ug,27094
|
22
|
+
futurehouse_client-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
futurehouse_client-0.5.0.dist-info/top_level.txt,sha256=TRuLUCt_qBnggdFHCX4O_BoCu1j2X43lKfIZC-ElwWY,19
|
24
|
+
futurehouse_client-0.5.0.dist-info/RECORD,,
|
File without changes
|
{futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{futurehouse_client-0.4.5.dev160.dist-info → futurehouse_client-0.5.0.dist-info}/top_level.txt
RENAMED
File without changes
|