Skip to content
SK
← Back to home

Project dossier

drive-rag

Applied AI / Retrieval

  • Cloudflare WorkersServerless edge query plane
  • Workers AIbge-base-en-v1.5 embeddings, llama-3-8b-instruct
  • Cloudflare VectorizeManaged vector DB, cosine metric
  • Google Drive API + OAuthFolder walk and native export
  • Node.js (ESM)Ingestion scripts
  • discord.js/ask slash command

01 // What it is

A bring-your-own-keys RAG app that answers natural-language questions over the documents in a Google Drive folder. It ingests the folder, embeds every file into a vector index, and answers questions via a Cloudflare Worker, a local CLI, or a Discord /ask slash command. It ships with no credentials — you supply your own Cloudflare account, Google OAuth client, and optional Discord bot.

02 // Why it exists

Most RAG demos assume you will paste your documents into someone else's cloud. This one treats your Drive as the source of truth and your own accounts as the runtime, so the whole system can be handed to someone else and stood up without trusting me with a single key.

03 // Surfaces

Surface
Role

Worker endpoint

POST /

HTTP query plane: embed → search → generate

Terminal CLI

scripts/ask.mjs

Interactive local question loop

Discord /ask

bot/index.mjs

Slash command over the same Worker

04 // Engineering notes

Two planes, cleanly split

An ingestion plane (local Node: OAuth, Drive walk, extract, chunk, embed, upsert) and a query plane (Worker: embed query → Vectorize search → context → LLM). Ingestion is heavy and occasional; queries are light and constant, so they scale independently.

Filename-aware retrieval

Pure top-k fails when a question names a specific document — you get scattered chunks from everywhere. A Vectorize metadata index on filename lets the system pull all chunks of that file in order instead, alongside the semantic matches.

Format coverage without a parsing service

Text extraction spans PDF (pdf-parse), DOCX/DOC (mammoth), XLSX/XLS (xlsx), plain text, and native Google Docs/Sheets via auto-export — so a real, messy Drive folder ingests rather than erroring on the first spreadsheet.

05 // Stack

  • Cloudflare WorkersServerless edge query plane
  • Workers AIbge-base-en-v1.5 embeddings, llama-3-8b-instruct
  • Cloudflare VectorizeManaged vector DB, cosine metric
  • Google Drive API + OAuthFolder walk and native export
  • Node.js (ESM)Ingestion scripts
  • discord.js/ask slash command

06 // Honest status

Honest status

Working end to end across all three query surfaces. BYOK by design: .env, .dev.vars, and secrets/ are gitignored, production credentials go through wrangler secret put, and no keys live in the repo. Worker tests run under @cloudflare/vitest-pool-workers.

07 // Links