public void DifferentAgentsTest()
		{
			var query = "I want pizza";

			{
				var dataService = CreateDataService();

				var request = new AIRequest(query);
				
				var response = dataService.Request(request);
				Assert.IsNotNull(response.Result);
				Assert.AreEqual("pizza", response.Result.Action);
				
			}

			{
				var config = new AIConfiguration(SUBSCRIPTION_KEY, "968235e8e4954cf0bb0dc07736725ecd", SupportedLanguage.English);
				var dataService = new AIDataService(config);
				var request = new AIRequest(query);
				
				var response = dataService.Request(request);
				Assert.IsNotNull(response.Result);
				Assert.IsTrue(string.IsNullOrEmpty(response.Result.Action));
				
			}

		}
Example #2
0
        public ApiAi(AIConfiguration config)
        {
            this.config = config;

            dataService = new AIDataService(this.config);
        }
Example #3
0
		public ApiAi(AIConfiguration config)
		{
			this.config = config;

			dataService = new AIDataService(this.config);
		}
 protected AIService(AIConfiguration config)
 {
     this.config = config;
     DataService = new AIDataService(config);
 }
Example #5
0
 public SystemRecognitionService(AIConfiguration config)
 {
     this.config = config;
     dataService = new AIDataService(config);
 }
 public SystemRecognitionService(AIConfiguration config)
 {
     this.config = config;
     dataService = new AIDataService(config);
 }
		public void SessionTest()
		{
			var config = new AIConfiguration(SUBSCRIPTION_KEY, ACCESS_TOKEN, SupportedLanguage.English);
			
			var firstService = new AIDataService(config);
			var secondService = new AIDataService(config);

			{
				var weatherRequest = new AIRequest("weather");
				var weatherResponse = MakeRequest(firstService, weatherRequest);
                Assert.IsNotNull(weatherResponse);
			}
			
			{
				var checkSecondRequest = new AIRequest("check weather");
				var checkSecondResponse = MakeRequest(secondService, checkSecondRequest);
                Assert.IsEmpty(checkSecondResponse.Result.Action);
			}
			
			{
				var checkFirstRequest = new AIRequest("check weather");
				var checkFirstResponse = MakeRequest(firstService, checkFirstRequest);
				Assert.IsNotNull(checkFirstResponse.Result.Action);
				Assert.IsTrue(checkFirstResponse.Result.Action.Equals("checked", StringComparison.InvariantCultureIgnoreCase));
			}
		}
	    private AIDataService CreateDataService()
	    {
	        var config = new AIConfiguration(SUBSCRIPTION_KEY, ACCESS_TOKEN, SupportedLanguage.English);
	        var dataService = new AIDataService(config);
	        return dataService;
	    }
		private AIResponse MakeRequest(AIDataService service, AIRequest request)
		{
			var aiResponse = service.Request(request);
			Assert.IsNotNull(aiResponse);
			Assert.IsFalse(aiResponse.IsError);
			Assert.IsFalse(string.IsNullOrEmpty(aiResponse.Id));
			Assert.IsNotNull(aiResponse.Result);
			return aiResponse;
		}
        public void ComplexParameterTest()
        {
            var config = new AIConfiguration(SUBSCRIPTION_KEY, 
                "23e7d37f6dd24e4eb7dbbd7491f832cf", // special agent with domains
                SupportedLanguage.English);
            
            var dataService = new AIDataService(config);

            var aiRequest = new AIRequest("Turn off TV at 7pm");
            var response = MakeRequest(dataService, aiRequest);

            Assert.AreEqual("domains", response.Result.Source);
            Assert.AreEqual("smarthome.appliances_off", response.Result.Action);

            var actionCondition = response.Result.GetJsonParameter("action_condition");

            var timeToken = actionCondition.SelectToken("time");
            Assert.IsNotNull(timeToken);
        }
Example #11
0
 protected AIService(AIConfiguration config)
 {
     this.config = config;
     DataService = new AIDataService(config);
 }