diff --git a/lemur-feedback/file.cs b/lemur-feedback/file.cs new file mode 100644 index 0000000..4709cf9 --- /dev/null +++ b/lemur-feedback/file.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +public class LemurFetcher +{ + // Function to make a POST request to LeMUR + public async Task PostLemur(string apiToken, string transcriptId) + { + // The URL of the AssemblyAI API endpoint + string url = "https://api.staging.assemblyai-labs.com/beta/generate/summary"; + + // Create a new dictionary with the audio URL + var data = new Dictionary() + { + { "transcript_ids", new List{transcriptId} }, + { "context", "this is a sales call" }, + { "answer_format", "short summary"} + }; + + // Create a new HttpClient to make the HTTP requests + using (var client = new HttpClient()) + { + // Set the "authorization" header with your API token + client.DefaultRequestHeaders.Add("authorization", apiToken); + + // Create a new JSON payload with the audio URL + var content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); + + // Send a POST request with the JSON payload to the API endpoint + HttpResponseMessage response = await client.PostAsync(url, content); + + // Read the response content as a string + var responseContent = await response.Content.ReadAsStringAsync(); + + // Deserialize the response content into a dynamic object + var responseJson = JsonConvert.DeserializeObject(responseContent); + + // Get the LeMUR response from the output JSON + string lemurResponse = responseJson.response; + return lemurResponse; + } + } +} + +public class Program +{ + public static void Main(string[] args) + { + string apiToken = "{your_api_token}"; + string transcriptId = "{transcript_id}"; + + LemurFetcher lemurFetcher = new LemurFetcher(); + + try + { + // Fetch the LeMUR output using the PostLemur function + string lemurOutput = lemurFetcher.PostLemur(apiToken, transcriptId); + + // Print the LeMUR output to the console + Console.WriteLine(lemurOutput); + } + catch (Exception ex) + { + // Print the error message if an exception is caught + Console.WriteLine($"Error: {ex.Message}"); + } + } +} diff --git a/lemur-feedback/file.php b/lemur-feedback/file.php new file mode 100644 index 0000000..150f08a --- /dev/null +++ b/lemur-feedback/file.php @@ -0,0 +1,50 @@ + [$transcript_id], + "context" => "this is a sales call", + "answer_format" => "short summary" + ]; + + // Initialize a cURL session for the API endpoint + $curl = curl_init($url); + + // Set the options for the cURL session for the API request + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + + // Execute the cURL session and decode the response + $response = json_decode(curl_exec($curl), true); + + // Close the cURL session + curl_close($curl); + + // Get the LeMUR output from the API response + $lemur_response = $response['response']; +} + +try { + $api_token = "YOUR-API-TOKEN"; + $transcript_id = "TRANSCRIPT-ID"; + + $lemur_output = lemur_post($api_token, $transcript_id); + echo $lemur_output; +} catch (Exception $e) { + echo 'Error: ' . $e->getMessage(); +} + +?> diff --git a/lemur-feedback/file.py b/lemur-feedback/file.py new file mode 100644 index 0000000..a3c585b --- /dev/null +++ b/lemur-feedback/file.py @@ -0,0 +1,39 @@ +import requests +import json +import sys + +def post_lemur(api_token, transcript_id): + # Set the API endpoint for creating a new LeMUR response + url = "https://api.staging.assemblyai-labs.com/beta/generate/summary" + + # Set the headers for the request, including the API token and content type + headers = { + "authorization": api_token, + "content-type": "application/json" + } + + # Set the data for the request, including the ID of the transcript to be analyzed + data = { + "transcript_ids": [ + transcript_id + ], + "context": "this is a sales call", + "answer_format": "short summary" + } + + # Send a POST request to the API to create a new transcript, passing in the headers and data + response = requests.post(url, json=data, headers=headers) + + # Get the LeMUR response from the JSON data + lemur_response = response.json()['response'] + + return lemur_response + +your_api_token = "{your_api_token}" +transcript_id = sys.argv[1] + +# Get output from LeMUR +lemur_output = post_lemur(your_api_token, transcript_id) + +# Print the summary +print(lemur_output) diff --git a/lemur-feedback/file.rb b/lemur-feedback/file.rb new file mode 100644 index 0000000..a7b0e22 --- /dev/null +++ b/lemur-feedback/file.rb @@ -0,0 +1,52 @@ +require "net/http" +require "json" + +# Function that sends a request to the LeMUR API +def post_lemur(api_token, transcript_id) + # The URL for the AssemblyAI API + url = "https://api.staging.assemblyai-labs.com/beta/generate/summary" + + headers = { + # The authorization header with your AssemblyAI API token + "authorization" => api_token, + + # The content-type header for the request body + "content-type" => "application/json" + } + + data = { + "transcript_ids" => [transcript_id], + "context" => "this is a sales call", + "answer_format" => "short summary" + } + + # Parse the API endpoint URL into a URI object + uri = URI.parse(url) + + # Create a new Net::HTTP object for making the API request + http = Net::HTTP.new(uri.host, uri.port) + + # Use SSL for secure communication + http.use_ssl = true + + # Create a new HTTP POST request with the API endpoint URL and headers + request = Net::HTTP::Post.new(uri.request_uri, headers) + + # Set the request body to the data hash, converted to JSON format + request.body = data.to_json + + # Send the API request and store the response object + response = http.request(request) + + # Get the LeMUR response from the JSON + parsed_json = JSON.parse(response.body) + lemur_response = parsed_json["response"] + return lemur_response +end + +# Replace {your_api_token} with your actual API token +api_token = "{your_api_token}" +transcript_id = "{transcript_id}" + +lemur_output = post_lemur(api_token, transcript_id) +puts lemur_output diff --git a/lemur-feedback/file.ts b/lemur-feedback/file.ts new file mode 100644 index 0000000..cd029e5 --- /dev/null +++ b/lemur-feedback/file.ts @@ -0,0 +1,31 @@ +import axios from 'axios'; + +const API_TOKEN = 'your_api_token'; +const TRANSCRIPT_ID = 'transcript_id'; + +// Function that sends a request to the Lemur API +async function lemurPost(api_token: string, transcriptId: string) { + const headers = { + authorization: api_token, + 'content-type': 'application/json', + }; + + // Send a POST request to the LeMUR API with the transcript ID in the request body + const response = await axios.post('https://api.staging.assemblyai-labs.com/beta/generate/summary', { + "transcript_ids": [ + transcriptId + ], + "context": "this is a sales call", + "answer_format": "short summary" + }, { headers }); + + // Retrieve the LeMUR API response + return response.data["response"]; +} + +async function main() { + const lemurResponse = await lemurPost(API_TOKEN, TRANSCRIPT_ID); + console.log(lemurResponse); +} + +main(); diff --git a/lemur-qa/file.cs b/lemur-qa/file.cs new file mode 100644 index 0000000..00f26d9 --- /dev/null +++ b/lemur-qa/file.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +public class LemurFetcher +{ + // Function to make a POST request to LeMUR + public async Task PostLemur(string apiToken, string transcriptId) + { + // The URL of the AssemblyAI API endpoint + string url = "https://api.staging.assemblyai-labs.com/beta/generate/question-answer"; + + // Create a new dictionary with the LeMUR API parameters + var PostBodyJson = @"{""transcript_ids"": [" + @"], ""questions"": [{""question"": ""Is this caller a qualified buyer?"", ""answer_options"": [""Yes"", ""No""]}, {""question"": ""Classify the call into one of the following scenarios"", ""answer_options"": [""Follow-up"", ""2nd Call""], ""context"": ""Anytime it is clear that the caller is calling back a second time about the same topic""}, {""question"": ""What is the caller\'s mood?"", ""answer_format"": ""Short sentence""}]}"; + var data = JsonSerializer.Deserialize>(PostBodyJson); + + // Create a new HttpClient to make the HTTP requests + using (var client = new HttpClient()) + { + // Set the "authorization" header with your API token + client.DefaultRequestHeaders.Add("authorization", apiToken); + + // Create a new JSON payload with the audio URL + var content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); + + // Send a POST request with the JSON payload to the API endpoint + HttpResponseMessage response = await client.PostAsync(url, content); + + // Read the response content as a string + var responseContent = await response.Content.ReadAsStringAsync(); + + // Deserialize the response content into a dynamic object + var responseJson = JsonConvert.DeserializeObject(responseContent); + + // Get the LeMUR response from the output JSON + string lemurResponse = responseJson.response; + return lemurResponse; + } + } +} + +public class Program +{ + public static void Main(string[] args) + { + string apiToken = "{your_api_token}"; + string transcriptId = "{transcript_id}"; + + LemurFetcher lemurFetcher = new LemurFetcher(); + + try + { + // Fetch the LeMUR output using the PostLemur function + string lemurOutput = lemurFetcher.PostLemur(apiToken, transcriptId); + + // Print the LeMUR output to the console + Console.WriteLine(lemurOutput); + } + catch (Exception ex) + { + // Print the error message if an exception is caught + Console.WriteLine($"Error: {ex.Message}"); + } + } +} diff --git a/lemur-qa/file.php b/lemur-qa/file.php new file mode 100644 index 0000000..0a7e09b --- /dev/null +++ b/lemur-qa/file.php @@ -0,0 +1,69 @@ + [$transcript_id], + "questions" => [ + [ + "question" => "Is this caller a qualified buyer?", + "answer_options" => [ + "Yes", + "No" + ] + ], + [ + "question" => "Classify the call into one of the following scenarios", + "answer_options" => [ + "Follow-up", + "2nd Call" + ], + "context" => "Anytime it is clear that the caller is calling back a second time about the same topic" + ], + [ + "question" => "What is the caller's mood?", + "answer_format" => "Short sentence" + ] + ] + ]; + + // Initialize a cURL session for the API endpoint + $curl = curl_init($url); + + // Set the options for the cURL session for the API request + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + + // Execute the cURL session and decode the response + $response = json_decode(curl_exec($curl), true); + + // Close the cURL session + curl_close($curl); + + // Get the LeMUR output from the API response + $lemur_response = $response['response']; +} + +try { + $api_token = "YOUR-API-TOKEN"; + $transcript_id = "TRANSCRIPT-ID"; + + $lemur_output = lemur_post($api_token, $transcript_id); + echo $lemur_output; +} catch (Exception $e) { + echo 'Error: ' . $e->getMessage(); +} + +?> diff --git a/lemur-qa/file.py b/lemur-qa/file.py new file mode 100644 index 0000000..820c232 --- /dev/null +++ b/lemur-qa/file.py @@ -0,0 +1,58 @@ +import requests +import json +import sys + +def post_lemur(api_token, transcript_id): + # Set the API endpoint for creating a new LeMUR response + url = "https://api.staging.assemblyai-labs.com/beta/generate/question-answer" + + # Set the headers for the request, including the API token and content type + headers = { + "authorization": api_token, + "content-type": "application/json" + } + + # Set the data for the request, including the ID of the transcript to be analyzed + data = { + "transcript_ids": [ + transcript_id + ], + "questions": [ + { + "question": "Is this caller a qualified buyer?", + "answer_options": [ + "Yes", + "No" + ] + }, + { + "question": "Classify the call into one of the following scenarios", + "answer_options": [ + "Follow-up", + "2nd Call" + ], + "context": "Anytime it is clear that the caller is calling back a second time about the same topic" + }, + { + "question": "What is the caller's mood?", + "answer_format": "Short sentence" + } + ] + } + + # Send a POST request to the API to create a new transcript, passing in the headers and data + response = requests.post(url, json=data, headers=headers) + + # Get the LeMUR response from the JSON data + lemur_response = response.json()['response'] + + return lemur_response + +your_api_token = "{your_api_token}" +transcript_id = sys.argv[1] + +# Get output from LeMUR +lemur_output = post_lemur(your_api_token, transcript_id) + +# Print the summary +print(lemur_output) diff --git a/lemur-qa/file.rb b/lemur-qa/file.rb new file mode 100644 index 0000000..cbf3e53 --- /dev/null +++ b/lemur-qa/file.rb @@ -0,0 +1,71 @@ +require "net/http" +require "json" + +# Function that sends a request to the LeMUR API +def post_lemur(api_token, transcript_id) + # The URL for the AssemblyAI API + url = "https://api.staging.assemblyai-labs.com/beta/generate/question-answer" + + headers = { + # The authorization header with your AssemblyAI API token + "authorization" => api_token, + + # The content-type header for the request body + "content-type" => "application/json" + } + + data = { + "transcript_ids" => [transcript_id], + "questions" => [ + { + "question" => "Is this caller a qualified buyer?", + "answer_options" => [ + "Yes", + "No" + ] + }, + { + "question" => "Classify the call into one of the following scenarios", + "answer_options" => [ + "Follow-up", + "2nd Call" + ], + "context" => "Anytime it is clear that the caller is calling back a second time about the same topic" + }, + { + "question" => "What is the caller's mood?", + "answer_format" => "Short sentence" + } + ] + } + + # Parse the API endpoint URL into a URI object + uri = URI.parse(url) + + # Create a new Net::HTTP object for making the API request + http = Net::HTTP.new(uri.host, uri.port) + + # Use SSL for secure communication + http.use_ssl = true + + # Create a new HTTP POST request with the API endpoint URL and headers + request = Net::HTTP::Post.new(uri.request_uri, headers) + + # Set the request body to the data hash, converted to JSON format + request.body = data.to_json + + # Send the API request and store the response object + response = http.request(request) + + # Get the LeMUR response from the JSON + parsed_json = JSON.parse(response.body) + lemur_response = parsed_json["response"] + return lemur_response +end + +# Replace {your_api_token} with your actual API token +api_token = "{your_api_token}" +transcript_id = "{transcript_id}" + +lemur_output = post_lemur(api_token, transcript_id) +puts lemur_output diff --git a/lemur-qa/file.ts b/lemur-qa/file.ts new file mode 100644 index 0000000..6577059 --- /dev/null +++ b/lemur-qa/file.ts @@ -0,0 +1,50 @@ +import axios from 'axios'; + +const API_TOKEN = 'your_api_token'; +const TRANSCRIPT_ID = 'transcript_id'; + +// Function that sends a request to the Lemur API +async function lemurPost(api_token: string, transcriptId: string) { + const headers = { + authorization: api_token, + 'content-type': 'application/json', + }; + + // Send a POST request to the LeMUR API with the transcript ID in the request body + const response = await axios.post('https://api.staging.assemblyai-labs.com/beta/generate/question-answer', { + "transcript_ids": [ + transcriptId + ], + "questions": [ + { + "question": "Is this caller a qualified buyer?", + "answer_options": [ + "Yes", + "No" + ] + }, + { + "question": "Classify the call into one of the following scenarios", + "answer_options": [ + "Follow-up", + "2nd Call" + ], + "context": "Anytime it is clear that the caller is calling back a second time about the same topic" + }, + { + "question": "What is the caller's mood?", + "answer_format": "Short sentence" + } + ] + }, { headers }); + + // Retrieve the LeMUR API response + return response.data["response"]; +} + +async function main() { + const lemurResponse = await lemurPost(API_TOKEN, TRANSCRIPT_ID); + console.log(lemurResponse); +} + +main();