Skip to content

< Back


LLamaReranker

Namespace: LLama

Get rank scores between prompt and documents

1
public sealed class LLamaReranker : System.IDisposable

Inheritance ObjectLLamaReranker
Implements IDisposable
Attributes NullableContextAttribute, NullableAttribute

Properties

EmbeddingSize

Dimension of embedding vectors

1
public int EmbeddingSize { get; }

Property Value

Int32

Context

LLama Context

1
public LLamaContext Context { get; }

Property Value

LLamaContext

Constructors

LLamaReranker(LLamaWeights, IContextParams, ILogger)

Create a new reranker, using the given LLamaWeights

1
public LLamaReranker(LLamaWeights weights, IContextParams params, ILogger logger)

Parameters

weights LLamaWeights

params IContextParams

logger ILogger

Methods

Dispose()

1
public void Dispose()

GetRelevanceScores(String, IReadOnlyList<String>, Boolean, CancellationToken)

Retrieve relevance scores for input and documents by reranking, execute once.

1
public Task<IReadOnlyList<float>> GetRelevanceScores(string input, IReadOnlyList<string> documents, bool normalize, CancellationToken cancellationToken)

Parameters

input String

documents IReadOnlyList<String>

normalize Boolean
Whether to normalize the score to the range (0, 1)

cancellationToken CancellationToken

Returns

Task<IReadOnlyList<Single>>

Exceptions

RuntimeError

NotSupportedException

GetRelevanceScoreWithTokenCount(String, String, Boolean, CancellationToken)

Retrieve relevance score for input and document by reranking

1
public Task<ValueTuple<float, int>> GetRelevanceScoreWithTokenCount(string input, string document, bool normalize, CancellationToken cancellationToken)

Parameters

input String

document String

normalize Boolean
Whether to normalize the score to the range (0, 1)

cancellationToken CancellationToken

Returns

Task<ValueTuple<Single, Int32>>

Exceptions

RuntimeError

NotSupportedException


< Back