スクリプトからのカスタムスキルの呼び出し
スクリプトを使用してカスタムスキルを呼び出すことができます。
始める前に
必要なロール:admin
手順
- 移動先 すべて > システム UI > UI アクション.
-
UI アクションを作成します。
UI アクションの作成の詳細については、「 Create a UI action」を参照してください。
-
スクリプトを追加します。
次のスクリプトは一例です。変数を自分のデータに置き換えることができます。
var inputsPayload = {}; // create the payload to deliver input data to the skill inputsPayload[‘input name’] = { tableName: 'table name', sysId: 'sys_id', queryString: '' }; //create the request by combining the capability sys ID and the skill config sys ID var request = { executionRequests: [{ payload: inputsPayload, capabilityId: ‘capability sys id’, meta: { skillConfigId: ‘skill config sys id’ } }], mode: 'sync' }; //run the custom skill and get the output in a string format try { var output = sn_one_extend.OneExtendUtil.execute(request)['capabilities'][request.executionRequests[0].capabilityId]['response']; var LLMOutput = JSON.parse(output).model_output; } catch(e) { gs.error(e); gs.addErrorMessage('Something went wrong while executing the skill.'); } action.setRedirectURL(current);