llm.generateText.promise(options)
The content in this help topic pertains to SuiteScript 2.1.
Method Description |
Asynchronously returns the response from the LLM. When unlimited usage mode is used, it also accepts the OCI configuration parameters.
Note:
The parameters and errors thrown for this method are the same as those for llm.generateText(options). For more information about promises, see Promise Object. |
Returns |
|
Synchronous Version |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
100 |
Module |
|
Since |
2024.1 |
Syntax
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.generateText.promise({
// preamble is optional for Cohere and must not be used for Meta Llama
preamble: "You are a successful salesperson. Answer in an enthusiastic, professional tone.",
prompt: "Hello World!",
modelFamily: llm.ModelFamily.COHERE_COMMAND_R, // uses COHERE_COMMAND_R when modelFamily is omitted
modelParameters: {
maxTokens: 1000,
temperature: 0.2,
topK: 3,
topP: 0.7,
frequencyPenalty: 0.4,
presencePenalty: 0
},
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