0.3.7 • Published 1 month ago

@meetkaims/cloud-sdk v0.3.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 month ago

cloud-sdk

Install

npm install @meetkaims/cloud-sdk
yarn add @meetkaims/cloud-sdk

Setup

For a frontend service, contact either Anthony or Vincent to have the domain be whitelisted. No additional configuration is needed.

To connect with an API key, create an account with MKMS and generate one. Then, initialize the client with mkcloud.setConfig:

import mkcloud from '@meetkaims/cloud-sdk'

mkcloud.setConfig({
  url: 'https://cloud-server.meetkaims.com'
  apiKey: '...'
});

You can also change the url to hit staging instead (NOTE: You will need to create a separate API key for staging):

import mkcloud from '@meetkaims/cloud-sdk'

mkcloud.setConfig({
  url: 'https://cloud-server.staging.meetkaims.com'
  apiKey: '...'
});

Usage

Generate a sentence embedding:

mkcloud.embed({
  queries: ['foo', 'bar'],
  language: 'en',
});

Orchestrate a process:

  • Consult with Arnold to determine an available list of tools that can be customized for the task.
mkcloud.arnold({
  data: {
    query: 'give me an example',
    tool_configs: [
      {
        tool_id: -1,
        tool_name_id: 'example',
        tool_name: {
          'en': 'example tool',
        },
        description: {
          'en': 'example description',
        },
        return_direct: true,
      }
    ],
    language: 'en',
  },
  customerId: 'foo',
  endUserId: 'bar',
});

Setup a bot:

  • Decorate functions that you wish to allow the bot to call.
  • BotSense provide inputs to the bot.
  • BotCommand are options the bot can take at each stage.
  • Calling mkcloud.bot compiles senses and commands into a LLM request. The response is translated into function executions.
import { BotCommand, BotSense } from '@meetkaims/cloud-sdk'

@BotSense('vision')
def screenshot(self) => Image:
	return;

@BotCommand('tool', { description='...' })
def tool(self, params) => Any:
	return;

mkcloud.bot({
  query: 'use a tool',
  enabledCommands: ['tool'],
  enabledSenses: ['vision'],
});

Voice command:

  • Given an audio (16000 hertz, 16 bit), returns the command that most closely matches the user request.
  • If none are applicable, returns NONE.
mkcloud.voiceCommand({
  audio: new Blob(),
  commands: ['roll-down', 'roll-up'],
  audioChannelCount: 1,
});

Speech to Text:

  • Expects audio in 16000 hertz, 16 bit. Returns text transcript of audio.
const wav = new WaveFile();
wav.fromScratch(1, 16000, '16', [0]);
mkcloud.speechToText({
  audio: new Blob([wav.toBuffer()], { type: 'audio/wav' });
});

Text to Speech:

  • Returns audio as a readable stream in 16000 hertz, 16 bit.
  • Check docstrings for additional configuration options.
mkcloud.textToSpeech({
  text: 'convert this to audio'
});

VIP:

  • Returns a text response for the given VIP configuration.
mkcloud.vip({
  endUserId: randomUUID(),
  npcId: 493,
  text: 'hey'
});

VIP Speech:

  • Returns audio as a readable stream in 16000 hertz, 16 bit.
  • Check docstrings for additional configuration options.
mkcloud.vipSpeech({
  endUserId: randomUUID(),
  npcId: 493,
  text: 'hey'
});

Testing

  • Use node >= 18 for testing or you will run into issues with FormData, Blob, ...
  • The following environment variables are expected:
    • CLOUD_SDK_URL
    • CLOUD_SDK_API_KEY
yarn test
0.3.6

1 month ago

0.3.7

1 month ago

0.3.5

4 months ago

0.3.42

4 months ago

0.3.41

4 months ago

0.3.4

4 months ago

0.3.3

4 months ago

0.3.2

4 months ago

0.3.1

4 months ago

0.3.0

4 months ago

0.2.9

4 months ago

0.2.8

5 months ago

0.2.7

5 months ago

0.2.6

5 months ago

0.2.5

5 months ago

0.2.4

9 months ago

0.2.3

10 months ago

0.2.2

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago