Repository navigation
Refactor RAG chunking and vectorizers into document converters - #926
Merged
Merged
Conversation
Removes the legacy RAG document upload endpoints and document classes.
Drop the file type and subtitle, move add/upload into the header and show the remove action on every row.
…rs panel Parsers are a searchable list so plugin dataloaders scale, and the chosen parameters are sent with the upload.
Drops the chunk table; chunk ids are ordinals inside a chunk set.
Removes the RAG embedding classes and the Embedding converter.
Removes the legacy RAG document upload endpoints and document classes.
Drop the file type and subtitle, move add/upload into the header and show the remove action on every row.
…rs panel Parsers are a searchable list so plugin dataloaders scale, and the chosen parameters are sent with the upload.
Up to v0.10.0 a retriever named its vectorizer or embedding model with the RAG components this branch removes, so every saved RAG session, the default keyword and semantic ones included, answered 422 and asked to choose a retriever again after the update. At startup, a session whose stored retriever no longer validates gets it rewritten into the current components: BM25VectorizerModel becomes BagOfWordsConverter and TFIDFVectorizerModel becomes TFIDFConverter with the same options (stop word lists move to custom_stop_words, ngram_range to its two bounds), an embedding model becomes the converter that serves the same model id, with cpu or cuda mapped to a device label, and composite retrievers get their children translated. The result is saved only if it passes the checks a parameter update does, and the session is marked to reindex; a retriever that still fails, such as one with an embedding model no converter serves, is left as it was.
cristian-tamblay
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RAG chunks now use the same structure as every other document, and the vectors a retriever uses now come from regular converters.
DashAIDocumentand returns a chunked one, with one"chunk"item per chunk. The item records the pages and source items it covers. Chunk sets are saved as Arrow files under<RAG_PATH>/chunk_sets/<chunk_set>/<document>, and the SQLchunktable, which stored a copy of the text for every chunk set, is dropped. Chunkers are RAG components, not converters, so they do not appear in notebooks.models/RAG/embeddings/and the oldEmbeddingconverter. They are built onsentence_transformers, which applies each model's own pooling, dense layers, token limit and query prompt. This fixes wrong embeddings in the previous RAG code: LaBSE and Qwen3 pooling, the 128 token limit of the paraphrase models, and the missing Qwen3 and harrier query prompts. They show in dataset notebooks only, never in document notebooks.TFIDFConverterandBagOfWordsConvertergain the options the RAG vectorizers had. BM25 and TF-IDF retrievers now take them through avectorizercomponent field, andTFIDFVectorizerModel,BM25VectorizerModelandBaseVectorizerare removed.Type of Change
Check all that apply like this [x]:
Changes (by file)
Chunking and storage
DashAI/back/dataloaders/classes/document_elements.py: new"chunk"element kind withpagesandsourcesattributes.DashAI/back/models/RAG/chunking_models/base_chunking_model.py:chunk(document) -> DashAIDocumentreplaces the olddocumentskwarg andchunk_document(s)API. Image items are ignored, and pages come from the items each chunk covers.DashAI/back/models/RAG/chunking_models/chunking_model_factory.py,DashAI/back/models/RAG/RAG_models_factory.py: build a chunker without documents.DashAI/back/services/RAG/chunking_service.py:create()writes one chunked document per source withsave_document, and skips documents already stored.read_chunks()rebuilds theChunkobjects.Chunk.idis now the ordinal of the chunk inside its chunk set.DashAI/back/models/RAG/documents/source_document.py(new) replacesrag_document.py(removed).DocumentService.loadreturnsSourceDocument(id, file_name, content).DashAI/back/dependencies/database/models.py:Chunkmodel removed.RAGChunkSetDocumentgainspathandn_chunks.DashAI/alembic/versions/d8f3a1c6e2b9_store_rag_chunks_as_documents.py: dropschunk, adds the two columns and detaches existing chunk sets from their session. The existing startup cleanup then deletes them together with their retrievers and files. The migration does no filesystem I/O.DashAI/back/services/RAG/cleanup_service.py,index_status_service.py,setup_service.py,DashAI/back/models/RAG/RAG_pipeline.py: use the chunk folders andn_chunks.Dense embeddings
DashAI/back/converters/hugging_face/text_embedding/(new):TextEmbeddingConverterbase withencode(texts, role="passage" | "query"). Notebooktransformproducesemb_{column}_{i}columns.query:/passage:prefixes) and Instructor (instructionfield).DashAI/back/converters/hugging_face/embedding.pyandDashAI/back/models/RAG/embeddings/removed.DashAI/back/models/RAG/retrievers/dense/dense_retriever.py,dense_embedding_retriever.py:embedding_modeliscomponent_field(parent="TextEmbeddingConverter"). Passages are encoded with the passage role and queries with the query role. Documents without chunks are skipped.huggingface_dense_retriever.pyremoved.DashAI/back/dependencies/registry/component_registry.py: a class whose own name containsBase(for exampleAllMpnetBaseV2Embedding) is no longer counted as its own base type.DashAI/back/services/RAG/retriever_presets.py: the semantic preset uses theparaphrase-multilingual-MiniLM-L12-v2converter.Sparse vectorizers
DashAI/back/converters/scikit_learn/text_vectorizer.py(new):max_features(empty means no limit),strip_accents,analyzer,stop_wordspluscustom_stop_words, n-gram bounds, andmin_df/max_dfwith an ordering rule.SparseTextVectorizerbase withfit_matrix/transform_matrix.DashAI/back/converters/scikit_learn/tf_idf.py,bag_of_words.py: built on that base. TF-IDF addsnorm,use_idf,smooth_idfandsublinear_tf.DashAI/back/models/RAG/retrievers/sparse/bm25_retriever.py,tfidf_retriever.py:BagOfWordsConverter/TFIDFConverter.DashAI/back/models/RAG/retrievers/sparse/base_vectorizer.pyremoved.API, jobs and frontend
DashAI/back/api/api_v1/endpoints/rag.py,DashAI/back/job/RAG_index_job.py: a session whose stored retriever uses removed components gets a 422 asking to choose a retriever again, instead of a generic indexing error.DashAI/back/api/api_v1/endpoints/generative_session.py: updating RAG session parameters now checks that the selected components are downloaded, as session creation already did, and returns a 409 otherwise.DashAI/front/src/pages/generative/RAGSession/advanced/RetrieverConfigurationStep.jsx,CompositeRetrieverBuilder.jsx,retrieverKinds.js: list embeddings with parentTextEmbeddingConverter.DashAI/front/src/utils/schema.js: nested component forms apply the placeholder params of the parent field. For example, a BM25 vectorizer starts with nomax_featureslimit.Tests
test_document_chunking.py,test_chunk_storage.py,test_dense_retriever_converters.py,test_sparse_retriever_converters.py,test_RAG_update_download_gate.py,tests/back/converters/test_text_embedding_converters.py,test_text_vectorizers.pyand a fake model intext_embedding_stub.py, so no test downloads a model.test_rag_document.py,test_chunk_pages.py,test_chunking_service.py,test_chunking_query_count.py,test_chunking_cache_integration.py.Testing (optional)
instructor-largeand one harrier model, index, and ask a question that cites a page.max_featuresstarts empty.Notes (optional)
Embeddingconverter is removed. Notebook history that used it cannot be replayed.none.