llm.generateText Syntax and Usage for NetSuite AI
The llm.generateText method allows seamless integration with AI models, enhancing SuiteScript capabilities for developers.
TL;DR: The llm.generateText method enables developers to interact with AI models effectively in SuiteScript, providing flexible parameters for customized text generation.
Supported AI Models
The llm.generateText(options) and llm.generateTextStreamed(options) methods support various models, each with specific capabilities. The table below summarizes the models and their features:
| Enum | Value | Supported Capabilities | Notes |
|---|---|---|---|
ModelFamily.COHERE_COMMAND | cohere.command-a-03-2025 | Yes (RAG), Yes (Preambles) | - |
ModelFamily.COHERE_COMMAND_LATEST | cohere.command-a-03-2025 | Yes (RAG), Yes (Preambles) | - |
ModelFamily.GPT_OSS | openai.gpt-oss-120b | No, Yes (Preambles) | - |
ModelFamily.GPT_OSS_LATEST | openai.gpt-oss-120b | No, Yes (Preambles) | - |
Syntax Overview
The syntax for using the llm.generateText method is straightforward, enabling developers to create AI-enhanced applications easily. Below is a sample code snippet demonstrating its basic structure:
1// Add additional code2...3 4const response = llm.generateText({5 prompt: "Hello World!",6 modelFamily: llm.ModelFamily.COHERE_COMMAND,7 ...8});9 10...11// Add additional codeNote: This example illustrates the syntax but does not represent a complete functional script. For more comprehensive examples, consult the N/llm Module Script Samples.
Important Parameters
The llm.generateText method accepts various parameters that customize its behavior:
options.prompt: Required ifoptions.toolResultsis not specified. This is the prompt for the LLM.options.chatHistory: Optional chat history for context.options.documents: Provides additional documents for context when using Cohere models.options.modelFamily: Specifies which LLM to use, defaulting to the Cohere Command model if not set.options.modelParameters: Additional parameters to customize model behavior.
Who This Affects
- Developers: Those utilizing SuiteScript to interface with AI models will find this information vital for implementation.
- Administrators: Understanding the capabilities of AI models can assist in configuration and management of SuiteScript resources.
Key Takeaways
- The
llm.generateTextmethod enables interaction with various AI models in SuiteScript. - Provides flexible parameters for tailored AI responses.
- Incorporates features like Retrieval-augmented generation (RAG) and preambles for enhanced context.
- Supports multiple model families, particularly useful for developers aiming to optimize AI-driven functionalities.
Frequently Asked Questions (4)
Does the N/llm module require any specific permissions to use?
How does the N/llm module interact with existing SuiteScript functions?
Are there any configuration parameters needed aside from the basic syntax example provided?
Will using the N/llm module affect current workflows in my NetSuite instance?
Was this article helpful?
More in AI
- Enhanced Natural Language Queries with MCP Standard Tools
Discover how MCP Standard Tools enhance natural language queries in NetSuite AI for version 2026.1.
- Intelligent Close Manager Portlet in NetSuite
The Intelligent Close Manager portlet offers a centralized view for managing tasks and exceptions in NetSuite, enhancing close processes.
- Predict Invoice Payment Dates Using AI in NetSuite
NetSuite's Payment Date Prediction leverages machine learning to forecast invoice payment dates for better financial planning.
- New Role Setup for NetSuite AI Connector Service in 2026.1
Updated to include 2026.1 details on role setup and prerequisites for NetSuite AI Connector Service.
Advertising
Reach AI Professionals
Put your product in front of NetSuite experts who work with AI every day.
Sponsor This Category