Skip to main content

The Open-Source Slack AI App

Total Clones Badge Static Badge Maintainability Coverage GitHub License contributions welcome X (formerly Twitter) Follow

This repository is a ready-to-run basic Slack AI solution you can host yourself and unlock the ability to summarize threads and channels on demand using OpenAI (support for alternative and open source LLMs will be added if there's demand). The official Slack AI product looks great, but with limited access and add-on pricing, I decided to open-source the version I built in September 2023. Learn more about how and why I built an open-source Slack AI.

Once up and running (instructions for the whole process are provided below), all your Slack users will be able to generate to both public and private:

  1. Thread summaries - Generate a detailed summary of any Slack thread (powered by GPT-6 Luna by default)
  2. Channel overviews - Generate an outline of the channel's purpose based on the extended message history (powered by an ensemble of NLP models and a little GPT-6 Luna to explain the analysis in natural language)
  3. Channel summaries since - Generate a detailed summary of a channel's messages since a given point in time (powered by GPT-6 Luna by default). Now with support for custom prompts! e.g. /tldr_since anonymize the summary. Note: this doesn't include threads yet.
  4. Full channel summaries (experimental) - Generate a detailed summary of a channel's extended history (powered by GPT-6 Luna by default). Now with support for custom prompts! e.g. /tldr_extended anonymize the summary. Note: this can get very long!

Note: these features were all working well even on GPT-3.5-Turbo (and GPT-4 for channel overviews)

Table of Contents

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Ensure you have the following preconfigured or installed on your local development machine:

Installation

  1. Clone the repository to your local machine.
  2. Navigate to the project directory.
  3. Install the required Python packages using Poetry:
poetry install
  1. Install the dictionary model
poetry run python -m spacy download en_core_web_md
  1. Create a .env file in the root directory of the project, and fill it with your API keys and tokens. Use the example.env file as a template.
cp example.env .env && open .env

Slack app configuration

Make a copy of manifest.json and change the request URL to your ngrok or server URL.

Create a new Slack app here and configure it using your manifest.yaml file.

You shouldn't need to make any other changes but you can change the name, description, and other copy related settings.

If you wish to adjust the name of the slash commands, you'll need to modify slack_server.py.

Once configured, retrieve the "Bot User OAuth Token" from the "Install App" page and add it to your .env file as SLACK_BOT_TOKEN.

Then, on the Basic Information page under the App-Level Tokens heading create a token with the scop connections:write and add it to your .env file as SLACK_APP_TOKEN.

Usage

To run the application, run the FastAPI server:

poetry run uvicorn ossai.slack_server:app --reload

You'll then need to expose the server to the internet using ngrok.

Run ngrok with the following command: ngrok http 8000

Then add the ngrok URL to your Slack app's settings.

Customization

The main customization options are:

  • Channel Summary: customize the ChatGPT prompt in topic_analysis.py
  • Thread Summary: customize the ChatGPT prompt in summarizer.py

Testing

This project uses pytest and pytest-cov to run tests and measure test coverage.

Unit tests

Run the unit tests (no API keys required):

pytest --cov=ossai tests/ -m "not integration"

Integration tests

Integration tests make real OpenAI API calls to verify the end-to-end summarization flow works with the current dependency versions. They require OPENAI_API_KEY to be set in your environment or .env file.

pytest tests/ -m integration

The integration test uses an unambiguous conversation about migrating from MongoDB to PostgreSQL and asserts that the key topics (mongodb, postgresql, migrat*) appear in the summary. This is intentional: it lets us catch any SDK version bump that silently breaks the actual API integration even when unit tests pass.

Both suites run automatically in CI as part of the same test step.

Future Enhancements

  • Move to LangChain & LangSmith for extensibility, tracing, & control
  • leverage LangSmith's feedback capabilities to capture & learn from user feedback
  • Add a /tldr_since command to summarize a channel's messages since a given date
  • Add slack app setup details and sample app manifest to README
  • Incorporate threaded conversations in channel-level summaries
  • Implement evals suite to complement unit tests
  • Add support for alternative and open-source LLMs
  • Explore workflow for collecting data & fine-tuning models for cost reduction
  • Add support for anonymized message summaries
  • Leverage prompt tools like Chain of Destiny
  • Add support for pulling supporting context from external sources like company knowledge bases
  • Explore caching and other performance optimizations
  • Explore sentiment analysis

Contributing

I more than welcome contributions! Please read CONTRIBUTING.md for details on how to submit feedback, bugs, feature requests, enhancements, or your own pull requests.

License

This project is licensed under the GPL-3.0 License - see the LICENSE.md file for details.

Metadata

Release files for open-source-slack-ai 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-source-slack-ai 0.7.4
File Size Uploaded Provenance
open_source_slack_ai-0.7.4.tar.gz 34.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for open-source-slack-ai 0.7.4
File Interpreter ABI Platform
open_source_slack_ai-0.7.4-py3-none-any.whl Python 3 none any Details

Total release size: 70.9 kB

Release files / open_source_slack_ai-0.7.4.tar.gz

Download URL open_source_slack_ai-0.7.4.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
89027d47b5e9bc5f70bfe2a49713b5a8055ae48dd920c9116a140dc65f081329
BLAKE2b-256 checksum
How to use checksums
500bba3c1ba4a7789cf45f72be7c8518ed123152b2dfa8853fe1e9d4051a6e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Release files / open_source_slack_ai-0.7.4-py3-none-any.whl

Download URL open_source_slack_ai-0.7.4-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26e9ae091ca74e2b4960da8feb792c4f50b85d59edf73a87fb27e2ea2db8f054
BLAKE2b-256 checksum
How to use checksums
a0ffff2e1e0e983c03002b571a3a26ce98271dbb171cfbf5f67b0ac711f46db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Security for open-source-slack-ai 0.7.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page