Let's Build a "Chat With PDF” app using Langchain(TS/JS), AI SDK, Pinecone DB, Open AI & Next.js 13

Поделиться
HTML-код
  • Опубликовано: 1 ноя 2024

Комментарии • 91

  • @henapra
    @henapra 8 месяцев назад +2

    Fantastic Raj. I am not a coder, just a sales guy and have been trying to develop one such thing for training my own team. This will help me a lot. Great going mate!

  • @Karimz-69
    @Karimz-69 7 месяцев назад +2

    You are a legend! Keep up the amazing work!

  • @orlandocastellanos9263
    @orlandocastellanos9263 Год назад +5

    Excellent video! Could you create a tutorial on building an agent using open-source tools like Llama2, Chroma DB, Langchain, and FastAPI? Also, include instructions on how to deploy the project

    • @raj_talks_tech
      @raj_talks_tech  Год назад

      thanks for the feedback ! Will see what I can do. I do really wanna try opensource llm but as I see it I would still need to use providers like Huggingface

  • @FaizanS-nu5hs
    @FaizanS-nu5hs 8 месяцев назад +2

    Excellent, very well explained!

  • @timschannel247
    @timschannel247 8 месяцев назад +1

    Hi Rajesh, Excellent Work Bro!

  • @jooshmayer
    @jooshmayer Год назад +2

    this is a dope tutorial keep it up bru

    • @raj_talks_tech
      @raj_talks_tech  Год назад +1

      Thanks for the feedback. Much appreciated!

  • @aakash2665
    @aakash2665 Год назад +1

    fab buddy , keeping making ai based interesting videos

  • @ayeshaejaz1627
    @ayeshaejaz1627 2 месяца назад +1

    it says conversationalretreivalqachain is deprecated now so, can you post an updated tutorial please?

  • @johnnylyimo
    @johnnylyimo Год назад +2

    Good tutor, i have followed along. unfortunately got an error when run scripts, last step of storing embeddings on function embedAndStoreDocs, it just failed. Error: Request failed with status code 404 at createError (.....) I don't know how to fix it, Please help me

    • @raj_talks_tech
      @raj_talks_tech  Год назад +1

      Hey John,
      I have also explained that your index creation might have failed. Check if you have the right pinecone API keys and try again. Or create the index on the pinecone console. It should work !

  • @henriquematias1986
    @henriquematias1986 2 месяца назад

    Very cool but what if the PDF is constanstly being updated. Let’s say it’s the documentation that keeps being updated…. We would need to delete the data on the pine and recreate again?
    Also would be possible to use claude instead of CHAT GPT in the end?

  • @prashlovessamosa
    @prashlovessamosa 10 месяцев назад +1

    Thanks Raj.

  • @mzafarr
    @mzafarr 10 месяцев назад +1

    Thanks for the video. Quick question, if I want to add multiple docs in my pinecone db should I run this cmd: npm run prepare:data and after that change the doc and run the cmd again?

    • @raj_talks_tech
      @raj_talks_tech  10 месяцев назад

      Should work when you run the cmd everytime for importing a doc. In the end you need to make sure that you append the new doc to existing namespace or add it to a new-namespace (which may need you to have a paid account).
      But adding to a new-namespace would be easier

    • @mzafarr
      @mzafarr 10 месяцев назад

      @@raj_talks_tech I'm on the free version so I am using it without namespaces. So will it work without changing anything else in your code, the only thing I changed was to remove the namespace part.

    • @raj_talks_tech
      @raj_talks_tech  10 месяцев назад

      @@mzafarr Yes then you have to append to the existing name-space without destroying existing data. Can you double-check by running the command twice on a fresh-namespace ? You should see sum of vectors (vectors for doc A + doc B).

    • @mzafarr
      @mzafarr 10 месяцев назад

      @@raj_talks_tech I looked at the code again and found that it won't do anything if index already exists. So I think some changes will be required, here you can have a look:
      const pineconeClient = new PineconeClient();
      await pineconeClient.init({...})
      const indexName = ...
      const existingIndexes = await pineconeClient.listIndexes();
      if (!existingIndexes.includes(indexName)) {
      createIndex(pineconeClient, indexName);
      } else {
      console.log("Your index already exists. nice !!");
      }

  • @swapnilharpale-ic5fq
    @swapnilharpale-ic5fq 9 месяцев назад +1

    Hey this is really good information, how can make use of this to answer based on my webiste data instead of pdf ?

    • @raj_talks_tech
      @raj_talks_tech  9 месяцев назад

      Please watch the attached link if you are done with "Chat with PDF"
      ruclips.net/video/S3S64iEjRzs/видео.html

  • @HollyJolly83
    @HollyJolly83 10 месяцев назад +1

    rather than using the command to execute("prepare:data": "tsx -r dotenv/config ./src/scripts/pinecone-prepare-docs.ts") for loading pdf, directly upload the file is possible? I tried it but the pdfLoader is throwing some error about fs module

    • @raj_talks_tech
      @raj_talks_tech  8 месяцев назад

      You cannot as you need to chunk it and upload it and create embeddings for each chunk

  • @ArtemBespalov
    @ArtemBespalov Год назад +3

    Suddenly namespaces are not supported in free tire project anymore. Also pinecode in new version expect array, so it doesn't work with new versions. Otherwise good tutorial. I made it to the end, but I'm not going to pay 70$ for the next pinecode tire to check if this actually can chat with documents.

    • @raj_talks_tech
      @raj_talks_tech  Год назад +2

      Simply remove namespaces from allover the app and try again. There is an answer on my discord, jump on

    • @Alex75847493759573
      @Alex75847493759573 Год назад +2

      You don't really have to pay. I found out afterwards. If you apply for the 70$ tire, you get charged with only what you use. It's about ~$2 per day. For the full day. It's completely based on time, you don't pay even for the whole day if you don't use it for that long.
      The only thing is that, if you have the index connected, then you pay. You can delete it and use it only when you need it and keep the information in a collection, which is ~$0.01 per day or something like that...

  • @shanu494
    @shanu494 8 месяцев назад +1

    hi raj, i had a small doubt. for this project do we need open ai credits?

    • @raj_talks_tech
      @raj_talks_tech  8 месяцев назад

      Yes you need a working API account.

  • @OBRosewell
    @OBRosewell 7 месяцев назад +1

    Raj, i f*cking love your videos. Could this technically be trained on millions of documents? i want tthem to medical documents

    • @raj_talks_tech
      @raj_talks_tech  7 месяцев назад

      thanks bud.
      this is more of a RAG so technically its not trained.
      However if you want the behaviour to change then you can prepare a large dataset from your data and try finetuning !!
      But in most cases RAG should work if you have a proper chunking + embedding in place

  • @Kkvta
    @Kkvta Год назад +1

    Hey Raj, great tutorial! I'm planning on building an app where the user uploads a PDF, it is parsed to plain text, uploaded to GPT with a prompt and the user receives generated data based on the PDF. Will I need Pinecone for that, or is Pinecone just used for prolonged, multiple gpt requests like a chat? Cheers!

    • @raj_talks_tech
      @raj_talks_tech  Год назад

      If your PDF is too large, you definitely need to store it in a vector DB(like Pinecone) and do a retrieval step and only add relevant data to the GPT prompt. Why ? Because GPT Prompts have max-cap on tokens.

    • @Kkvta
      @Kkvta Год назад +1

      That makes a lot of sense, thanks mate.@@raj_talks_tech

  • @AakashKushwaha-x1d
    @AakashKushwaha-x1d Год назад +1

    excellent

  • @mohamed.hesham
    @mohamed.hesham 6 месяцев назад

    i did the Embed PDF and store on Pinecone DB
    put iam bilding by app using express js
    can eny one help me how to implement Conversational Retrieval QA

  • @alishoaib3932
    @alishoaib3932 10 месяцев назад +1

    Thanks buddy great tutorial ❤. I followed you but i am getting error. Error: Question key question not found. Can you help me plz

    • @raj_talks_tech
      @raj_talks_tech  8 месяцев назад

      Can you hop on the discord server you might find answers there !

  • @daianabilbao2771
    @daianabilbao2771 2 месяца назад

    Is it possible to not allow uploading a pdf? I have pdfs i want to train the ai with. I don't want the user to upload the pdf themselves.

    • @raj_talks_tech
      @raj_talks_tech  2 месяца назад

      @@daianabilbao2771 You are probably talking about fine tuning ? Thats a fairly complex process cos you will have to prepare your dataset based on your pdf and fine tune it !

  • @JU-vt4nk
    @JU-vt4nk 20 дней назад +1

    👏👏

  • @junaidiqbal4104
    @junaidiqbal4104 7 месяцев назад +1

    i get into a problem that 17:16, PineconeClient is not a module in this package

  • @tiagoc9754
    @tiagoc9754 9 месяцев назад +1

    How to handle PDF files that contains images, diagrams, charts, tables, etc?

    • @raj_talks_tech
      @raj_talks_tech  8 месяцев назад +1

      In this app you may not be able to handle it, but if you use GPT4 Vision capabilities you can

    • @tiagoc9754
      @tiagoc9754 8 месяцев назад +1

      @@raj_talks_tech thank you. Yeah, I tried using GTP4 vision but it didn't work very well with flowcharts. Tesseract also fails on this. The only solution I could find so far is manually converting them to some textual representation. But that's not a valid option if we want users to upload their docs. I'm still looking forward a better solution for this. I'd be very grateful if you come across any solutions and could share them here. I'll let you know if I find anything as well

    • @raj_talks_tech
      @raj_talks_tech  8 месяцев назад +1

      @@tiagoc9754 May be try cogagent

    • @tiagoc9754
      @tiagoc9754 8 месяцев назад

      @@raj_talks_tech Thank you, I'll take a look at that one

  • @TheWhoIsTom
    @TheWhoIsTom 6 месяцев назад

    Nice thank you. Would it be possible to create a new one with the current packages? I get a lot of deprecated errors.

    • @raj_talks_tech
      @raj_talks_tech  6 месяцев назад +1

      there is an update on my discord about this.
      updated namespaces field and also verified it last month

    • @TheWhoIsTom
      @TheWhoIsTom 6 месяцев назад

      @@raj_talks_tech nice thank you. Like the way you teaching!
      Another question: is there a chance you will record a session where you show implementing just an api route which does the work and than returning the result to the requester?

  • @KaranKulshrestha-e5x
    @KaranKulshrestha-e5x Год назад

    Hello, how you can deploy this project on vercel because streaming do not support in vercel, can you please make a video or help us in deploying this site

    • @raj_talks_tech
      @raj_talks_tech  Год назад

      Hi,
      For streaming I am using ai-sdk from Vercel. So I am pretty sure that it should be supported.

  • @tiagopereira1181
    @tiagopereira1181 11 месяцев назад +1

    My application seems like it has access to information other than the files I provided, do you have any idea why this might happen? Great tutorial btw

    • @raj_talks_tech
      @raj_talks_tech  11 месяцев назад

      Not entirely sure what you mean here. If you run nodejs it should have access to your file-system.

    • @tiagopereira1181
      @tiagopereira1181 11 месяцев назад

      @@raj_talks_tech basically I Uploaded a text file and the vectors on my dB are good but when I talk to him and make questions about the texts i gave him he gives me information that is not in there.

    • @tiagopereira1181
      @tiagopereira1181 11 месяцев назад

      @@raj_talks_tech it also seems odd that we have no similarity search running in the APP. How does it choose the right information ?

    • @raj_talks_tech
      @raj_talks_tech  11 месяцев назад

      @@tiagopereira1181 Pinecone takes care of it. It takes care of during embedding and also retrieval

    • @tiagopereira1181
      @tiagopereira1181 11 месяцев назад

      @@raj_talks_tech it is weird because in the sources on each message it has chunks of texts that I Uploaded him with but the message that he sends is not related to the those files i uploaded

  • @divyanshiagrwal5216
    @divyanshiagrwal5216 6 месяцев назад +1

    Hii can we use upload the pdf from the web also

  • @skrylla
    @skrylla 8 месяцев назад +1

    How can I use a local LLM with this?

  • @Nebbie3
    @Nebbie3 10 месяцев назад

    whats the accuracy of the LLM ?

  • @KinglhbCoding
    @KinglhbCoding Год назад +1

    Where can I install ai-stream-experimental/react

    • @raj_talks_tech
      @raj_talks_tech  Год назад

      Now the ai sdk supports streaming out of the box so you just need to install ai sdk and impor from "ai/react"

  • @starlord7526
    @starlord7526 Год назад

    I am trying to follow through your video but when I try to setup the project, I don't have same files as you do. It would have been better if you could record that portion too. Sorry if it sounded like I wanted to be spoon fed, but thats not true

    • @starlord7526
      @starlord7526 Год назад

      I don't have components as you do and global.css has no dark mode lines

    • @raj_talks_tech
      @raj_talks_tech  Год назад +1

      Can you join my discord ? I think I can help you out !

  • @aaaryanpatel
    @aaaryanpatel Год назад +1

    Can I build this without pinecode??

    • @raj_talks_tech
      @raj_talks_tech  Год назад +1

      Absolutely. You can use any vector database. And open source ones like Qdrant.

    • @aaaryanpatel
      @aaaryanpatel Год назад +1

      @@raj_talks_tech Oh! Thanks 🙏🏻

  • @yt-mca
    @yt-mca Год назад +1

    Why pinecone and not something else?

    • @raj_talks_tech
      @raj_talks_tech  Год назад

      certainly you can use any vectorDB, I just used Pinecone as it was easy to get started

  • @tiagoc9754
    @tiagoc9754 9 месяцев назад

    I didn't get why we need 2 prompt templates

    • @raj_talks_tech
      @raj_talks_tech  9 месяцев назад +1

      Its for chaining LLM calls because instead of making everything in one call, you break down things into multiple tasks

    • @tiagoc9754
      @tiagoc9754 9 месяцев назад

      @@raj_talks_tech thank you! I wasn't fully aware of the stand alone question concept. Now it makes totally sense

  • @Rawkney
    @Rawkney 2 месяца назад

    how to make without openapi

  • @joshualazar40
    @joshualazar40 8 месяцев назад +1

    Is this considered RAG?

  • @TomAsh519
    @TomAsh519 5 месяцев назад

    man your codebase is different to what you have in the video

  • @hugorose4054
    @hugorose4054 11 месяцев назад

    can upload multi pdf file

    • @raj_talks_tech
      @raj_talks_tech  11 месяцев назад

      Hey Hugo,
      For now just one, but it should be pretty easy to extend