Class: LetsDiscussRetrieveService

LetsDiscussRetrieveService()

The Let's Discuss module allows the user to have a conversation with the AI about the content provided by the user. The main difference between this module and the Question Answering module is that Let's Discuss keeps a history of the interactions. LetsDiscuss service to be used for retrieving sessions.

Constructor

new LetsDiscussRetrieveService()

Source:

Methods

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

Parameters:
Name Type 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.
return_messages boolean When set to true, in addition to returning all the session records, it will also return all the messages associated with each session.
Source:
Returns:
sessions - dictionary list
List of sessions. Each session contains the following data:
context: The content discussed in the session.
session_id: Session's ID.
messages: If return_messages is true, this list will contain a list of dictionaries representing the interactions between the system and the user. Each dictionary contains the user's query, the system's response and the interaction's ID as message_id, which is an integer indicating their order.
Type
Promise.<Object>
Example
import { SoffosServices } from "soffosai";

const my_apiKey = "Token <put your api key here>";
const service = new SoffosServices.LetsDiscussRetrieveService({apiKey:my_apiKey});
let response = await service.call('me again', true);
console.log(JSON.stringify(response, null, 2));

// returns
// {
//     "sessions": [
//       {
//         "context": "The James Webb Space Telescope is the largest, most powerful space telescope ever built.     It will allow scientists to look at what our universe was like about 200 million years     after the Big Bang. The telescope will be able to capture images of some of the first     galaxies ever formed. It will also be able to observe objects in our solar system from     Mars outward, look inside dust clouds to see where new stars and planets are forming     and examine the atmospheres of planets orbiting other stars.",
//         "session_id": "b658686f8b834b3f86d5218a4549e1c4",
//         "messages": [
//           {
//             "query": "Where can I see the photos taken by this telescope?",
//             "response": "The photos taken by the James Webb Space Telescope will be available to the public on the official website of the telescope.",
//             "message_id": 0
//           },
//           {
//             "query": "What is the purpose of observing this?",
//             "response": "The James Webb Space Telescope will allow scientists to look at what our universe was like about 200 million years after the Big Bang. It will also be able to observe objects in our solar system from Mars outward, look inside dust clouds to see where new stars and planets are forming and examine the atmospheres of planets orbiting other stars.",
//             "message_id": 1
//           }
//         ]
//       }
//     ],
//     "session_count": 1
// }

setInputConfigs(name, return_messagesopt)

Parameters:
Name Type Attributes Default Description
name string Reference name of this Service. It will be used by the Pipeline to reference this Service.
return_messages boolean | InputConfig <optional>
true When set to true, in addition to returning all the session records, it will also return all the messages associated with each session.
Source: