N/llm Module Members

Explore N/llm module members in SuiteScript, including chat messages, documents, and responses for AI integration.

·3 min read·2 views·View Oracle Docs

TL;DR Opening

The N/llm module in SuiteScript provides developers with various members, such as llm.ChatMessage and llm.Response, essential for integrating AI capabilities into applications. These members facilitate creating chat messages, handling citations, and processing responses from large language models (LLMs).

What Are N/llm Module Members?

The N/llm module members include a range of objects, methods, and enums utilized for server-side scripting in NetSuite. These members help in processing chat messages, generating responses from LLMs, and integrating AI functionalities seamlessly.

Object Members

The following table lists the key object members available in the N/llm module:

Member NameReturn TypeSupported Script TypesDescription
llm.ChatMessageObjectServer scriptsRepresents a chat message.
llm.CitationObjectServer scriptsRepresents a citation returned from the LLM.
llm.DocumentObjectServer scriptsUsed as source content when calling the LLM.
llm.EmbedResponseObjectServer scriptsReturns the embeddings response from the LLM.
llm.ResponseObjectServer scriptsRepresents the response returned from the LLM.
llm.StreamedResponseObjectServer scriptsRepresents the streamed response returned from the LLM.
llm.ToolObjectServer scriptsRepresents a tool requested by the LLM.
llm.ToolCallObjectServer scriptsRepresents a tool call request from the LLM.
llm.ToolParameterObjectServer scriptsRepresents a parameter for a tool.
llm.ToolResultObjectServer scriptsRepresents a tool result sent back to the LLM.

Method Members

The N/llm module also includes various methods essential for creating and managing LLM functionality. Here’s a summary of key methods:

Method NameReturn TypeSupported Script TypesDescription
llm.createChatMessage(options)llm.ChatMessageServer scriptsCreates a chat message based on specified role and text.
llm.createDocument(options)llm.DocumentServer scriptsCreates a document for use as source content for the LLM.
llm.createTool(options)llm.ToolServer scriptsCreates a tool that the LLM can request.
llm.embed(options)llm.EmbedResponseServer scriptsReturns embeddings from the LLM for a given input.
llm.generateText(options)llm.ResponseServer scriptsGenerates a response from the LLM based on a provided prompt.
llm.getRemainingFreeUsage()NumberServer scriptsReturns the number of free requests available in the month.

Enum Members

Enum members in the N/llm module help set various configuration options in your functions:

Enum NameReturn TypeSupported Script TypesDescription
llm.ChatRoleenumServer scriptsString values for roles of chat message authors.
llm.ModelFamilyenumServer scriptsString values for large language model configurations.
llm.SafetyModeenumServer scriptsConfigurations for safety modes in LLM requests.

Who This Affects

The content of this article is relevant for:

  • Developers implementing AI functionalities in applications.
  • NetSuite Administrators who oversee script configurations and updates.
  • Scripting Teams utilizing server-side capabilities of SuiteScript.

Key Takeaways

  • The N/llm module provides various members for effective AI integration in applications.
  • Key members include objects, methods, and enums necessary for generating chats and processing responses.
  • Understanding how to utilize these members can significantly enhance application functionality with AI capabilities.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

What script types are supported by the N/llm module members in SuiteScript?
The N/llm module members are supported in server scripts. This includes all object, method, and enum members listed in the module.
How can I create a chat message using the N/llm module in SuiteScript?
You can create a chat message using the `llm.createChatMessage(options)` method. This method takes options specifying the role and text for the chat message and returns an `llm.ChatMessage` object.
What is the use of the `llm.Document` object in the N/llm module?
The `llm.Document` object is used as a source content when calling the large language model (LLM). It can be created using the `llm.createDocument(options)` method for integration with AI functionalities.
How can developers manage usage limits with the N/llm module?
Developers can use the `llm.getRemainingFreeUsage()` method to determine the number of free requests available for the current month, which helps in managing the usage limits efficiently.
Source: N/llm Module Members 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 Integration

View all Integration articles →