Skip to content

Commit 5c73641

Browse files
sync: Merge pull request #36 from AceDataCloud/fix/improve-polling-guidance
Synced from monorepo directory: suno
1 parent 76ae71c commit 5c73641

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

core/utils.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ def _with_submission_guidance(
1717
"task_id": task_id,
1818
"poll_tool": poll_tool,
1919
"batch_poll_tool": batch_poll_tool,
20-
"next_step": f'Call {poll_tool}(task_id="{task_id}") to poll until the task completes and the final media URLs are available.',
20+
"polling_interval_seconds": 15,
21+
"max_poll_attempts": 20,
22+
"expected_wait_seconds": 300,
23+
"next_step": (
24+
f'Call {poll_tool}(task_id="{task_id}") to poll until the task completes '
25+
f"and the final media URLs are available. "
26+
f"IMPORTANT: Media generation typically takes 1-5 minutes. "
27+
f"Wait at least 15 seconds between each poll. "
28+
f"Keep polling for up to 20 attempts. Do NOT stop early — the task is still running."
29+
),
2130
}
2231
return payload
2332

@@ -50,11 +59,17 @@ def _with_task_guidance(
5059
"batch_poll_tool": batch_poll_tool,
5160
"state": state,
5261
"is_complete": False,
53-
"next_step": f'Task is NOT complete yet (state: "{state}"). '
54-
f'IMPORTANT: Only state="complete" with success=true means the task is finished. '
55-
f"Ignore any intermediate audio_url values (e.g. audiopipe.suno.ai URLs) — "
56-
f"these are streaming previews, NOT final results. "
57-
f'Call {poll_tool}(task_id="{task_id}") again after a few seconds.',
62+
"polling_interval_seconds": 15,
63+
"max_poll_attempts": 20,
64+
"next_step": (
65+
f'Task is NOT complete yet (state: "{state}"). '
66+
f'IMPORTANT: Only state="complete" with success=true means the task is finished. '
67+
f"Ignore any intermediate audio_url values — "
68+
f"these are streaming previews, NOT final results. "
69+
f'Wait 15 seconds, then call {poll_tool}(task_id="{task_id}") again. '
70+
f"Media generation typically takes 1-5 minutes. "
71+
f"Keep polling for up to 20 attempts. Do NOT stop early."
72+
),
5873
}
5974
return payload
6075

0 commit comments

Comments
 (0)