How to Combine Vector Search and SQL for RAG

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ •

  • @kenchang3456
    @kenchang3456 8 місяців тому +4

    Thanks for sharing. Between combining knowledge graphs and now SQL this is really advanced stuff (at least for me) and it'll take a bit of time to digest it but I'm happy that your videos are so detailed. The use of instructor/pydantic is a technique for controlling the conversation is going to take some digging on my part to understand it. I really appreciate you putting so much effort and sharing it with us.

    • @johannesjolkkonen
      @johannesjolkkonen  8 місяців тому +3

      Thank you Ken, much appreciated!
      There was definitely a lot of stuff in this video, so totally expected that it might take a bit of time to absorb. But once you do, I think you'll already be in a stronger place than most in thinking about RAG beyond simple vectors

  • @avthar16
    @avthar16 8 місяців тому +1

    Great video Johannes!

  • @korendani
    @korendani 8 місяців тому +2

    Nice, Thanks for sharing.

  • @tollington9414
    @tollington9414 6 місяців тому +1

    Very nice demo, its funny, I was just wondering if sql and vector search could be combined ... and you've nailed it.

  • @HarryWang-cd4yq
    @HarryWang-cd4yq 8 місяців тому +1

    Hey, just curious, what ide is that?

    • @johannesjolkkonen
      @johannesjolkkonen  8 місяців тому +2

      I'm glad you asked! It's cursor.sh, a branch of VSCode (and therefore compatible with most VSCode extensions), but with AI-capabilities wayyy better than Copilot. Highly recommend checking it out!

    • @cesarmosqueira6963
      @cesarmosqueira6963 8 місяців тому

      I’m glad you asked that too

    • @HarryWang-cd4yq
      @HarryWang-cd4yq 8 місяців тому

      @@johannesjolkkonen cool, thank you. great video is cool also

  • @kezy2695
    @kezy2695 7 місяців тому

    Hey Johannes, nice video, I have a question, trying to build RAG and stuck on chunking the data into vector db. I have huge FAQ on my website (about 500 pages) in format question and then answer. Now want to put this in the vector db, but I don't know if I need to put only answers, or question+answer as one chunk, or question and answer as separates chunks, how you will proceed?

    • @johannesjolkkonen
      @johannesjolkkonen  7 місяців тому +1

      Thank you!
      That's a good question. Let's assume you are performing search just by embedding the user's question and running that as a vector search (not sufficient for a lot of cases, but for FAQ it might be).
      In this case, the question in your FAQ-data is the most relevant, because you are basically trying to match the user's question with a semantically similar question in your FAQ-data (and then retrieve the answer). So, as a simple approach you might just do question+answer as one chunk.
      However, the answer might not actually have a lot of semantic similarity to the user's question, so including the answer in your vector field might negatively affect the quality of your results.
      So as an alternative, you could do the following:
      1. From your FAQ-data, populate your vector db so that each document in the vector db has two fields: a vector field, which only contains the (embedded) FAQ-question, and then separately a content field, which is the (plain-text) answer associated for that question.
      2. Then, you run your vector search against the vector field, and return the content field as part of your results.
      3. This way, the searching is just based on the semantic similarity of the questions, rather than taking the answers into account.
      This might be counterintuitive if you are used to thinking about vector searches where the search-field and the retrieved field are always the same, but there are other ways to do it as well.
      Hope this helps!

    • @kezy2695
      @kezy2695 7 місяців тому

      @@johannesjolkkonen Heyy, thanks for your answer, good point of view 🙏 Currently my systems works the same, but instead of vector db, I use normal text search implemented in Elasticsearch. I am searching for most similar question, then the output of elastic is passed to gpt and final output is returned.
      1) Do you think that by replacing elastic with vector db, I could get better results while searching for proper context to be used later in gpt to finalize response?

  • @kamalu2076
    @kamalu2076 6 місяців тому +1

    Really helpful content but please dont add music while you are talking, especially overpowering music. Makes it very difficult to follow what you are speaking.