Excellent video, thank you so much! I have concerns about data privacy tho. It would be great to do the same with another model that could run locally, like alpaca... would it be possible?
I would love to see a video where I can build same thing with open source alternative tech, being a student that would be very much helpful to build some capstone projects.
@@DataIndependent If you switch to open source I'm fairly certain you will increase access and grow faster as a content creator. I only use only source tools and will wait for someone to create an alternative. I tend to seek out creators that use these tools by default. It's good to know about the tech of course but if I can't own it I don't use it daily and don't usually recommend it unless it's business related.
@@chrisriley6264 There is PrivateGPT with ChromaDB and Vicuna LLM. Fully local and free. But it's not too impressive ATM on its own. I think with some tweaking and optimisation, it will become useful.
I am new to AI, but have an interest in AI application for healthcare, specifically in the emergency department. Your explanations are very easy to follow ... great job!
@@DataIndependent Really, this is a useful video. Do you have any suggestions on getting the embedding value from variable "embeddings" or "dosearch"? I tried to find answers from openai library codes or langchain documents but didn't get a clear answer.
This is such a good combination of accessible and technical. Thanks so much for what you're doing! As a technical person very new and exploring this space, your content is so so helpful
An amazing video, I learned a lot thanks to this. LangChan's documentation is very difficult for me to understand, but thanks to your video I feel much more confident to start experimenting with this library.
I have a use case with a haven't seen anywhere: I create a private GPT that has documents as contexts. This documents has criteria for a specific subject I give it system instructions so its function is to evaluate a user document that it's attached as a part of the prompt, to see if the document complies with the criteria in the context documents, and give detail response on the result of evaluation and the justification that includes, the content of the user document and the criteria in the context documents. I want to do that in LangChain but I don't know hot to add a user document as a part of the prompt for the RAG.. It would be great if you can you explain how to approach this implementation. Thanks you for the content!! Keep the good work.
Help! When installing ChromaDB with pip install chromadb i keep getting this error "clang: error: the clang compiler does not support '-march=native' error: command '/usr/bin/clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for hnswlib Failed to build hnswlib ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects" I've been trouble shooting this all day and cannot get it resolved. MacOS 13.4 Intel i7
that's a great tutorial of using langchain and GPT for building a QA robot. But i have a question. If you made specific questions, it could give you relevant answers. But in regular conversations, people can't always give full details. For example, the 1st question is "what did the president say about stephen curry?", the robot can understand and give answer. but the 2nd question is "did he reply?", most of details are lost in the 2nd one, if this question is sent directly to gpt, probably it can't give you correct answer. how do you think about that?
@@yantaosong thx for the reply, I figured out that I should generate the standalone question according to the context before I make the query. Thank you anyway
Great video Greg, thank you!! The VectorDBQA method is already deprecated, use below chat = RetrievalQA.from_llm(llm=OpenAI(), retriever=docs.as_retriever())
I asked this to Langchain helper chat AI, this is the answer: RetrievalQA.from_llm and VectorDBQA are both question answering models in the Langchain library. RetrievalQA.from_llm is a chain that uses a large language model (LLM) as the question answering component. It retrieves relevant documents from a vector database (VectorDB) based on the query and then uses the LLM to generate an answer. VectorDBQA, on the other hand, directly retrieves documents from a vector database and uses a default question answering prompt to generate an answer. Both models can be used to answer questions based on retrieved documents, but RetrievalQA.from_llm provides more flexibility in terms of customizing the prompt and using the LLM for generating answers.
Great video! I would love to see some in-depth walk through of the various chain types and agents, along with examples to help clarify usage. Thank you.
Really helpful for me, thank you! I also heard about GPT Index , but don't know the difference between LangChain with GPT Index. Is it possible to see more details about the comparison?
I am highly interested in the implementation of a T-5 and different ways for textsplitting without losing context. A tour would be greatly appreciated..
Thank you for implementing the feature with the text file. While using the line of code 'qa = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=docsearch)', I received feedback indicating that the VectorDBQA module is deprecated. Deprecated cautions suggests importing 'from langchain.chains import RetrievalQA', which includes a retriever parameter. However, I encountered an issue when attempting to replace 'docsearch' with this parameter. Can you please advise me on how to properly use the 'RetrievalQA' module?
Check out my latest video on the 7 core concepts of Langchain and specifically the indexes section. I have an example about retriever in there. If that doesn't help then I recommend looking at the documentation
I had the same error. I swapped the code with VectorDBQA to the following RetrievalQA.from_chain_type(llm=OpenAI(temperature=0.5), chain_type="stuff", retriever=docsearch.as_retriever()) The thing that took me time to find was the docserach.as_retiever function
Great video! Is there a way to create a chatbot that smartly uses our data + gpt-3.5 data and give us a COMBINED answer from both the data set instead of just our data set or gpt data set? So let's say your document had details about 'what did McCarthy discover?' but there's no information for 'when did McCarthy discover the language lisp?'. In this case, it should still be able to answer by looking up our data set for details related to McCarthy and language lisp... and then look-up the gpt-3.5 data for details related to when was it discovered as that's not in our data set.
Thanks Greg! Great video on using custom files. Could you share a video about RAGs? I heard there are many types and I'd love to learn which is best for different tasks.
Thanks for the great tutorial! For multiple documents, can you please advise on how i can retrieve the file name where the contextual information is retrieved from?
I'm got IndexError: list index out of range when executing this line: docsearch = Chroma.from_documents(texts, embeddings). I tried loading a large pdf file. This could be the culprit. Can you suggest a workaround?
I have got a better answer :D "' In 1960, John McCarthy published a remarkable paper in which he showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for "List Processing," because one of his key ideas was to use a simple data structure called a list for both code and data.'"
A very useful bit of information - and I'm not sure if this is possible with LangChain - would be to display how many tokens each request is using etc. This video is awesome but, behind the scenes, we have no idea how many tokens/embeddings/queries are being performed so I can't see any way to keep track of the cost involved in doing this over and over
How can I integrate this to Bubble? Only part I am struggling with is being able to deploy a script like this and have it interact with Bubble via APIs
hi great video! Im wondering if anybody got an error when creating the docsearch "IndexError: list index out of range". Cant seem to find why this happens if I followed step by step. Any help is greatly appreciated. Thanks!
In this example, Chroma always generates an in memory DuckDB database, each time you open and run this notebook to query your text documents it has to build the database from scratch. Is there any way to save this to disk and use that in subsequent queries. And if it could be loaded into memory each subsequent time that would be great.
This is awesome - how am I able to use this with a Davinci Model for more in-depth responses? Can you do a second video on Fine-Tuning this system to reduce Hallucinations, create more complex responses, and ask it more in-depth questions?
@@DataIndependent UA-cam Transcripts; I have a course that’s divided into 12 Months, all adding up to a total of 118 .txt files for Transcripts. I’d like to be able to create a “tutor” if you will, one where I can ask questions about the contents of the course if something confuses me I’ve made one that does this, but the absolute main issue I’ve found is structuring the Transcript data… The bot cannot interpret raw Transcripts all too well, so I realize I may need to reformat them into something like a Knowledge Graph for each Lecture. What would be the best way to structure/format a Transcript for this use case? The issue is that minimal data should be lost when re-formatting so the bot isn’t lacking any information that’s already been discussed. This has been my biggest issue
If I upload my custom documents to OpenAI, will it be private? I want to ensure that it is not available to the public at large and is only accessible through my API key. Can you clarify? Secondly, how long will this data set persist in OpenAI? If I upload my documents to OpenAI can I query it a month or two later? How about a year? Thanks
/ If I upload my custom documents to OpenAI, will it be private? Assume they're not. You can check their website for policies but either way you're giving them your data. You don't ever "upload" your documents to OpenAI. You give them a prompt and they return it. openai.com/policies/api-data-usage-policies
@@DataIndependent Can you share some tips? Python version? I can't seem to get past the import nltk line since it throws an error but I have everything installed in my virtual env 🤔
@@DataIndependent let’s say you had a sheet or dataframe or web table of bus trip categories, cities prices and departure times. is it possible to ask a langchain app for averages, totals, predictions on any feature? To combine both LLM and basic computational results? or even show you a bar chart 📊 by executing a python chart function using text input parameters?
Nice! Thanks for the comment. I need to explore other document loaders and custom agents before I try out more vectorstores or dbs. I jotted this down on my ideas list.
A bit of both? It's passing the docs to the LLM then coming up with answer for you. It's a bit of summarization but also word for word. Whatever the LLM chooses.
There seems to be some sort of limit on the length. It seems to be somewhere around 8 to 10k words. Some of my documents will work at that length but some of them dont. It says the token limit has been reached on some of them. Did I do something wrong or is that expected?
That's totally correct. There is a token limit that you'll hit. Check out my video on "workarounds to openai token limit" for information on what to do about it.
What a great video! Can this be done on web-urls - I have a use case wherein we have several internal confluence pages. And want to ask questions on them.Can they be somehow loaded into vectorDB. Any guidance highly appreciated.
great video. is there any need to set temperature to anything other than zero for such 'search' like applications? i can see enterprise search being a simple use case, but people would want 1 authoritative answer or a ranking. so in such a case, can it for example, fall back to amazon kendra -which ranks the results instead ?
Taht is only reason stopping me from going all in on chatgpt , is there an alternative? Which can help me , i don't want to share all information with chatgpt at the same time don't have money to make my own locallly host gpt
Great video series, keep up the amazing work! Also, you kind of look like Bradley Cooper. I figured that was a decent compliment, so I thought I would toss it your way. Have a great one.
Great feedback! How do you add extra documents to the Chroma store when using the persisted_directory? Neither 'add_documents()' nor 'from_documents()' seem to work for me :-(
What's the error you're getting? Here is the documentation (at the bottom) that could help: langchain.readthedocs.io/en/latest/modules/indexes/vectorstore_examples/chroma.html
I was able to edit the code with Directory loader function to read and query most types of documents in a folder. Is there a way I can integrate Google Search within the same code and questioning Chain so the logic of the model is to make a decision to search local db and if no answer is found it will also look on the internet
HI Greg , thanks for your tutorial video. I am new to AI and I am wondering what if at first we want to explore private folders/database consist of multiple pdf with the chatbot (as search engine) then would like to ask question to specific document retrieved by the chatbot earlier, so when we ask questions to the bot it focus to search on selected document rather than the entire folder/database. Is it possible to apply metadata to address each chunks sources or maybe using the "agent" framework for this case? Thank you
This still seems to be uploading "private" data over to openAI during the embedding creation phase. Is there a way to create the embeddings without having to pass the document data to their APIs?
I understand how you are using CharacterTextSplitter to chunk the data into 1000 characters. What code could be used to chunk by each page, and also if you wanted to chunk every time a particular word arises, such as "Question:"? I'm asking because I would like to create embedding for each question and answer in a deposition. Many thanks for the great videos! This helps even a non-coder understand the overall process. Excellent job!
Nice! That’s fun. The splitter takes an argument “separator” which you can customize and it’ll split your documents by that thing. In your case you can have it look for “question:” and split there. It’s not ideal and you may need to do some string clean up but it’ll work
thats what i do, sometimes gotta pull out the ol regex especially when chunking code, thankfully gpt makes that not an afternoon of regex googling anymore lol@@DataIndependent
What is the limitation to this approach, in terms of amount of data to query over, considering the OpenAI model still has a token limit. Can I have thousands of documents, if I use a proper vector database? Are there any numbers one can refer to?
@@DataIndependent Yes but in the real world people don't just have a handful of documents. They have entire databases or large complex filesystem etc, which is the whole reason they'd love a solution like this to query it with natural language. So if I have 10k Google Drive docs of policies, procedures, contracts maybe, legal docs etc... and want to create a chatbot for my employees to ask questions about all of it, LangChain is not going to be able to paste entire documents into the prompt for OpenAI or any other model... I presume. I assume that some querying needs to happen beforehand to narrow down the list of documents to as few as possible, maybe whittle that down further into relevant summaries etc, all of which takes a language model to understand what to focus on (I assume again), and then the tiny result gets pasted back into the prompt to OpenAI for a final answer to the user's query. So I am missing something, and not sure what it is.
@@PatrickMetzdorf ah I see. Check out my video on “asking a question to a book” it does exactly this. Yes, you do a semantic search before, narrow down the results, then use those results in your prompt.
Dude this amazing - thanks so much. Can you also do a tutorial, building an application that interfaces with this? say uploading a doc into an app etc.
Nice that sounds fun. Check out my video on building apps which may help ua-cam.com/video/U_eV8wfMkXU/v-deo.html I believe Streamlit is easy to work with on files.
Lets say I have an e-commerce store containing 100k+ product details and want to store them in a vectorstore, is there a way around calling open-ai embeddings for each of the product? maybe there is a free alternative?
Great video! Any concerns about privacy here? You mentioned about using local files, but it seems like there is a chance for OpenAI to have access to the doc text?
OpenAI (or any LLM you use) will only have access to the pieces you send over to them. In this example we load up 5-10 essays. But to answer a question we only send 4 smaller chucks over to OpenAI. So if you're worried about OpenAI seeing *any* of your data, then yes there are privacy concerns. They no doubt are using your data to train more models, beyond that I'm not sure what they are doing with it.
@@DataIndependent thanks for the answer. I also have the same concern :) I am curious to know is it possible to run a local GPT model to perform the same task using langchain. It would be great that you can share some of your thought :) Thank you very much!
Hi I have a question. I am using GPT-3 for the task of few-shot text classification, I have tried directly GPT-3 and also via LangChain (using the same few-shot examples for both, the same format of the prompt (the one from LangChain formatter) and the same features of GPT-3). I had better results when I used LangChain. Is there any explanation why LangChain performed better than directly using GPT-3? thanks
I want to create a app for support where It should respond from the document ( the document can be anything like for programming languages error support) but my agent should create those query as well in that document or database if its not available in the document. Can you tell me how to do those things in Langchain. Also can you create some more interesting videos on Langchain.
Good question - Have you followed the tutorial here? langchain.readthedocs.io/en/latest/modules/llms/integrations/azure_openai_example.html?highlight=azure What's the error you're getting?
Thank you for video! I have a question. What if i would like to use own embeddings model that deployed on AWS and it has embedding dimention is 512 but index dimention is 1536? How can i solve this problem? How can i decrease the dimention of index? InvalidDimensionException: Dimensionality of (512) does not match index dimensionality (1536)
Hi there. Haven't checked whether someone else asked this before, but what are the reasons for replacing Chroma by FAISS in the notebook? Is the latter a better option as vector store? Tks
Honestly - I was having errors with both Chroma and FAISS for a while so I had to switch between them. Those errors seem to be fixed so either is fine imo
1) Does the size of your own data (the text files in this case), affect the OpenAI charges? If so, this could be something one should be very aware of...correct? 2) Do the text files end up at OpenAI somewhere? I'm just thinking of private data ending up somewhere unintentionally.
Awesome! 1) The thing that matters is how much data you pass to openai, not necessarily the size of your original document. 2) Data you send to OpenAI does stay with OpenAI for 30 days and then it's deleted
Really helpful video. Thanks for sharing. I am exploring if we can use CSV data to fine tune chatgpt and then use chatgpt's generic knowledge to augment the response. Like percentage of employees in my dataset living in CA. Chatgpt should get employees count from my personal dataset and CA population from its own knowledge base. Can langchain help ?
Yep, that sounds doable. You'd want to do that via a chain and include the math tools as well. ex: * Get your employee count in CA * Google to get CA population * Divide the two
really appreciate your work, just have one question for the chunk, how can I split the text into chunks by sentence or comma or space instead of chunk size?
Check out this page langchain.readthedocs.io/en/latest/_modules/langchain/text_splitter.html#RecursiveCharacterTextSplitter Where is says "self._separators = separators or ["
", " ", " ", ""]" Those are the default separators but you can specify your own. Do separators="," for a comma for example
I am really enjoying your content on Langchain. Its awesome. I was hoping if you could create videos around Vicuna LLM...What it is, How to fine-tune or train Vicuna LLM on custom dataset.
it has following error. ValidationError: 1 validation error for LLMChain prompt none is not an allowed value (type=type_error.none.not_allowed) May i ask how to fix that?
Thanks for this demo. I’ve built something similar using a set of unpublished manuscripts from a book publisher I work with. LangChain and OpenAI do a great job of answering questions contained within the texts, but it suddenly ONLY knows what is in my custom embeds. if I ask to compare a manuscript to one of Steven King’s best sellers it knows nothing. Because the only source is the embeds I’ve loaded into Pinecone, for example. How do you get the private data ADDED to the normal corpus and the answer reflect knowledge from both? I’d love to see a demo of that scenario.
Amazing video! Thank you so much for putting this out. How does the text splitting affect the accuracy of returned results? I have a collection of question and answers for an educational course. I want to customize the prompt given to ChatGPT that these are question and answers and find the correct answer. Is this something that can be done with LangChain?
Yep big time. If you have a small set of question/answers then you can do the method in this video. If you have a ton of questions/answer, check out my video on asking a book a question
@@DataIndependent Thanks for the reply. Agree that recursive splitter is more useful for a single large document. My question was more like - is it possible to tell CHATGPT via a prompt that you are looking at question and answer document instead of it assuming they are just pieces of text?
You can play around with your prompt to try and get it not to answer anything outside of what you want. I've had success with "If you don't know the answer say, 'I don't know.' Don't make anything up"
Can we use some structured data here? Can I query on the CSV data about my sales like how my sales performing in last 12 months, or something like that?
@@DataIndependent Thanks for the response! I've checked that out and that is fascinating! But I have a question regarding "questioning the tabular data + textual (unstructured) data". I've seen that at a time the "create_pandas_dataframe_agent" takes only single DF (table) at a time and then we can query on that. But... Suppose a scenario where I have 5 files. 1. A CSV with all information about the COVID-19 cases in the world 2, 3, 4, & 5 are the unstructured (text) files (Wikipedia pages) on the Olympics 2020. Now, if I ask something like: "What was the reason behind postponing the Olympics 2020"? Then the model should be able to answer from all data given to it also from the table. For: "In 2020 the world was suffering from the covid-19 and also Japan, where the Olympics were supposed to be held. At that time, Japan had around 2,000 daily cases and to prevent the spread, the Olympics was postponed". (Of course, the response is made up) But as we can see that the model is able to pick up the number of active cases "2,000" from the csv and is able to integrate with the rest of the story from the text data (assuming that number wasn't in the text data). Or say in a second use case, I give my sales data as a CSV and then ask something like: "How are my sales performing in the last 12 months, and which are the significant factors for it?" then we can imagine that the model should answer some trend, some figures, etc analyzing the data. The question is, is it possible? And if yes then how can we achieve such generative response from the model? What could be the pipeline? And whether it is possible with open-source frameworks such as Haystack or langchain? Please help. Thanks 🙏
This was super helpful! Would love a video on using pandas dataframe as a loader. It loads fine with one column but having multiple columns causes issues with chroma for some reason
Great video, thank you! After implementing your steps, I always get the error that I reached the token limit of the model. I have to use 300+ .txt files. Does changing the chain type help here? I watched your video on chain types as well :)
that awesome, is there a way for us to combine the vectored/custom data we have with GPTs own base training? so we can get an almost double referenced output? could we state in our return prompt to have gpt add onto the pulled vectorDB data its own understanding of the topic or would it do that already? cheers!
You could alter your prompt to have it add any extra details that aren't in the context. People often need to say, "only use what's in the context, don't make anything up" So I bet the reverse would be true too
@@DataIndependent yeah makes sense, I'm fine tuning a model with highly niched data for specific software use cases. Base gpt has good details but not enough however I don't want to eliminate the existing gpt knowledge with my custom data so yeah, imma play around with the prompting and ask for it to use its own core knowledge with the pinecone VDB
Thanks for the video, very informative and didactic! So, if I understood it correctly, what this pipeline is doing would be somehow this: 1. Get chunks of text and create one embedding representation for each chunk. 2. Perform a semantic (vector) search on the database containing those vectors/text 3. Append the top X results from the semantic search (which is still the raw text from your dataset) + append the question you’re asking. The final string with all this content appended will be sent to OpenAI’s model Is that correct? Is it possible to have finer control over some aspects of this pipeline? E.g. number of X results (or minimum vector distance) to include in the OpenAI’s query? Or choose which OpenAI model to use?
Yep, more or less that is correct. Yes, you can control the "N" which is the number of documents returned. When using pine cone you can get the distance metric back with the N documents. You could filter out the ones you don't want. You can switch the OpenAI model when you initialize your model in the first place. The default is Davinci but you can switch it up.
I just binged all of your videos on Langchain, this is exactly the library I was looking for. One question I have is if you need to utilize an OpenAI embeddings model for vector search of custom data, how would you also utilize a Model like let’s say Davinci if the solution also calls providing results not just from the vectorized content? For instance if the solution calls for having knowledge of personal data but also need to utilize LangChain search tools for query answer search? I don’t believe the OpenAI embeddings model can also do what you presented in your previous videos but I could be wrong. Any help would be greatly appreciated. Please keep up the videos!!
Nice! Thank you very much. For your question * Quick clarification - you don't *need* to use OpenAI for embeddings, lots of models can give you this. * The embeddings are just a way to get relevant documents. Once you got those docs you can do all sorts of chains (like the query answer search).
@@DataIndependent I have one more question further to Kalease (which is a great Q btw). So after vectorized and uploaded to Pinecone for example, and let say where the original text (pdf, word, text etc) are resided; once they are disconnected, will the LLM still be able to retrieve the information (sorry if people have already asked this)
Excellent video, thank you so much!
I have concerns about data privacy tho. It would be great to do the same with another model that could run locally, like alpaca... would it be possible?
I would love to see a video where I can build same thing with open source alternative tech, being a student that would be very much helpful to build some capstone projects.
Sounds good! I'll add that to the list.
@@DataIndependent If you switch to open source I'm fairly certain you will increase access and grow faster as a content creator. I only use only source tools and will wait for someone to create an alternative. I tend to seek out creators that use these tools by default. It's good to know about the tech of course but if I can't own it I don't use it daily and don't usually recommend it unless it's business related.
@@chrisriley6264 There is PrivateGPT with ChromaDB and Vicuna LLM. Fully local and free. But it's not too impressive ATM on its own.
I think with some tweaking and optimisation, it will become useful.
The underrated ninja of the AI space. Amazing content and explanation. VERY USEFUL.
Nice! Thank you Abhishek!
I am new to AI, but have an interest in AI application for healthcare, specifically in the emergency department. Your explanations are very easy to follow ... great job!
Nice! Glad to hear it
@@DataIndependent Really, this is a useful video. Do you have any suggestions on getting the embedding value from variable "embeddings" or "dosearch"? I tried to find answers from openai library codes or langchain documents but didn't get a clear answer.
This is such a good combination of accessible and technical. Thanks so much for what you're doing! As a technical person very new and exploring this space, your content is so so helpful
Nice I love it! Thank you!
Great series about LangChain a must see!
Nice thanks!
An amazing video, I learned a lot thanks to this. LangChan's documentation is very difficult for me to understand, but thanks to your video I feel much more confident to start experimenting with this library.
Awesome, I'm glad it worked out. Let me know what other videos or questions you have
Is it possible to use Chat GPT-4 with a private source data? Something proprietary for example that wont get shared out to the model?
For that you'll want to use a private local model on your own computer. It would work there.
I have a use case with a haven't seen anywhere: I create a private GPT that has documents as contexts. This documents has criteria for a specific subject I give it system instructions so its function is to evaluate a user document that it's attached as a part of the prompt, to see if the document complies with the criteria in the context documents, and give detail response on the result of evaluation and the justification that includes, the content of the user document and the criteria in the context documents. I want to do that in LangChain but I don't know hot to add a user document as a part of the prompt for the RAG.. It would be great if you can you explain how to approach this implementation. Thanks you for the content!! Keep the good work.
Help! When installing ChromaDB with pip install chromadb i keep getting this error
"clang: error: the clang compiler does not support '-march=native'
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects"
I've been trouble shooting this all day and cannot get it resolved.
MacOS 13.4
Intel i7
If Chroma isn't working for you try FAISS or check out their other integrations with vectorstores
langchain.com/integrations.html
Thanks Greg, found your video from reddit. Extremely well explained, great work!🤗
that's a great tutorial of using langchain and GPT for building a QA robot. But i have a question. If you made specific questions, it could give you relevant answers. But in regular conversations, people can't always give full details. For example, the 1st question is "what did the president say about stephen curry?", the robot can understand and give answer. but the 2nd question is "did he reply?", most of details are lost in the 2nd one, if this question is sent directly to gpt, probably it can't give you correct answer. how do you think about that?
langchain have buffer and memory storage can fix this .
@@yantaosong thx for the reply, I figured out that I should generate the standalone question according to the context before I make the query. Thank you anyway
ua-cam.com/video/2xxziIWmaSA/v-deo.html 7:28
where are these chunks saved in chroma db?
if so how can I check these db vectors?
Great video Greg, thank you!! The VectorDBQA method is already deprecated, use below
chat = RetrievalQA.from_llm(llm=OpenAI(), retriever=docs.as_retriever())
I asked this to Langchain helper chat AI, this is the answer: RetrievalQA.from_llm and VectorDBQA are both question answering models in the Langchain library.
RetrievalQA.from_llm is a chain that uses a large language model (LLM) as the question answering component. It retrieves relevant documents from a vector database (VectorDB) based on the query and then uses the LLM to generate an answer.
VectorDBQA, on the other hand, directly retrieves documents from a vector database and uses a default question answering prompt to generate an answer.
Both models can be used to answer questions based on retrieved documents, but RetrievalQA.from_llm provides more flexibility in terms of customizing the prompt and using the LLM for generating answers.
sir can we implement same module in nodejs frame work?
i tried but some of required modules are not available in nodejs
Great video! I would love to see some in-depth walk through of the various chain types and agents, along with examples to help clarify usage. Thank you.
Super helpful! Thanks so much. It looks like OpenAI made a change and depreciated VectorDBQA and suggested RetrievalQA.
Langchain made that change and yep that is what they recommend now!
@@DataIndependent Any suggestion for how to update the jupyter notebook? Thanks!
Really helpful for me, thank you! I also heard about GPT Index , but don't know the difference between LangChain with GPT Index. Is it possible to see more details about the comparison?
Totally - Let's do a video on this. Thanks for the tip
I am highly interested in the implementation of a T-5 and different ways for textsplitting without losing context. A tour would be greatly appreciated..
Nice! Sounds good and I'll add this to the list.
Thank you for implementing the feature with the text file. While using the line of code 'qa = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=docsearch)', I received feedback indicating that the VectorDBQA module is deprecated. Deprecated cautions suggests importing 'from langchain.chains import RetrievalQA', which includes a retriever parameter. However, I encountered an issue when attempting to replace 'docsearch' with this parameter. Can you please advise me on how to properly use the 'RetrievalQA' module?
Check out my latest video on the 7 core concepts of Langchain and specifically the indexes section. I have an example about retriever in there.
If that doesn't help then I recommend looking at the documentation
I had the same error. I swapped the code with VectorDBQA to the following
RetrievalQA.from_chain_type(llm=OpenAI(temperature=0.5), chain_type="stuff", retriever=docsearch.as_retriever())
The thing that took me time to find was the docserach.as_retiever function
Freaking awesome video, all stuff, no fluff!! This will help me get started quickly, thank you so much!
Great video! Is there a way to create a chatbot that smartly uses our data + gpt-3.5 data and give us a COMBINED answer from both the data set instead of just our data set or gpt data set?
So let's say your document had details about 'what did McCarthy discover?' but there's no information for 'when did McCarthy discover the language lisp?'. In this case, it should still be able to answer by looking up our data set for details related to McCarthy and language lisp... and then look-up the gpt-3.5 data for details related to when was it discovered as that's not in our data set.
Thanks Greg! Great video on using custom files.
Could you share a video about RAGs? I heard there are many types and I'd love to learn which is best for different tasks.
Thanks for the great tutorial! For multiple documents, can you please advise on how i can retrieve the file name where the contextual information is retrieved from?
LangChain has the functionality to give you an answer w/ sources which should help. Check out their documentation.
I'm got IndexError: list index out of range when executing this line: docsearch = Chroma.from_documents(texts, embeddings). I tried loading a large pdf file. This could be the culprit.
Can you suggest a workaround?
Hm, I haven't run into that one yet. Have you done it on a small pdf?
Is your texts a list or a single text file? I believe it should be a list
I have got a better answer :D "' In 1960, John McCarthy published a remarkable paper in which he showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for "List Processing," because one of his key ideas was to use a simple data structure called a list for both code and data.'"
A very useful bit of information - and I'm not sure if this is possible with LangChain - would be to display how many tokens each request is using etc. This video is awesome but, behind the scenes, we have no idea how many tokens/embeddings/queries are being performed so I can't see any way to keep track of the cost involved in doing this over and over
Here you go! langchain.readthedocs.io/en/latest/modules/llms/examples/token_usage_tracking.html?highlight=token
this is why i wan't make my own module in js.
@@DataIndependent Thanks, this was helpful
How can I integrate this to Bubble? Only part I am struggling with is being able to deploy a script like this and have it interact with Bubble via APIs
I'm not sure, but if you wanted to see how to do it on another platform you could check out my "how to build a webapp" video
hi great video! Im wondering if anybody got an error when creating the docsearch "IndexError: list index out of range". Cant seem to find why this happens if I followed step by step. Any help is greatly appreciated. Thanks!
What about using semantic search to retrieve relevant docs and flan-t5 to reasong over them?
Nice! I'll do a video on that next
In this example, Chroma always generates an in memory DuckDB database, each time you open and run this notebook to query your text documents it has to build the database from scratch. Is there any way to save this to disk and use that in subsequent queries. And if it could be loaded into memory each subsequent time that would be great.
Check out the documentation here about persistence
python.langchain.com/en/latest/modules/indexes/vectorstore_examples/chroma.html
@Greg Kamradt can we pass prompts to Chatmodel while using conversational retrieval chain?
Great video! What if the data in these files cannot leave the premises? Does calling the embedding take the data off premise?
Yes, because you need to send your raw text to OpenAI to get the embeddings back.
If you wanted you could use a locally hosting embedding engine
@@DataIndependent thanks! Can you point me to some resources on locally hosted embedding engine?
Can you show how to do the same with GPT4All 🙏 I don't see support for embeddings for the model they use.
Ada-002 does the embeddings, not GPT4. But yes, I'll do a video on that later
Thanks for the video. Can this be done for a 3000 text document?
Yes
This is awesome - how am I able to use this with a Davinci Model for more in-depth responses? Can you do a second video on Fine-Tuning this system to reduce Hallucinations, create more complex responses, and ask it more in-depth questions?
Ya sounds great - What is your use case that you want to run through? It's always better with a real world example
@@DataIndependent UA-cam Transcripts; I have a course that’s divided into 12 Months, all adding up to a total of 118 .txt files for Transcripts. I’d like to be able to create a “tutor” if you will, one where I can ask questions about the contents of the course if something confuses me
I’ve made one that does this, but the absolute main issue I’ve found is structuring the Transcript data…
The bot cannot interpret raw Transcripts all too well, so I realize I may need to reformat them into something like a Knowledge Graph for each Lecture. What would be the best way to structure/format a Transcript for this use case? The issue is that minimal data should be lost when re-formatting so the bot isn’t lacking any information that’s already been discussed. This has been my biggest issue
If I upload my custom documents to OpenAI, will it be private? I want to ensure that it is not available to the public at large and is only accessible through my API key. Can you clarify?
Secondly, how long will this data set persist in OpenAI? If I upload my documents to OpenAI can I query it a month or two later? How about a year? Thanks
/ If I upload my custom documents to OpenAI, will it be private?
Assume they're not. You can check their website for policies but either way you're giving them your data.
You don't ever "upload" your documents to OpenAI. You give them a prompt and they return it.
openai.com/policies/api-data-usage-policies
Exactly what I was looking for - thank you!
Nice! Glad to hear it
@@DataIndependent Haivng a hell of a time getting the imports and dependancies working correctly...
@@tubehelpr same. It was a pain and didn’t record that part for y’all
@@DataIndependent Can you share some tips? Python version? I can't seem to get past the import nltk line since it throws an error but I have everything installed in my virtual env 🤔
@@tubehelpr what’s the error say?
Thanks a lot, what exactly is different between vectorDBQA and retriever though, they are doing same thing?
can you create an example video to show an agent which does computations on a customer table or sheet?
Nice! What's a tactical example of what you mean? I always like real-world use cases.
@@DataIndependent let’s say you had a sheet or dataframe or web table of bus trip categories, cities prices and departure times. is it possible to ask a langchain app for averages, totals, predictions on any feature? To combine both LLM and basic computational results? or even show you a bar chart 📊 by executing a python chart function using text input parameters?
Excellent demo! Very straightforward programming.
Nice thank you Michael
Excellent walk through, thanks! If you have any interest in the elasticSearch integration I'd love to see a video on that :)
Nice! Thanks for the comment. I need to explore other document loaders and custom agents before I try out more vectorstores or dbs. I jotted this down on my ideas list.
Query response - is it summarizing from the docs or picking up an exact phrase ?
A bit of both? It's passing the docs to the LLM then coming up with answer for you. It's a bit of summarization but also word for word. Whatever the LLM chooses.
There seems to be some sort of limit on the length. It seems to be somewhere around 8 to 10k words. Some of my documents will work at that length but some of them dont. It says the token limit has been reached on some of them. Did I do something wrong or is that expected?
That's totally correct. There is a token limit that you'll hit.
Check out my video on "workarounds to openai token limit" for information on what to do about it.
What a great video! Can this be done on web-urls - I have a use case wherein we have several internal confluence pages. And want to ask questions on them.Can they be somehow loaded into vectorDB. Any guidance highly appreciated.
great video. is there any need to set temperature to anything other than zero for such 'search' like applications? i can see enterprise search being a simple use case, but people would want 1 authoritative answer or a ranking. so in such a case, can it for example, fall back to amazon kendra -which ranks the results instead ?
I don't fully understand the question but I would experiment with other temperature values to see what works best for you.
bad idea. open ai will keep your query and response (which includes your personal data) in their datacenter, and used it to train their next model.
Taht is only reason stopping me from going all in on chatgpt , is there an alternative? Which can help me , i don't want to share all information with chatgpt at the same time don't have money to make my own locallly host gpt
Great video series, keep up the amazing work!
Also, you kind of look like Bradley Cooper. I figured that was a decent compliment, so I thought I would toss it your way. Have a great one.
Great feedback! How do you add extra documents to the Chroma store when using the persisted_directory? Neither 'add_documents()' nor 'from_documents()' seem to work for me :-(
What's the error you're getting?
Here is the documentation (at the bottom) that could help: langchain.readthedocs.io/en/latest/modules/indexes/vectorstore_examples/chroma.html
I was able to edit the code with Directory loader function to read and query most types of documents in a folder. Is there a way I can integrate Google Search within the same code and questioning Chain so the logic of the model is to make a decision to search local db and if no answer is found it will also look on the internet
Cool! Is there any chance we could use other LLMs? instead of openAI? or was this designed specifically based on openAI models?
You could use other LLMs no problem. That's one of the cool parts about LangChain, swapping LLMs is easy
HI Greg , thanks for your tutorial video. I am new to AI and I am wondering what if at first we want to explore private folders/database consist of multiple pdf with the chatbot (as search engine) then would like to ask question to specific document retrieved by the chatbot earlier, so when we ask questions to the bot it focus to search on selected document rather than the entire folder/database. Is it possible to apply metadata to address each chunks sources or maybe using the "agent" framework for this case? Thank you
This still seems to be uploading "private" data over to openAI during the embedding creation phase. Is there a way to create the embeddings without having to pass the document data to their APIs?
I understand how you are using CharacterTextSplitter to chunk the data into 1000 characters. What code could be used to chunk by each page, and also if you wanted to chunk every time a particular word arises, such as "Question:"? I'm asking because I would like to create embedding for each question and answer in a deposition. Many thanks for the great videos! This helps even a non-coder understand the overall process. Excellent job!
Nice! That’s fun. The splitter takes an argument “separator” which you can customize and it’ll split your documents by that thing.
In your case you can have it look for “question:” and split there.
It’s not ideal and you may need to do some string clean up but it’ll work
thats what i do, sometimes gotta pull out the ol regex especially when chunking code, thankfully gpt makes that not an afternoon of regex googling anymore lol@@DataIndependent
Your videos are extremely helpful. Looking forward to more
Nice! Thank you - what else do you want to see?
How is the cost like when making request to the gpt model. Is it expensive or affordable? If it expensive how can it be reduced?
Here is pricing for openai
openai.com/pricing
The new gpt3.5 model is 10x less than the davinci one I've been using
What is the limitation to this approach, in terms of amount of data to query over, considering the OpenAI model still has a token limit. Can I have thousands of documents, if I use a proper vector database? Are there any numbers one can refer to?
Depends on the token limit of the model you’re using. You’ll need to pick between context and output you ask your LLM
@@DataIndependent Yes but in the real world people don't just have a handful of documents. They have entire databases or large complex filesystem etc, which is the whole reason they'd love a solution like this to query it with natural language. So if I have 10k Google Drive docs of policies, procedures, contracts maybe, legal docs etc... and want to create a chatbot for my employees to ask questions about all of it, LangChain is not going to be able to paste entire documents into the prompt for OpenAI or any other model... I presume. I assume that some querying needs to happen beforehand to narrow down the list of documents to as few as possible, maybe whittle that down further into relevant summaries etc, all of which takes a language model to understand what to focus on (I assume again), and then the tiny result gets pasted back into the prompt to OpenAI for a final answer to the user's query. So I am missing something, and not sure what it is.
@@PatrickMetzdorf ah I see. Check out my video on “asking a question to a book” it does exactly this.
Yes, you do a semantic search before, narrow down the results, then use those results in your prompt.
@@DataIndependent Ah, Ok thanks, I'll find that.
Dude this amazing - thanks so much. Can you also do a tutorial, building an application that interfaces with this? say uploading a doc into an app etc.
Nice that sounds fun. Check out my video on building apps which may help
ua-cam.com/video/U_eV8wfMkXU/v-deo.html
I believe Streamlit is easy to work with on files.
Lets say I have an e-commerce store containing 100k+ product details and want to store them in a vectorstore, is there a way around calling open-ai embeddings for each of the product? maybe there is a free alternative?
Great video! Any concerns about privacy here? You mentioned about using local files, but it seems like there is a chance for OpenAI to have access to the doc text?
OpenAI (or any LLM you use) will only have access to the pieces you send over to them. In this example we load up 5-10 essays. But to answer a question we only send 4 smaller chucks over to OpenAI.
So if you're worried about OpenAI seeing *any* of your data, then yes there are privacy concerns. They no doubt are using your data to train more models, beyond that I'm not sure what they are doing with it.
@@DataIndependent thanks for the answer. I also have the same concern :) I am curious to know is it possible to run a local GPT model to perform the same task using langchain. It would be great that you can share some of your thought :) Thank you very much!
Hi I have a question. I am using GPT-3 for the task of few-shot text classification, I have tried directly GPT-3 and also via LangChain (using the same few-shot examples for both, the same format of the prompt (the one from LangChain formatter) and the same features of GPT-3). I had better results when I used LangChain. Is there any explanation why LangChain performed better than directly using GPT-3? thanks
Temperature tuning?
Amazing video! Would be great to see a version with an open-source model such as Alpaca/LLaMa. Does anyone know if it is available/possible?
I want to create a app for support where It should respond from the document ( the document can be anything like for programming languages error support) but my agent should create those query as well in that document or database if its not available in the document.
Can you tell me how to do those things in Langchain.
Also can you create some more interesting videos on Langchain.
@DataIndependent Excellent video !! I can't get it work with Azure OpenAI service. How do i specify API base, API type, API version etc.
Good question - Have you followed the tutorial here?
langchain.readthedocs.io/en/latest/modules/llms/integrations/azure_openai_example.html?highlight=azure
What's the error you're getting?
@@DataIndependentyes, i did. but it doesn’t tell how to pass azure openai bindings to fetch embeddings and chroma .. that’s where i’m stuck.
@@DataIndependent error: InvalidRequestError: The API deployment for the resource does not exist.
@@ngates83 I'm unsure my friend. You can try the langchain discord support channel and they may be able to help there.
So cool! Can't wait for the next video
Nice! Love this - What would you like to see?
@@DataIndependent It would be excellent to learn about how LangChain modules works behind the scenes 🤯
It's a really great video i want to ask that how to increase speeed bcz it takes alot of time to reply to user query
How private will it be for our private notes, Excel or word file?
Anything you send to OpenAI should be assumed not private. Check their privacy policy for more information.
Thank you for video!
I have a question. What if i would like to use own embeddings model that deployed on AWS and it has embedding dimention is 512 but index dimention is 1536?
How can i solve this problem?
How can i decrease the dimention of index?
InvalidDimensionException: Dimensionality of (512) does not match index dimensionality (1536)
If you embeddings have 512 you'll need to switch up that setting on Pinecone. You do this when you set up your index
can this be done with a local LLM instead of sending private data to OpenAI?
Hi there. Haven't checked whether someone else asked this before, but what are the reasons for replacing Chroma by FAISS in the notebook? Is the latter a better option as vector store? Tks
Honestly - I was having errors with both Chroma and FAISS for a while so I had to switch between them. Those errors seem to be fixed so either is fine imo
When you load the embedding using openAI's API key via langchain, what models are you using by default? text-embedding-ada-002?
Yep exactly
Here you are using the OpenAI API and training the model with our own data. Is there anyway that we can do that offline (without internet) ?
Yep totally, get yourself a local model and run it on your machine. It will be not as powerful and slow!
will this work for PDF files?
1) Does the size of your own data (the text files in this case), affect the OpenAI charges? If so, this could be something one should be very aware of...correct?
2) Do the text files end up at OpenAI somewhere? I'm just thinking of private data ending up somewhere unintentionally.
Awesome!
1) The thing that matters is how much data you pass to openai, not necessarily the size of your original document.
2) Data you send to OpenAI does stay with OpenAI for 30 days and then it's deleted
Really helpful video. Thanks for sharing. I am exploring if we can use CSV data to fine tune chatgpt and then use chatgpt's generic knowledge to augment the response. Like percentage of employees in my dataset living in CA. Chatgpt should get employees count from my personal dataset and CA population from its own knowledge base. Can langchain help ?
Yep, that sounds doable. You'd want to do that via a chain and include the math tools as well.
ex:
* Get your employee count in CA
* Google to get CA population
* Divide the two
Here is an example of using an agent
ua-cam.com/video/kYRB-vJFy38/v-deo.html
@@DataIndependent Thank you.
please correct me if am wrong,
langchain library uses open ai model like "text-danvenci-003" same way what model is used in this video ?
Yep as of today davinci is the default model, but that'll change as more models come out
really appreciate your work, just have one question for the chunk, how can I split the text into chunks by sentence or comma or space instead of chunk size?
Check out this page
langchain.readthedocs.io/en/latest/_modules/langchain/text_splitter.html#RecursiveCharacterTextSplitter
Where is says "self._separators = separators or ["
", "
", " ", ""]"
Those are the default separators but you can specify your own. Do separators="," for a comma for example
@@DataIndependent thank you so much ! have a good day
very helpful for me, i can follow it with no problem. thanks!!! i am wondering if there are document loader available for excel files?
Check out the langchain documentation for their currently supported loaders!
I am really enjoying your content on Langchain. Its awesome. I was hoping if you could create videos around Vicuna LLM...What it is, How to fine-tune or train Vicuna LLM on custom dataset.
Amazing video. Any idea if this method work with information stored on my local Mysql database?
This is great. How do you force it to use a specific Open AI model such as gpt-3.5-turbo?
it has following error.
ValidationError: 1 validation error for LLMChain
prompt
none is not an allowed value (type=type_error.none.not_allowed)
May i ask how to fix that?
It looks like you need to fill out a value for your prompt. It's saying that "none" isn't an allowed value for "prompt"
Thanks for this demo. I’ve built something similar using a set of unpublished manuscripts from a book publisher I work with.
LangChain and OpenAI do a great job of answering questions contained within the texts, but it suddenly ONLY knows what is in my custom embeds. if I ask to compare a manuscript to one of Steven King’s best sellers it knows nothing. Because the only source is the embeds I’ve loaded into Pinecone, for example.
How do you get the private data ADDED to the normal corpus and the answer reflect knowledge from both?
I’d love to see a demo of that scenario.
Did you find a answer to this?
how private would the file be after using it with ChatGPT?
Great question - here is where they talk about data privacy: help.openai.com/en/articles/6783457-chatgpt-general-faq
Amazing video! Thank you so much for putting this out.
How does the text splitting affect the accuracy of returned results? I have a collection of question and answers for an educational course. I want to customize the prompt given to ChatGPT that these are question and answers and find the correct answer. Is this something that can be done with LangChain?
Yep big time. If you have a small set of question/answers then you can do the method in this video. If you have a ton of questions/answer, check out my video on asking a book a question
@@DataIndependent Thanks for the reply. Agree that recursive splitter is more useful for a single large document. My question was more like - is it possible to tell CHATGPT via a prompt that you are looking at question and answer document instead of it assuming they are just pieces of text?
very nice and clear explanation. but how to make chat only talk about the topic that can be found in the document?
You can play around with your prompt to try and get it not to answer anything outside of what you want.
I've had success with "If you don't know the answer say, 'I don't know.' Don't make anything up"
It would be cool to see how to load code documentation directly from the web.
Thanks for the note - that would be sweet and I'll run a video on it if a plugin doesn't do that out of the box shortly
Can we use some structured data here? Can I query on the CSV data about my sales like how my sales performing in last 12 months, or something like that?
Yep totally - check out langchain documentation for a CSV loader or SQL engine
@@DataIndependent Thanks for the response! I've checked that out and that is fascinating!
But I have a question regarding "questioning the tabular data + textual (unstructured) data". I've seen that at a time the "create_pandas_dataframe_agent" takes only single DF (table) at a time and then we can query on that. But...
Suppose a scenario where I have 5 files.
1. A CSV with all information about the COVID-19 cases in the world
2, 3, 4, & 5 are the unstructured (text) files (Wikipedia pages) on the Olympics 2020.
Now, if I ask something like: "What was the reason behind postponing the Olympics 2020"?
Then the model should be able to answer from all data given to it also from the table. For: "In 2020 the world was suffering from the covid-19 and also Japan, where the Olympics were supposed to be held. At that time, Japan had around 2,000 daily cases and to prevent the spread, the Olympics was postponed".
(Of course, the response is made up) But as we can see that the model is able to pick up the number of active cases "2,000" from the csv and is able to integrate with the rest of the story from the text data (assuming that number wasn't in the text data).
Or say in a second use case, I give my sales data as a CSV and then ask something like: "How are my sales performing in the last 12 months, and which are the significant factors for it?" then we can imagine that the model should answer some trend, some figures, etc analyzing the data.
The question is, is it possible? And if yes then how can we achieve such generative response from the model? What could be the pipeline? And whether it is possible with open-source frameworks such as Haystack or langchain?
Please help. Thanks 🙏
Amazing tutoring 😊, if I may ask How can I train or on my e-commerce data and be able to get response in form of list of product IDs
Check out my video on getting structured data back from your LLM, that may help.
Your videos are so amazingly well done. Thank you for your hard work!
Awesome thank you Daethyra
This was super helpful! Would love a video on using pandas dataframe as a loader. It loads fine with one column but having multiple columns causes issues with chroma for some reason
Hi, I have a q... how to save the "qa" model?
but how do we turn this into an application so others could use?
how about table in pdf , but most content are text ?
That was great, thanks a lot for your knowledge and for your work. Great job!
Nice, glad it was helpful
Great video, thank you! After implementing your steps, I always get the error that I reached the token limit of the model. I have to use 300+ .txt files. Does changing the chain type help here? I watched your video on chain types as well :)
bro i get the same error and i cant find a way to fox that have you solve it?
that awesome, is there a way for us to combine the vectored/custom data we have with GPTs own base training? so we can get an almost double referenced output? could we state in our return prompt to have gpt add onto the pulled vectorDB data its own understanding of the topic or would it do that already? cheers!
You could alter your prompt to have it add any extra details that aren't in the context.
People often need to say, "only use what's in the context, don't make anything up"
So I bet the reverse would be true too
@@DataIndependent yeah makes sense, I'm fine tuning a model with highly niched data for specific software use cases. Base gpt has good details but not enough however I don't want to eliminate the existing gpt knowledge with my custom data so yeah, imma play around with the prompting and ask for it to use its own core knowledge with the pinecone VDB
man this guy is a GOAT
Thanks for the video, very informative and didactic!
So, if I understood it correctly, what this pipeline is doing would be somehow this:
1. Get chunks of text and create one embedding representation for each chunk.
2. Perform a semantic (vector) search on the database containing those vectors/text
3. Append the top X results from the semantic search (which is still the raw text from your dataset) + append the question you’re asking. The final string with all this content appended will be sent to OpenAI’s model
Is that correct?
Is it possible to have finer control over some aspects of this pipeline? E.g. number of X results (or minimum vector distance) to include in the OpenAI’s query? Or choose which OpenAI model to use?
Yep, more or less that is correct.
Yes, you can control the "N" which is the number of documents returned. When using pine cone you can get the distance metric back with the N documents. You could filter out the ones you don't want.
You can switch the OpenAI model when you initialize your model in the first place. The default is Davinci but you can switch it up.
I just binged all of your videos on Langchain, this is exactly the library I was looking for.
One question I have is if you need to utilize an OpenAI embeddings model for vector search of custom data, how would you also utilize a Model like let’s say Davinci if the solution also calls providing results not just from the vectorized content? For instance if the solution calls for having knowledge of personal data but also need to utilize LangChain search tools for query answer search?
I don’t believe the OpenAI embeddings model can also do what you presented in your previous videos but I could be wrong. Any help would be greatly appreciated.
Please keep up the videos!!
Nice! Thank you very much.
For your question
* Quick clarification - you don't *need* to use OpenAI for embeddings, lots of models can give you this.
* The embeddings are just a way to get relevant documents. Once you got those docs you can do all sorts of chains (like the query answer search).
@@DataIndependent Thank you for the info. Do you have anything on your list for querying a SQL db for answers?
@@Kalease54 I haven't done that yet but good idea. I'll add that to the list.
@@DataIndependent I have one more question further to Kalease (which is a great Q btw). So after vectorized and uploaded to Pinecone for example, and let say where the original text (pdf, word, text etc) are resided; once they are disconnected, will the LLM still be able to retrieve the information (sorry if people have already asked this)