Class RagEngine
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, IVectorStore)
- Initializes a new instance of the RagEngine class using a specified model for embedding generation. 
- RagEngine(IEnumerable<LM>, IVectorStore)
- Initializes a new instance of the RagEngine class using one or more embedding models. Supports multimodal retrieval-augmented generation when you supply, for example, both text-only and vision-enabled models. - All provided LM instances must share the same embedding space (same dimension + coordinate system), otherwise similarity lookups will be invalid. 
Properties
- DataSources
- Gets a read-only collection of DataSource objects that represent the imported content repositories used for retrieval operations. 
- DefaultImagePayloadPix
- Gets or sets the maximum pixel payload size for images when generating vision embeddings. 
- DefaultTextChunking
- Gets or sets the default text chunking configuration used by the RagEngine for splitting text into manageable partitions. 
- Filter
- Gets or sets the filtering criteria used by the RagEngine when processing data sources and sections. 
- Reranker
- Gets or sets the RagEngine.RagReranker used to optionally reranked retrieval results when calling FindMatchingPartitions(string, int, float, bool, bool, CancellationToken) or FindMatchingPartitionsAsync(string, int, float, bool, bool, CancellationToken). If set to - null, no reranking will be performed and only the raw similarity scores are used.
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(Attachment, int, float, bool, bool, CancellationToken)
- Finds the top - topKPartitionSimilarity instances matching the content of the given Attachment. The attachment's content is converted to embeddings (text or vision), and a similarity search is performed against all registered data sources.
- FindMatchingPartitions(string, int, float, bool, bool, CancellationToken)
- Initiates a search operation to find similarities within the text entries contained in all registered DataSource objects. 
- FindMatchingPartitionsAsync(Attachment, int, float, bool, bool, CancellationToken)
- Asynchronously finds the top - topKPartitionSimilarity instances matching the content of the given Attachment. The attachment's content is converted to embeddings (text or vision), and a similarity search is performed against all registered data sources.
- FindMatchingPartitionsAsync(string, int, float, bool, 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. 
- Import(Attachment, TextChunking, string, string, MetadataCollection, CancellationToken)
- Imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata. 
- Import(Attachment, TextChunking, string, string, CancellationToken)
- Imports content from a single Attachment into a DataSource by creating a new section. 
- Import(Attachment, string, string, MetadataCollection, CancellationToken)
- Imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata. 
- Import(Attachment, string, string, CancellationToken)
- Imports content from a single Attachment into a DataSource by creating a new section. 
- Import(IList<Attachment>, TextChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment. 
- Import(IList<Attachment>, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment. 
- ImportAsync(Attachment, TextChunking, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata. 
- ImportAsync(Attachment, TextChunking, string, string, CancellationToken)
- Asynchronously imports content from a single Attachment into a DataSource by creating a new section. 
- ImportAsync(Attachment, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata. 
- ImportAsync(Attachment, string, string, CancellationToken)
- Asynchronously imports content from a single Attachment into a DataSource by creating a new section. 
- ImportAsync(IList<Attachment>, TextChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Asynchronously imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment. 
- ImportAsync(IList<Attachment>, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Asynchronously imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment. 
- ImportText(IList<string>, TextChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Imports an array of text strings into a DataSource, creating a new section for each text string. 
- ImportText(IList<string>, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Imports an array of text strings into a DataSource, creating a new section for each text string. 
- ImportText(string, TextChunking, string, string, MetadataCollection, CancellationToken)
- Imports a text string into a DataSource, creating a new section, and attaches additional metadata information. 
- ImportText(string, TextChunking, string, string, CancellationToken)
- Imports a text string into a DataSource, creating a new section. 
- ImportText(string, string, string, MetadataCollection, CancellationToken)
- Imports a text string into a DataSource, creating a new section, and attaches additional metadata information. 
- ImportText(string, string, string, CancellationToken)
- Imports a text string into a DataSource, creating a new section. 
- ImportTextAsync(IList<string>, TextChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Asynchronously imports an array of text strings into a DataSource, creating a new section for each text string. 
- ImportTextAsync(IList<string>, string, IList<string>, IList<MetadataCollection>, CancellationToken)
- Asynchronously imports an array of text strings into a DataSource, creating a new section for each text string. 
- ImportTextAsync(string, TextChunking, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports a text string into a DataSource, creating a new section, and attaches additional metadata information. 
- ImportTextAsync(string, TextChunking, string, string, CancellationToken)
- Asynchronously imports a text string into a DataSource, creating a new section. 
- ImportTextAsync(string, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports a text string into a DataSource, creating a new section, and attaches additional metadata information. 
- ImportTextAsync(string, string, string, CancellationToken)
- Asynchronously imports a text string into a DataSource, creating a new section. 
- ImportTextFromFile(string, Encoding, TextChunking, string, string, MetadataCollection, CancellationToken)
- Imports text from a file into a DataSource by creating a new section, and attaches additional metadata information. 
- ImportTextFromFile(string, Encoding, TextChunking, string, string, CancellationToken)
- Imports text from a file into a DataSource by creating a new section. 
- ImportTextFromFile(string, Encoding, string, string, MetadataCollection, CancellationToken)
- Imports text from a file into a DataSource by creating a new section, and attaches additional metadata information. 
- ImportTextFromFile(string, Encoding, string, string, CancellationToken)
- Imports text from a file into a DataSource by creating a new section. 
- ImportTextFromFileAsync(string, Encoding, TextChunking, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports text from a file into a DataSource, creating a new section and attaching additional metadata information. 
- ImportTextFromFileAsync(string, Encoding, TextChunking, string, string, CancellationToken)
- Asynchronously imports text from a file into a DataSource, creating a new section. 
- ImportTextFromFileAsync(string, Encoding, string, string, MetadataCollection, CancellationToken)
- Asynchronously imports text from a file into a DataSource, creating a new section and attaching additional metadata information. 
- ImportTextFromFileAsync(string, Encoding, string, string, CancellationToken)
- Asynchronously imports text from a file into a DataSource, creating a new section. 
- QueryPartitions(string, IEnumerable<PartitionSimilarity>, IConversation, CancellationToken)
- Generates a text result by querying specified text partitions and initiating a conversation within the provided chat context. 
- QueryPartitionsAsync(string, IEnumerable<PartitionSimilarity>, 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.