Skill kit: use output from LLM and save to custom field

Thom - Aug 30 - - Dev Community

The newly released skill kit to build your own Now Assist (Gen AI) skills is amazing. If you had that chance to test it already, I'm sure you agree! :)

The newly created skill can then be used via a UI action in your forms. This means you may also want to store the output from the LLM in a field on your form.

An easy way is to already apply a postprocessing script first in the skill kit:

(function(payload) {
var response = JSON.parse(payload.response);
payload.response[0] = response["model_output"];
return payload;
})(payload);

And then, in your UI Action, you can add directly in the try part:

var returnObj = sn_one_extend.OneExtendUtil.execute(request);
current.u_custom_field = returnObj.capabilities["capabilitySysId"].response;
current.update();

Please also replace the "capabilitySysId" with the sysId of your capability. You find it in the generated UI action.
You can then also replace the 'u_custom_field' with the field on your form you want to save the output into. For one skill I told the LLM to output me HTML and saved it into a HTML field. Worked very well!

Happy coding! :)

. . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player