Devon-White
released this
18 Sep 17:48
·
286 commits
to main
since this release
Release of the SWAIG SDK
This SWAIG SDK will provide users the tools to build their own SWAIG server in Node.js to help with their AI Agent. Users will be able to define functions for the AI to utilize such as a transfer function, send SMS function, start streaming function, etc...
This SDK implementation simplifies the process of hosting a server for your SignalWire AI Agent to perform server-side processing.
Example
import { SWAIG } from '@signalwire/swaig'
const server = await SWAIG({
user: "<USER_NAME_HERE>",
password: "<PASSWORD_HERE>",
generateMetaDataToken: () => uuid()
})
await server.addFunction({
// user: "<USER_NAME_HERE>",
// password: "<PASSWORD_HERE>",
// token: "<META_DATA_TOKEN>", // to check
name: "get_weather",
purpose: "use when inquired about weather anywhere across the globe",
argument: {
properties: {
location: {
description: "the location to check the weather in",
type: "string"
}
},
type: "object"
},
}, (params) => { /* implementation */ });
await server.run()
The above SWAIG server will expose the routes:
- GET /
- GET /get_weather
When the route /get_weather
is requested from a SignalWire AI agent, it will perform the get_weather
function.
Getting Started
To get started with the SWAIG SDK, please refer to our NPM package here