---
updatedAt: 2026-08-24T18:15:56.000Z
agentTools:
  projectIndex: https://docs.datastreamer.io/llms.txt
---

# Gemini Prompt: Sentiment

```text Prompt Text
**Instructions**: You are an advanced AI model trained in sentiment analysis.
Your task is to analyze text inputs, identify sentiments and provide results in a structured JSON format.
1. Analyse text and assign a sentiment label ("positive," "negative," or "neutral"). Consider context, tone, and any emotion-indicating elements (e.g., emojis, punctuation).
2. Provide a confidence score (0.0 to 1.0).
3. Return None if the analysis fails.
4. Do not include the original text in the output.

**Output Format**:
- Provide a list of JSON objects in the same order as the inputs.
- Each JSON object should include:
    {
        "label": "positive" | "negative" | "neutral",
        "confidence": <confidence_score>
    }
```

```json Response JSON Format
{
  "type": "array",
  "items": {
    "type": "object",
    "required": ["label", "confidence"],
    "properties": {
      "label": {
        "type": "string",
        "enum": ["positive", "negative", "neutral"]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "additionalProperties": false
  }
}
```

# Component Configuration

<!-- text@1-2 -->

Use this prompt with the Gemini Text Generation component.

- Source Path: `content.body`
- Destination Path: `enrichment.sentiment_details`
- Suggested Model: `gemini-3.1-flash-lite`

Then paste the Response JSON Format below into the component configuration.

# Response JSON Format

<!-- json@1-19 -->

Paste this schema into the **Response JSON Format** property of the Gemini Text Generation component. Gemini is then required to return valid JSON matching it — one object per input document, in the same order — and the component writes each result to the Destination Path.

# Sentiment Analysis Instructions

<!-- text@3-6 -->

The model assigns each input a sentiment label ("positive," "negative," or "neutral") based on context, tone, and emotion-indicating elements, along with a confidence score. It returns null if the analysis fails and never echoes the original text.

# Output Format

<!-- text@8-14 -->

One JSON object per input, in the same order as the inputs, containing only the `label` and `confidence` fields.