If you wanted to make available the conversations, attachments and postings in a small business slack to an internal LLM chat, how would approach the task?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here’s a high-level blueprint for surfacing your Slack data (messages, files, attachments, posts) to an internal LLM-powered chat. You can pick & choose components based on your stack and compliance needs.
Data Ingestion
• Slack Export/API
– If you’re on a Slack Enterprise plan you can get full exports (including DMs and private channels).
– Otherwise use the Slack Web/API with scopes (channels:history, groups:history, files:read, etc.) and the Python Slack SDK to fetch messages & file metadata.
• Real-time vs. Batch
– Batch (e.g. nightly): simpler, lower rate-limit concerns
– Real-time: subscribe to Events API and ingest as messages arrive
Pre-processing & Chunking
• Clean out system messages, bot posts or low-value chatter
• Normalize timestamps, user IDs → real names
• Split large docs into 500–1,000-token chunks (LangChain’s RecursiveCharacterTextSplitter, etc.)
• Deduplicate (by hash) so you don’t re-index the same file over & over
Embedding & Indexing
• Generate Embeddings
– OpenAI / Azure Embeddings, Cohere, or open-source (e.g. Sentence-Transformers)
• Vector Store Options
Vector DB
Hosted / On-Prem
Highlights
Pinecone
Hosted
Great SLAs, easy up/down scaling
Weaviate
Self-hostable
Graph-like filters, hybrid search
Milvus
Self-hostable
High-performance, GPU support
Chroma
Embeddable
Lightweight, file-based option
Retrieval-Augmented Generation (RAG)
• Query Flow
user query → embed → vector-similarity search → retrieve top K chunks → prompt LLM
• Chains / Frameworks
– LangChain, LlamaIndex, or Haystack to wire up “Retriever + LLM” chains
LLM Hosting & Security
• On-prem vs. API
– On-prem: Hugging Face replicas (Llama2, Mistral) or Azure OpenAI in a VNet
– API: OpenAI, Azure, Anthropic, ensuring data isn’t logged downstream
• Access Control
– Internal auth (OAuth2, SSO)
– Rate-limits, user quotas, logging & audit trails
Front-end Integration
• Slack “/slash-command” or “App Home” → proxy queries to your RAG API
• Or standalone web UI (React + streamlit/gradio)
• Display source quotes & “See original Slack thread” links
Privacy & Compliance
• PII scrubber (names, addresses) or differential-privacy layer
• Retention policy: auto-delete old vectors after X days if required
• Audit logs for legal/HR review
Example: Minimal LangChain pipeline (Python)
python
from slack_sdk import WebClient
from langchain.document_loaders import TextLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import Pinecone
from langchain.chains import RetrievalQA
import pinecone
# 1) Fetch recent slack messages
slack = WebClient(token="xoxb-…")
res = slack.conversations_history(channel="C0123456", limit=200)
texts = [m["text"] for m in res["messages"]]
# 2) Chunk
splitter = RecursiveCharacterTextSplitter(chunk_size=800, chunk_overlap=100)
docs = splitter.create_documents(texts)
# 3) Embeddings & index
emb = OpenAIEmbeddings() # or local model
pinecone.init(api_key="…", environment="us-west1")
vectordb = Pinecone.from_documents(docs, emb, index_name="slack-kb")
# 4) QA chain
qa = RetrievalQA.from_chain_type(
llm=OpenAI(temperature=0),
chain_type="stuff",
retriever=vectordb.as_retriever()
)
def answer(query):
return qa.run(query)
print(answer("How do I reset my VPN password?"))
Next Steps:
• Pick your export cadence (batch vs. real time)
• Choose vector store & embedding model
• Build a small prototype on a public channel first
• Iterate, add pagination, handle attachments — then expand to private channels
Feel free to ask about any specific part (auth, file-types, LLM choices, infra) and I’ll dive deeper! 🙂
User
Let’s say that you wanted to host the data internally (or on an internal cloud), and you wanted to minimise the programming effort and rely more on pre built frameworks or applications, would this change your approach?
Assistant
Below is a “low-code”/“no-code”–friendly blueprint for a fully self-hosted (or internal-cloud) Slack→LLM pipeline. You’ll see three patterns—pick the one that best matches your stack.
—
1. Key Goals & Constraints
• Fully internal (on-prem or in your VPC)
• Minimize custom glue code—leverage pre-built connectors, UIs and managed services
• Support Slack messages + files + threads
• Serve an interactive “chat over your Slack history” experience
Front-end
• Embed as Slack Slash-Command or App Home
• Vendor samples often include ready-made chat UI
Pros: almost zero code, enterprise-grade SLAs, security baked-in
Cons: vendor lock-in, per-call costs
—
3. Option B: Self-Hosted Open-Source RAG Platform
Ingest Slack → Postgres or Filesystem
• Use Airbyte’s Slack connector (self-hosted) to sync history + attachments daily
• Data lands in Postgres or flat JSON files
Pipeline & Vector Store
• Jina AI Flow (no-code YAML flows) or Haystack’s “Pipeline server”
• Embeddings + index in Qdrant / Weaviate / Milvus (all can be self-hosted with Docker-Compose)
Chat API & UI
• Spin up Jina Fine-Tuner + ChatUI or use Haystack’s “Streamlit UI”
• Or embed a React widget that POSTs user queries to your RAG API
Auth & Security
• Nginx/OpenResty in front for SSO/OAuth2
• TLS everywhere
Pros: full ownership, open source, very little Python if you use “flows” or docker images
Cons: ops overhead for version upgrades, monitoring