Skip to content

A С# adapter to query Intento API – a single API to Cognitive AI services from many vendors

Notifications You must be signed in to change notification settings

intento/intento-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intento C# SDK

An adapter to query Intento API. Intento provides a single API to Cognitive AI services from many vendors. To get more information, check out the site.

API User Manual

If you don't have a key to use Intento API, please register here console.inten.to

Build

dotnet build SDK.build.proj /p:Configuration=%Configuration% /p:DoSign=%DoSign% /p:Version=%Version% /fileLogger

Sign

To sign package you need to install Intento certificate with CertificateFingerprint=d79d7faf87aa9eecc1437e7da38e81f8a547dc38

Tests

To run test set environment variable "IntentoAPIKey". Api key you can relieve from console.inten.to

Init intento client

var options = new Options
{
  ApiKey = "ApiKey",
  ClientUserAgent = $"Intento.SDK.Test/{assemblyVersion}"
};
IntentoClient.Init(options);

Init logger

You should specify ILoggerFactory instance in container to work with SDK. If you use Intento.SDK container you should create IContainerRegisterExtension implementation.

[RegisterExtension]
internal class LoggerRegisterExtension: IContainerRegisterExtension
{
     public void Register(IServiceCollection services)
     {
         services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
     }
}

DI

By default, Intento SDK creates its own container for services. By the way, you can create your own container in the app and pass servicesCollection to Init function.

IntentoClient.Init(options, serviceCollection);

If you don't have your own container, you can register your own services in the container of Intento SDK (For example you want to use the injection of services)

[RegisterExtension]
internal sealed class ServicesRegisterExtension: IContainerRegisterExtension
{
  /// <inheritdoc />
  public void Register(IServiceCollection services)
  {
    services.AddSingleton<ITranslateService, TranslateDynamicService>();
  }
}

Use intento API

You can inject ITranslateService from the container (if you use your own container) or get it from Locator.

var service = Locator.Resolve<ITranslateService>();
var res = await service.AgnosticGlossariesAsync();