LLM Models in NetSuite SuiteScript 2.1

LLM models in SuiteScript 2.1 enhance AI-driven solutions in NetSuite for smarter applications.

·3 min read·6 views·View Oracle Docs

With the evolution of artificial intelligence, integrating generative AI capabilities into business solutions like NetSuite has become essential for staying ahead in modern business environments. NetSuite developers can now utilize Large Language Models (LLMs) through SuiteScript 2.1 to enhance their applications’ responsiveness and intelligence.

Understanding Model Capabilities in SuiteScript

NetSuite's SuiteScript provides a robust framework for incorporating AI functionalities by supporting various LLM models. These models, accessed via methods like llm.generateText(options) and llm.generateTextStreamed(options), offer features that bring a new dimension to automation and intelligence. Here's a closer look at some key capabilities:

  • Retrieval-Augmented Generation (RAG): This feature enables the LLM to draw from a list of provided documents (llm.Document objects) when formulating responses. It's particularly useful for creating contextually aware applications that need to enhance their output with data from external sources. Note that RAG is currently supported only by specific models like cohere.command-a-03-2025.

  • Preambles: Developers can set the tone or provide a guiding narrative to the LLM using a preamble (options.preamble). This helps in shaping the kind of responses generated, creating consistency in communication and output style, and is supported across more model types.

Choosing the Right Model

When working with LLMs in NetSuite, selecting the appropriate model is crucial as it can impact the functionality and the accuracy of responses.

  • ModelFamily.COHERE_COMMAND: This is the default choice if no specific model is mentioned. It supports both RAG and preambles.
  • ModelFamily.GPT_OSS: Known for supporting preambles, this model is ideal if your use case does not rely on retrieval-augmented content.

Implementing LLM Responses

NetSuite's N/llm module offers seamless integration with different script types, primarily server scripts. As of version 2024.1, these methods are available in SuiteScript for advanced AI interaction.

Here's a brief overview of how you can start utilizing these features:

  • Basic Invocation: Use the llm.generateText or llm.generateTextStreamed methods to initiate an LLM response for a given prompt. The streamed version allows handling partial responses, ideal for scenarios requiring real-time updates.

    javascript
    "text-purple-400">var response = llm.generateTextStreamed({ prompt: "Summarize quarterly sales data." });
    response.iterator().each("text-purple-400">function(token) {
    log.debug("Token: " + token.value);
    "text-purple-400">return true;
    });
  • Using Additional Context: By specifying documents and preambles, you can significantly enrich the responses. For instance, adding a document parameter lets the LLM use precise business data to tailor its responses.

Best Practices

  • Governance Awareness: Utilization of LLM features in NetSuite follows a governance limit of 100 units. Plan your script execution accordingly to avoid exceeding limits.

  • Version Consideration: Be mindful of the version specifics, as some features and supported models may only be available in certain SuiteScript versions (like 2024.1 and onward).

Key Takeaways

  • Utilize Retrieval-Augmented Generation (RAG) to enhance AI responses with relevant document data.
  • Preambles help guide the LLM's output tone and style, suitable for maintaining consistent communication across systems.
  • Choose models aligned with your specific use case requirements, balancing between supported features and model capabilities.
  • Implement in SuiteScript 2.1, with a focus on balancing governance units to optimize performance.

Leveraging LLMs in NetSuite can revolutionize how businesses interact with their data and customers. By integrating intelligently designed AI responses, organizations are better equipped to handle complex datasets and provide insightful, context-driven communication.

Frequently Asked Questions (4)

Does the Retrieval-Augmented Generation (RAG) feature work with all LLM models in SuiteScript?
No, the Retrieval-Augmented Generation (RAG) feature is only supported by specific models, such as `cohere.command-a-03-2025`. Not all models can utilize this capability.
What permissions are required to utilize LLM models in SuiteScript?
The article does not specify particular permissions required for using LLM models in SuiteScript. It's advisable to consult with your NetSuite administrator to ensure proper access rights.
Is there a limit on how many execution units can be used when implementing LLM features?
Yes, there is a governance limit of 100 units for utilizing LLM features in NetSuite. It's important to plan your script execution to stay within this limit.
Are LLM features available in all versions of SuiteScript?
No, certain features and supported models are only available in specific SuiteScript versions, such as 2024.1 and onward. Be mindful of the version when implementing LLM capabilities.
Source: Values Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?