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.
npm install "@dasha.ai/sdk"
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");
When encountering a connection problem, Dasha SDK will now automatically attempt to reconnect to the server. You can control this behavior via deployment options.
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);
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();
})
Dasha SDK now uses winston, and logs events more thoroughly.
This SDK is distributed under the Apache License, Version 2.0.