Skip to content

Commit 626a125

Browse files
author
Dylan Huang
authored
Remove redundant rollout_id (#225)
* Update RemoteRolloutProcessor docstring to reference online tutorial for API usage * remove top-level rollout_id from InitRequest * skip unstable test in CI
1 parent 1a1d09c commit 626a125

File tree

6 files changed

+12
-33
lines changed

6 files changed

+12
-33
lines changed

eval_protocol/pytest/remote_rollout_processor.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,7 @@ class RemoteRolloutProcessor(RolloutProcessor):
1515
"""
1616
Rollout processor that triggers a remote HTTP server to perform the rollout.
1717
18-
Expected remote API:
19-
- POST {remote_base_url}/init
20-
Body: {
21-
"rollout_id": str,
22-
"model": str,
23-
"messages": list[dict],
24-
"tools": list[dict] | null,
25-
"metadata": {
26-
"invocation_id": str,
27-
"experiment_id": str,
28-
"rollout_id": str,
29-
"run_id": str | null,
30-
"row_id": str | null
31-
},
32-
}
33-
Returns: {"ok": true}
34-
35-
- GET {remote_base_url}/status?rollout_id=...
36-
Returns: {"terminated": bool, "info": {...}?}
18+
See https://evalprotocol.io/tutorial/remote-rollout-processor for documentation.
3719
"""
3820

3921
def __init__(
@@ -126,7 +108,6 @@ async def _process_row(row: EvaluationRow) -> EvaluationRow:
126108
raise ValueError("Rollout ID is required in RemoteRolloutProcessor")
127109

128110
init_payload: InitRequest = InitRequest(
129-
rollout_id=row.execution_metadata.rollout_id,
130111
model=model,
131112
messages=clean_messages,
132113
tools=row.tools,

eval_protocol/types/remote_rollout_processor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class RolloutMetadata(BaseModel):
2020
class InitRequest(BaseModel):
2121
"""Request model for POST /init endpoint."""
2222

23-
rollout_id: str
2423
model: str
2524
messages: List[Message] = Field(min_length=1)
2625
tools: Optional[List[Dict[str, Any]]] = None

tests/chinook/langgraph/test_langgraph_chinook_tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def build_graph_kwargs(cp: CompletionParams) -> Dict[str, Any]:
1919

2020

2121
@pytest.mark.asyncio
22+
@pytest.mark.skipif(os.environ.get("CI") == "true", reason="Only run this test locally since its not stable")
2223
@pytest.mark.skipif(os.getenv("FIREWORKS_API_KEY") in (None, ""), reason="FIREWORKS_API_KEY not set")
2324
@evaluation_test(
2425
input_messages=[[[Message(role="user", content="Use tools to count total tracks in the database.")]]],

tests/remote_server/remote_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@app.post("/init")
2424
def init(req: InitRequest):
2525
# Persist state
26-
_STATE[req.rollout_id] = {"terminated": False}
26+
_STATE[req.metadata.rollout_id] = {"terminated": False}
2727

2828
# Kick off worker thread that does a single-turn chat via Langfuse OpenAI integration
2929
def _worker():
@@ -43,10 +43,10 @@ def _worker():
4343

4444
except Exception as e:
4545
# Best-effort; mark as done even on error to unblock polling
46-
print(f"❌ Error in rollout {req.rollout_id}: {e}")
46+
print(f"❌ Error in rollout {req.metadata.rollout_id}: {e}")
4747
pass
4848
finally:
49-
_STATE[req.rollout_id]["terminated"] = True
49+
_STATE[req.metadata.rollout_id]["terminated"] = True
5050

5151
t = threading.Thread(target=_worker, daemon=True)
5252
t.start()

tests/remote_server/typescript-server/server.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ app.post("/init", async (req: Request, res: Response) => {
4646
try {
4747
// Validate request body
4848
const validatedData = initRequestSchema.parse(req.body);
49-
const { rollout_id, model } = validatedData;
49+
const { model, metadata } = validatedData;
50+
const rollout_id = metadata.rollout_id;
5051

5152
console.log(`Initializing rollout ${rollout_id} with model ${model}`);
5253

@@ -137,11 +138,12 @@ app.get("/status", (req: Request, res: Response) => {
137138
async function simulateRolloutExecution(
138139
initRequest: InitRequest
139140
): Promise<void> {
140-
const rolloutState = rolloutStates.get(initRequest.rollout_id);
141+
const rollout_id = initRequest.metadata.rollout_id;
142+
const rolloutState = rolloutStates.get(rollout_id);
141143
if (!rolloutState) return;
142144

143145
try {
144-
console.log(`Starting rollout execution for ${initRequest.rollout_id}`);
146+
console.log(`Starting rollout execution for ${rollout_id}`);
145147

146148
const openai = new OpenAI({
147149
apiKey: process.env["OPENAI_API_KEY"],
@@ -160,12 +162,9 @@ async function simulateRolloutExecution(
160162
rolloutState.ended_at = new Date().toISOString();
161163
rolloutState.completed_turns = 1;
162164

163-
console.log(`Rollout ${initRequest.rollout_id} completed successfully`);
165+
console.log(`Rollout ${rollout_id} completed successfully`);
164166
} catch (error) {
165-
console.error(
166-
`Error in rollout execution for ${initRequest.rollout_id}:`,
167-
error
168-
);
167+
console.error(`Error in rollout execution for ${rollout_id}:`, error);
169168

170169
rolloutState.status = "failed";
171170
rolloutState.ended_at = new Date().toISOString();

typescript/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const metadataSchema = z
4040
.loose();
4141

4242
export const initRequestSchema = z.object({
43-
rollout_id: z.string(),
4443
model: z.string(),
4544
messages: z.array(messageSchema).min(1),
4645
tools: z.array(toolSchema).optional().nullable(),

0 commit comments

Comments
 (0)