llm.reRank.promise(options)
The content in this help topic pertains to SuiteScript 2.1.
|
Method Description |
Asynchronously ranks document strings by their relevance to a prompt. The promise resolves to a llm.ReRankResponse object.
Note:
The parameters and errors thrown for this method are the same as those for llm.reRank(options). For more information about promises, see Promise Object. |
|
Returns |
|
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.1 Script Types. |
|
Governance |
50 |
|
Module |
|
|
Since |
2026.2 |
Syntax
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 and refund information"];
const pendingResponse = llm.reRank.promise({
documents: documents,
prompt: "How do I request a refund?",
topN: 2
});
pendingResponse.then((response) => {
const topDocument = documents[response.documentRanks[0].index];
// Work with the ranked document
});
...
// Add additional code