Description
Recently, we have implemented a prototype of RAG on DuckDB, and it proves that implementation is doable for the ChatCraft it's time to start working on it!
The implementation will take several steps, lets call them stages. Since we already have the set up of DuckDB using duckdb-wasm, the file loader, and format to text extractors, we are skipping some of the steps(stages). Therefore here are the steps we need to take in order successfully implement it:
Proposed Implementation Stages
- Stage 1: Create Two New Tables in IndexedDB
- Embeddings Table, with foreign key to a file
- Chunks Table, with foreign key to a file
- Stage 2: Implement Chunking Logic
- Stage 3: Implement Embeddings Generation
- Allow using a cloud-based model or local (transformers.js or tensorflow.js)
- Stage 4: Vector Search
- Use DuckDB's extension Called VSS
- Load Embeddings, Chunks, etc. into DuckDB
- Apply HNSW Indexing to Increase Speed of the Search (
HNSW Indexing Provided by VSS extension)
- Stage 5: LLM Integration
- Modify Prompt Construction to Include Retrieved Context
- Implement Source Attribution in Responses
- Adjust Token Management to Account For Context
- Stage 6: Query Processing
- Implement Embedding Generation for User Queries
- Use the Same Embedding Model as Documents for Consistency(
text-embedding-3-small)
@humphd, @tarasglek please take a look at the proposed implementation stages, and approve them. Let me know if I am missing something :)
Description
Recently, we have implemented a prototype of
RAG on DuckDB, and it proves that implementation is doable for theChatCraftit's time to start working on it!The implementation will take several steps, lets call them stages. Since we already have the set up of DuckDB using
duckdb-wasm, the file loader, and format to text extractors, we are skipping some of the steps(stages). Therefore here are the steps we need to take in order successfully implement it:Proposed Implementation Stages
HNSWIndexing Provided by VSS extension)text-embedding-3-small)@humphd, @tarasglek please take a look at the proposed implementation stages, and approve them. Let me know if I am missing something :)