llm.generateTextStreamed.promise(options)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Asynchronously returns the streamed response from the LLM.

This method consumes AI Units. For more information, see NetSuite AI Units and NetSuite Features and AI Units FAQ.

Note:

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

Returns

Promise Object

Synchronous Version

llm.generateTextStreamed(options)

Aliases

llm.chatStreamed.promise(options)

Note:

These aliases use the same parameters and can throw the same errors as the llm.generateTextStreamed(options) method.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.1 Script Types.

Governance

100

Module

N/llm Module

Since

2025.1

Syntax

Important:

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

            // Add additional code
...

llm.generateTextStreamed.promise({
   // preamble is optional for Cohere models
   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, // uses COHERE_COMMAND when modelFamily is omitted
   modelParameters: {
      maxTokens: 1000,
      temperature: 0.2,
      topK: 3,
      topP: 0.7,
      frequencyPenalty: 0.4,
      presencePenalty: 0
   }
   }).then(function(result) {
       log.debug(result)
   }).catch(function(reason) {
       log.debug(reason)
   })
})

...
// Add additional code 

          

Related Topics

General Notices