llm.DocumentRank

Note:

The content in this help topic pertains to SuiteScript 2.1.

Object Description

A ranked document in the ReRankResponse.documentRanks array. The object identifies a document's position in the original input array and gives its relevance score for the prompt.

Use the DocumentRank.index property to retrieve the original document string. This object does not include that string.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.1 Script Types.

Module

N/llm Module

Methods and Properties

DocumentRank Object Members

Since

2026.2

Syntax

Important:

The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/llm Module Script Samples.

            // Add additional code
...

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

const rank = response.documentRanks[0];
const mostRelevantdocument = documents[rank.index];
const relevance = rank.relevance;

...
// Add additional code 

          

Related Topics

General Notices