public void ListCustomPrebuiltEntities()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp    = await client.Versions.ListAsync(testAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Communication"
                };

                var results          = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomain);
                var prebuiltEntities = await client.Model.ListCustomPrebuiltEntitiesAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                Assert.Contains(prebuiltEntities, entity => entity.CustomPrebuiltDomainName == prebuiltDomain.DomainName);
            });
        }
        public void ListCustomPrebuiltModels()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp    = await client.Versions.ListAsync(testAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Calendar"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                var validTypes = new string[] { "Intent Classifier", "Closed List Entity Extractor", "Entity Extractor" };

                Assert.True(prebuiltModels.All(m => validTypes.Contains(m.ReadableType)));
            });
        }
        public void AddCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp         = await client.Versions.ListAsync(testAppId);
                var version             = versionsApp.FirstOrDefault().Version;
                var prebuiltDomainToAdd = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Communication"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomainToAdd);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                foreach (var result in prebuiltModels)
                {
                    Assert.Contains(results, m => m == result.Id);
                }
            });
        }
Ejemplo n.º 4
0
        public void ListCustomPrebuiltIntents()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results         = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltIntents = await client.Model.ListCustomPrebuiltIntentsAsync(GlobalAppId, version);

                Assert.Contains(prebuiltIntents, entity => entity.CustomPrebuiltDomainName == prebuiltDomain.DomainName);
            });
        }
Ejemplo n.º 5
0
        public void ListCustomPrebuiltModels()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Calendar"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                var validTypes = new string[] { "Intent Classifier", "Entity Extractor" };

                Assert.True(prebuiltModels.All(m => validTypes.Contains(m.ReadableType)));
            });
        }
Ejemplo n.º 6
0
        public void AddCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var versionsApp         = await client.Versions.ListAsync(GlobalAppId);
                var version             = versionsApp.FirstOrDefault().Version;
                var prebuiltDomainToAdd = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomainToAdd);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                foreach (var result in results)
                {
                    Assert.True(result != Guid.Empty);
                    Assert.Contains(prebuiltModels, m => m.Id.Equals(result));
                }
            });
        }
Ejemplo n.º 7
0
        public void DeleteCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                Assert.Contains(prebuiltModels, o => o.CustomPrebuiltDomainName == "Gaming");

                await client.Model.DeleteCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain.DomainName);

                prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                Assert.DoesNotContain(prebuiltModels, o => o.CustomPrebuiltDomainName == "Gaming");
            });
        }