> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnia-voice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a dataset from logs

> Curate logged traffic into a managed training dataset.

Curation is automatic: errored, truncated (`finish_reason=length`), empty, and duplicate exchanges are dropped, and every drop is reported by reason. With `holdout_pct`, a second **disjoint** `{name}-eval` dataset is created — no example appears in both, so it's a valid eval set rather than the model's own homework. Pass its id as `sample_filters.dataset_id` when queueing an eval.

Requires an owner/admin key.



## OpenAPI

````yaml /openapi.json post /v1/datasets/from_logs
openapi: 3.1.0
info:
  title: Omnia Management API
  description: >-
    The management API behind the improvement loop: capture and setup, request
    logs and datasets, grades (labels), judges (criteria), evals and deploy
    gates, fine-tuning and reinforcement learning, dedicated GPU endpoints, and
    model aliases and versions. Authenticated with a workspace API key
    (sk_sovereign_...). The inference API (chat, embeddings, rerank, responses)
    is OpenAI-compatible and documented separately.


    Responses are snake_case, list endpoints on the loop products use the
    {"object": "list", "data": [...]} envelope, and refusals use the same nested
    error shape the gateway emits: {"error": {"message", "type", "code"}}.
    Request bodies on the loop products (logs, labels, criteria, evals,
    datasets, aliases) are snake_case; the training and infrastructure products
    (fine-tuning, GRPO, environment tools, dedicated, model-version adoption)
    validate camelCase bodies, and each schema below says which it is. Endpoints
    that spend money require a key minted by a workspace owner or admin and
    return 403 otherwise.
  version: 1.0.0
servers:
  - url: https://gateway.omnia-voice.com
    description: Production
  - url: https://platform.omnia-voice.com/api
    description: Production (legacy alias — same API, older base URL)
security:
  - bearerAuth: []
paths:
  /v1/datasets/from_logs:
    post:
      tags:
        - Logs
      summary: Create a dataset from logs
      description: >-
        Curate logged traffic into a managed training dataset.


        Curation is automatic: errored, truncated (`finish_reason=length`),
        empty, and duplicate exchanges are dropped, and every drop is reported
        by reason. With `holdout_pct`, a second **disjoint** `{name}-eval`
        dataset is created — no example appears in both, so it's a valid eval
        set rather than the model's own homework. Pass its id as
        `sample_filters.dataset_id` when queueing an eval.


        Requires an owner/admin key.
      operationId: createDatasetFromLogs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatasetFromLogs'
      responses:
        '201':
          description: The created dataset(s) and the curation summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetFromLogsResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    DatasetFromLogs:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          maxLength: 80
          example: support-bot-v1
        holdout_pct:
          type: integer
          minimum: 0
          maximum: 50
          default: 0
          description: >-
            Also create a second, DISJOINT "{name}-eval" dataset holding this
            percentage of examples. No example appears in both — that's what
            makes it valid as an eval source.
          example: 10
        filters:
          type: object
          description: >-
            Which logged exchanges to curate. Omit for all of them. Keys: model,
            tag (the task label sent as X-Omnia-Tag; a dataset scoped to one
            task beats one built from mixed traffic), segment (an auto-detected
            traffic segment, a `segment` value from GET /v1/logs),
            finish_reason, cache_hit (boolean), start and end (unix seconds).
          properties:
            model:
              type: string
            tag:
              type: string
            segment:
              type: string
              description: >-
                Curate only one auto-detected traffic segment (a `segment` value
                from GET /v1/logs) — one application surface, even when nothing
                was tagged.
            finish_reason:
              type: string
            cache_hit:
              type: boolean
            start:
              type: integer
              description: Unix seconds, inclusive.
            end:
              type: integer
              description: Unix seconds, exclusive.
        sources:
          type: object
          description: >-
            Which models feed the build. The same task (tag) usually spans every
            model you route it to; this chooses among them.
          properties:
            models:
              type: array
              description: >-
                Include-list: only these models' exchanges feed the build. An
                empty list means no restriction. Rejected with 400 unless every
                entry is a non-empty string.
              items:
                type: string
        quality:
          type: object
          description: >-
            The quality ladder (default cleaned). In every mode, exchanges a
            human graded FAIL never enter a dataset.
          properties:
            mode:
              type: string
              description: >-
                cleaned: mechanical curation only. graded: keep only exchanges a
                human graded pass (free). judge: a calibrated judge keeps only
                passing conversations; judge calls are billed as usage and
                refused up front (402) if the wallet can't cover a conservative
                estimate.
              enum:
                - cleaned
                - graded
                - judge
            criterion_id:
              type: string
              description: >-
                Required for mode "judge". The criterion must be calibrated
                (aligned tier), not drift-flagged, and request-unit; a
                segment-bound judge is only usable on builds scoped to its
                segment.
    DatasetFromLogsResult:
      type: object
      properties:
        training_name:
          type: string
        training_count:
          type: integer
        eval_name:
          type: string
          description: Present when holdout_pct > 0.
        eval_count:
          type: integer
        summary:
          type: object
          description: >-
            Curation accounting: total, kept, dropped {unparseable, errored,
            truncated, empty, duplicate, human_failed}, and the multi-turn
            folding counts. Every drop is counted by reason, so a dataset is
            never silently thinner than you think.
          properties:
            total:
              type: integer
            kept:
              type: integer
            dropped:
              type: object
              properties:
                unparseable:
                  type: integer
                errored:
                  type: integer
                truncated:
                  type: integer
                  description: >-
                    finish_reason=length — cut off mid-answer, misleading as
                    training data.
                empty:
                  type: integer
                duplicate:
                  type: integer
                  description: >-
                    Byte-identical exchange already kept (cache-hit replays
                    collapse here).
        quality:
          type: object
          description: >-
            What the quality gate actually did: mode, criterion_id and
            criterion_name (judge mode), the judge's kappa at build time,
            human_pass_kept, ungraded_excluded (graded mode), judged /
            judge_passed / judge_failed / judge_unparsed and judge_spend_usd
            (judge mode). A dataset never claims more than what happened.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                invalid_request_error, insufficient_quota, rate_limit_error, or
                api_error.
            code:
              type: string
              description: >-
                Machine-stable cause, e.g. invalid_api_key, not_found,
                insufficient_permissions, precondition_failed.
          required:
            - message
            - type
            - code
      description: >-
        Every refusal — gateway and management API alike — uses this one
        envelope.
  responses:
    BadRequest:
      description: Malformed request or invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    Forbidden:
      description: The key lacks the required owner/admin permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. `sk_sovereign_...`, sent as `Authorization:
        Bearer <key>`.

````