# Label the sentiment of product reviews with an LLM

**Use case:** 

Give each review a sentiment label (positive, negative or mixed), validated against your list. Only the review text goes to the model; ids come along for joins. Swap in your own reviews or a review scraper's dataset.

## Input

```json
{
  "rows": [
    {
      "id": "r1",
      "product": "Steel kettle",
      "text": "Boils fast and the handle stays cool. Exactly what I wanted for the price."
    },
    {
      "id": "r2",
      "product": "Steel kettle",
      "text": "Started leaking from the base after two weeks, and support never answered my emails."
    },
    {
      "id": "r3",
      "product": "Desk lamp",
      "text": "Lovely warm light and easy to assemble, but the switch feels flimsy."
    }
  ],
  "textFields": [
    "text"
  ],
  "labels": [
    "positive",
    "negative",
    "mixed"
  ],
  "model": "openai/gpt-4.1-mini",
  "keepFields": [
    "id"
  ],
  "onlyNew": false,
  "maxTokensPerRow": 4000
}
```

## Output

```json
{
  "sourceIndex": {
    "label": "Row",
    "format": "integer"
  },
  "kept": {
    "label": "Kept fields",
    "format": "object"
  },
  "valid": {
    "label": "Valid",
    "format": "boolean"
  },
  "data": {
    "label": "Answer",
    "format": "object"
  },
  "errors": {
    "label": "Errors",
    "format": "array"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The AI for Every Row: Bulk LLM to Classify & Summarize Datasets Actor is ready to run with the inputs already set for "Label the sentiment of product reviews with an LLM". [Sign up or log in](https://console.apify.com/create-task-from-example/ogukpJejfr6ODMgYB) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Label the sentiment of product reviews with an LLM" task

The AI for Every Row: Bulk LLM to Classify & Summarize Datasets Actor will start running based on the input automatically. You can also change all the input fields, like rows (json array), text fields (the only fields sent to the model), and more, to match your specific use case.

### 3. Receive the "Label the sentiment of product reviews with an LLM" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as row, kept fields, valid, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Label the sentiment of product reviews with an LLM" task via API](https://apify.com/humble-echidna/ai-rows.md).

## About this Actor

This example demonstrates how to use [AI for Every Row: Bulk LLM to Classify & Summarize Datasets](https://apify.com/humble-echidna/ai-rows.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/humble-echidna/ai-rows.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/humble-echidna/ai-rows.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
