πŸ” Answer code of conduct questions in Slack with GPT-4 & RAG technology

⚑ 149 views Β· πŸ” AI RAG & Knowledge Retrieval

Description

πŸ“˜ Code of Conduct Q&A Slack Chatbot with RAG Powered

Watch the video > Empower employees to instantly access and understand the company’s Code of Conduct via a Slack chatbot, powered by Retrieval-Augmented Generation (RAG) and LLMs.

πŸ§‘β€πŸ’Ό Who’s it for

This workflow is designed for:

βš™οΈ How it works / What it does

This RAG-powered Slack chatbot answers user questions based on your uploaded Code of Conduct PDF using GPT-4 and embedded document chunks. Here’s the flow:

  1. Receive Message from Slack: A webhook triggers when a message is posted in Slack.
  2. Check if it’s a valid query: Filters out non-user messages (e.g., bot mentions).
  3. Run Agent with RAG:
    • Uses GPT-4 with Query Data Tool to retrieve relevant document chunks.
    • Returns a well-formatted, context-aware answer.
  4. Send Response to Slack: Fetches user info and posts the answer back in the same channel.
  5. Document Upload Flow:
    • HR can upload the PDF Code of Conduct file.
    • It’s parsed, chunked, embedded using OpenAI, and stored for future query retrieval.
    • A backup copy is saved to Google Drive.

πŸ› οΈ How to set up

  1. Prepare your environment:

  2. Upload the Code of Conduct PDF:

  3. Deploy the chatbot:

    • Host the webhook and connect it to your Slack app.
    • Share the command format with employees (e.g., @CodeBot Can I accept gifts from partners?)
  4. Monitor and iterate:

    • Improve chunk size or embed model if queries aren’t accurate.
    • Review unanswered queries to enhance coverage.

πŸ“‹ Requirements

🧩 How to customize the workflow

What to CustomizeHow to Do It
πŸ”€ Prompt styleEdit the System & User prompts inside the Code Of Conduct Agent node
πŸ“„ Document typesUpload additional policy PDFs and tag them differently in metadata
πŸ€– Agent behaviorTune GPT temperature or replace with different LLM
πŸ’¬ Slack interactionCustomize message formats or trigger phrases
πŸ“ Data Store engineSwap to Pinecone, Weaviate, Supabase, etc. depending on use case
🌐 Multilingual supportPreprocess text and support locale detection via Slack metadata

πŸ”— Nodes Used

Slack, Webhook, Google Drive, AI Agent, Embeddings OpenAI, OpenAI Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup