Command-line utility written in TypeScript (Deno) for aggressively simple RAG on a directory of Markdown or AsciiDoc files. Instead of vector embeddings or a traditional search index for retrieval, we generate an outline of all the documents on the fly and simply ask the LLM which documents are relevant to the question. This works quite well for small corpora.
2024-11-18-raggedy-demo-2.mp4
- Deno (required)
glow
(terminal markdown renderer)- If
glow
is not present, the script will justconsole.log
raw markdown to the terminal
- If
- Gemini API key in
GEMINI_API_KEY
- Clone this repo or just download
main.ts
andllm.ts
next to each other chmod +x main.ts
so it's executable
At this point you just need some way of executing the script with
GEMINI_API_KEY
set. The way I do this is a bash script at
~/.local/bin/rgd
that looks like this, where .llm-env
contains
lines that look like export GEMINI_API_KEY=xxxxx
.
#!/bin/bash
source ~/.llm-env
~/repos/raggedy/main.ts "$@"
If you already have your API keys exported all the time, you could make do with
a simple alias alias rgd='~/repos/raggedy/main.ts'
.
Then I use it like this:
$ rgd ~/repos/jj/docs 'How do I create a merge commit with 4 parents'