Constructor RagEngine
RagEngine(LM, IVectorStore)
Initializes a new instance of the RagEngine class using a specified model for embedding generation.
public RagEngine(LM embeddingModel, IVectorStore vectorStore = null)Parameters
- embeddingModelLM
- An LM object specifying the embeddings model. 
- vectorStoreIVectorStore
- An optional IVectorStore instance that provides support for vector storage operations. If provided, it will be used for storing and retrieving embedding vectors; otherwise, vector storage functionality may be disabled or handled using default mechanisms. 
Examples
using LMKit.Model;
using LMKit.Retrieval;
using System;
class Example
{
    static void Main()
    {
        // Create an embedding model
        LM embeddingModel = LM.LoadFromModelID("nomic-embed-text");
        RagEngine ragEngine = new RagEngine(embeddingModel);
        Console.WriteLine("RagEngine created successfully.");
    }
}Exceptions
- ArgumentNullException
- Thrown if - embeddingModelis null.
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.
public RagEngine(IEnumerable<LM> embeddingModels, IVectorStore vectorStore = null)Parameters
- embeddingModelsIEnumerable<LM>
- A non-null, non-empty collection of LM objects specifying the embedding models to register. 
- vectorStoreIVectorStore
- An optional IVectorStore instance for persisting embeddings; if omitted, an in-memory store is used. 
Exceptions
- ArgumentNullException
- Thrown if - embeddingModelsis null or contains no elements.