private static async Task Run(string question) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); var almeClient = new AlmeClient(new Uri("https://askjenn.alaskaair.com/")); // Setup the request ConverseRequest req = new ConverseRequest(); req.channel = "Console"; req.origin = "Typed"; req.parameters = new ConverseRequestParameters(); req.question = question; // Call the Converse endpoint var res = await almeClient.ConverseAsync(req); stopWatch.Stop(); // Write the response out to the console Console.WriteLine(res.text); Console.WriteLine(); Console.WriteLine(string.Format("Time to Answer: {0}", stopWatch.Elapsed)); Console.WriteLine(JsonConvert.SerializeObject(res)); }
private async Task <SpeechletResponse> BuildAskJennResponseAsync(Intent intent, Session session) { var almeClient = new AlmeClient(new Uri("https://askjenn.alaskaair.com/")); // Setup the request ConverseRequest req = new ConverseRequest(); req.channel = "Console"; req.origin = "Typed"; req.parameters = new ConverseRequestParameters(); Slot question = intent.Slots["Question"]; Logger.Info($"Question={question.Value.ToString()}"); req.question = question.Value.ToString(); // Call the Converse endpoint var res = await almeClient.ConverseAsync(req); return(BuildSpeechletResponse(intent.Name, res.text, false)); }