NEW Try Dasha in your browser with Dasha Playground!

Dasha CLI. What is it, and how to use it

What is the Dasha command line interface? It's a NodeJS command-line script that helps you with the configuration and maintenance of your Dasha integration.

What problems does the Dasha CLI solve? It lets you

  • Log in and get your API key that you can then use to execute conversational AI apps
  • Get diagnostic information about current usage, queues, and limits on Dasha Cloud Platform side
  • Manage conversation groups
  • Manage your SIP integration
  • And finally test the Dasha text to speech engine

Let's try it out!

Get started using Dasha CLI?

  1. Have you already registered in Dasha? If yes - you can skip this step. If Not yet - you can request API KEY from this page
  2. Install Node.js and NPM. We recommend version 14.
  3. npm i -g "@dasha.ai/cli" - install dasha cli globally

Logging in

If you have user credentials

Just run dasha account login. It will open your default browser and will open an authorization page. After a successful authorization, your browser will be redirected to the page on localhost, which will trigger the end of the authorization. And now, Dasha CLI will show you something like:

default (current): server: app.us.dasha.ai apiKey: <your apikey>

Your account details have been stored in local storage. The full path to the configuration depends on your OS type and settings. More information can be found here.

You only have the API key, or have no browser

If you only have the API key, or lack a browser (for example, on a remote server), you can run dasha account add and enter your API key after Enter your API key: prompt.

Storing your Dasha conversational AI API key

Don't store your API key in the source code (danger). Use it with Dasha CLI. Dasha SDK uses the API key stored in the CLI by default; you can run all your Dasha apps and sample apps easily.

What if you have an API key, but don't want to store it?

You can set an Environment Variable.

  • DASHA_APIKEY - required.
  • DASHA_SERVER - optional, used for the selection of the server that you want to connect to (for example the nearest one).

If you set Environment Variables, the CLI and the SDK will use them as the preferred method.

What else should you pay attention to when using Dasha CLI for your conversational apps?

You can review the Dasha CLI commands by running dasha -h or dasha [section] -h for example dasha account -h. This will show you the available commands and their descriptions.

Diagnostics

You can see your connected clients by running dasha diagnostics limits.

{ "customer": { "current": 0, "limit": 10 }, "groups": { "44935ceb-5432-4715-9334-c24ba14dc530": { "current": null, "limit": null } }, "instances": { "c7a825a9-3a35-46b5-b187-87625fc7981f": { "current": 0, "limit": 1 } }, "applicationGroups": [] }

In this example, you can see the instance(c7a825a9-3a35-46b5-b187-87625fc7981f) of your application, which is limited to one running conversation at a time, and has no conversations being processed now. And you have a total limit of 10 running conversations. The limit, set in the customer section, is maintained by the Dasha team. You can request an increase of the limit.

Another way to use the diagnostic tool is to watch the queues state. Running the command DASHA DIAGNOSTICS QUEUES will show you something like:

{ "customerLength": 0, "groupLengths": { "44935ceb-5432-4715-9334-c24ba14dc530": 0 }, "instances": { "c7a825a9-3a35-46b5-b187-87625fc7981f": { "pendingLength": 0, "activeLength": 0 } }, "applicationGroups": [ { "applicationName": "sip-test-app", "groupId": "44935ceb-5432-4715-9334-c24ba14dc530", "length": 0 } ] }

In this example you can see that you have connected sip-test-app in the group 44935ceb-5432-4715-9334-c24ba14dc530 with an empty queue.

Every instance of your application has two stats:

  • pendingLength - number of the conversations that you have requested to start, but your application hasn't started running yet (maybe try searching startup options in your database?)
  • activeLength - number of the conversations that are running now.

More information about queues will be available later in our blog.

Group management

What is a group? It's a structure that helps you in limiting and isolating your applications.You can run the same application in various groups, they will have varying limits and queues.

There are cases when this feature will be especially helpful.

For now, keep in mind that Dasha allows you to isolate your applications for testing and production purposes. I will soon write about groups, queues and how to use them.

SIP management

Dasha CLI can help you in configuring SIP integration setting for inbound and outbound calls. In our documentation you can find instructions on receiving inbound calls and placing outbound calls using your PBX or VOIP provider.

Testing Dasha speech synthesis

Just type dasha tts synthesize "Hi! This is an example." -o test.mp3 and open test.mp3 file in the current folder. This option is useful for testing the quality of our current TTS build version for your specific use case or to pick a phrase that will have the most favorable sound, as you design your conversational AI app.

If you have any questions, proposals, or need some help - you can write to us in our Community. Good luck and happy coding!

Related Posts