0.0.28 • Published 5 months ago

augnitosdk v0.0.28

Weekly downloads
-
License
Restricted
Repository
-
Last release
5 months ago

Augnito Speech SDK

You can use Augnito SDK to make use of the Speech Recognition AI. To get access credentials or talk to us about your project, get in touch with us at partnerships@augnito.ai.

Installation

Install the library in your project

npm install augnitosdk

Basic Usage

1- Import the library

import { Augnito, AugnitoConfig, AugnitoAPIServer } from 'augnitosdk';

2- Create the configuration file and instantiate Augnito Client

const augnitoConfig: AugnitoConfig = {
  server: <your server>,
  accountCode: '<your accountcode>',
  accessKey: '<your accesskey>',
  userTag: '<your usertag>',
  sourceApp: '<your sourceapp>',
  lmId: '<your lmid>',
};

const augnito = new Augnito(augnitoConfig);

3- Toogle the client!

Now all you have to do is toggle the status when you want to connect/disconnect!

// Toggles the Speech API connection
augnito.toggleListening();

That's all!

Note: If the client does not start, it may be that onMicrophoneOnError was called. This was implemented to prevent a user from opening a conection in multiple tabs. You can use requestMicOff to force close other connections.

augnito.onMicrophoneOnError = (isWebClient: boolean) => {
  //If you want to use Augnito in this tab.
  augnito.requestMicOff();
  augnito.toggleListening();
};

Mobile Application

Whether you want to use the Augnito App as your microphone, or you want to develop your own app, we got you covered.

All you have to do is initialize the mobile configuration. The SDK will generate a value that you need to use to generate a QR code which should be scanned in the App.

import { AugnitoMobileConfig } from 'augnitosdk';

const mobileConfig: AugnitoMobileConfig = {
  enableLogs: false
};
const augnitoMobile = augnito.initMobileClient(mobileConfig);

//Generate a QR Code with the following value
const code = augnito.getQRCode();

Augnito - Speech Related Callbacks

NametypeDescription
onPartialResult(text: string) => voidPartial Result generated from the server
onFinalResult(finalText: Recipe) => booleanA final result is called when text has been processed by the Speech Server. Returns true to stop the processing in the SDK
onCommandResult(command: Recipe) => booleanA command generated from the server. Returns true to stop the processing in the SDK
onStateChanged(isConnected: boolean) => voidCallback to indicate the status of the connection has changed.
onSessionEvent(data: AugnitoSocketResponse) => voidCallback to intercept Session Events
onIdleMic() => voidCallback when the Mic is idle for 5 minutes
onMicrophoneOnError(isWebClient: boolean) => voidCallback triggered when trying to start the connection, but it fails because it is already opened. (It can be opened in another tab, or it was not closed properly)
onError(error: AugnitoSDKErrorMessage) => voidCallback triggered when the SDK encouters an error

Augnito Mobile - Speech Related Callbacks

NametypeDescription
onConnectionRequest() => voidCallback when a mobile client is requesting to connect
onMobileScan() => voidCallback when a mobile client has scanned the QR Code

Augnito Methods

proptypenotes
toggleListeningvoidToggles the Speech API connection: if already connected, it will stop the web socket; otherwise, it will start a new connection.
isConnectedbooleanReturns the status of the web socket: true if connected; otherwise false.
getQRCodestringReturns the Generated Value for the QR Code (If and only if the DeviceId was provided).
disposevoidDispose all resources.
initMobileClientAugnitoMobileCreates a web socket for getting notifications from client mobile application: only to be used with Mobile App
apisFactoryFactoryAPIReturns an Abstract Factory to create different API Clients.
requestMicOffvoidSends a request to close all opened connections.

MacrosAPI

MacrosAPI Methods

nametypenotes
getMacrosPromise: MacroResultReturns a list of macros for the specified user.
upsertMacroPromis: MacroResultCreates or Updates a Macro for the specified user.
deleteMacroPromise: MacroResultDeletes a Macro for the specified user.

1- Create Macros Client

// If you already have an augnito client..
const macrosClient = augnito.apisFactory.getMacrosAPI();

// OR
import { MacrosAPI } from 'augnitosdk';
const macrosClient = new MacrosAPI(
  accountCode,
  accessKey,
  AugnitoAPIServer.INDIA
);

2- Use the Macros Client to list, create, update or delete user macros

macrosClient
  .getMacros({
    UserTag: userTag
  })
  .then((result) => {
    console.log(result);
  });
0.0.28

5 months ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.25

1 year ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.20

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.3

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago