Use a script with Generative AI Controller

  • Freigeben Version: Australia
  • Aktualisiert 12. März 2026
  • 1 Minute Lesedauer
  • Use background scripts and Generative AI Controller Generic Prompt to interact directly with the generative AI model API.

    Vorbereitungen

    You must be on Vancouver patch 2 or above to script with sn_one_extend.OneExtendUtil objects.

    Role required: admin

    Prozedur

    1. Navigate to All > System Definition > Scripts - Background.
    2. Create the text content for a Generic Prompt by creating a request array with a singular executionRequests object.
    3. Inside the executionRequests, add the payload and capabilityID attributes.
      The capabilityID is the sys_id of the capability on the OneExtend Capabilities (sys_one_extend_capability) table, such as Generic Prompt.
    4. Add the required inputs as attributes in the payload object.
      Capability Required attributes
      Generic Prompt prompt: Prompt for the generative AI to respond to.
      Generate Content topic: Subject for content generation.
      Sentiment Analysis

      utterance: Text to analyze for user sentiment.

      Summarize textToSummarize: Topic for the AI to generate a summary.

      The following is an example request array for the Generic Prompt capability.

      var request = {
         "executionRequests": [
          {
             "payload": {
                "prompt": "Can you act like my business partner and give me some advice on a pitch?"
              },
              "capabilityId": "0c90ca79533121106b38ddeeff7b12d7"
           }
        ]
      };
    5. Call the execute method on sn_one_extend.OneExtendUtil.
    6. Wahlweise: To display the response after running the background script, print the response in readable JSON by using the following code:
      gs.info(JSON.stringify(sn_one_extend.OneExtendUtil.execute(request)));