Spaces:
Sleeping
Sleeping
File size: 1,377 Bytes
cdf485e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | """
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
|