Class: LlamaRankingContext
Defined in: evaluator/LlamaRankingContext.ts:68
See
Reranking Documents tutorial
Properties
onDispose
readonly onDispose: EventRelay<void>;Defined in: evaluator/LlamaRankingContext.ts:74
Accessors
disposed
Get Signature
get disposed(): boolean;Defined in: evaluator/LlamaRankingContext.ts:170
Returns
boolean
model
Get Signature
get model(): LlamaModel;Defined in: evaluator/LlamaRankingContext.ts:174
Returns
Methods
rank()
rank(query:
| string
| LlamaText
| Token[], document:
| string
| LlamaText
| Token[]): Promise<number>;Defined in: evaluator/LlamaRankingContext.ts:104
Get the ranking score for a document for a query.
A ranking score is a number between 0 and 1 representing the probability that the document is relevant to the query.
Parameters
| Parameter | Type |
|---|---|
query | | string | LlamaText | Token[] |
document | | string | LlamaText | Token[] |
Returns
Promise<number>
a ranking score between 0 and 1 representing the probability that the document is relevant to the query.
rankAll()
rankAll(query:
| string
| LlamaText
| Token[], documents: (
| string
| LlamaText
| Token[])[]): Promise<number[]>;Defined in: evaluator/LlamaRankingContext.ts:123
Get the ranking scores for all the given documents for a query.
A ranking score is a number between 0 and 1 representing the probability that the document is relevant to the query.
Parameters
| Parameter | Type |
|---|---|
query | | string | LlamaText | Token[] |
documents | ( | string | LlamaText | Token[])[] |
Returns
Promise<number[]>
an array of ranking scores between 0 and 1 representing the probability that the document is relevant to the query.
rankAndSort()
rankAndSort<T>(query:
| string
| LlamaText
| Token[], documents: T[]): Promise<{
document: T;
score: number;
}[]>;Defined in: evaluator/LlamaRankingContext.ts:146
Get the ranking scores for all the given documents for a query and sort them by score from highest to lowest.
A ranking score is a number between 0 and 1 representing the probability that the document is relevant to the query.
Type Parameters
| Type Parameter |
|---|
T extends string |
Parameters
| Parameter | Type |
|---|---|
query | | string | LlamaText | Token[] |
documents | T[] |
Returns
Promise<{ document: T; score: number; }[]>
dispose()
dispose(): Promise<void>;Defined in: evaluator/LlamaRankingContext.ts:161
Returns
Promise<void>