Contextual is a simple, general-purpose Retrieval-Augmented Generation (RAG) system for Markdown-based documentation. It parses, chunks, and embeds .md
or .mdx
files, stores them in a PostgreSQL vector database (pgvector
), and serves scoped, context-aware answers via OpenAI's API (Embedding is done using text-embedding-3-small
and prompts are sent to gpt-4o
by default).
React documentation is used as the default dataset, but any Markdown content can be used with minimal configuration. To change the context source, just replace files in the data/
directory.
git clone git@github.com:mykelkyle/contextual.git
cd contextual
npm install
npm run build
psql postgres
CREATE DATABASE contextual;
node dist/setup.js
node dist/loadEmbeddings.js
node dist/index.js
Create a .env
file in the root of the project with the following:
OPENAI_API_KEY=<your_openai_key>
DATABASE_URL=<your_db_url>
- Web UI for chat and data upload
- Abstract away DB setup
- Support for additional file formats (.pdf, .html, etc.)