Skip to content

NICEElevateAI/ElevateAIDotNetSDK

Repository files navigation

.Net core 6 SDK for ElevateAI

ElevateAI provides an API for Speech-to-text (ASR), behavioral analysis and sentiment analysis of voice interactions.

Example

  1. Signup and retrieve API token from ElevateAI.
  2. Declare an interaction. Provide a URI if you want ElevateAI to download the interaction via a Public URI.
  3. Retrieve Interaction ID from JSON response and store.
  4. Upload a file.
  5. Check status every 30 seconds using Interaction ID until status returns 'processed' or an error status.
  6. Retrieve results - phrase-by-phrase transcript, punctuated transcript, and AI results.
using ElevateAI.SDK;
using ElevateAI.SDK.Responses;


string token = "API-TOKEN";
string baseUrl = @"https://api.elevateai.com/v1/";
string langaugeTag = "en-us";
string vert = "default";
string transcriptionMode = "highAccuracy";
string localFilePath = @"\\my\localfile.wav";

//Step 1,2
var delcareResponse = ElevateAISDK.DeclareAudioInteraction(langaugeTag, vert, transcriptionMode, token, true, null, baseUrl);

//Step 3
var uploadResponse = ElevateAISDK.UploadFile(delcareResponse.InteractionIdentifier.Value.ToString(), token, localFilePath, baseUrl);


//Step 4
//Loop over status until processed
InteractionStatusResponse status = null;
while (true)
{
    status = ElevateAISDK.GetInteractionStatus(delcareResponse.InteractionIdentifier.Value.ToString(), token, baseUrl);
    if (status.InteractionStatus.status == "processed" || status.InteractionStatus.status == "fileUploadFailed" || status.InteractionStatus.status == "fileDownloadFailed" || status.InteractionStatus.status == "processingFailed")
    {
        break;
    }
    Thread.Sleep(30000);
}

//step 5
//get results after file is processed 
var puncTranscript = ElevateAISDK.GetInteractionPunctuatedTranscript(delcareResponse.InteractionIdentifier.Value.ToString(), token, baseUrl);
var wordByWordTranscript = ElevateAISDK.GetInteractionWordByWordTranscript(delcareResponse.InteractionIdentifier.Value.ToString(), token, baseUrl);
var aiResults = ElevateAISDK.GetAIResults(delcareResponse.InteractionIdentifier.Value.ToString(), token, baseUrl);