---
agentTools:
  projectIndex: https://preemo.readme.io/llms.txt
---

# Sentiment analysis

Analyzes text to determine the emotional tone of the message.

# OpenAPI definition

```json
{
  "externalDocs": {
    "description": "Gradient AI documentation",
    "url": "https://docs.gradient.ai"
  },
  "info": {
    "contact": {
      "email": "support@gradient.ai",
      "name": "Gradient AI Support",
      "url": "https://docs.gradient.ai/discuss"
    },
    "description": "Interface for interacting with Gradient AI.",
    "title": "Gradient AI API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "security": [
    {
      "AccessToken": []
    }
  ],
  "servers": [
    {
      "description": "Production endpoint",
      "url": "https://api.gradient.ai/api"
    },
    {
      "url": "http://localhost:3026/api"
    }
  ],
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "components": {
    "securitySchemes": {
      "AccessToken": {
        "scheme": "bearer",
        "type": "http"
      }
    },
    "schemas": {
      "AnalyzeSentimentSuccess": {
        "type": "object",
        "properties": {
          "sentiment": {
            "type": "string",
            "enum": [
              "negative",
              "neutral",
              "positive"
            ]
          }
        },
        "required": [
          "sentiment"
        ]
      },
      "AnalyzeSentimentError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "message"
        ]
      },
      "AnalyzeSentimentBodyParams": {
        "type": "object",
        "properties": {
          "document": {
            "type": "string",
            "minLength": 1,
            "description": "The document that will be analyzed to determine the sentiment."
          },
          "examples": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "document": {
                  "type": "string",
                  "minLength": 1
                },
                "sentiment": {
                  "type": "string",
                  "enum": [
                    "negative",
                    "neutral",
                    "positive"
                  ]
                }
              },
              "required": [
                "document",
                "sentiment"
              ]
            },
            "description": "Example pairs of documents and sentiments."
          }
        },
        "required": [
          "document"
        ]
      }
    }
  },
  "paths": {
    "/blocks/analyze-sentiment": {
      "post": {
        "description": "Analyzes text to determine the emotional tone of the message.",
        "operationId": "AnalyzeSentiment",
        "summary": "Sentiment analysis",
        "tags": [
          "Blocks"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "x-gradient-workspace-id",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyzeSentimentBodyParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyzeSentimentSuccess"
                }
              }
            }
          },
          "4XX": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyzeSentimentError"
                }
              }
            }
          }
        }
      }
    }
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 201,
      "2": 83,
      "3": 144,
      "4": 228,
      "5": 32,
      "6": 103,
      "7": 0,
      "8": 117,
      "9": 236,
      "10": 84,
      "11": 142
    }
  }
}
```