futurehouse-client 0.4.5.dev160__tar.gz → 0.4.5.dev201__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.
- {futurehouse_client-0.4.5.dev160/src/futurehouse_client.egg-info → futurehouse_client-0.4.5.dev201}/PKG-INFO +1 -1
- futurehouse_client-0.4.5.dev201/src/futurehouse_client/models/client.py +128 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/version.py +3 -3
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201/src/futurehouse_client.egg-info}/PKG-INFO +1 -1
- futurehouse_client-0.4.5.dev160/src/futurehouse_client/models/client.py +0 -72
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/LICENSE +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/README.md +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/data_storage.md +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/docs/__init__.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/docs/client_notebook.ipynb +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/pyproject.toml +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/setup.cfg +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/__init__.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/clients/__init__.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/clients/data_storage_methods.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/clients/job_client.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/clients/rest_client.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/models/__init__.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/models/app.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/models/data_storage_methods.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/models/job_event.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/models/rest.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/py.typed +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/__init__.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/auth.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/general.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/module_utils.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/monitoring.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/utils/world_model_tools.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client.egg-info/SOURCES.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client.egg-info/dependency_links.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client.egg-info/requires.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client.egg-info/top_level.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_client.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data/test_file.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data/test_information.txt +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data/test_manifest.yaml +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data_storage_e2e.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data_storage_methods.py +0 -0
- {futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_rest.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.4.5.
|
3
|
+
Version: 0.4.5.dev201
|
4
4
|
Summary: A client for interacting with endpoints of the FutureHouse service.
|
5
5
|
Author-email: FutureHouse technical staff <hello@futurehouse.org>
|
6
6
|
License: Apache License
|
@@ -0,0 +1,128 @@
|
|
1
|
+
from typing import Any, Generic, TypeAlias, TypeVar
|
2
|
+
|
3
|
+
from aviary.message import Message
|
4
|
+
from aviary.tools.base import Tool
|
5
|
+
from ldp.agent import Agent
|
6
|
+
from ldp.data_structures import Transition
|
7
|
+
from ldp.graph.ops import OpResult
|
8
|
+
from pydantic import BaseModel, ConfigDict, Field, field_serializer
|
9
|
+
|
10
|
+
from .app import Step
|
11
|
+
|
12
|
+
T = TypeVar("T")
|
13
|
+
|
14
|
+
|
15
|
+
# TODO: revisit this
|
16
|
+
# unsure what crow states will return
|
17
|
+
# need to revisit after we get more crows deployed
|
18
|
+
class BaseState(BaseModel):
|
19
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
20
|
+
|
21
|
+
|
22
|
+
class BeforeTransitionState(BaseState):
|
23
|
+
current_state: Any = Field()
|
24
|
+
observations: list[Message] = Field()
|
25
|
+
|
26
|
+
|
27
|
+
class InitialState(BaseState):
|
28
|
+
initial_state: Any = Field()
|
29
|
+
|
30
|
+
|
31
|
+
class ASVState(BaseState, Generic[T]):
|
32
|
+
action: OpResult[T] = Field()
|
33
|
+
next_state: Any = Field()
|
34
|
+
value: float = Field()
|
35
|
+
|
36
|
+
@field_serializer("action")
|
37
|
+
def serialize_action(self, action: OpResult[T]) -> dict:
|
38
|
+
return action.to_dict()
|
39
|
+
|
40
|
+
|
41
|
+
class EnvResetState(BaseState):
|
42
|
+
observations: list[Message] = Field()
|
43
|
+
tools: list[Tool] = Field()
|
44
|
+
|
45
|
+
|
46
|
+
class EnvStepState(BaseState):
|
47
|
+
observations: list[Message] = Field()
|
48
|
+
reward: float = Field()
|
49
|
+
done: bool = Field()
|
50
|
+
trunc: bool = Field()
|
51
|
+
|
52
|
+
|
53
|
+
class TransitionState(BaseState):
|
54
|
+
transition: Transition = Field()
|
55
|
+
|
56
|
+
@field_serializer("transition")
|
57
|
+
def serialize_transition(self, transition: Transition) -> dict:
|
58
|
+
transition_data = transition.model_dump()
|
59
|
+
return transition_data | {
|
60
|
+
"action": transition.action.to_dict() if transition.action else None,
|
61
|
+
}
|
62
|
+
|
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
|
+
|
120
|
+
StateType: TypeAlias = (
|
121
|
+
BeforeTransitionState
|
122
|
+
| InitialState
|
123
|
+
| ASVState
|
124
|
+
| EnvResetState
|
125
|
+
| EnvStepState
|
126
|
+
| TransitionState
|
127
|
+
| GlobalState
|
128
|
+
)
|
@@ -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.4.5.
|
32
|
-
__version_tuple__ = version_tuple = (0, 4, 5, '
|
31
|
+
__version__ = version = '0.4.5.dev201'
|
32
|
+
__version_tuple__ = version_tuple = (0, 4, 5, 'dev201')
|
33
33
|
|
34
|
-
__commit_id__ = commit_id = '
|
34
|
+
__commit_id__ = commit_id = 'g8acb99411'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.4.5.
|
3
|
+
Version: 0.4.5.dev201
|
4
4
|
Summary: A client for interacting with endpoints of the FutureHouse service.
|
5
5
|
Author-email: FutureHouse technical staff <hello@futurehouse.org>
|
6
6
|
License: Apache License
|
@@ -1,72 +0,0 @@
|
|
1
|
-
from typing import Any, Generic, TypeAlias, TypeVar
|
2
|
-
|
3
|
-
from aviary.message import Message
|
4
|
-
from aviary.tools.base import Tool
|
5
|
-
from ldp.data_structures import Transition
|
6
|
-
from ldp.graph.ops import OpResult
|
7
|
-
from pydantic import BaseModel, ConfigDict, Field, field_serializer
|
8
|
-
|
9
|
-
T = TypeVar("T")
|
10
|
-
|
11
|
-
|
12
|
-
# TODO: revisit this
|
13
|
-
# unsure what crow states will return
|
14
|
-
# need to revisit after we get more crows deployed
|
15
|
-
class BaseState(BaseModel):
|
16
|
-
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
17
|
-
|
18
|
-
|
19
|
-
class BeforeTransitionState(BaseState):
|
20
|
-
current_state: Any = Field()
|
21
|
-
observations: list[Message] = Field()
|
22
|
-
|
23
|
-
|
24
|
-
class InitialState(BaseState):
|
25
|
-
initial_state: Any = Field()
|
26
|
-
|
27
|
-
|
28
|
-
class ASVState(BaseState, Generic[T]):
|
29
|
-
action: OpResult[T] = Field()
|
30
|
-
next_state: Any = Field()
|
31
|
-
value: float = Field()
|
32
|
-
|
33
|
-
@field_serializer("action")
|
34
|
-
def serialize_action(self, action: OpResult[T]) -> dict:
|
35
|
-
return action.to_dict()
|
36
|
-
|
37
|
-
@field_serializer("next_state")
|
38
|
-
def serialize_next_state(self, state: Any) -> str:
|
39
|
-
return str(state)
|
40
|
-
|
41
|
-
|
42
|
-
class EnvResetState(BaseState):
|
43
|
-
observations: list[Message] = Field()
|
44
|
-
tools: list[Tool] = Field()
|
45
|
-
|
46
|
-
|
47
|
-
class EnvStepState(BaseState):
|
48
|
-
observations: list[Message] = Field()
|
49
|
-
reward: float = Field()
|
50
|
-
done: bool = Field()
|
51
|
-
trunc: bool = Field()
|
52
|
-
|
53
|
-
|
54
|
-
class TransitionState(BaseState):
|
55
|
-
transition: Transition = Field()
|
56
|
-
|
57
|
-
@field_serializer("transition")
|
58
|
-
def serialize_transition(self, transition: Transition) -> dict:
|
59
|
-
transition_data = transition.model_dump()
|
60
|
-
return transition_data | {
|
61
|
-
"action": transition.action.to_dict() if transition.action else None,
|
62
|
-
}
|
63
|
-
|
64
|
-
|
65
|
-
StateType: TypeAlias = (
|
66
|
-
BeforeTransitionState
|
67
|
-
| InitialState
|
68
|
-
| ASVState
|
69
|
-
| EnvResetState
|
70
|
-
| EnvStepState
|
71
|
-
| TransitionState
|
72
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/docs/client_notebook.ipynb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/src/futurehouse_client/py.typed
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data/test_file.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.4.5.dev160 → futurehouse_client-0.4.5.dev201}/tests/test_data_storage_e2e.py
RENAMED
File without changes
|
File without changes
|
File without changes
|