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

# Predict a task described in words



## OpenAPI

````yaml /api-reference/openapi.json post /v1/databases/{database_id}/tasks/predict
openapi: 3.1.0
info:
  title: tabSutra API
  version: '1.0'
  description: >-
    One pretrained model for forecasting, classification, regression and
    recommendation on tables and databases.
servers:
  - url: https://api.tabsutra.com
security:
  - bearerAuth: []
paths:
  /v1/databases/{database_id}/tasks/predict:
    post:
      summary: Predict a task described in words
      operationId: predict_task_v1_databases__database_id__tasks_predict_post
      parameters:
        - name: database_id
          in: path
          required: true
          schema:
            type: string
            title: Database Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TaskRequest:
      properties:
        outputs:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Outputs
          description: >-
            classification: label, probabilities. regression: mean, median,
            quantiles, interval. Default: all of them.
        quantiles:
          items:
            type: number
          type: array
          title: Quantiles
          description: 'Regression: the levels (between 0 and 1) of the quantiles returned.'
          default:
            - 0.1
            - 0.5
            - 0.9
        coverage:
          type: number
          exclusiveMaximum: 1
          exclusiveMinimum: 0
          title: Coverage
          description: >-
            Regression: the share of the predicted distribution the interval
            holds.
          default: 0.8
        task:
          additionalProperties: true
          type: object
          title: Task
          description: >-
            A task in words. next_days: {"kind": "next_days", "entity",
            "events", "measure" (count, sum, mean, max, share, any, none,
            more_than, any_matching), "column", "where", "threshold",
            "window_days", "rows" (all, active, with_events), "through",
            "exclude_columns"}. next_items: {"kind": "next_items", "source",
            "items", "events", "window_days", "k", "rows"}. fill_column:
            {"kind": "fill_column", "table", "column", "task"}.
          examples:
            - column: amount
              entity: customers
              events: orders
              kind: next_days
              measure: sum
              window_days: 30
        at:
          anyOf:
            - type: string
            - type: 'null'
          title: At
          description: >-
            Stand at this date: nothing dated after it is read (default: the
            database's last date).
        n_dates:
          type: integer
          maximum: 64
          minimum: 1
          title: N Dates
          description: 'next_days: the dates the examples are made at, one window apart.'
          default: 12
        target_range:
          anyOf:
            - prefixItems:
                - anyOf:
                    - type: number
                    - type: 'null'
                - anyOf:
                    - type: number
                    - type: 'null'
              type: array
              maxItems: 2
              minItems: 2
            - type: 'null'
          title: Target Range
          description: 'Regression: outputs are clipped to [low, high].'
        explain:
          type: boolean
          default: false
          title: Explain
          description: >-
            Add to each prediction the contribution of each input to it. See
            Explanations.
        explain_top:
          type: integer
          default: 10
          minimum: 1
          maximum: 100
          title: Explain Top
          description: The number of largest contributions returned per prediction.
        explain_class:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Explain Class
          description: >-
            Classification: the class whose probability is explained. Default:
            the predicted label.
      type: object
      required:
        - task
      title: TaskRequest
    PredictResponse:
      properties:
        predictions:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Predictions
          description: >-
            One object per row, keyed by 'id' (the id column, or the row's
            position).
        report:
          additionalProperties: true
          type: object
          title: Report
      type: object
      required:
        - predictions
        - report
      title: PredictResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as ''Authorization: Bearer <key>''.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.