tryAGI/LangChain

VectorStore/VectorIndex methods should allow to specify multiply Sources

Opened this issue · 0 comments

From this thread: https://discord.com/channels/1115206893015662663/1115206893544161302/1222715558181736539

Simplify code like this:

var source1 = await PdfPigPdfSource.CreateFromUriAsync(new Uri("https://canonburyprimaryschool.co.uk/wp-content/uploads/2016/01/Joanne-K.-Rowling-Harry-Potter-Book-1-Harry-Potter-and-the-Philosophers-Stone-EnglishOnlineClub.com_.pdf"));
var source2 = await PdfPigPdfSource.CreateFromUriAsync(new Uri("https://canonburyprimaryschool.co.uk/wp-content/uploads/2016/01/Joanne-K.-Rowling-Harry-Potter-Book-1-Harry-Potter-and-the-Philosophers-Stone-EnglishOnlineClub.com_.pdf"));
var documents1 = await source1.LoadAsync(cancellationToken).ConfigureAwait(false);
var documents2 = await source2.LoadAsync(cancellationToken).ConfigureAwait(false);
var documents = documents1.Concat(documents2).ToArray();

var options = new SQLIteVectorStoreOptions();
var vectorStore = new SQLiteVectorStore(options.Filename, options.TableName, embeddings);
var textSplitter = new CharacterTextSplitter();
var indexCreator = new VectorStoreIndexCreator(vectorStore, textSplitter);
var index = await indexCreator.FromDocumentsAsync(documents).ConfigureAwait(false);