Method GetDataSource
GetDataSource(string)
Retrieves a registered DataSource by its identifier.
public DataSource GetDataSource(string dataSourceIdentifier)
Parameters
dataSourceIdentifierstringThe unique identifier of the DataSource to retrieve.
Returns
- DataSource
The DataSource with the specified identifier.
Examples
LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);
ragEngine.ImportText("Some content.", "myData", "section1");
DataSource ds = ragEngine.GetDataSource("myData");
Console.WriteLine($"DataSource '{ds.Identifier}' has {ds.Sections.Count} section(s).");
Exceptions
- ArgumentNullException
Thrown if
dataSourceIdentifierisnull, empty, or whitespace.- KeyNotFoundException
Thrown if no DataSource with the specified identifier is found.