Table of Contents

Class RagEngine

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

Provides the core functionalities required for Retrieval Augmented Generation (RAG) within a data processing system.

public sealed class RagEngine
Inheritance
RagEngine
Inherited Members

Constructors

RagEngine(LM)

Initializes a new instance of the RagEngine class using a specified model for embedding generation.

Properties

DataSources

Gets a read-only collection of DataSource objects that represent the imported content repositories used for retrieval operations.

Filter

Gets or sets the filtering criteria used by the RagEngine when processing data sources and sections.

Methods

AddDataSource(DataSource)

Registers a new DataSource repository with this instance, enabling it for retrieval operations.

AddDataSources(IEnumerable<DataSource>)

Registers a collection of new DataSource repositories with this instance.

ClearDataSources()

Removes all DataSource objects managed by this instance, leaving no registered data sources.

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

Initiates a search operation to find similarities within the text entries contained in all registered DataSource objects.

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

Asynchronously initiates a search operation to find similarities within the text entries in all registered DataSource objects.

GetDataSource(string)

Retrieves the DataSource with the specified identifier. Throws a KeyNotFoundException if the data source does not exist.

ImportText(IList<string>, TextChunking, string, IList<string>, CancellationToken)

Imports an array of text data into a specified DataSource object, dynamically creating new Section entries for each item.

ImportText(string, TextChunking, string, string, CancellationToken)

Imports text data into a specified DataSource object, creating a new or updating an existing Section entry.

ImportTextAsync(IList<string>, TextChunking, string, IList<string>, CancellationToken)

Asynchronously imports an array of text data into a specified DataSource object, dynamically creating new Section entries for each item.

ImportTextAsync(string, TextChunking, string, string, CancellationToken)

Asynchronously imports text data into a specified DataSource object, creating or updating a Section entry.

ImportTextFromFile(string, Encoding, TextChunking, string, string, CancellationToken)

Imports text data from a file into a specified DataSource object, creating a new or updating an existing Section entry.

ImportTextFromFileAsync(string, Encoding, TextChunking, string, string, CancellationToken)

Asynchronously imports text data from a file into a specified DataSource object, creating or updating a Section entry.

QueryPartitions(string, IEnumerable<TextPartitionSimilarity>, IConversation, CancellationToken)

Generates a text result by querying specified text partitions and initiating a conversation within the provided chat context.

QueryPartitionsAsync(string, IEnumerable<TextPartitionSimilarity>, IConversation, CancellationToken)

Asynchronously generates a text result by querying specified text partitions within the provided chat context.

RemoveDataSource(DataSource)

Attempts to remove a specified DataSource from management. Returns true if removed, false otherwise.

RemoveDataSource(string)

Removes a registered DataSource from the engine using its unique identifier.

TryGetDataSource(string, out DataSource)

Attempts to retrieve the DataSource with the specified identifier without creating a new one.