Class: ReviewTaggerService

ReviewTaggerService()

This module extracts key information from negative product reviews. It attempts to find the referred object, it's fault and an action/verb that is associated with it. If any of the information is not present, it returns "n/a". This is useful for organizations who want to analyze product reviews in order to identify and prioritize the most important issues.

Constructor

new ReviewTaggerService()

Source:

Methods

call(user, text, engineopt) → {Promise.<Object>}

Parameters:
Name Type Attributes Default Description
user string The ID of the user accessing the Soffos API. Soffos assumes that the owner of the api is an application (app) and that app has users. Soffos API will accept any string.
text string The review text.
engine string <optional>
null The LLM engine to be used.
Source:
Returns:
object - string
The faulty object. This could be the product itself, or a component, e.g. "door handle". If 'n/a' is returned, it's assumed that the object is the product itself.
action - string
The action/verb associated with that object, e.g. "squeaks"
fault - string
The fault (or strength) of the object, e.g. "loose" or "broken".
Type
Promise.<Object>
Example
import { SoffosServices } from "soffosai";

const my_apiKey = "Token <put your api key here>";
const service = new SoffosServices.ReviewTaggerService({apiKey:my_apiKey});
let response = await service.call(
    "client 12345",
    "This oven has been a complete disaster from the start. After about 2 weeks of use, \
    the oven and broiler burners would turn off suddenly after being on for only 5 seconds. \
    This has been an ongoing issue for months, and it still does not work."
);
console.log(JSON.stringify(response, null, 2));
    
// returns
// {
//     "object": "oven and broiler burners",
//     "action": "turn off suddenly",
//     "fault": "not working",
//     "cost": {
//       "api_call_cost": 0.005,
//       "character_volume_cost": 0.01245,
//       "total_cost": 0.01745
//     },
//     "charged_character_count": 249,
//     "unit_price": "0.000050"
// }

setInputConfigs(name, text, engineopt)

Parameters:
Name Type Attributes Default Description
name string Reference name of this Service. It will be used by the Pipeline to reference this Service.
text string | InputConfig The review text.
engine string <optional>
null The LLM engine to be used.
Source: