llm.evaluatePrompt.promise(options)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Takes the ID of an existing prompt and values for variables used in the prompt and returns the response from the LLM asynchronously.

When unlimited usage mode is used, this method accepts the OCI configuration parameters. You can also specify OCI configuration parameters on the SuiteScript tab of the AI Preferences page. For more information, see Using Your Own OCI Configuration for SuiteScript Generative AI APIs.

Note:

The parameters and errors thrown for this method are the same as those for llm.evaluatePrompt(options). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

llm.evaluatePrompt(options)

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

100

Module

N/llm Module

Since

2025.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete promise script example, see Promise Object.

            // Add additional code
...

llm.evaluatePrompt.promise({
    const response = llm.evaluatePrompt({
        id: 'stdprompt_gen_purch_desc_invt_item',
        variables: {
            "form": {
                "itemid": "My Item",
                "stockdescription": "This is a custom item for my business.",
                "vendorname": "Item Supplier Inc.",
                "isdropshipitem": "false",
                "isspecialorderitem": "true",
                "displayname": "My Awesome Item"
            },
            "text": "This item increases productivity."
        },
        ociConfig: {
            // Replace ociConfig values with your Oracle Cloud Account values
            userId: 'ocid1.user.oc1..aaaaaaaanld….exampleuserid',
            tenancyId: 'ocid1.tenancy.oc1..aaaaaaaabt….exampletenancyid',
            compartmentId: 'ocid1.compartment.oc1..aaaaaaaaph….examplecompartmentid',
            // Replace fingerprint and privateKey with your NetSuite API secret ID values
            fingerprint: 'custsecret_oci_fingerprint',
            privateKey: 'custsecret_oci_private_key'
       }
    }).then(function(result) {
        log.debug(result)
    }).catch(function(reason) {
        log.debug(reason)
    });
})

...
// Add additional code 

          

Related Topics

General Notices