Build a Chatbot With Custom Data Using ChatGPT and Supabase

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ส.ค. 2024
  • Thanks to Supabase for sponsoring this video! Check out the launch week here: supabase.com/launch-week
    Enjoying my videos? Sign up for more content here: www.coopercodes.com/
    In this video we build a Supabase and OpenAI system that allows us to call an API endpoint with a question, and then get an answer based off our own CUSTOM data. Pretty impressive! This is done by using PostgreSQL vector storage, Supabase Edge functions, and OpenAI Embeddings. Even if you're a beginner to using embeddings, this video is a great start into understanding how you can build AI systems with your own custom data!
    match_documents code: pastebin.com/6PdKt8hH
    initial index.ts code: pastebin.com/2EvkZeTn
    FINAL CODE: github.com/coopercodes/Custom...
    I used this blog post as a resource throughout the video: supabase.com/blog/openai-embe...
    0:00 Intro
    0:38 System discussion / Introduction to embeddings
    5:33 Setup Supabase Vector Storage (PostgreSQL)
    9:08 Get API keys / Project URL
    10:11 Generating embeddings from custom data
    18:20 Setting up Supabase edge functions
    23:36 Building out API logic (ask-custom-data)
    38:15 Calling our API endpoint (Asking questions!)
    41:05 Thanks for watching!
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @splattelol
    @splattelol ปีที่แล้ว +9

    Mom clear the calendar, Cooper just uploaded a new video

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

      Hahahah thanks for the comment 😂

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

    Awesome video man. Really well explained. Thank you!

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

    Just what I was looking for. Thank you

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

      No prob, I got you 👍

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

    Thanks for the great tutorial!

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

    your tutorial was super awesome and helpful.

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

    Time to make this as my NLP Final Project 🔥

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

      Hahaha best of luck Rayno!

  • @Deus-lo-Vuilt
    @Deus-lo-Vuilt 7 หลายเดือนก่อน

    Nice thanks for video , I liked

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

    how does this not have more views

  • @oleksandr.brazhii
    @oleksandr.brazhii ปีที่แล้ว +4

    Very useful video, thanks.
    There're some questions regarding final prompting:
    Why do you add '---
    ' to each context doc end? Is '---' indicates a piece of independent info to davinci model? If yes, then why '
    '? Doesn't the model replacing it with a space before processing?
    And what are the benefits of using text-davinci-003 completion model rather than gpt-3.5-turbo which is cheaper (so more technically effective)?

  • @user-eb8qu3es8t
    @user-eb8qu3es8t 10 หลายเดือนก่อน

    Brilliant!

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

    Nice video - very useful.

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

      I can't believe I forgot to respond to this! Thank you for the support, glad you found it useful.

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

    Another banger🔥

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

      Yessir! Thanks for watching :)

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

    Thank you for this amazing tutorial! Question about the cost. How do I know how much it costs (open ai api call + supabase function call) ?

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

    brilliant video by the way, there are some projects where you feel joy making it this was one of them

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

      Thank you, glad you found it enjoyable :) Thanks again for your comment

  • @RobChambers-ew8gj
    @RobChambers-ew8gj 3 หลายเดือนก่อน

    Can you do a video that builds upon this one, adding a frontend interface for both user prompts and assistant responses, and also an "admin" window that would allow for data training without the need for code? That would rock!

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

    Another brilliant tutorial! Q: Is the custom data sent everytime the user communicates GPT? In that case, a large custom data will be very expensive to run. Unless GPT reads the custom data ones and uses it as context for all future conversations

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว +8

      Great question! I will start by saying that this endpoint is more of a Q&A style, it forgets any context from previous messages and it simply answers the question that a user asks. I plan to create another video showing off a conversational chatbot with custom data, where messages can go back and forth.
      The entirety of your PostgreSQL documents database is not sent with every single request if that is what you're asking. Take a look at the diagram around 1:00 for help with this, as the process is the following:
      I ask a question "Who is Cooper Codes?", the backend code will find all the relevant documents to that SPECIFIC question, so it will show all the data points most relevant to that question (for example "Cooper Codes is a programmer"). If I had a database that held information for ALL youtubers, it would still only give the data points relevant to Cooper Codes to my ChatGPT prompt. This is because of some logic happening in the match_documents function (code here: pastebin.com/6PdKt8hH ) that allows us to get the documents MOST relevant to our specific question.
      In the end our prompt is literally:
      "
      Tell the chatbot how to behave
      --- include Cooper Codes information for Cooper Codes question ---
      --- question here: "Who is Cooper Codes?"
      "
      Hopefully this helps! Please let me know if I didn't answer something in particular here. I am planning on releasing more basic videos on this topic in the future!

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

    Awesome tutorial! Could you talk more about how we could learn to convert PDFs and other documents into string format so that we can use them in this program?

    • @artarioo
      @artarioo 6 หลายเดือนก่อน

      I recommend checking out pdfjs, had a similar question and it came in pretty useful

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

    Thanks a lot. How to use supabase openAPI schema inside GPT4?

  • @samanthalee6749
    @samanthalee6749 4 หลายเดือนก่อน

    Wanted to mention that copy-pasting the DB password (at 21:23) might not work - you have to type the password. Took me like 10 mins to find the problem and solved it thanks to a gh thread.

  • @ericmasonco
    @ericmasonco 25 วันที่ผ่านมา

    Is there a way to include news article links for the bot to learn and provide responses with that content?

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

    Hi I have followed the instructions word for word but when I try to linj to my project I get "Failed to symlink supabase with error: package.json not found" package.json does exist and I am logged in

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

    damn great, is it possbilt to connect chat messagner?

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

    I do everything it says but when I run node.js I get "SyntaxError: The requested module 'openai' does not provide an export named 'Configuration'".
    What can it be?, excellent video anyway, very well explained

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

    i run node server.js and got internal server error 500 ?

  • @meysamjed
    @meysamjed 3 หลายเดือนก่อน

    Thank you first of all.
    I am not a programmer and I just want to know if this chatbot can be connected to Manychat and used through Instagram?

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

    I am getting "failed to create new function on supabase project" When I run npx supabase deploy ask-custom-base 😢 can anyone help??

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

    Im trying to set up the edge funtion btw Im unable to paste ( or manually type at least ) the acess token, the VS terminal doues not allowme, this is what the terminal says:
    PS C:\Users\xxxxx\SupaBaseDocs> npx supabase init
    Generate VS Code workspace settings? [y/N] y
    Error: open C:\.code-workspace: Access is denied.
    Try rerunning the command with --debug to troubleshoot the error.
    PS C:\Users\Carlos\SupaBaseDocs> npx supabase init --debug
    Generate VS Code workspace settings? [y/N] y
    Error: open C:\.code-workspace: Access is denied.
    Any idea how to pass that ? is one of those issues you dont know how to deal with"

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

      Having worked with edge functions recently, this workspace settings thing is new (Didn't exist in this video). Although unideal what happens when you say "N"? Could be a workaround, as I don't believe you need the VS code workspace settings for it to work.
      answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
      According to this it may help to run VS code as an administrator, as it may not have access to certain parts of your folder structure (which then cause the errors).

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

    Sorry found the proplem i had npx link supabase instead of npx supabase link

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

    ive watched a few times and cant get past this same error running node server.js please help me

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

      Take a look at upper and lower cases, most of errors are for little details.

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

      did you manage to fix the node server.js error?

  • @eintyp4389
    @eintyp4389 6 หลายเดือนก่อน

    DO not try this the OpenAI API is depricated... again.

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

    I have copied the code for index.ts , I have updated the keys and url but I get the following error Could not find the function public.match_documents(match_count, match_threshold, query_embedding Has anyone managed to get the code working ?
    Thanks

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

      Seems the code is wronh it should be
      match_documents no longer has a match_threshold parameter
      const { data: documents, error } = await supabaseClient.rpc('match_documents', {
      query_embedding: embedding,

      match_count: 10, // Choose the number of matches

      })