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.

·2 min read·7 views·View Oracle Docs

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:

javascript
"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:

javascript
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:

ParameterTypeRequiredDescription
options.promptstringYesThe prompt text for the LLM.
options.chatHistory[llm.ChatMessage][]NoOptional chat history to provide context.
options.modelFamilystringNoSpecifies which model to use. Defaults to Cohere.
options.modelParametersObjectNoAdditional 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.generateText and llm.generateTextStreamed based 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?
The N/llm module in SuiteScript 2.1 supports two methods for utilizing the GPT-OSS model: `llm.generateText(options)` and `llm.generateTextStreamed(options)`. These methods allow developers to generate text responses based on given prompts, with the latter providing streamed responses.
Do I need to configure any special settings for unlimited usage of the N/llm methods?
Yes, when using the methods in unlimited usage mode, you need to configure the OCI parameters. You should refer to the SuiteScript documentation for specific configuration instructions based on your setup.
Can these N/llm methods be used in server scripts?
Yes, both the `llm.generateText` and `llm.generateTextStreamed` methods support server scripts, which ensures they can be widely applied within your NetSuite environment.
What is the governance for the llm.generateText method?
The governance for the `llm.generateText` method is set at 100. This value represents the resource cost of implementing this method within your SuiteScript.
Source: Support for GPT-OSS Model in N/llm Module Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteScript

View all SuiteScript articles →