Пример #1
0
        public async Task AnalyzeConversationOrchestrationPredictionLuisAsync()
        {
            ConversationAnalysisClient client = Client;

            Response <AnalyzeConversationTaskResult> response = await client.AnalyzeConversationAsync(
                "Reserve a table for 2 at the Italian restaurant.",
                TestEnvironment.OrchestrationProject);

            CustomConversationalTaskResult customConversationalTaskResult = response.Value as CustomConversationalTaskResult;
            var orchestratorPrediction = customConversationalTaskResult.Results.Prediction as OrchestratorPrediction;

            string             respondingProjectName = orchestratorPrediction.TopIntent;
            TargetIntentResult targetIntentResult    = orchestratorPrediction.Intents[respondingProjectName];

            if (targetIntentResult.TargetKind == TargetKind.Luis)
            {
                LuisTargetIntentResult luisTargetIntentResult = targetIntentResult as LuisTargetIntentResult;
                BinaryData             luisResponse           = luisTargetIntentResult.Result;

                Console.WriteLine($"LUIS Response: {luisResponse.ToString()}");
            }

            Assert.That(targetIntentResult.TargetKind, Is.EqualTo(TargetKind.Luis));
            Assert.That(orchestratorPrediction.TopIntent, Is.EqualTo("RestaurantIntent"));
        }
Пример #2
0
        public void AnalyzeConversationOrchestrationPredictionLuis()
        {
            ConversationAnalysisClient client = Client;

            Response <AnalyzeConversationResult> response = client.AnalyzeConversation(
                "Book me flight from London to Paris",
                TestEnvironment.OrchestrationProject);

            OrchestratorPrediction orchestratorPrediction = response.Value.Prediction as OrchestratorPrediction;

            #region Snippet:ConversationAnalysis_AnalyzeConversationOrchestrationPredictionLuis
            string             respondingProjectName = orchestratorPrediction.TopIntent;
            TargetIntentResult targetIntentResult    = orchestratorPrediction.Intents[respondingProjectName];

            if (targetIntentResult.TargetKind == TargetKind.Luis)
            {
                LuisTargetIntentResult luisTargetIntentResult = targetIntentResult as LuisTargetIntentResult;
                BinaryData             luisResponse           = luisTargetIntentResult.Result;

                Console.WriteLine($"LUIS Response: {luisResponse.ToString()}");
            }
            #endregion

            Assert.That(targetIntentResult.TargetKind, Is.EqualTo(TargetKind.Luis));
            Assert.That(orchestratorPrediction.TopIntent, Is.EqualTo("FlightBooking"));
        }