Contact Us 1-800-596-4880

Configuring Sentiment Operations

Configure the Sentiment Analyzer Operation

Use the Sentiment analyzer operation to send a simple prompt request to the configured LLM. This operation uses a plain text prompt as input and responds with a sentiment for the input text. The sentiment value can be NEUTRAL, POSITIVE, or NEGATIVE.

To configure the Sentiment analyzer operation:

  1. Select the operation on the Studio canvas.

  2. In the General properties section, enter plain text to analyze for its sentiment in the Prompt field.

This is the XML configuration for this operation:

<ms-aichain:sentiment-analyze
  doc:name="Sentiment analyze"
  doc:id="cad4ef27-5c85-47f7-a68c-f666809b0846"
  config-ref="MAC_AI_Llm_configuration"
  data="#[payload.inputText]"
/>

Output Configuration

This operation responds with a JSON payload that contains the sentiment of the input text. Additionally, attributes such as token usage and sentiment details are included as part of the metadata (attributes) but not within the main payload.

This is an example response of the JSON payload:

{
    "response": "POSITIVE"
}

Along with the JSON payload, the operation returns attributes, which include information about token usage, for example:

{
  "tokenUsage": {
      "outputCount": 2,
      "totalCount": 39,
      "inputCount": 37
  },
  "additionalAttributes": {
      "isPositive": "false"
  }
}
View on GitHub