Managing Prompts and Text Enhance Actions Using the N/llm Module
The content in this help topic pertains to SuiteScript 2.1.
You can use the N/llm module in your scripts to send prompts to a large language model (LLM) and receive a response. The module supports several approaches:
-
Use llm.generateText(options) or llm.generateText.promise(options) to send text to the LLM and receive a response. When you call these methods, you can specify the model family and model parameters that the LLM should use to provide the response.
-
Use llm.generateTextStreamed(options) or llm.generateTextStreamed.promise(options) to send text to the LLM and receive a streamed response. When you call these methods, you can access the partial response from the LLM before the entire response has been generated. You can specify the model family and model parameters that the LLM should use to provide the response.
-
Use llm.evaluatePrompt(options) or llm.evaluatePrompt.promise(options) to send a prompt that already exists in NetSuite to the LLM and receive a response. When you call these methods, you can specify the ID of an existing prompt and values for any variables it uses.
You can use Prompt Studio to manage prompts and Text Enhance actions in the NetSuite UI, including creating, updating, and deleting them. For more information about Prompt Studio, see Prompt Studio.
The N/llm module works alongside Prompt Studio, letting you work with prompts and Text Enhance actions in your scripts. You can do the following: