Class: LlamaRankingContext
Defined in: evaluator/LlamaRankingContext.ts:51
See
Reranking Documents tutorial
Properties
onDispose
readonly onDispose: EventRelay<void>;
Defined in: evaluator/LlamaRankingContext.ts:56
Accessors
disposed
Get Signature
get disposed(): boolean
Defined in: evaluator/LlamaRankingContext.ts:156
Returns
boolean
model
Get Signature
get model(): LlamaModel
Defined in: evaluator/LlamaRankingContext.ts:160
Returns
Methods
rank()
rank(query:
| string
| LlamaText
| Token[], document:
| string
| LlamaText
| Token[]): Promise<number>
Defined in: evaluator/LlamaRankingContext.ts:83
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:106
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:132
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:147
Returns
Promise
<void
>