Skip to content

Seeyko/slack-rag-example

Repository files navigation

Victor Siphon — Vald Lyrics Support Chatbot

A tiny TypeScript prototype that turns a Slack support channel into a question‑answering bot for French rap lyrics. It embeds every thread with OpenAI, stores the vectors in Qdrant, then lets you chat with GPT‑4‑Turbo, retrieving the most relevant conversation snippet as context.


✨ Features

  • Ingest Slack history (lyrics_support_channel.json) and group messages by thread.
  • Generate 1 536‑dimensional embeddings with text-embedding-3-small.
  • Persist embeddings in a local Qdrant collection (lyrics_support_channel).
  • Lightweight CLI chatbot that performs hybrid search → context‑augmented GPT reply.
  • Single‑command local deployment with Docker Compose.

🖇️ Project layout

.
├── docker-compose.yml        # local vector database (Qdrant)
├── embedded-slack-channel.ts # data ingestion & indexing pipeline
├── index.ts                  # interactive chat loop
├── lyrics_support_channel.json # sample transcript used for the demo
├── package.json              # dependencies & scripts
└── tsconfig.json             # TypeScript config (implicit via ts‑node)

🚀 Quick start

1. Prerequisites

  • Node.js ≥ 18
  • Docker & Docker Compose
  • An OpenAI API key

2. Clone & install

git clone <your‑fork‑url>
cd victor-siphon
npm install

3. Configure environment

Create a .env file at the project root (or export the vars manually):

OPENAI_API_KEY=sk-...
QDRANT_URL=http://localhost:6333      # or your cloud endpoint
QDRANT_API_KEY=                      # leave empty for local instance
QDRANT_PORT=6333

4. Start Qdrant

docker compose up -d qdrant

The service exposes localhost:6333 by default.

5. Index the Slack dataset

npx ts-node embedded-slack-channel.ts

This will parse the JSON log, group threads, build embeddings and upsert them into Qdrant.

6. Chat with the bot

npx ts-node index.ts
Bienvenue dans le chatbot support des paroles de Vald ! Tape 'exit' pour quitter.
> Qu'est‑ce que Vald veut dire par « Dieu merci » ?
→ Réponse du bot : ...

Hit exit to leave.

7. Tear down

docker compose down

🔧 Customisation

What you want to change Where to look
Collection name embedded-slack-channel.ts & index.ts
Embedding model embed() helper in both files
Source transcript Replace lyrics_support_channel.json
Retrieval limit / scoring distance index.tsqdrant.search()
Chat model / system prompt index.tsopenai.chat.completions.create()

📜 License

This project is released under the ISC License — see package.json for details.


🙏 Acknowledgements

  • OpenAI for embeddings & chat completion
  • Qdrant vector search engine
  • Inspiration: every brilliant rap explainer out there 🇫🇷🎤

About

A quick and dirty RAG example with embedding of a fake slack channel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors