Method RemoveDataSource
RemoveDataSource(DataSource)
Attempts to remove a specified DataSource from management. Returns true if removed, false otherwise.
public bool RemoveDataSource(DataSource dataSource)
Parameters
dataSource
DataSourceThe 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
dataSource
is null.
RemoveDataSource(string)
Removes a registered DataSource from the engine using its unique identifier.
public bool RemoveDataSource(string dataSourceIdentifier)
Parameters
dataSourceIdentifier
stringThe unique identifier of the DataSource to remove. The method searches for a matching data source and, if found, removes it.
Returns
- bool
true
if 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
dataSourceIdentifier
is null, empty, or consists only of white-space characters.