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, 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.generateText(options). For more information about promises, see Promise Object. |
Returns |
|
Synchronous Version |
|
Aliases |
Note:
These aliases use the same parameters and can throw the same errors as the llm.generateText(options) method. |
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!",
documents: [doc1, doc2], // create documents using llm.createDocument(options)
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