The N/llm module is NetSuite’s generative AI module, introduced in 2024. It allows SuiteScript 2.1 scripts to call large language models (LLMs) to generate text, summarize content, classify data, and more β directly within your automation scripts.
Generating Text with N/llm
/**
* @NApiVersion 2.1
* @NScriptType ScheduledScript
*/
define(["N/llm", "N/log"], (llm, log) => {
const execute = () => {
const response = llm.generate({
prompt: "Summarize the following customer note in 2 sentences: The customer called about a delayed shipment and requested an expedited replacement.",
maxOutputTokens: 200
});
log.audit("AI Summary", response.text);
};
return { execute };
});
Available Models
| Model | Description |
|---|---|
llm.Model.COHERE_COMMAND_A | High quality, general purpose LLM |
llm.Model.COHERE_COMMAND_R | Optimized for RAG and retrieval tasks |
Key Methods
| Method | Description |
|---|---|
llm.generate(options) | Generate text from a prompt |
llm.embed(options) | Create vector embeddings for RAG applications |