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!
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
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
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
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 !
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?
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?
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
@@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.
@@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).
@@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 !!"); }
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
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.
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...
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
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!
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.
@@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 !
@@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 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?
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 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.
@@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
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
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!
You are a legend! Keep up the amazing work!
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
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
Excellent, very well explained!
Hi Rajesh, Excellent Work Bro!
this is a dope tutorial keep it up bru
Thanks for the feedback. Much appreciated!
fab buddy , keeping making ai based interesting videos
it says conversationalretreivalqachain is deprecated now so, can you post an updated tutorial please?
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
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 !
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?
Thanks Raj.
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?
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
@@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.
@@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).
@@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 !!");
}
Hey this is really good information, how can make use of this to answer based on my webiste data instead of pdf ?
Please watch the attached link if you are done with "Chat with PDF"
ruclips.net/video/S3S64iEjRzs/видео.html
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
You cannot as you need to chunk it and upload it and create embeddings for each chunk
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.
Simply remove namespaces from allover the app and try again. There is an answer on my discord, jump on
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...
hi raj, i had a small doubt. for this project do we need open ai credits?
Yes you need a working API account.
Raj, i f*cking love your videos. Could this technically be trained on millions of documents? i want tthem to medical documents
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
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!
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.
That makes a lot of sense, thanks mate.@@raj_talks_tech
excellent
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
Thanks buddy great tutorial ❤. I followed you but i am getting error. Error: Question key question not found. Can you help me plz
Can you hop on the discord server you might find answers there !
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.
@@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 !
👏👏
i get into a problem that 17:16, PineconeClient is not a module in this package
how to resolve that?
@@smitagrawal7385 did you resolve it?
How to handle PDF files that contains images, diagrams, charts, tables, etc?
In this app you may not be able to handle it, but if you use GPT4 Vision capabilities you can
@@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
@@tiagoc9754 May be try cogagent
@@raj_talks_tech Thank you, I'll take a look at that one
Nice thank you. Would it be possible to create a new one with the current packages? I get a lot of deprecated errors.
there is an update on my discord about this.
updated namespaces field and also verified it last month
@@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?
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
Hi,
For streaming I am using ai-sdk from Vercel. So I am pretty sure that it should be supported.
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
Not entirely sure what you mean here. If you run nodejs it should have access to your file-system.
@@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.
@@raj_talks_tech it also seems odd that we have no similarity search running in the APP. How does it choose the right information ?
@@tiagopereira1181 Pinecone takes care of it. It takes care of during embedding and also retrieval
@@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
Hii can we use upload the pdf from the web also
Absolutely 💯
How can I use a local LLM with this?
Use Ollama
whats the accuracy of the LLM ?
Where can I install ai-stream-experimental/react
Now the ai sdk supports streaming out of the box so you just need to install ai sdk and impor from "ai/react"
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
I don't have components as you do and global.css has no dark mode lines
Can you join my discord ? I think I can help you out !
Can I build this without pinecode??
Absolutely. You can use any vector database. And open source ones like Qdrant.
@@raj_talks_tech Oh! Thanks 🙏🏻
Why pinecone and not something else?
certainly you can use any vectorDB, I just used Pinecone as it was easy to get started
I didn't get why we need 2 prompt templates
Its for chaining LLM calls because instead of making everything in one call, you break down things into multiple tasks
@@raj_talks_tech thank you! I wasn't fully aware of the stand alone question concept. Now it makes totally sense
how to make without openapi
Is this considered RAG?
Yes !
man your codebase is different to what you have in the video
can upload multi pdf file
Hey Hugo,
For now just one, but it should be pretty easy to extend