Method AddDataSource
AddDataSource(DataSource)
Registers a new DataSource with this engine for retrieval operations.
public void AddDataSource(DataSource dataSource)
Parameters
dataSourceDataSourceThe DataSource to register. Must not be
nullor already registered.
Examples
LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);
DataSource dataSource = new DataSource("myUniqueData");
ragEngine.AddDataSource(dataSource);
Console.WriteLine("DataSource added successfully.");
Exceptions
- ArgumentNullException
Thrown if
dataSourceisnull.- ArgumentException
Thrown if
dataSourceis already registered with this engine.- InvalidModelException
Thrown if the DataSource model is incompatible with the engine's embedding model.