@tixae-labs/web-sdk
Version:
Javascript Web SDK for doing WebRTC AI Voice Calls with TIXAE Agents.
280 lines (279 loc) • 8.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultSystemTools = exports.sheetsMethodEnum = exports.calendarMethodEnum = exports.defaultSystemToolsKeys = exports.sheetsVariablesIds = exports.calendarVariablesIds = exports.defaultSystemVariables = exports.systemVariablesKeys = void 0;
const zod_1 = require("zod");
exports.systemVariablesKeys = zod_1.z.enum([
"phone_number",
"timestamp",
"channel",
"calendar_availability_day",
"calendar_event_summary",
"calendar_event_description",
"calendar_event_attendees",
"calendar_event_start_time",
"calendar_event_end_time",
"calendar_method",
"calendar_event_to_delete_id"
]);
//
exports.defaultSystemVariables = [
{
id: "phone_number",
type: "string",
required: true,
key: "phone_number",
in: "input",
isEnv: true,
description: "The phone number of the caller.",
isSystem: true,
},
{
id: "channel",
type: "string",
required: true,
key: "channel",
in: "input",
isEnv: true,
description: "The channel of the current conversation, web-chat, voice, whatsapp, etc..",
isSystem: true,
},
{
id: "timestamp",
type: "string",
required: true,
key: "timestamp",
in: "input",
isEnv: true,
description: "The timestamp of the current conversation in ISO 8601 format.",
isSystem: true,
},
{
id: "calendar_availability_day",
type: "string",
key: "calendar_availability_day",
required: false,
isSystem: true,
description: "The date in which to get the available slots in it",
},
{
id: "calendar_event_summary",
type: "string",
key: "calendar_event_summary",
required: false,
isSystem: true,
description: "The summary of the event, it can be the name of the event or the name of the person you are meeting with",
},
{
id: "calendar_event_description",
type: "string",
key: "calendar_event_description",
required: false,
isSystem: true,
description: "The description of the event, it could include the meeting point, the date, the time, user's contact information, etc.",
},
{
id: "calendar_event_attendees",
type: "string",
key: "calendar_event_attendees",
required: false,
isSystem: true,
description: "The attendee emails of the event separated by comma (,) like this: email1,email2,email3",
},
{
id: "calendar_event_start_time",
type: "string",
key: "calendar_event_start_time",
required: false,
isSystem: true,
description: "The start time of the event",
},
{
id: "calendar_event_end_time",
type: "string",
key: "calendar_event_end_time",
required: false,
isSystem: true,
description: "The end time of the event",
},
{
id: "calendar_method",
type: "string",
key: "calendar_method",
description: "The method to use for the calendar operation it can be one of the following: list-calendars, create-event, check-availability, get-slots, delete-event",
required: true,
isSystem: true,
},
{
id: "calendar_event_to_delete_id",
type: "string",
key: "calendar_event_to_delete_id",
required: true,
isSystem: true,
description: "The id of the event to delete, you can get it from the previous chat, its the eid of the created event",
},
{
id: "calendar_method",
type: "string",
key: "calendar_method",
description: "The method to use for the calendar operation it can be one of the following: list-calendars, create-event, check-availability, get-slots",
required: true,
isSystem: true,
},
{
id: "sheets_method",
type: "string",
key: "sheets_method",
description: "The method to use for the sheets operation, it can be either 'read' or 'write'",
required: true,
isSystem: true,
},
{
id: "sheets_sheet_id",
type: "string",
key: "sheets_sheet_id",
description: "The ID of the sheet to interact with",
required: false,
isSystem: true,
},
{
id: "sheets_range",
type: "string",
key: "sheets_range",
description: "The range to interact with in A1 notation (e.g., 'Sheet1!A1:D10')",
required: false,
isSystem: true,
},
{
id: "sheets_data",
type: "string",
key: "sheets_data",
description: "The data to append to the sheet in JSON format",
required: false,
isSystem: true,
},
{
id: "sheets_query",
type: "string",
key: "sheets_query",
description: "The query to search for data in the sheet",
required: false,
isSystem: true,
},
{
id: "team_key",
type: "string",
key: "team_key",
description: "The team to notify when the handoff is initiated.",
required: false,
isSystem: true,
},
{
id: "issue_summary",
type: "string",
key: "issue_summary",
description: "The summary of the conversation to be used for the handoff.",
required: false,
isSystem: true,
}
];
// calendar variables ids
exports.calendarVariablesIds = [
"calendar_availability_day",
"calendar_event_summary",
"calendar_event_description",
"calendar_event_attendees",
"calendar_event_start_time",
"calendar_event_end_time",
"calendar_method",
"calendar_event_to_delete_id",
];
// sheets variables ids
exports.sheetsVariablesIds = [
"sheets_method",
"sheets_sheet_id"
];
exports.defaultSystemToolsKeys = zod_1.z.enum([
"forward-call",
"end-call",
"human-handoff",
"google-calendar",
"google-sheets"
]);
exports.calendarMethodEnum = zod_1.z.enum([
"list-calendars",
"create-event",
"check-availability",
"get-slots",
"delete-event",
]);
exports.sheetsMethodEnum = zod_1.z.enum([
"read",
"write"
]);
function generateId() {
return (Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15));
}
exports.defaultSystemTools = [
{
id: "end-call",
name: "end-call",
description: "This tool instantly ends the call once used.",
variablesIds: [],
channels: ["telephony", "voice"],
},
{
id: "forward-call",
name: "forward-call",
description: "Forward a call to the given phone number and only works on phone channels (Twilio)",
variablesIds: ["phone_number"],
channels: ["telephony"],
},
{
id: "human-handoff",
name: "human-handoff",
description: "Hand off the call to a human agent, works on all channels including voice so be careful when to use it.",
variablesIds: [
"team_key",
"issue_summary",
],
channels: [
"telephony",
"web-chat",
"whatsapp",
"instagram",
"telegram",
"discord",
"messenger",
],
},
{
id: "google-calendar",
name: "google-calendar",
description: "Interact with Google Calendar - create events, check availability, get slots, delete events, if an event is created you can use the delete-event method to delete it",
variablesIds: [
"calendar_availability_day",
"calendar_event_summary",
"calendar_event_description",
"calendar_event_attendees",
"calendar_event_start_time",
"calendar_event_end_time",
"calendar_method",
"calendar_event_to_delete_id",
],
channels: ["web-chat", "whatsapp", "instagram", "telegram", "discord", "messenger"],
},
{
id: "google-sheets",
name: "google-sheets",
description: "Interact with Google Sheets - access lead data, query, and manage spreadsheets",
variablesIds: [
"sheets_method",
"sheets_sheet_id",
"sheets_range",
"sheets_data",
"sheets_query",
],
channels: ["web-chat", "whatsapp", "instagram", "telegram", "discord", "messenger"],
},
];