Skip to content

Create Dataset imports and Evaluation Tasks through explicit state transitions

GenMedia exposes authenticated workspace endpoints for resumable Dataset folder ingestion, bounded bundle compatibility, and Evaluation Task creation. Upload is split into create, private object upload, finalize, and status polling. Large files go directly to private Storage instead of crossing a Function request body, and idempotent publication cannot create a second Dataset version on retry.

Dataset import lifecycle
MethodPathPurpose
POST/api/datasets/importsCreate an import and receive its upload contract
POST/api/datasets/imports/{importId}/filesRegister folder files and receive object-scoped TUS creation tokens
TUSPrivate resumable targetUpload registered files directly in 6 MiB chunks
PUTSigned bundle targetUpload one bounded archive directly to private object storage
POST/api/datasets/imports/{importId}/finalizeValidate, parse, and publish the immutable Dataset version idempotently
GET/api/datasets/imports/{importId}Poll import status plus a safe localization summary or null
GET/api/datasets/localizations/status?datasetVersionId={versionId}Read MLOpt-safe queue and per-language readiness counts
POST/api/datasets/localizations/dispatchRequeue failed localization jobs for one Dataset version or configured language
POST/api/tasks/importCreate an Evaluation Task from finished candidate media
POST/api/tasks/generateCreate an endpoint-backed Evaluation Task and generation plan
GET | POST | DELETE/api/tasks/{taskId}/evaluation-linksList, create, or revoke account-free Evaluation links for one eligible task
GET | POST/api/public-evaluation/{token}Preview a public Evaluation and exchange a verified human challenge for a task-scoped guest Session
POST/api/public-evaluation/session/claim-ticketCreate the same-browser, one-time handoff used to save a completed guest Evaluation
POST/api/public-evaluation/session/claimAttach the completed guest Evaluation to a verified Standard account without rewriting its events
POST/api/evaluation-sessionCheck prerequisites, start or resume a Session, record playback, submit, continue, or finish through an action envelope

Authentication and scope

These are workspace endpoints, not an anonymous public ingestion service. The caller must have an authenticated GenMedia session and the MLOpt capability required for the target operation. Project, Dataset, Protocol, storage ownership, and task access are checked again on the server.

The current contract does not advertise external API keys. Browser session authentication and same-origin request rules remain authoritative until a separately scoped machine credential product is shipped.

Create and upload

The create request records the Dataset name, description, purpose, retention, filename patterns, content warnings, upload mode, sourceLanguage, and targetLanguages. Operators should send both language fields explicitly. The API defaults an omitted sourceLanguage to en and an omitted targetLanguages to an empty list; the browser importer explicitly starts with tr-tr selected. targetLanguages accepts an explicit list of up to eight supported language tags. Media modality is inferred only after byte validation. Folder mode returns a file-registration endpoint; archive mode returns one short-lived bundle target.

Folder files are registered just in time in batches of at most three, matching upload concurrency so every two-hour creation token is used immediately. Each response contains a signed token scoped to one fixed private object; the resulting resumable upload URL remains valid for up to 24 hours. Upload bytes only to the returned object target. Never place bearer tokens, provider credentials, or secret configuration in Dataset files.

Folder mode accepts 10 GiB total, 5 GiB per file, 5,000 files, and 2,000 sources. Archive mode accepts .zip, .tar, .tar.gz, .tgz, and prompt-only .csv with a 200 MiB compressed, 192 MiB expanded, and 64 MiB per-entry limit. Multi-gigabyte archives and URL manifests are not supported.

Finalize and poll

Finalize checks the caller, import ownership, object metadata, archive limits, path safety, config schema, media modality, anchors, group parameters, and marker bounds. It is idempotent: retrying the same finalized import returns its durable result instead of creating another Dataset version.

Poll the import status until it is ready or failed. Once a Dataset version exists, the response also includes its safe localization summary or null when the optional projection is temporarily unavailable. Dataset readiness and localization readiness are separate: publication is fail-open, while source analysis and selected translations continue in their retryable queue. The status response is deliberately sanitized and does not return storage paths, signed URLs, provider details, job IDs, or raw secret-bearing config. A failed import reports bounded validation categories and can be replaced by another import.

Localization readiness and retry

The Dataset detail page lets an MLOpt operator update target languages and shows each active language as ready or processing, item counts per language, aggregate processing and failure counts, and a Retry failed action when exhausted jobs exist. The settings update commits the active language set and durable queue rows together, then starts one bounded background dispatch. A target becomes selectable for a new Session only when every exact Dataset item is ready. Legacy Dataset versions without localization metadata retain their raw-source compatibility path.

GET or PATCH /api/datasets/{datasetId}/languages reads or replaces the active target-language set. PATCH requires a same-origin MLOpt session and JSON targetLocales. It never edits Dataset version settings or content hashes; it returns only safe aggregate counts and language tags.

A signed-in MLOpt operator can call GET /api/datasets/localizations/status?datasetVersionId={versionId}. The response contains a localization projection with configured, sourceLocale, targetLocales, translationVersion, itemCount, expectedJobs, counts, readyLocales, and localeReadyCounts. counts groups queued, running, retry_wait, complete, and failed jobs. The route also idempotently restores any missing jobs for the immutable version without exposing source text, provider responses, errors, or credentials.

POST /api/datasets/localizations/dispatch accepts JSON with datasetVersionId and an optional targetLocale. It requires a same-origin MLOpt session, requeues only failed matching jobs, runs a bounded dispatch, and returns requeued, dispatched, and the updated localization summary. Successful immutable copies are not replaced.

GET on the dispatch route is the one-minute internal Cron worker. It requires CRON_SECRET and claims at most two jobs per invocation. It is operational infrastructure, not a browser-session or external API-key endpoint.

Task creation remains a separate operation

Publishing a Dataset does not create an Evaluation Task. A task binds one published Dataset version, an available Experiment type, reviewer instructions, a Protocol and Sampling Plan, model or treatment identities, an audience, and an optional staffing Job.

For a finished-media Dataset request, send schema genmedia-dataset-task-v1, dataset_version_id, and language to /api/tasks/import. The language field sets the Task default. Before a Session starts, the evaluator may choose any configured locale whose exact copy and important-part analysis are ready for every Dataset item; the server validates and pins that choice transactionally. The import response localization summary describes the default legacy presentation created with the Task.

Use /api/tasks/import when candidate media already exists. Use /api/tasks/generate when supported fal endpoints should produce the conditions. Both paths validate the same task contract before the task becomes available to reviewers.

Evaluation Session actions

The authenticated /api/evaluation-session endpoint accepts an explicit action. prerequisites returns the caller’s answer-free Reviewer Practice and Golden Control readiness. start validates those prerequisites, the reviewer brief acknowledgement, the current preflight, account eligibility, staffing, and risk state before returning the first opaque assignment. next resumes the same durable Session.

playback records one ordered sample for one presented candidate and returns creditedSeconds, requiredSeconds, and complete. submit accepts win, tie, skip, or rating and returns an idempotent receipt plus the next assignment. finish closes a Session only after its configured minimum decision count. Every response is private and no-store; model identity, storage paths, private answer keys, device digests, and risk details are not part of the browser contract.

Each assignment uses the exact language pinned to its Evaluation Session. Its localization metadata identifies the requested and resolved locale, whether the displayed copy is localized or source, the translation contract version, and whether that copy is ready. Resume and operator replay resolve the same immutable localization id. Important spans apply only to the exact prompt string returned with that assignment.