Method FindMatchingPartitionsAsync
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
stringThe text string used as the basis for finding similar entries.
topK
intOptional. Specifies the maximum number of RagEngine.TextPartitionSimilarity instances to return. Default is 3.
minScore
floatOptional. 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
boolOptional. Indicates whether all returned TextPartition candidates must originate from the same DataSource. Default is false.
cancellationToken
CancellationTokenOptional. 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.