# Dataset2GPT

## Actor Statistics

- Total users: 3
- Monthly users: 2
- Runs succeeded: 100.00%
- Categories: AI, Automation, Integrations

## Pricing

$7.95/month + usage

## Input Schema

- **datasetId** (type: string): Optional: Dataset ID for testing. Integration uses payload automatically.
- **targetEmail** (type: string): Optional: Email address to send the summary to.
- **focusTopic** (type: string): Optional: Specific topic or aspect to focus on in the summary.
- **summaryLength** (type: integer): Length of the summary in words (max 2000).
- **openaiApiKey** (type: string): Your OpenAI API key for generating summaries

## API example

## Dataset2GPT

- **OpenAPI Version:** `3.1.1`
- **API Version:** `0.0`

### Servers

- **URL:** `https://api.apify.com/v2`

### Operations

#### Executes an Actor, waits for its completion, and returns Actor's dataset items in response.

- **Method:** `POST`
- **Path:** `/acts/flamboyant_leaf~dataset2gpt/run-sync-get-dataset-items`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`datasetId`**

  `string` — Optional: Dataset ID for testing. Integration uses payload automatically.

- **`focusTopic`**

  `string` — Optional: Specific topic or aspect to focus on in the summary.

- **`openaiApiKey`**

  `string` — Your OpenAI API key for generating summaries

- **`summaryLength`**

  `integer`, default: `1000` — Length of the summary in words (max 2000).

- **`targetEmail`**

  `string` — Optional: Email address to send the summary to.

**Example:**

```
{
  "datasetId": "",
  "targetEmail": "",
  "focusTopic": "",
  "summaryLength": 1000,
  "openaiApiKey": ""
}
```

##### Responses

###### Status: 200 OK

#### Executes an Actor and returns information about the initiated run in response.

- **Method:** `POST`
- **Path:** `/acts/flamboyant_leaf~dataset2gpt/runs`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`datasetId`**

  `string` — Optional: Dataset ID for testing. Integration uses payload automatically.

- **`focusTopic`**

  `string` — Optional: Specific topic or aspect to focus on in the summary.

- **`openaiApiKey`**

  `string` — Your OpenAI API key for generating summaries

- **`summaryLength`**

  `integer`, default: `1000` — Length of the summary in words (max 2000).

- **`targetEmail`**

  `string` — Optional: Email address to send the summary to.

**Example:**

```
{
  "datasetId": "",
  "targetEmail": "",
  "focusTopic": "",
  "summaryLength": 1000,
  "openaiApiKey": ""
}
```

##### Responses

###### Status: 200 OK

\####### Content-Type: application/json

- **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

#### Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.

- **Method:** `POST`
- **Path:** `/acts/flamboyant_leaf~dataset2gpt/run-sync`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`datasetId`**

  `string` — Optional: Dataset ID for testing. Integration uses payload automatically.

- **`focusTopic`**

  `string` — Optional: Specific topic or aspect to focus on in the summary.

- **`openaiApiKey`**

  `string` — Your OpenAI API key for generating summaries

- **`summaryLength`**

  `integer`, default: `1000` — Length of the summary in words (max 2000).

- **`targetEmail`**

  `string` — Optional: Email address to send the summary to.

**Example:**

```
{
  "datasetId": "",
  "targetEmail": "",
  "focusTopic": "",
  "summaryLength": 1000,
  "openaiApiKey": ""
}
```

##### Responses

###### Status: 200 OK

### Schemas

#### inputSchema

- **Type:**`object`

* **`datasetId`**

  `string` — Optional: Dataset ID for testing. Integration uses payload automatically.

* **`focusTopic`**

  `string` — Optional: Specific topic or aspect to focus on in the summary.

* **`openaiApiKey`**

  `string` — Your OpenAI API key for generating summaries

* **`summaryLength`**

  `integer`, default: `1000` — Length of the summary in words (max 2000).

* **`targetEmail`**

  `string` — Optional: Email address to send the summary to.

**Example:**

```
{
  "datasetId": "",
  "targetEmail": "",
  "focusTopic": "",
  "summaryLength": 1000,
  "openaiApiKey": ""
}
```

#### runsResponseSchema

- **Type:**`object`

* **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

## Dataset2GPT

**Dataset2GPT** reads any dataset on Apify and uses GPT-based AI to perform a variety of text-processing tasks—such as summarization, analysis, classification, or transformation. Whether you want a comprehensive 2,000-word synopsis, key insights, sentiment analysis, or custom NLP transformations, Dataset2GPT can handle it.

> For a complete tutorial on how to integrate Dataset2GPT to analyse Reddit comments in bulk, please see our tutorial using our gpt-powered summary actor [here](https://dev.to/airabbit/summarize-social-media-with-apify-and-summaryxl-4obh).

### Features

- **GPT-Powered Processing** using GPT-4o-mini for best price/performance ratio
- **Flexible Output Length**: Control how long or detailed the result should be (100–2,000 words or more)
- **Task Focus**: Provide a specific topic or angle for the AI to focus on (e.g., “marketing analysis,” “customer feedback,” “sentiment extraction”)
- **Token Usage & Cost Tracking**: Monitor how many tokens the AI uses and the associated cost
- **PDF Export** with Markdown formatting for easy sharing
- **Optional Email Delivery** of processed results

### How It Works

1. **Input**: Your Apify actor collects or generates data in a dataset.
2. **Processing**: Dataset2GPT reads the dataset content as plain text, then uses GPT to perform your desired task.
3. **AI Output**: The AI generates the requested output (e.g., summary, analysis, transformation).
4. **Delivery**: Retrieve the output in multiple formats (dataset record, PDF, email).

### Benefits

- **Rapid Insights**: Quickly extract meaning or structure from large datasets.
- **Plain Text Processing**: No complex parsing required—just feed text.
- **Seamless Integration**: Works with *any* Apify actor that outputs to a dataset.
- **Automation**: Set up once and let Dataset2GPT handle the heavy lifting.

### Perfect For

- Market Researchers
- Social Media Managers
- Data Scientists
- Business Intelligence Teams
- Content Analysts
- Anyone working with scraped or collected data

### Input Parameters

| Parameter    | Type    | Required | Default | Description                                                                                     |
|--------------|---------|----------|---------|-------------------------------------------------------------------------------------------------|
| datasetId    | string  | No       | -       | Dataset ID for testing. When used as an integration, dataset ID is handled automatically         |
| openaiApiKey | string  | Yes      | -       | Your OpenAI API key for GPT-based processing                                                    |
| summaryLength| integer | No       | 1000    | Desired length of output in words (100–2000). You can also use it for controlling output detail  |
| focusTopic   | string  | No       | -       | Specific topic or angle to guide the AI’s processing (e.g., “sentiment analysis” or “key points”)|
| targetEmail  | string  | No       | -       | Email address to send the results to (requires EMAIL\_SUPPORT=true)                               |

### Output Formats

1. **Dataset Record**
   ```json
   {
       "output": "The AI-generated text (e.g., summary, analysis, transformations)...",
       "tokenUsage": {
           "promptTokens": 1234,
           "completionTokens": 567,
           "totalTokens": 1801
       },
       "costs": {
           "promptCost": 0.001234,
           "completionCost": 0.000567,
           "totalCost": 0.001801
       }
   }
   ```
   - The `output` field contains the GPT-processed text.
   - Token usage and cost breakdown are provided for transparency.

2. **PDF Output**
   - Stored in a key-value store under the `OUTPUT` key.
   - Includes Markdown formatting for better readability.
   - Downloadable via the Apify console or API.

3. **Email Delivery** (Optional)
   - Sends the GPT output in HTML and plain text formats.
   - Requires `EMAIL_SUPPORT=true` and a valid `targetEmail`.

### Getting Started

1. **Add Dataset2GPT to Your Apify Actor**: For example, if you have an actor scraping Reddit or Twitter, attach Dataset2GPT as an integration step.
2. **Use the Default Dataset**: In your input configuration, set `"datasetId": "{{resource.defaultDatasetId}}"` to automatically consume the scraped data.
3. **Run Your Apify Actor**: Once it finishes, Dataset2GPT will read the dataset and produce the requested AI output.
4. **Retrieve Your Results**:
   - Download from the dataset.
   - Grab the PDF from the key-value store.
   - Or check your inbox if you enabled email delivery.

### Usage Examples

#### As an Integration (Recommended)

```json
{
    "openaiApiKey": "your-openai-api-key",
    "summaryLength": 1500,
    "focusTopic": "product feedback analysis"
}
```

> Here, Dataset2GPT will generate a ~1500-word analysis focusing on product feedback.

#### For Testing

```json
{
    "datasetId": "your-dataset-id",
    "openaiApiKey": "your-openai-api-key",
    "summaryLength": 1000
}
```

> Useful for local testing. Specify a known `datasetId`.

#### With Email Delivery

```json
{
    "openaiApiKey": "your-openai-api-key",
    "targetEmail": "user@example.com",
    "focusTopic": "sentiment extraction"
}
```

> Generates text focusing on sentiments and sends it to `user@example.com`.

### Environment Variables

- `EMAIL_SUPPORT`: Enable/disable email functionality (default: true)
- `MAX_PARALLEL_REQUESTS`: Controls parallel API requests (default: 10)
- `PROMPT_TOKEN_COST`: Cost per 1M prompt tokens (default: 0.150)
- `COMPLETION_TOKEN_COST`: Cost per 1M completion tokens (default: 0.075)

***

With **Dataset2GPT**, turn any dataset into meaningful insights, summaries, transformations, or advanced NLP tasks—powered by GPT.
