[Sentiment] Analyzer
The Sentiment analyzer
operation is a simple prompt request operation to the configured LLM. It 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
.
Input Fields
Module Configuration
This refers to the Amazon Bedrock Configuration set up in the Getting Started section.
General Operation Field
- TextToAnalyze: Contains the prompt as plain text for the operation. This is the text which will be analyzed for its sentiment.
Additional Properties
- ModelName: The name of the LLM. You can select any model from the supported LLM Providers.
- Region: The aws region.
- Temperature: Specifies the dataset to be evaluated by the LLM using the provided template and instructions.
- Top K: The number of most-likely candidates that the model considers for the next token.
- Top P: The percentage of most-likely candidates that the model considers for the next token.
- MaxToken: The maximum number of token to consume to the output generation
XML Configuration
Below is the XML configuration for this operation:
<mac-bedrock:
sentiment-analyze
doc:name="Sentiment analyze"
doc:id="9a67cf44-5709-409d-9fc1-2ec34d6bf858"
config-ref="AWS"
TextToAnalyze="#[payload.data]"
/>
Output Field
This operation responds with a json
payload.
Example Output
This output has been converted to JSON.
{
"inputTextTokenCount": 117,
"results": [
{
"tokenCount": 7,
"outputText": "\nThe sentiment is positive.",
"completionReason": "FINISH"
}
]
}
- inputTextTokenCount: Token used to process the input.
- result:
- tokenCount: The number of token used to generate the output.
- outputText: The response from the LLM on the prompt sent.
- completionReason: The reason the response finished being generated. The following reasons are possible:
- FINISHED – The response was fully generated.
- LENGTH – The response was truncated because of the response length you set.
- STOP_CRITERIA_MET – The response was truncated because the stop criteria was reached.
- RAG_QUERY_WHEN_RAG_DISABLED – The feature is disabled and cannot complete the query.
- CONTENT_FILTERED – The contents were filtered or removed by the content filter applied.
Example Use Cases
This operation is particularly useful in scenarios where you need to analyze the sentiment of text, such as:
- Customer Feedback Analysis: Determining whether customer feedback is positive, negative, or neutral.
- Social Media Monitoring: Analyzing the sentiment of social media posts or comments to gauge public opinion.
- Market Research: Assessing the sentiment of survey responses or market research data.