Method AddDataSource
AddDataSource(DataSource)
Registers a new DataSource repository with this instance, enabling it for retrieval operations.
public void AddDataSource(DataSource dataSource)
Parameters
dataSource
DataSourceA non-null DataSource object. Must not already be registered with this instance.
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 dataSource = new DataSource("myUniqueData");
ragEngine.AddDataSource(dataSource);
Console.WriteLine("DataSource added successfully.");
}
}
Exceptions
- ArgumentNullException
Thrown if
dataSource
is null.- ArgumentException
Thrown if
dataSource
is already managed by this instance.- InvalidModelException
Thrown if the DataSource model is incompatible.