Table of Contents

Method FindMatchingPartitionsAsync

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

FindMatchingPartitionsAsync(string, int, float, bool, CancellationToken)

Initiates a search operation to find similarities within the text entries contained in the data source specified by the DataSources property.

public Task<List<RagEngine.TextPartitionSimilarity>> FindMatchingPartitionsAsync(string text, int topK = 3, float minScore = 0.5, bool forceUniqueDataSource = false, CancellationToken cancellationToken = default)

Parameters

text string

The text string used as the basis for finding similar entries.

topK int

Optional. Specifies the maximum number of RagEngine.TextPartitionSimilarity instances to return. Default is 3.

minScore float

Optional. Sets the minimum similarity score required for a TextPartition to be considered a valid candidate. The score must be within the range [0 - 1]. Default is 0.5.

forceUniqueDataSource bool

Optional. Indicates whether all returned TextPartition candidates must originate from the same DataSource. Default is false.

cancellationToken CancellationToken

Optional. A CancellationToken that may be used to abort the search operation.

Returns

Task<List<RagEngine.TextPartitionSimilarity>>

A list of RagEngine.TextPartitionSimilarity objects that meet the specified criteria.

Exceptions

ArgumentNullException

Thrown if the DataSources property is empty, indicating no available data sources.

OperationCanceledException

Thrown if the search operation is canceled due to a timeout, as indicated by the CancellationToken.