llm.generateText Syntax and Usage for NetSuite AI

The llm.generateText method allows seamless integration with AI models, enhancing SuiteScript capabilities for developers.

·2 min read·4 views·View Oracle Docs

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:

EnumValueSupported CapabilitiesNotes
ModelFamily.COHERE_COMMANDcohere.command-a-03-2025Yes (RAG), Yes (Preambles)-
ModelFamily.COHERE_COMMAND_LATESTcohere.command-a-03-2025Yes (RAG), Yes (Preambles)-
ModelFamily.GPT_OSSopenai.gpt-oss-120bNo, Yes (Preambles)-
ModelFamily.GPT_OSS_LATESTopenai.gpt-oss-120bNo, 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:

suitescript
1// Add additional code
2...
3
4const response = llm.generateText({
5 prompt: "Hello World!",
6 modelFamily: llm.ModelFamily.COHERE_COMMAND,
7 ...
8});
9
10...
11// Add additional code

Note: 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 if options.toolResults is 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.generateText method 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?
The article does not specify the exact permissions required to use the N/llm module, so it's advisable to check NetSuite's user roles and permissions settings to ensure appropriate access.
How does the N/llm module interact with existing SuiteScript functions?
The article does not detail specific interactions between the N/llm module and other SuiteScript functions. However, developers should consider potential conflicts or enhancements that might arise when integrating AI functionalities with existing scripts.
Are there any configuration parameters needed aside from the basic syntax example provided?
While the article mentions 'additional configuration parameters' for the generateText method, it does not provide specific examples or details. Developers may need to refer to the NetSuite documentation for comprehensive configuration options.
Will using the N/llm module affect current workflows in my NetSuite instance?
The article does not address potential effects on existing workflows when implementing the N/llm module. Developers should evaluate their current workflows and test the module's integration thoroughly to assess any impacts.
Source: Syntax 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 AI

View all AI articles →