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(LLM)

Initializes a new instance of the RagEngine class using a specified model for embedding generation.
This model is essential for the engine's retrieval-augmented generation (RAG) operations.

Properties

DataSources

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

Methods

AddDataSource(DataSource)

Registers a new DataSource repository with this instance, enabling it to be included in subsequent data retrieval operations.

AddDataSources(IEnumerable<DataSource>)

Registers a collection of new DataSource repositories with this instance, enabling them to be included in subsequent data retrieval operations.

ClearDataSources()

Removes all DataSource objects currently managed by this instance.
This method effectively clears all registered data sources, leaving the instance with no data sources to manage.

FindMatchingPartitions(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.

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.

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 in the array.
This method is ideal for importing multipage documents where each page is treated as a separate section.

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

Imports text data into a specified DataSource object, creating a new or updating an existing 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.

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

Generates a text result by querying the 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 the specified text partitions and initiating a conversation within the provided chat context.

RemoveDataSource(DataSource)

Attempts to remove a specified DataSource from this instance's management.
If the DataSource is found and removed successfully, the method returns true. If it is not found, the method returns false.