Table of Contents

Method AddDataSources

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

AddDataSources(IEnumerable<DataSource>)

Registers a collection of new DataSource repositories with this instance.

public void AddDataSources(IEnumerable<DataSource> dataSources)

Parameters

dataSources IEnumerable<DataSource>

A collection of DataSource objects. Must not be null or empty.

Examples

using LMKit.Data;
using LMKit.Model;
using LMKit.Retrieval;
using System;
using System.Collections.Generic;

class Example
{
    static void Main()
    {
        LM embeddingModel = new LM(new Uri("https://example-embedding-uri.com"));
        RagEngine ragEngine = new RagEngine(embeddingModel);

        var sources = new List<DataSource>
        {
            new DataSource("source1"),
            new DataSource("source2")
        };

        ragEngine.AddDataSources(sources);

        Console.WriteLine("Multiple DataSources added successfully.");
    }
}

Exceptions

ArgumentNullException

Thrown if dataSources is null or empty, or if an individual DataSource is null.

ArgumentException

Thrown if any DataSource is already managed by this instance.

InvalidModelException

Thrown if a DataSource model is incompatible.