Spaces:
Running
Running
| """ | |
| PreferenceLab Environment Client. | |
| Connects to a running PreferenceLab server via WebSocket/HTTP. | |
| Example (async): | |
| >>> from preference_lab import PreferenceLabEnv, PairwiseAction | |
| >>> async with PreferenceLabEnv(base_url="https://your-space.hf.space") as env: | |
| ... obs = await env.reset() | |
| ... result = await env.step(PairwiseAction(choice="A")) | |
| Example (sync): | |
| >>> with PreferenceLabEnv(base_url="https://your-space.hf.space").sync() as env: | |
| ... obs = env.reset() | |
| ... result = env.step(PairwiseAction(choice="A")) | |
| """ | |
| from openenv.core.mcp_client import MCPToolClient | |
| class PreferenceLabEnv(MCPToolClient): | |
| """ | |
| Client for the PreferenceLab Environment. | |
| Provides tool-calling style interactions with the RLHF preference | |
| simulation environment. Inherits all functionality from MCPToolClient. | |
| Available tools (discovered via list_tools()): | |
| - rank_responses: Task 1 — choose A or B | |
| - score_response: Task 2 — rate on 4 axes | |
| - order_responses: Task 3 — rank 4 responses | |
| Example: | |
| >>> with PreferenceLabEnv(base_url="http://localhost:8000").sync() as env: | |
| ... env.reset() | |
| ... tools = env.list_tools() | |
| ... result = env.call_tool("rank_responses", choice="A") | |
| """ | |
| pass # MCPToolClient provides all needed functionality | |