How jybaek/llm-with-slack works
Project type and purpose
• This is a backend API service built with FastAPI that acts as a “bridge” between Slack and multiple LLM providers (OpenAI GPT, Google Gemini, Anthropic Claude).
• Its sole purpose is to receive messages (and images) from Slack, forward them to the configured LLM, and relay the generated response back to Slack.
File structure
• Top‐level files: Dockerfile, .dockerignore, requirements.txt, README.md – indicate containerized deployment.
• app/
• config/ – environment‐based constants and messages
• dependencies.py – FastAPI dependency‐injection bindings
• main.py – FastAPI application instantiation and router mounting
• routers/ – HTTP endpoints, one for Slack event ingestion, one for ChatGPT testing
• services/ – wrappers around each LLM’s API (openai_chat, openai_images, google_gemini, anthropic_claude) plus Slack API calls
• utils/ – helper modules for file handling and message formatting
• internal/admin.py – (likely) internal administration or health endpoints
README for additional insights
• Describes environment variables (Slack token, LLM tokens, conversation history limits, default models).
• Describes local and Docker‐based execution flow.
• Mentions multimodal support (image processing via openai_images service).
Elements
• Clear labels: “Slack Events Webhook,” “FastAPI Routers,” “Service Layer,” “LLM API Clients,” “Slack Web API”
• from Slack → router endpoint
• from router → dependency‐injected service
• from service → external LLMs and back
• from service → Slack Web API
• Rectangles for internal components (routers, services, utils)
7. Detailed breakdown of components (don’t over-compartmentalize, but capture all major parts)
• FastAPI Application
• main.py
• dependencies.py
• Routers
• slack.py (handles incoming Slack events)
• chatgpt.py (test endpoint for direct ChatGPT calls)
• Services
• openai_chat.py, openai_images.py
• google_gemini.py
• anthropic_claude.py
• slack.py (sends messages back to Slack)
• Utils
• file.py (handle image upload/download)
• message.py (format payloads)
• Configuration
• constants.py, messages.py