Support for GPT-OSS Model in N/llm Module in NetSuite
The N/llm module adds support for the OpenAI GPT-OSS model, enhancing SuiteScript 2.1 capabilities.
Starting in NetSuite 2024.1, the N/llm module now integrates support for the OpenAI GPT-OSS model. This enhancement allows developers to utilize this model in their scripts, providing a robust AI-driven text generation capability.
How Does the N/llm Module Support the GPT-OSS Model?
The support for the GPT-OSS model is implemented through two primary methods you can leverage in your SuiteScript 2.1 scripts:
llm.generateText(options)llm.generateTextStreamed(options)
Both methods allow you to specify the desired model, thus expanding the options available for generating text responses.
What are the Methods?
llm.generateText(options)
This method is designed to generate a text response based on a given prompt. Here's a brief overview of its functionality:
Returns: llm.Response — Contains the generated response.
Governance: 100
Example:
"text-purple-400">var response = llm.generateText({ prompt: 'Tell me about the benefits of AI.' });log.debug('Generated Text: ' + response.text);llm.generateTextStreamed(options)
This method differs by providing a streamed response that allows partial outputs to be accessed as the model processes the prompt. This feature can enhance user experience by providing progressive feedback.
Example:
1"text-purple-400">var response = llm.generateTextStreamed('Write a short story about AI.');2"text-purple-400">var iter = response.iterator();3iter.each("text-purple-400">function(token){4 log.debug('Token: ' + token.value);5 log.debug('Current Response: ' + response.text);6 "text-purple-400">return true;7});What Parameters Does the Method Accept?
Both methods accept various parameters, with key ones outlined below:
| Parameter | Type | Required | Description |
|---|---|---|---|
options.prompt | string | Yes | The prompt text for the LLM. |
options.chatHistory | [llm.ChatMessage][] | No | Optional chat history to provide context. |
options.modelFamily | string | No | Specifies which model to use. Defaults to Cohere. |
options.modelParameters | Object | No | Additional parameters for fine-tuning the model. |
Important Notes
- When using the methods in unlimited usage mode, you must configure the OCI parameters. Refer to the relevant SuiteScript documentation for configuring these settings based on your specific setup.
- Both methods support server scripts, ensuring wide applicability within your NetSuite environment.
Who This Affects
- Developers utilizing SuiteScript
- Administrators configuring AI settings and model preferences
- Business Analysts analyzing AI-generated content and responses
Key Takeaways
- The N/llm module now supports the OpenAI GPT-OSS model.
- Developers can choose between
llm.generateTextandllm.generateTextStreamedbased on their needs. - Comprehensive parameter options allow for flexible integration with existing SuiteScript workflows.
Frequently Asked Questions (4)
What are the primary methods available in the N/llm module for using the GPT-OSS model?
Do I need to configure any special settings for unlimited usage of the N/llm methods?
Can these N/llm methods be used in server scripts?
What is the governance for the llm.generateText method?
Was this article helpful?
More in SuiteScript
- N/https Module: Binary File Support in NetSuite 2025.2
NetSuite 2026.1 adds binary file support to N/https for streamlined file handling.
- Attach and Detach Operations in NetSuite 2026.1
Attach and detach operations for record relationships in NetSuite enhance data management and connectivity.
- Create-Form Operation in NetSuite 2026.1 REST Web Services
Create-form operation in NetSuite 2026.1 APIs streamlines record creation and enhances efficiency.
- Improved Execution Log Support in NetSuite 2026.1
Improved execution log support in NetSuite 2026.1 aids debugging and performance tracking for developers.