tripathysagar commited on
Commit
b9ad460
·
verified ·
1 Parent(s): 78f4de3

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client.py +9 -14
client.py CHANGED
@@ -12,11 +12,11 @@ from openenv.core.client_types import StepResult
12
  from openenv.core.env_server.types import State
13
  from openenv.core import EnvClient
14
 
15
- from .models import MazeAction, MazeObservation
16
 
17
 
18
  class MazeEnv(
19
- EnvClient[MazeAction, MazeObservation]
20
  ):
21
  """
22
  Client for the Maze Env Environment.
@@ -54,9 +54,7 @@ class MazeEnv(
54
  Returns:
55
  Dictionary representation suitable for JSON encoding
56
  """
57
- return {
58
- "message": action.message,
59
- }
60
 
61
  def _parse_result(self, payload: Dict) -> StepResult[MazeObservation]:
62
  """
@@ -69,16 +67,13 @@ class MazeEnv(
69
  StepResult with MazeObservation
70
  """
71
  obs_data = payload.get("observation", {})
72
- observation = MazeObservation(
73
- echoed_message=obs_data.get("echoed_message", ""),
74
- message_length=obs_data.get("message_length", 0),
75
- done=payload.get("done", False),
76
- reward=payload.get("reward"),
77
- metadata=obs_data.get("metadata", {}),
78
- )
79
-
80
  return StepResult(
81
- observation=observation,
 
 
 
 
 
82
  reward=payload.get("reward"),
83
  done=payload.get("done", False),
84
  )
 
12
  from openenv.core.env_server.types import State
13
  from openenv.core import EnvClient
14
 
15
+ from models import MazeAction, MazeObservation, MazeState
16
 
17
 
18
  class MazeEnv(
19
+ EnvClient[MazeAction, MazeObservation, MazeState]
20
  ):
21
  """
22
  Client for the Maze Env Environment.
 
54
  Returns:
55
  Dictionary representation suitable for JSON encoding
56
  """
57
+ return {"direction": action.direction}
 
 
58
 
59
  def _parse_result(self, payload: Dict) -> StepResult[MazeObservation]:
60
  """
 
67
  StepResult with MazeObservation
68
  """
69
  obs_data = payload.get("observation", {})
 
 
 
 
 
 
 
 
70
  return StepResult(
71
+ observation=MazeObservation(
72
+ position=obs_data.get("position", []),
73
+ grid_view=obs_data.get("grid_view", ""),
74
+ done=payload.get("done", False),
75
+ reward=payload.get("reward"),
76
+ ),
77
  reward=payload.get("reward"),
78
  done=payload.get("done", False),
79
  )