Spaces:
Running
Running
File size: 416 Bytes
2f1e7ff | 1 2 3 4 5 6 7 | """A rejected or malformed ingestion response must never start task polling."""
def accepted_task_id(status, payload):
task_id = payload.get('task_id') if isinstance(payload, dict) else None
if status != 202 or not isinstance(task_id, str) or task_id.strip().lower() in {'', 'none', 'null'}:
raise ValueError('INGESTION_CONTRACT_ERROR: expected HTTP 202 with a non-empty task_id')
return task_id
|