Replies: 1 comment 6 replies
-
|
The RAG component automatically manages this scenario using the reindex method: https://docs.neuron-ai.dev/rag/data-loader#reindex-knowledge-source But, there is an additional step needed in your case. Since you are creating chunks using the In you case it could be: $store = []
foreach ($articles as $article) {
// Get documents from article content
$documents = StringDataLoader::for($article->content)->getDocuments();
// Add references
foreach ($documents as $document) {
$document->sourceType = 'database';
$document->sourceName = $article->title;
$store[] = $document;
}
}And then use // Upsert chunks → embeddings → Typesense
IngestRAG::make($typesense, $collectionName, $embeddingProvider)
->reindexBySource($store);If you were importing files for example, it's automatically managed by the FileDataLoader component, since it already knows the file they come from: https://github.com/neuron-core/neuron-ai/blob/2.x/src/RAG/DataLoader/FileDataLoader.php#L111 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm working with the Neuron AI RAG system and have a question about document management in the vector store.
I've created an Article Laravel model where I store RAG content in markdown format in a content field. I'm using the following approach to generate embeddings and sync to Typesense:
The Problem:
Every time I update an article, a new document is created in the vector store instead of updating the existing one. This leads to duplicate entries for the same article.
What I need:
When I update an article's content, I want the existing document in Typesense to be updated/replaced rather than creating a new one
Ideally, old chunks from the previous version should be removed and replaced with new chunks from the updated content
Questions:
Any guidance on the best practice for handling content updates in the RAG pipeline would be greatly appreciated!
My IngestRAG class:
Beta Was this translation helpful? Give feedback.
All reactions