---
title: "Generate AI-based Suggestions for Dataview"
method: POST
path: "/workspaces/{workspace_id}/projects/{project_id}/suggestions"
tags: ["Dataviews", "generate AI Data"]
---

# Generate AI-based Suggestions for Dataview

`POST /workspaces/{workspace_id}/projects/{project_id}/suggestions`

## Request

- Base URL: `https://app.mammoth.io/api/v2`
- URL: `https://app.mammoth.io/api/v2/workspaces/{workspace_id}/projects/{project_id}/suggestions`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-KEY` and API key in header `X-API-SECRET` and API key in header `X-WORKSPACE-ID`

Given the prompt, generate AI data against a sequence number in the pipeline

## Path parameters

- `workspace_id` integer, required: Workspace refers to a collection of projects. Workspace ID is unique identifier for workspace.
- `project_id` integer, required: Project ID of the workspace

## Query parameters

- `dataset_id` integer, nullable: Id of the dataset
- `dataview_id` integer: Dataview ID of the dataset

## Request body

- UnifiedPromptSpec: Parameters required for intent-based extraction or filtering
  - `suggestion_type` 'extract_text' | 'add_condition' | 'generate_task' | 'apply_ai_template' | 'derivative_fuzzy_bucket' | 'date_format' | 'json_suggest', required: Type of operation (extraction or conditional filtering)
  - `params` union, required: Encapsulated parameters for the operation
    - CustomPromptParams
      - `column_name` string, required: The name of the column to apply extraction on
      - `sequence_number` integer, required: The sequence order of the extraction rule
      - `prompt` string, nullable: The user-defined prompt for AI-based extraction
      - `edit_regex` EditRegexSpec
        - `expression` string, required: Regex pattern for extraction
        - `delimiter` string, required: Delimiter used in regex pattern
        - `global_flag` boolean, required: Whether the regex should match globally
        - `capturing_groups` integer[], required: List of capturing group indices
    - AddConditionParams
      - `sequence_number` integer, required: The rule's order in the processing pipeline
      - `prompt` string, required: A human-readable condition statement, specifying a rule for data processing, e.g., 'Filter rows where Price > 100'
      - `origin` 'functions_panel' | 'null', nullable: Specifies the source of the API call that triggered this condition addition. Defaults to 'functions_panel'.
    - GenerateTaskParams
      - `prompt` string, nullable: Plain English condition, e.g., 'Filter rows where Price > 100'
      - `task_template` TaskMinimalSchema[], nullable: A list of dictionaries defining task templates, including task name, columns, reasons, etc.
        - `task_name` 'SQL Query' | 'Generative AI' | 'Extract Text' | 'Bulk Replace' | 'Conditional Filter' | 'Remove Duplicate Rows' | 'Show Top/Bottom Rows' | 'Edit Cells' | 'Label & Insert Values' | 'Fill Missing Values' | 'Find & Replace' | 'Increment/Decrement Date Values' | 'Extract Date Part' | 'Calculate Date Difference' | 'Math Function' | 'Window Function' | 'Obtain Large or Small Values' | 'Text Formatting' | 'Extract JSON' | 'Group & Aggregate' | 'Columns To Rows' | 'Crosstab' | 'Add Column' | 'Copy Columns' | 'Combine Multiple Columns' | 'Convert Column Type' | 'Remove Column' | 'Split Into Multiple Columns' | 'Branch Out' | 'Join' | 'Lookup', required: UI-facing task name
        - `task_description` string, required: Description of the transformation task. Include names of columns involved and how those columns are used.
        - `columns` ColumnDetails[], required: List of columns involved in the task
          - `name` string, required: Name of the column to apply the task to
          - `reason` string, required: Reason for applying the task to this column
        - `task_key` string, required: Automatically compute task_key from task_name
      - `task_key` string, nullable: This task key is optional. If the user is interacting from within the function panel, frontend will include this key alongside the prompt. This allows the backend to send only the relevant rule/function information to the LLM for context, instead of all available rules.
    - DerivativeFuzzyBucketParams
      - `column` string, required: Name of the column to generate fuzzy-bucket suggestions for
      - `params` object, required: Volatile query specification used to fetch sample values for the column
      - `grouping_strategy` string, nullable: Strategy used to group similar values, e.g. 'auto'
      - `method` string, nullable: Clustering method used for fuzzy bucketing, e.g. 'pdist'
      - `groups` object[], nullable: The modal's in-progress bulk-replace groups (NAME/STATIC_VALUES/DYNAMIC_VALUES), if any. When present, the sample query used to generate clustering candidates is annotated with ownership against these groups, so each suggested value already carries its true count and current owning group -- no separate follow-up annotation request needed.
    - DateFormatParams
      - `samples` string[], required: Sample values to detect a date format for, or validate against a given format
      - `format` string, nullable: Postgres-style date format to validate the samples against. When omitted, matching date formats are detected instead.
    - JsonSuggestParams
      - `internal_name` string, required: Internal column name to infer the JSON structure for
      - `sequence_number` integer, nullable: Pipeline step at which to sample the column's values

## Response `200`

The request was processed successfully, but a valid regex pattern could not be generated

- object

## Other responses

- `201`: Regex and example generated successfully
- `202`: Request accepted, processing continues off-line
- `400`: Bad request syntax or unsupported method
- `401`: Authorization error
- `403`: Request forbidden -- authorization will not help

---

[API](https://skmtc.dev/mammoth/apis/mammoth-analytics.md) · [All operations](https://skmtc.dev/mammoth/apis/mammoth-analytics/llms.txt) · [OpenAPI document](https://skmtc.dev/mammoth/apis/mammoth-analytics/revisions/fe078afe239b?raw)
