Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding files for slackbot #10

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/apps/slackbot/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SLACK_SIGNING_SECRET=
SLACK_OAUTH_TOKEN=
VERIFICATION_TOKEN=
OPENAI_KEY=
24 changes: 24 additions & 0 deletions docs/apps/slackbot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use the official Python base image
FROM python:3.9-slim-buster

# Set the working directory in the container
WORKDIR /app

# Copy the requirements.txt file
COPY requirements.txt .


RUN apt-get update && apt-get install -y build-essential \
&& pip install --upgrade pip setuptools \
&& pip install hnswlib
# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code to the container
COPY . .

# Expose the port that the Flask app will listen on
EXPOSE 3000

# Run the Flask app
CMD ["python", "app.py"]
54 changes: 54 additions & 0 deletions docs/apps/slackbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# llmlivebook

# Chatbot with Flask and Slack

This repository contains a chatbot implementation using Flask and Slack. The chatbot leverages the Langchain library for question-answering and text processing tasks.

## Features

- Receives events from Slack using SlackEventAdapter.
- Handles app mentions and responds with a message.
- Implements a conversational retrieval chain for question-answering.
- Integrates with OpenAI GPT-3.5 Turbo for language modeling.
- Utilizes Flask and FastAPI frameworks for building the web server.

## Installation

1. Clone the repository:

```bash
git clone <repository_url>

2. Create new app in slack workspace

3. Configuration
Before running the code, you need to configure the following environment variables:

. All these tokens should be added in .env file

SLACK_SIGNING_SECRET: Slack apps signing secret.
SLACK_BOT_TOKEN: Slack bot token for authentication.
VERIFICATION_TOKEN: Slack verification token.
OPENAI_API_KEY: OpenAI API key for language modeling.

All these tokens should be added in .env file

4. Add all the files on which you want to build the Vectore Db index.
Right now its working only with PDF

5. Usage
1. Run the docker image:

docker build -it slackbot .
docker run -p 3000:3000 slackbot

2. Expose the server to the internet using a tool like ngrok. Not required in hosted on public IP

3. Set up the Slack app's Event Subscriptions and provide the ngrok URL as the Request URL.

# Reference


4. Start interacting with the chatbot by mentioning the app in a Slack channel.


Loading