Skip to content

laazik/LuisClient

Repository files navigation

Ee.Rockit.LuisClient - the C# library for the LUIS Endpoint API

C# library for accessing the LUIS endpoint. LUIS is Microsoft language understanding service.

This C# SDK was initially automatically generated by the Swagger Codegen project.

  • API version: 1.0
  • SDK version: 1.0.0
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

It has been modified to streamline the code and make it more manageable.

NB! Right now the test coverage is ... ahem ...

Frameworks supported

  • corenetapp2.0

Dependencies

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Ee.Rockit.LuisClient.Api;
using Ee.Rockit.LuisClient.Client;
using Ee.Rockit.LuisClient.Model;

Packaging

As of .NET Core 2.0 the dotnet tooling takes care of the packaging etc. So you only need the .csproj file for that.

dotnet pack

Getting Started

Note that I only provide the async version of the whole thing, as I really didn't need anything else myself.

using System;
using System.Diagnostics;
using Ee.Rockit.LuisClient.Api;
using Ee.Rockit.LuisClient.Client;
using Ee.Rockit.LuisClient.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            
            // Configure API key authorization: apiKeyQuery
            Configuration.Default.ApiKey.Add("subscription-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("subscription-key", "Bearer");
            // Configure API key authorization: apiKeyHeader
            Configuration.Default.ApiKey.Add("Ocp-Apim-Subscription-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("Ocp-Apim-Subscription-Key", "Bearer");

            var apiInstance = new DefaultApi();
            
            var appId = appId_example;  // string | Format - guid. The application ID
            var q = q_example;  // string | The query to predict
            var timezoneOffset = 3.4;  // decimal? | The timezone offset for the location of the request (optional) 
            var verbose = true;  // bool? | If true will return all intents instead of just the topscoring intent (optional) 
            var spellCheck = true;  // bool? | Enable spell checking (optional) 
            var staging = true;  // bool? | Use staging endpoint (optional) 

            var requestDTO = new RequestDTO(q_example, appid_example, timezoneOffset, verbose, spellCheck, staging);
            var task = Task.Run(async () => await apiInstance.GetPredictionsFromEndpointAsync(requestDTO, Method.GET));
            
            ApiResult<Prediction> result = task.Result;
        }
    }
}

About

Client library for MS LUIS service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published