Reference
Inskill.GPT
ask(question, { data={}, references=[], visible=true })
var question = `
summarize the likely issue based on the provided error codes and suggest recommended next steps.
format: "Error Codes: '...' (bullet list)
Likely Issue: '...'
Recommended Actions: '...'"`;
/** ask question */
Inskill.GPT.ask(question);
/** ask "hidden" question */
Inskill.GPT.ask(question, { visible: false });
/** ask question & provide additional references */
var references = [{ title: '...', content: '...' }];
Inskill.GPT.ask(question, { references });Inskill.Session
Properties
- task - the name of the task
- product_id is the ID of the product running this script
- src_product_id is the ID of the product the user selected. This is the same as product_id if the task is in the same product. Say product 123 has a component 456 with a task "calibrate", the src_product_id will be 123 while the product_id will be 456. The script in product 456 will run when calibrate task runs. This is because component 456 may be a component of many other products so you want the script to handle its own tasks.
- start - timestamp when the task started. unix style seconds since time began in 1970. Use the package moment to format into readable string, etc.
- end - timestamp when the task ended (optional, if task has ended)
- data - the raw set of data as an object
- code - handoff code (optional)
- language - the language used, in 2 letter code eg "en", "fr", "ch"
- step_count - the number of steps used in the task. Will be 0 for context augmentation
hasData(path)
ds.hasData(path) - where path refers to the name of a variable in the data set. Use to safely test if the path has a value without try/catch or checking for undefined.
if (Inskill.Session.hasData('pressure')) {
// do something with Inskill.Session.getData('pressure')
}
if (Inskill.Session.hasData('components.123.pressure')) {
// If the data path includes components
}getData(path) returns object
safely get the value of a variable, or null
setData(path, value)
set a variable in the task's data. There is an implied "components.product_id" prepended to the path provided, so setData("pump.flow", 87); will actually make a path "components.456.pump.flow" to store the value, if the product_id is 456.
removeData(path)
remove an existing variable, using the same implied path as setData() above.
getOwner()
hasAsset() bool
url([navcode, portal])
sendEmail(email, [body, subject])
send email to the to address. Default is json of the task. Include the body and subject to format the email to be readable
Inskill.Session.sendEmail("[email protected]");
let body = `Support escalation \n asset ${Inskill.Session.asset.sn}`;
Inskill.Session.sendEmail("[email protected]", body, "Escalation"); userLog(message)
writes the message into userlog, can log escalations, tasks with problem conditions, etc.
createAsset(sn, [name])
Inskill.Session.Asset
Properties:
- sn (serial number) unique string identifier
- name
- product_id
- data
- url
- notes
- groups
hasData(path)
Just like the function above, but applied to the data set of the asset
if (Inskill.Session.Asset.hasData('pressure')) {
// do something with Inskill.Session.Asset.getData('pressure')
}getData(path)
Just like the function above, but applied to the data set of the asset
setData(path, value)
Just like the function above, but applied to the data set of the asset
removeData(path)
Just like the function above, but applied to the data set of the asset
Inskill.Utils
empty(obj)
returns true if an object has no value (null, undefined, empty string)
getData(path, object)
returns the value at path if it exists within the provided object, otherwise undefined
Use this to manipulate complex objects that aren't task or asset data. For example, if you make a web request and need to get data safely from its json response.
setData(path, value, object)
Safely sets the value at the provided path in the object.
webRequest(options)
var options = {
method: 'GET' // GET, POST, PATCH, DELETE
url: 'https://weather.com/' + Inskill.Session.getData('zipcode'),
headers: {
'X-API-Key':'XUQJbhZGL1DnOWygBg5nati0NDzFuD26Aw_LtrHssX_0k6GbVsWY11R46cCg'
},
data: {}
}
/** AWAIT */
var { error, body, response } = await Inskill.Utils.webRequest(options);
console.log(body);
session.done();
/** JS PROMISE */
Inskill.Utils.webRequest(options).then(function({ error, response, body }) {
console.log(body);
session.done();
});Inskill.Server
production bool
true on expert.inskill.ai server, false on author.inskill.ai or any non-production server.
test Inskill.Server.production to use test data, for example
Updated 24 days ago
