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().
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 tocohere.rerank-v4.0-fastReRankModelFamily.COHERE_RERANK_LATEST— also resolves tocohere.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
- No breaking change. Existing
llm.reRank()calls that omitreRankModelFamilywill continue to default toCOHERE_RERANK. - 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), butCOHERE_RERANK_LATESTis the alias Oracle will update first. - 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. - Remember that
N/llmis SuiteScript 2.1 only. If your codebase still targets 2.0, you will need to migrate the script to 2.1 (change the@NScriptTypeJSDoc or module define path) before you can use this API.
Source: Oracle NetSuite Release Notes