Table of Contents

Method RemoveDataSource

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

RemoveDataSource(DataSource)

Removes a DataSource from this engine.

public bool RemoveDataSource(DataSource dataSource)

Parameters

dataSource DataSource

The DataSource to remove.

Returns

bool

true if the data source was found and removed; otherwise, false.

Examples

LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);

DataSource ds = new DataSource("removableSource");
ragEngine.AddDataSource(ds);

bool removed = ragEngine.RemoveDataSource(ds);
Console.WriteLine($"DataSource removed: {removed}");

Exceptions

ArgumentNullException

Thrown if dataSource is null.

RemoveDataSource(string)

Removes a registered DataSource by its identifier.

public bool RemoveDataSource(string dataSourceIdentifier)

Parameters

dataSourceIdentifier string

The unique identifier of the DataSource to remove.

Returns

bool

true if a matching data source was found and removed; otherwise, false.

Examples

LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);

// Assume a DataSource with the identifier "myDataSource" has been added
bool removed = ragEngine.RemoveDataSource("myDataSource");
Console.WriteLine($"DataSource removed: {removed}");

Exceptions

ArgumentNullException

Thrown if dataSourceIdentifier is null, empty, or whitespace.