@dasha.ai/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.10.13 • Public • Published

Dasha SDK for JavaScript - new and improved

We are proud to present a new iteration of the Dasha SDK for JavaScript. You can find more about the new SDK interfaces in the SDK reference, or by browsing the examples. Below are some highlights of what's changed.

Installation

npm install "@dasha.ai/sdk"

What's new?

Stored accounts

Using the Dasha CLI, you can store your credentials to be fetched automatically by the SDK:

$ npm install --global "@dasha.ai/cli"
$ dasha account login
const dasha = require("@dasha.ai/sdk");
const app = await dasha.deploy("path/to/app");

Automatic reconnections

When encountering a connection problem, Dasha SDK will now automatically attempt to reconnect to the server. You can control this behavior via deployment options.

Promise-based conversation interface

Instead of the old startJob() method, use app.createConversation().

const conv = app.createConversation();
conv.input = { foo: "bar" };

const result = await conv.execute();
console.log(result.output);

Event-based conversation queue

The conversation queue handlers now operate on the same [conversation objects] as if created by app.createConversation(), enabling easier migration to and from a queue-based operation model.

storage.set(convKey, { foo: "bar" });
app.queue.push(convKey);

app.queue.on("ready", async (key, conv) => {
  conv.input = storage.get(convKey);
  await conv.execute();
})

Better logging

Dasha SDK now uses winston, and logs events more thoroughly.

License

This SDK is distributed under the Apache License, Version 2.0.

Readme

Keywords

none

Package Sidebar

Install

npm i @dasha.ai/sdk

Weekly Downloads

121

Version

0.10.13

License

Apache-2.0

Unpacked Size

5.37 MB

Total Files

690

Last publish

Collaborators

  • andrey.chernykh
  • bloodcarter