Conversation summaries

Last updated: 2023-02-09Contributors
Edit this page

The Artificial Intelligence conversation summarization API allows you to summarize the contents of speaker-tagged audio transcript by extracting what is determined to be the most relevant parts of the conversation. The API provides two types of summaries:

  • Abstractive. The summary generated is a unique construction that attempts to convey the meaning of the text. This is ideal for generating an abstract of the specified text.
  • Extractive. The summary generated is a sequence of excerpts of the most relevant sentences. This is ideal for creating a list of highlights from a block of text.

The API also allows developers to optionally specify the start and end times, as well as a speaker ID in order to generate a summary from a portion of a larger previously diarized transcription, or to contrain the summary to a specific time period. '

Generating a summary from a block of text

Request parameters

Parameter Type Description
summaryType String Permitted values: Extractive (default), AbstractiveLong, AbstractiveShort, All. Specify All to compute both extractive and abstractive type of summaries.
utterances List[utterances-Data] List of speakerId, start, end and text object.

utterances-Data

Parameter Type Description
text String Text blob for summary.
speakerId String Speaker id for the text blob. Optional. Used in an abstractive summary to reference in the output.
start Number start time of the segment. Optional.
end Number start time of the segment. Optional.

Example code

After you have setup a simple web server to process the response, copy and paste the code from below in a file. In the process, make sure to edit the variables found in ALL CAPS to ensure your code runs properly.

const RC = require('@ringcentral/sdk').SDK;
require('dotenv').config();

// replace with your ngrok address below
const WEBHOOK_ADDRESS = "YOUR NGROK HTTPS URL" + "/webhook"; 

    // Initialize the RingCentral SDK and Platform
const rcsdk = new RC({
    'server':       process.env.RC_SERVER_URL,
    'clientId':     process.env.RC_CLIENT_ID,
    'clientSecret': process.env.RC_CLIENT_SECRET
});

const platform = rcsdk.platform();

// Authenticate with RingCentral Developer Platdorm using Developer's JWT Credential
platform.login({
     'jwt': process.env.RC_JWT
});

// Call the Speech to Text API right after login asynchronously
platform.on(platform.events.loginSuccess, () => {
    conversationSummarization();
});

async function conversationSummarization() {
    try {
        console.log("Calling RingCentral Conversational Summarization API");
        let resp = await platform.post("/ai/text/v1/async/summarize?webhook=" + WEBHOOK_ADDRESS, {
            "summaryType": "Extractive",
            "utterances": [
                {
                    "text": "A knowledge base is an online support library that contains useful information 
                             about your product or service and any related topics. Commonly referred to as 
                             a 'self-service' solution, a knowledge base lets your customers find answers 
                             to their support questions without having to speak to a person on your team 
                             (and taking up their precious time).  A knowledge base can include any variety 
                             of resources that help customers get the most from a product or service, 
                             including how-to guides, video tutorials, FAQs, white papers, case studies, 
                             and even user forums.  Unlike marketing materials and onboarding sequences, 
                             knowledge bases provide comprehensive and detailed information about all 
                             aspects of a company's products and customer service.  For example, you might 
                             include in-depth documentation about how to troubleshoot different product 
                             issues, as well as knowledge base articles explaining your payment structures 
                             and refund policies."
                }
            ]
        });
        console.log("Converation Summarization Job " + resp.statusText + " with HTTP status code " + resp.status);
    } 
    catch (e) {
        console.log("An Error Occurred : " + e.message);
    }
}

Run your sample code.

$ node index.js
import os,sys
import logging
import requests
from ringcentral import SDK
from dotenv import load_dotenv

# Load Enviroment variables
load_dotenv()

def conversationalSummary():
    # Endpoint to invoke Conversational Summary
    endpoint = "https://platform.devtest.ringcentral.com/ai/text/v1/async/summarize"
    # Webhook as Query Param
    querystring = {"webhook":os.getenv('WEBHOOK_ADDRESS')}
    # Payload
    payload = {
        "summaryType": "Extractive",
        "utterances": [
            {
                "text": """A knowledge base is an online support library that contains useful 
                        information about your product or service and any related topics. 
                        Commonly referred to as a 'self-service' solution, a knowledge base 
                        lets your customers find answers to their support questions without 
                        having to speak to a person on your team (and taking up their 
                        precious time).  A knowledge base can include any variety of 
                        resources that help customers get the most from a product or service, 
                        including how-to guides, video tutorials, FAQs, white papers, case 
                        studies, and even user forums.  Unlike marketing materials and 
                        onboarding sequences, knowledge bases provide comprehensive and 
                        detailed information about all aspects of a company's products and 
                        customer service.  For example, you might include in-depth 
                        documentation about how to troubleshoot different product issues, 
                        as well as knowledge base articles explaining your payment structures 
                        and refund policies."""
            }
        ]
    }

    try:
        # Instantiate Ringcentral SDK 
        rcsdk = SDK( os.getenv('RC_CLIENT_ID'),os.getenv('RC_CLIENT_SECRET'),os.getenv('RC_SERVER_URL'))
        platform = rcsdk.platform()
        # Login Using JWT
        platform.login( jwt=os.getenv('RC_JWT') );
        # Make HTTP POST call to the Conversational Summarization endpoint with the query string and payload
        response = platform.post(endpoint, payload, querystring);
        print(response.json());

    except Exception as e:
        print(e)

try:
    conversationalSummary()
except Exception as e:
    print(e)

Run your sample code.

$ python3 app.py

Example response

{
    "status": "Success",
    "response": {
        "summaries": [
            {
                "name": "Extractive",
                "values": [
                    {
                        "value": "Commonly referred to as a “self-service” solution, a knowledge base. 
                                  Lets your customers find answers to their support questions without 
                                  having to speak to a person on your team and taking up their precious 
                                  time.",
                        "start": 0.12,
                        "end": 1.12,
                        "speakerId": "",
                        "confidence": 0.5238
                    },
                    {
                        "value": "A knowledge base can include any variety of resources that help 
                                  customers get the most from a product or service, including howto 
                                  guides, video tutorials, Faqs, white papers, case studies and even 
                                  user forums.",
                        "start": 0.12,
                        "end": 1.12,
                        "speakerId": "",
                        "confidence": 0.5143
                    }
                ]
            }
        ]
    }
}

Summaries Object

Parameter Type Description
summaries List[Summary-Output-Unit] Summary-Output Unit object defined below

Summary-Output Unit

Parameter Type Description
name Enum Options: Extractive, AbstractiveLong, AbstractiveShort
values List[Summary-Timings-Unit] Summary-Output Unit object defined below

Summary-Timings Unit

Parameter Type Description
start Number Start time of the summary segment in seconds.
end Number End time of the summary segment in seconds.
value String Text of the summary segment.
confidence Number confidence score for the summary segment