DEV Community

Thom
Thom

Posted on

3

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

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! :)

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more