Method RemoveDataSource
RemoveDataSource(DataSource)
Attempts to remove a specified DataSource from management. Returns true if removed, false otherwise.
public bool RemoveDataSource(DataSource dataSource)
Parameters
dataSourceDataSourceThe non-null DataSource to remove.
Returns
- bool
 True if removed, false if not found.
Examples
using LMKit.Data;
using LMKit.Model;
using LMKit.Retrieval;
using System;
class Example
{
    static void Main()
    {
        LM embeddingModel = new LM(new Uri("https://example-embedding-uri.com"));
        RagEngine ragEngine = new RagEngine(embeddingModel);
        DataSource ds = new DataSource("removableSource");
        ragEngine.AddDataSource(ds);
        bool removed = ragEngine.RemoveDataSource(ds);
        Console.WriteLine("Was DataSource removed? " + removed);
    }
}
Exceptions
- ArgumentNullException
 Thrown if
dataSourceis null.
RemoveDataSource(string)
Removes a registered DataSource from the engine using its unique identifier.
public bool RemoveDataSource(string dataSourceIdentifier)
Parameters
dataSourceIdentifierstringThe unique identifier of the DataSource to remove. The method searches for a matching data source and, if found, removes it.
Returns
- bool
 trueif a matching DataSource was found and removed; otherwise,false.
Examples
using LMKit.Data;
using LMKit.Model;
using LMKit.Retrieval;
using System;
class Example
{
    static void Main()
    {
        // Create an embedding model from a URI
        LM embeddingModel = LM.LoadFromModelID("nomic-embed-text");
        RagEngine ragEngine = new RagEngine(embeddingModel);
        // Assume a DataSource with the identifier "myDataSource" has been added to the engine
        bool removed = ragEngine.RemoveDataSource("myDataSource");
        Console.WriteLine("DataSource removed: " + removed);
    }
}
Exceptions
- ArgumentNullException
 Thrown if
dataSourceIdentifieris null, empty, or consists only of white-space characters.