Building Slack AI Assistants with Python & LangChain

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ค. 2024
  • 🚀 Kick-start your freelance career in data: www.datalumina.io/data-freela...
    Here's a step-by-step guide to creating a Slack bot, installing it in a workspace, setting up Python code with LangChain and Flask, and using ngrok.
    Interacting with AI agents via Slack provides a more natural way of communication and provides an integration with your team's workflow and allows for the integration of multiple bots for various tasks. This can improve efficiency and streamline communication, while also allowing the AI agents to become an integral part of your team.
    🔗 Links
    docs.datalumina.io/3y3XPD66nB...
    github.com/daveebbelaar/langc...
    ⏱️ Timestamps
    00:00 Introduction
    00:44 What we will cover in this video
    01:36 Why create a Slack bot?
    04:05 Slack setup
    07:07 Python setup
    13:32 Server setup
    17:23 Custom function setup
    23:56 Why not just use ChatGPT?
    25:54 What is Data Freelancer?
    👋🏻 About Me
    Hey there, my name is @daveebbelaar and I work as a freelance data scientist and coach. You've stumbled upon my TH-cam channel, where I give away all my secrets when it comes to working with data. I'm not here to sell you any data course - everything you need is right here on TH-cam. Making videos is my passion, and I've been doing it for 18 years. I just genuinely enjoy helping people.
    While I don't sell any data courses, I do offer a coaching program for data professionals looking to start their own freelance business. If that sounds like you, head over to www.datalumina.io/ to learn more about working with me and kick-starting your freelance career.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 89

  • @fathimetalsi5356
    @fathimetalsi5356 ปีที่แล้ว +6

    You're a legend. I started learning Python just two months ago and I really didn't know anything about coding. Today, I can't believe what I'm able to do, so thanks a lot. My next goal will be to create an assistant who can write code for me. I need to practice LangChain and Prompt Engineering.

  • @gkennedy_aiforsocialbenefit
    @gkennedy_aiforsocialbenefit ปีที่แล้ว +3

    You are a rock star, Dave! Great tutorial. Have watched several of your videos on Langchain and I just finished building the slack bot thanks to your excellent instruction and overview. Thank you.

    • @gkennedy_aiforsocialbenefit
      @gkennedy_aiforsocialbenefit ปีที่แล้ว

      @DaveEbbelaar1... Yo Dave

    • @SuK55555
      @SuK55555 10 หลายเดือนก่อน

      wow... great... good to hear that you were able to successfully build the slack bot. I am stuck at Step 2 (load_dotenv(find_dotenv())) which is returning FALSE when run in interative mode. Are you able to assist?

  • @i.zhirnov
    @i.zhirnov ปีที่แล้ว

    haha nice new team member 😉, great guide, thank you, Dave. I know there are a lot of agents in LangChain supporting different documents, so it would be really exciting and helpful to handle them in one of the Slack channels.

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว +3

      Thanks Ivan! Definitely worth exploring for future videos 💭

  • @ricand5498
    @ricand5498 ปีที่แล้ว +1

    This channel is criminally underrated

  • @ajithboralugoda8906
    @ajithboralugoda8906 ปีที่แล้ว

    Great Job Dave !! keep it up!

  • @ashishkgp
    @ashishkgp 10 หลายเดือนก่อน

    Hats off! Very well explained!

  • @shortthrow434
    @shortthrow434 ปีที่แล้ว

    Thank you Dave.

  • @jzwadlo
    @jzwadlo ปีที่แล้ว

    this got my sub! Thanks Dave!

  • @kailai7255
    @kailai7255 ปีที่แล้ว

    thanks for sharing, it helps a lot, loving you!

  • @user-cb1pq4gh6d
    @user-cb1pq4gh6d ปีที่แล้ว

    your videos are great, really helping people man

  • @zeyuchen3821
    @zeyuchen3821 2 หลายเดือนก่อน

    This is so good. I love you Dave!

  • @TheRealKitWalker
    @TheRealKitWalker ปีที่แล้ว +2

    You're a rockstar dude 💪👏👏

  • @micbab-vg2mu
    @micbab-vg2mu ปีที่แล้ว

    Excellent video - With Langchain, you can surpass GPT limitations by incorporating tools and vector databases

  • @_slickyricky
    @_slickyricky ปีที่แล้ว +2

    Hey Dave when are you going to do part two of the video showing how to get Emma to do different tasks? A coding bot would be nice or further going into using a company’s db to feed back info when Emma is asked would also be great! Awesome video by the way thank you!

    • @EstherL-wd9yx
      @EstherL-wd9yx ปีที่แล้ว +2

      I second the connecting to the company's DB part, as long as no legal/security/privacy issue arises from this

  • @ai.millions
    @ai.millions ปีที่แล้ว +1

    Wow, that's a game changer

  • @AngusLou
    @AngusLou ปีที่แล้ว

    This is brilliant. It would be nice to see how to structure multiple bots in different channels. Should we bulit multiple bots in one app or one bot per app?

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      Thanks! Depends on what you want. Both would work.

  • @SuK55555
    @SuK55555 10 หลายเดือนก่อน +1

    Excellent Video Dave. I am stuck at Step 2, When I run (load_dotenv(find_dotenv())) this in interative mode in Visual Studio Code it is returning FALSE instead of TRUE. Any suggestions please

  • @VastUni
    @VastUni ปีที่แล้ว

    perfect

  • @84ed84
    @84ed84 ปีที่แล้ว

    Great video. Thanks for the walkthrough. Why did you use 3.5 turbo instead of GPT-4?

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว +1

      I am on the waitlist for GPT-4

  • @krisszostak4849
    @krisszostak4849 ปีที่แล้ว

    Emma's comments are absolute gold! 😆

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      She's a bit sassy 😂

    • @krisszostak4849
      @krisszostak4849 ปีที่แล้ว

      @@daveebbelaar you should have hired a plain Jane instead 😉

  • @marcova10
    @marcova10 ปีที่แล้ว

    Good one!, but suggest to not delegate delivering your videos by an AI, well,... not yet
    they are all well explained and very clear,

  • @yaser220
    @yaser220 ปีที่แล้ว

    Can I added it to group chat so she can analyze the chat then summarize it and if there’s tasks can it appoint the task to individual mentioned on the text 😅 I’m trying to do this but I’m not sure if it’s will work well

  • @RVarblas
    @RVarblas ปีที่แล้ว

    Really cool video, thanks! Do you think something like this for Discord would be more difficult to achieve?

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      Thanks! I think the process should be very similar for Discord.

    • @paschalgodwin5808
      @paschalgodwin5808 ปีที่แล้ว

      @@daveebbelaar I tried doing somthing similar for discord some days ago before stumbling on your video, I was having issues getting to read the messages sent by the user. I came across an article that said something along the lines of discord changed their intents policy so as to keep messages more private and protected, except the bot is verified and permitted to do so, it will be hard to access users' message and feed the bot

  • @bradcummins9532
    @bradcummins9532 11 หลายเดือนก่อน

    Is personal data safe when you are linking the AI to your DB? D they own the rights to that data? Does anyone know how that works once the data is retrieved from your DB?

  • @vaishnavimhaske7218
    @vaishnavimhaske7218 13 วันที่ผ่านมา

    Great Project! But my slack is unable to verify the link. The terminal shows 403 Forbidden and slack shows the URL link did not respond to the challenge parameter. It would be great if someone could help me with the error.

  • @AleSaira
    @AleSaira ปีที่แล้ว

    thx for the great explanation!! Can u give me a suggest how can I get my bot user id easier, because following ur instructions is not completely for me clear how can I run my script I mean it give me back some errors but in the end everything works good

    • @phenrotte130
      @phenrotte130 ปีที่แล้ว

      Same issue here, I use Pycharm to run the code

  • @utkuarslan5
    @utkuarslan5 ปีที่แล้ว

    How would you connect the bot to Teams?

  • @DJPapzin
    @DJPapzin ปีที่แล้ว +1

    I see the OpenAI API is used but where do we put the key? ".env" file?

  • @SebastianGruber-ul1kc
    @SebastianGruber-ul1kc ปีที่แล้ว +5

    Dave it's a great tutorial! Just working on setting up a slack agent, unfortunately I am stuck at 15:30 as the slack API doesn't verify the URL. I get the error message "Your URL didn't respond with the value of the 'challange' parameter". Any thoughts what the issue could be? I am running the ngrok server and see requests coming in when checking localhost:4040. Any help would be highly appreciated. THx

    • @pinaster0477
      @pinaster0477 ปีที่แล้ว

      Did you sort this issue?

    • @ameeny5572
      @ameeny5572 11 หลายเดือนก่อน

      @daveebbelaar bump

    • @yohanndiravino
      @yohanndiravino 11 หลายเดือนก่อน

      @@pinaster0477 : th-cam.com/video/FDLZ4pcItko/w-d-xo.html

    • @MikeRhodesIdeas
      @MikeRhodesIdeas 7 หลายเดือนก่อน

      bump! same error here

    • @just-another-gpt-user
      @just-another-gpt-user หลายเดือนก่อน

      Same here, it throws 401 Unauthorised in ngrok and flask, i tried regenerating signing secret but still same issue... this is a blocker ... @daveebbelaar quick response on this will be really helpful

  • @ryankozak8968
    @ryankozak8968 ปีที่แล้ว

    Having issues with ngrok changing forwarding URL each session, leading to refreshes in slack api a must do, per session. Any work arounds to help keep this address static?

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว +1

      Unfortunately, that is not possible. It's kinda annoying but that is why this is a development setup.

  • @damnft8218
    @damnft8218 ปีที่แล้ว

    Hello is there a way to contact you regarding one of these projects?

  • @omnimode4804
    @omnimode4804 5 หลายเดือนก่อน

    how to set up python interactive?

  • @AICandyMD
    @AICandyMD ปีที่แล้ว

    when i try to run the interactive terminal to get the bot toke id, i keep getting this error and don't know how to fix it.
    ModuleNotFoundError: No module named 'slack_sdk'
    however when i run pip list, it shows that it's there. slack-sdk 3.21.3

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      Make sure that you are installing in the correct environment and also using the correct environment in VS Code. You can also try to run `pip3 install slack_sdk`

  • @DJPapzin
    @DJPapzin ปีที่แล้ว

    A free hosting server would be great

  • @user-zq3ij3qc9q
    @user-zq3ij3qc9q ปีที่แล้ว

    for the env your doc is missing the ai part. here is the code - OPENAI_API_KEY= "insertkeyhere"

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      Thanks! I've updated it ;)

  • @Gabirell
    @Gabirell ปีที่แล้ว

    Hi. Thanks for your videos… just a curiosity (off topic) where are you from? I’m curious about your “v’s”: for my ears sound like “f’s” which is common in my natural Valencia (Spain) and in Brazilian Portuguese… so… you seem to be north European so which is your most used language? Cheers!

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว +1

      Haha you are not the first one to mention that. I wasn't even aware of it. I am from the Netherlands ;)

    • @Gabirell
      @Gabirell ปีที่แล้ว

      @@daveebbelaar Really interesting how different languages have things in common… thanks for answering!

  • @VenomsGT
    @VenomsGT ปีที่แล้ว

    comment for the algorithm :)

  • @galileor713
    @galileor713 ปีที่แล้ว

    Can we use it on whatsapp business?

  • @MikeRhodesIdeas
    @MikeRhodesIdeas 7 หลายเดือนก่อน

    @dave does this require a paid ngrok account to work?

    • @daveebbelaar
      @daveebbelaar  7 หลายเดือนก่อน

      Nope, I used the free version.

  • @ScottMillien
    @ScottMillien ปีที่แล้ว

    nice ! thank you :D I will sub your channel. I hope you can teach or show how I can connect it to a database , so it can read our company data
    !

  • @JohnMiller123
    @JohnMiller123 11 หลายเดือนก่อน

    Can Emma be animated and use a resident text to speech app?

  • @Patrick-rj8gh
    @Patrick-rj8gh ปีที่แล้ว +10

    If only Emma could wash the dishes and clean the bathroom.

  • @farhanafridi8694
    @farhanafridi8694 9 หลายเดือนก่อน

    Can we make a chatbot like this for WhatsApp ?

  • @Zolipants
    @Zolipants ปีที่แล้ว

    I called mine Craig

  • @makro3581
    @makro3581 ปีที่แล้ว

    Hey Dave, really good content, can't get enough :)
    Maybe someone can help with this error: urllib.error.URLError:
    What to do now?

    • @nicolascort
      @nicolascort ปีที่แล้ว

      Im getting the same error

    • @dawsongrattidge1695
      @dawsongrattidge1695 ปีที่แล้ว

      Me too

    • @jamesmccombe7289
      @jamesmccombe7289 ปีที่แล้ว +1

      ​@@nicolascort
      Add this under the import os on line 1
      import ssl
      ssl._create_default_https_context = ssl._create_unverified_context

    • @jamesmccombe7289
      @jamesmccombe7289 ปีที่แล้ว +1

      @@dawsongrattidge1695 Add this under the import os on line 1
      import ssl
      ssl._create_default_https_context = ssl._create_unverified_context

    • @reginabm
      @reginabm 2 หลายเดือนก่อน

      @@jamesmccombe7289 worked as a charm! Thanks!

  • @user-os8zn1nu8m
    @user-os8zn1nu8m 3 หลายเดือนก่อน

    YO ANYBODY NOTICE PYTHON IS SPELLED AS PYTON IN THE DOC!
    BRO CORRECT IT

  • @sergedecoster5388
    @sergedecoster5388 ปีที่แล้ว +1

    1. Extremely complicated solution for something really simple. But yes, i understand that more things can be done.
    2.Implementing prompt templates in a vsto addon for outlook would be much more convenient.
    3.If your email is in browser gramerlyGo already writes your email.
    4. No talk about data privacy. Is it really ok to send the email you received to OpenAI? The sender did not agree to this. You might have NDA in place...
    5. Making a local LLM write email would be quite slow.
    6. No mention of the fact that copy paste into chatGPT is free, while using the API is expensive.

    • @iEuroPirate
      @iEuroPirate ปีที่แล้ว

      Man, email is not alone in big IT forest.

  • @jimcrow2000
    @jimcrow2000 ปีที่แล้ว

    nice video, but would have been nice to know it is not beginner friendly, and some sort of python knowledge, would not have wasted time. thanks anyway.

  • @joshualeeman
    @joshualeeman ปีที่แล้ว

    LOL, are your replies to youtube comments generated by an AI assistant too?

    • @daveebbelaar
      @daveebbelaar  ปีที่แล้ว

      Haha nope, that is still the real me - for now 👀

  • @daveebbelaar
    @daveebbelaar  ปีที่แล้ว +1

    Stupid human with his incompetent brain was not even able to spell his own name correctly in Slack...

  • @paresh3915
    @paresh3915 ปีที่แล้ว

    Having a hard time getting the bot_user_id using your method at 9:50 , can't seem to run the code in the interactive window as you did in the video , When I try to run the code:
    "import os
    from slack_sdk import WebClient
    from slack_sdk.errors import SlackApiError
    from slack_bolt.adapter.flask import SlackRequestHandler
    from slack_bolt import App
    from dotenv import find_dotenv, load_dotenv
    from flask import Flask, request
    from functions import draft_email
    # Load environment variables from .env file
    load_dotenv(find_dotenv())"
    I KEEP GETTING THIS ERROR
    : "False
    Output exceeds the size limit. Open the full output data in a text editor---------------------------------------------------------------------------
    AttributeError Traceback (most recent call last)
    c:\Users\15199\Desktop\AIExperiments\langchain-experiments\slack\app.py in line 8
    6 from dotenv import find_dotenv, load_dotenv
    7 from flask import Flask, request
    ----> 8 from functions import draft_email
    9 # Load environment variables from .env file
    11 load_dotenv(find_dotenv())
    File c:\Users\15199\Desktop\AIExperiments\langchain-experiments\slack\functions.py:1
    ----> 1 from langchain.chat_models import ChatOpenAI
    2 from langchain.chains import LLMChain
    3 from dotenv import find_dotenv, load_dotenv
    File c:\Users\15199\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\__init__.py:6
    3 from importlib import metadata
    4 from typing import Optional
    ----> 6 from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
    7 from langchain.cache import BaseCache
    8 from langchain.callbacks import (
    9 set_default_callback_manager,
    10 set_handler,
    11 set_tracing_callback_manager,
    12 )
    ...
    ---> 26 def get(self, url: str, **kwargs: Any) -> requests.Response:
    27 """GET the URL and return the text."""
    28 return requests.get(url, headers=self.headers, **kwargs)
    AttributeError: partially initialized module 'requests' has no attribute 'Response' (most likely due to a circular import)"
    and I cant seem to find a solution to get past that. Please suggest what I can do, I am new to learning Data science and Machine Learning using the jupyter interactive window, Please suggest what should I do to get past this step or any resources you can recommend to get more knowledge on this top. Appreciate your content a lot, Thank you!

  • @DJPapzin
    @DJPapzin ปีที่แล้ว

    having difficulties obtaining my SLACK_BOT_USER_ID