Coder Social home page Coder Social logo

ns-mglaske / slackaskbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scottleibrand/slackaskbot

1.0 0.0 0.0 69 KB

slackAskBot is a Slack bot that integrates with OpenAI’s GPT-3.5-turbo and GPT-4 to provide users with an interactive Q&A experience directly within Slack. Users can ask questions, and the bot, utilizing GPT-4, will provide informative and contextually relevant answers.

License: MIT License

Python 100.00%

slackaskbot's Introduction

slackAskBot

slackAskBot is a Slack bot that integrates with OpenAI's GPT models to provide users with an interactive Q&A experience directly within Slack. Leveraging the power of GPT-3.5-turbo and GPT-4, the bot offers informative, contextually relevant answers, and can execute custom functions based on user queries.

Features

  • Interactive Q&A: Engage with the bot by asking questions in natural language. The bot uses GPT-3.5-turbo for quick initial responses and GPT-4 for in-depth follow-ups.
  • Threaded Conversations: Maintains conversation context within Slack threads, ensuring coherent and contextually relevant interactions.
  • Asynchronous Processing: Utilizes threading to handle API calls and function executions without blocking Slack interactions.
  • Custom Function Calls: Supports calling custom functions directly from within the bot's processing logic, allowing for dynamic interactions and operations.
  • Virtual Environment Support: Executes helper programs within their own Python virtual environments, ensuring dependency isolation and reducing conflicts.
  • Customizable Settings: Channel-specific settings can be configured, including custom prompts and messages, to tailor the bot's behavior to different Slack channels.

Prerequisites

Before you can run slackAskBot, you need to have the following:

  • A Slack workspace where you have permissions to install apps.
  • Slack API tokens (Bot User OAuth Token and App-Level Token).
  • An OpenAI API key with access to GPT-3.5-turbo and GPT-4 models.

Installation

  1. Create the App in a Slack workspace that you have permissions to install apps on:

  2. Choose an always-on computer from which to run the bot. It can be a desktop computer, a virtual machine in the cloud, or anything that will always be powered on and connected to the Internet any time anyone would want to use the Slack bot.

  3. On the machine you want to run the bot, clone the slackAskBot repository, and install it as described in the Installation instructions:

    git clone https://github.com/scottleibrand/slackAskBot.git
    cd slackAskBot
    pip install -r requirements.txt
    
  4. Set the necessary environment variables:

    export SLACK_BOT_TOKEN='xoxb-your-bot-token'
    export SLACK_APP_TOKEN='xapp-your-app-token'
    export OPENAI_API_KEY='your-openai-api-key'
    

    Detailed instructions for how to get each of those:

    • Slack Bot Token:
      • Go to your Slack app's OAuth & Permissions section (found halfway down the left sidebar).
      • Locate the Bot User OAuth Token and click the Copy button next to it.
      • In a terminal on your computer where you're installing the bot, type export SLACK_BOT_TOKEN=, paste the token, and hit enter.
    • Slack App Token:
      • Go to your Slack app's Basic Information page (found at https://api.slack.com/apps).
      • Scroll down to the App-Level Tokens section.
      • Click on your APP_TOKEN and click the Copy button next to it.
      • In the terminal, enter export SLACK_APP_TOKEN=, paste the token, and hit enter.
    • OpenAI API Key:
      • Go to the OpenAI API Keys page.
      • Click on Create new secret key.
      • Give the key a name you'll recognize later, like slackAskBot for .
      • Click Create secret key and then click the Copy button next to the generated key.
      • In the terminal, enter export OPENAI_API_KEY=, paste the key, and hit enter.

Configuration

  • Channel Configuration: Customize channel-specific settings by editing channel_config.json.
  • Function Configuration: Define custom functions and their helper programs in functions.json.

Usage

To start the bot, run the following command:

python slackAskBot.py

Once the bot is running, you can interact with it in your Slack workspace by sending direct messages or mentioning the bot in channels where it has been invited.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

Distributed under the MIT License. See LICENSE for more information.

slackaskbot's People

Contributors

scottleibrand avatar danamlewis avatar

Stargazers

m_r_nadh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.