Spaces:
Sleeping
Sleeping
| """ | |
| client.py — Official OpenEnv client using EnvClient base class | |
| """ | |
| from __future__ import annotations | |
| from openenv.core import EnvClient | |
| from server.environment import SensitivityAction, SensitivityObservation | |
| class PromptSensitivityEnv(EnvClient): | |
| """ | |
| Client for the Prompt Sensitivity Detection environment. | |
| Usage (async): | |
| async with PromptSensitivityEnv(base_url="https://your-space.hf.space") as env: | |
| result = await env.reset() | |
| action = SensitivityAction(verdict="sensitive", confidence=0.9, | |
| explanation="...", sensitive_variant_index=2) | |
| result = await env.step(action) | |
| print(result.reward) | |
| Usage (sync): | |
| with PromptSensitivityEnv(base_url="...").sync() as env: | |
| result = env.reset() | |
| result = env.step(action) | |
| """ | |
| action_type = SensitivityAction | |
| observation_type = SensitivityObservation |