Spaces:
Sleeping
Sleeping
Download client.py from LooperBhunesh/Open-env: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/LooperBhunesh/Open-env/resolve/main/client.py
- Command line
-
hf download hf://spaces/LooperBhunesh/Open-env/client.py
-
curl -L -o client.py https://huggingface.co/spaces/LooperBhunesh/Open-env/resolve/main/client.py
1.19 kB
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # All rights reserved. | |
| # | |
| # This source code is licensed under the BSD-style license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| """Client for the support operations environment.""" | |
| from typing import Dict | |
| from openenv.core import EnvClient | |
| from openenv.core.client_types import StepResult | |
| from .models import SupportOpsAction, SupportOpsObservation, SupportOpsState | |
| class SupportOpsEnv( | |
| EnvClient[SupportOpsAction, SupportOpsObservation, SupportOpsState] | |
| ): | |
| """Persistent WebSocket client for support task rollouts.""" | |
| def _step_payload(self, action: SupportOpsAction) -> Dict: | |
| return action.model_dump(exclude_none=True, mode="json") | |
| def _parse_result(self, payload: Dict) -> StepResult[SupportOpsObservation]: | |
| observation = SupportOpsObservation.model_validate(payload.get("observation", {})) | |
| return StepResult( | |
| observation=observation, | |
| reward=payload.get("reward"), | |
| done=payload.get("done", False), | |
| ) | |
| def _parse_state(self, payload: Dict) -> SupportOpsState: | |
| return SupportOpsState.model_validate(payload) | |