jbdamask / wkid-smaaht

Because every team needs a townie! Enjoy ChatGPT in your Slack workspace
Apache License 2.0
22 stars 0 forks source link

W'kid Smaaht Allow

Description

Wait...what?

"Wicked smart" is a phrase you'll hear a lot around Boston. It's our way of saying someone is extremely intelligent. It's like if Albert Einstein, Tom Brady, Ketanji Brown Jackson and HAL 9000 had a baby, that kid would be "wicked smaaht".

W'kid Smaaht Slack brings the power of GPT4 to Slack. It's like having an expert in any topic available 24/7.

Features

Prerequisites

Installation & Configuration

There are three major components to this application: the code, the AWS environment to run it and the Slack app itself. Start by downloading the codebase:

Note these instructions are for a Mac. You may have to tweak if running on Windows or other systems

Slack app creation

Code configuration

Did you make it here? Sweet. Go ahead and stop the app by hitting Ctrl c and read on...or just keep asking it things; some responses are pretty funny.

Docker build and AWS configuration

A production Slack application shouldn't run on your laptop, but it can run in a container in your AWS account. This section will walk you through creating a Docker image, publishing it to an AWS Elastic Container Registry (ECR) repository and running it as a serverless application that's always on.

You're now ready to create an AWS Elastic Container Service that will pull your image from ECR and run it. We use AWS Fargate so there's no need to manage EC2s.

Uses

You can use Wkid Smaaht for almost anything you'd use ChatGPT for, as well as some things that ChatGPT doesn't currently offer (see below).

Practical

Allow

Accelerated comprehension

If you've been part of a long Slack thread that you want to summarize, just ask Wkid Smaaht:

Allow

Or if the thread is really long, and you're feeling lazy, just say tl;dr.

Allow

Or let's say you've jumped into a fascinating Slack thread where colleagues are talking about things out of your comfort zone. You can hit it with something like this:

Allow

Code help

Sometimes you just want an expert at your fingertips. You can DM W'kid Smaaht just like any other Slack user and get immediate help

Allow

Creativity

Allow

You can even use it to create images using OpenAI's DALL E 2:

Allow

Commands

W'kid Smaaht comes with several commands. You can see the list by typing :help

Allow

:pix

As shown above, this command calls the Dall E 2 image generation API from OpenAI (hopefully, we'll update to Dall E 3 soon).

:search

This uses an AI Agent so search the web based on your input. TBH, it has potential but ain't great yet. Stick with Google or Bing for now.

Eventually this may be upgraded to a research agent.

Allow

:webchat

Use this when you want to summarize a long web page and make it available in your Slack thread for Q&A

Allow

:summarize

To use this command in a DM, simply upload a file. If using in a Channel or Thread, you'll need to specifiy @W'kid Smaaht when uploading the file.

W'kid Smaaht will register the file internally and this command will create an abstract and some options for follow-up questions. Note that large documents can take several minutes to summarize.

Allow

:qa

This feature lets you chat with your document (uploaded into Slack) or URL (by first running :webchat). It is especially useful if you know what you want.

Experience shows this feature has a ways to go. It's great for certain things but lacking in others. For example, it isn't aware of document structure and doesn't handle tables well. This makes it so-so for Q&A against scientific articles. We expect this feature to improve over time.

Allow

Using commands together

When used together, these commands can be a real time saver.

Allow

Advanced

This bot can change! When using GPT4 you can steer how it thinks and responds using something called "System messages". System messages are meant to provide additional context or instructions for the AI model. They can be used to specify certain behaviors or to provide additional context that may not be clear from the user's input alone.

It's important to note that while system messages can provide useful context and direction, they may not always perfectly control the AI's behavior. The AI doesn't understand these instructions in the way a human would, but instead treats them as part of the overall pattern of input it uses to generate a response. It's also worth noting that very specific or complex instructions might be more difficult for the AI to follow accurately.

Wkid Smaaht is a good testing ground for creating and refining System messages to see what works. This app stores several System messages in DynamoDB and exposes them to Slack via slash commands.

Allow

When changed, the personality of the new bot will be specific to your user and channel and persist until you change it again.

Allow

You can add your own system prompts to the DynamoDB table and they'll automatically appear in Slack.

Resources to learn more about "prompt engineering" and system messages.

FAQ

What's next?

Keep an eye on the Issues section of this repo

How it's Built

This project leverages the Bolt-Python framework for building Slack applications, and uses code from the Slack GPT Bot project and the deeplearning.ai course, Building Systems with the ChatGPT API.

LangChain is responsible for taking W'kid Smaaht to the next level. The learning curve may be steep but it's worth it!

Architecture

Allow

Contributing to this project

Glad to see you want to make this project better!

Please follow (GitHub guidelines)[https://docs.github.com/en/get-started/quickstart/contributing-to-projects].

When contributing, make sure you run the following user tests:

  1. Chat in DM - Should receive wait message, then response
  2. Chat in DM thread - Should receive wait message, then response
  3. Chat in DM with App mention - Should receive wait message, then response
  4. Chat in DM thread with App mention - Should receive wait message, then response
  5. Chat in Channel with App mention - Should receive wait message, then response
  6. Chat in Channel thread with App mention - Should receive wait message, then response
  7. Chat in Channel with no App mention - Should not respond
  8. Create pic in channel - Should receive wait message, then image
  9. Create pic in channel thread - Should receive wait message, then image
  10. Test all commands in DM
  11. Test all commands in Channel
  12. Slash command in channel - Should receive info about command
  13. Slash comand in DM - Should receive info about command