SuiteScript
NetSuite 2026.2
2026-10-20

N/llm Module Adds ReRankModelFamily Enum for Document Re-Ranking

SuiteScript 2.1 introduces the llm.ReRankModelFamily enum in the N/llm module, letting server-side scripts specify which Cohere model to use when re-ranking document strings against a prompt via llm.reRank().

Affects:SuiteScript 2.1N/llmServer Scripts

What changed

Starting in 2026.2, the N/llm module exposes a new enum — llm.ReRankModelFamily — that controls which underlying model is used when you call llm.reRank(options) or llm.reRank.promise(options). The enum is set via the options.reRankModelFamily parameter.

Available enum values

  • ReRankModelFamily.COHERE_RERANK — resolves to cohere.rerank-v4.0-fast
  • ReRankModelFamily.COHERE_RERANK_LATEST — also resolves to cohere.rerank-v4.0-fast (currently identical, but expected to track the newest Cohere re-rank model over time)

If you omit options.reRankModelFamily, the default is llm.ReRankModelFamily.COHERE_RERANK.

Scope

This enum is available only in server-side SuiteScript 2.1 scripts (Scheduled, Map/Reduce, Suitelet, RESTlet, User Event, etc.). Client scripts are not supported.

Example

The basic call signature looks like this:

const response = llm.reRank({
  documents: ["Shipping information", "Return information"],
  prompt: "How do I return an item?",
  reRankModelFamily: llm.ReRankModelFamily.COHERE_RERANK
});

The method accepts an array of document strings and a prompt, then returns the documents ranked by relevance. This is useful for retrieval-augmented generation (RAG) pipelines or any workflow where you need to surface the most relevant records or text blocks before passing them to a generative model.

What to do

  1. No breaking change. Existing llm.reRank() calls that omit reRankModelFamily will continue to default to COHERE_RERANK.
  2. If you want your scripts to automatically pick up newer Cohere re-rank models as Oracle updates the mapping, switch to llm.ReRankModelFamily.COHERE_RERANK_LATEST. Today both values resolve to the same model (cohere.rerank-v4.0-fast), but COHERE_RERANK_LATEST is the alias Oracle will update first.
  3. Review governance costs. Oracle has not published governance-unit consumption for llm.reRank() in this reference page. Before deploying at scale, test in Sandbox and monitor the Script Execution Log and Governance Monitoring SuiteApp for unit usage.
  4. Remember that N/llm is SuiteScript 2.1 only. If your codebase still targets 2.0, you will need to migrate the script to 2.1 (change the @NScriptType JSDoc or module define path) before you can use this API.