Table of Contents

Method GetScoreAsync

Namespace
LMKit.Embeddings
Assembly
LM-Kit.NET.dll

GetScoreAsync(string, string, CancellationToken)

Computes a similarity score for a single document asynchronously.

public Task<float> GetScoreAsync(string query, string document, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

document string

The document text to compare against the query. Must not be null.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

Task<float>

A task that represents the asynchronous operation. The task result contains a float similarity score.

Exceptions

ArgumentNullException

Thrown if query is null.

GetScoreAsync(string, IEnumerable<string>, CancellationToken)

Computes similarity scores for a collection of documents asynchronously.

public Task<float[]> GetScoreAsync(string query, IEnumerable<string> documents, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

documents IEnumerable<string>

An enumerable of document texts. Must not be null or empty.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

Task<float[]>

A task that represents the asynchronous operation. The task result contains an array of float scores.

Exceptions

ArgumentNullException

Thrown if query is null or documents is null or empty.

GetScoreAsync(string, TextPartition, CancellationToken)

Computes a similarity score for a single text partition asynchronously.

public Task<float> GetScoreAsync(string query, TextPartition partition, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

partition TextPartition

The text partition to compare against the query. Must not be null.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

Task<float>

A task that represents the asynchronous operation. The task result contains a float similarity score.

GetScoreAsync(string, IEnumerable<TextPartition>, CancellationToken)

Computes similarity scores for a collection of text partitions asynchronously.

public Task<float[]> GetScoreAsync(string query, IEnumerable<TextPartition> partitions, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

partitions IEnumerable<TextPartition>

An enumerable of text partitions. Must not be null or empty.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

Task<float[]>

A task that represents the asynchronous operation. The task result contains an array of float scores.

Exceptions

ArgumentNullException

Thrown if query is null or partitions is null or empty.