protected async Task <LuisResponse> MakeCall2(string text, ILuisConfiguration configuration) { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", configuration.ApiKey); queryString["q"] = text; queryString["timezoneOffset"] = "0"; queryString["verbose"] = "true"; queryString["spellCheck"] = "false"; queryString["staging"] = "false"; var uri = "https://" + configuration.Domain + ".api.cognitive.microsoft.com/luis/v2.0/apps/" + configuration.ApiId + "?" + queryString; var response = await client.GetAsync(uri); var strResponseContent = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <LuisResponse>(strResponseContent); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="LuisNLUTrainClient"/> class. /// </summary> /// <param name="luisConfiguration">LUIS configuration.</param> /// <param name="luisSettings">LUIS settings.</param> /// <param name="luisClient">LUIS client.</param> public LuisNLUTrainClient(ILuisConfiguration luisConfiguration, LuisSettings luisSettings, ILuisTrainClient luisClient) { this.LuisConfiguration = luisConfiguration ?? throw new ArgumentNullException(nameof(luisConfiguration)); this.LuisSettings = luisSettings ?? throw new ArgumentNullException(nameof(luisSettings)); this.LuisClient = luisClient ?? throw new ArgumentNullException(nameof(luisClient)); this.LuisAppId = luisConfiguration.AppId; }
/// <summary> /// Initializes a new instance of the <see cref="LuisNLUTrainClient"/> class. /// </summary> /// <param name="luisConfiguration">LUIS configuration.</param> /// <param name="luisTemplate">LUIS app template.</param> /// <param name="luisClient">LUIS client.</param> public LuisNLUTrainClient(ILuisConfiguration luisConfiguration, LuisApp luisTemplate, ILuisTrainClient luisClient) { this.LuisConfiguration = luisConfiguration ?? throw new ArgumentNullException(nameof(luisConfiguration)); this.LuisTemplate = luisTemplate ?? throw new ArgumentNullException(nameof(luisTemplate)); this.LuisClient = luisClient ?? throw new ArgumentNullException(nameof(luisClient)); this.LuisAppId = luisConfiguration.AppId; this.LuisAppCreated = luisConfiguration.AppCreated; }
public LuisTestClient(ILuisConfiguration luisConfiguration) { this.LuisConfiguration = luisConfiguration ?? throw new ArgumentNullException(nameof(luisConfiguration)); var endpointCredentials = new ApiKeyServiceClientCredentials(luisConfiguration.EndpointKey); this.RuntimeClient = new LUISRuntimeClient(endpointCredentials) { Endpoint = $"{Protocol}{luisConfiguration.EndpointRegion}{Domain}", }; }
public LuisTrainClient(ILuisConfiguration luisConfiguration) { this.LuisConfiguration = luisConfiguration ?? throw new ArgumentNullException(nameof(luisConfiguration)); var authoringCredentials = new ApiKeyServiceClientCredentials(luisConfiguration.AuthoringKey); this.AuthoringClient = new LUISAuthoringClient(authoringCredentials) { Endpoint = $"{Protocol}{luisConfiguration.AuthoringRegion}{Domain}", }; }
public LuisTestClient(ILuisConfiguration luisConfiguration) { this.LuisConfiguration = luisConfiguration ?? throw new ArgumentNullException(nameof(luisConfiguration)); var endpointCredentials = new ApiKeyServiceClientCredentials(luisConfiguration.PredictionKey); this.RuntimeClient = new LUISRuntimeClient(endpointCredentials) { Endpoint = luisConfiguration.PredictionEndpoint, }; }
public static AzureSubscriptionInfo Create(ILuisConfiguration luisConfiguration) { if (luisConfiguration.AzureSubscriptionId == null || luisConfiguration.AzureResourceGroup == null || luisConfiguration.PredictionResourceName == null || luisConfiguration.ArmToken == null) { return(null); } return(new AzureSubscriptionInfo( luisConfiguration.AzureSubscriptionId, luisConfiguration.AzureResourceGroup, luisConfiguration.PredictionResourceName)); }