RAG with HuggingFace + FAISS + Langchain | Retrievel Augmented Generation
HTML-код
- Опубликовано: 17 фев 2024
- RAG with Hugging Face, Faiss, and LangChain: A Powerful Combo for Information Retrieval and Generation
Retrieval-augmented generation (RAG) is a technique that combines the strengths of dense retrieval and sequence-to-sequence (seq2seq) models to generate informative and context-aware responses. Here's how it works in this specific setup:
Hugging Face: This open-source platform provides pre-trained models for text embedding and generation, which are key components of RAG.
Faiss: This library implements efficient similarity search algorithms, allowing RAG to quickly find relevant documents from a large corpus.
LangChain: This workflow automation tool helps orchestrate the different steps involved in the RAG pipeline, making it easier to build and deploy complex systems.
RAG cookbook: huggingface.co/learn/cookbook...
very helpful video! im doing it on my company for it help desk questions, but with llm model with azure openAI, should I deploy ada02 for embedding creation and how would you do the search if its not a simple content column but various pdf documents? Azure AI search service might be helpful but is way to expensive
Yes, you can use the ada embedding model for generating an embedding vector and store it in a vector store. If you have large documents, you can chunk them based on various chunking techniques that are available in many RAG applications, ensuring the embedding model doesn't truncate your embedding randomly.
how would you do the search? What Tool do you recommend me? Im very new to the topic. Thanks in advance@s
can you tell me about the chunking techniques and the RAG Application? How could I start? :)@@mlworks
@@Z4rnii For chunking, follow this notebook.
github.com/FullStackRetrieval-com/RetrievalTutorials/blob/main/5_Levels_Of_Text_Splitting.ipynb
@@Z4rnii Simple RAG - huggingface.co/learn/cookbook/en/rag_zephyr_langchain
can i use gemma 7b-it model instead of intel?
Yes.
What is that page_content_cokumn and context? Because I don't see context in you printed data
Also I have CSV file which I loaded using CSV loader and in that there is columb instructions which has questions and output has answers of it do I have to create embedding of entire data with both the columns or just the column output?
page_content_column is the column that represents, the context column of the dataset. Checkout the context column here huggingface.co/datasets/databricks/databricks-dolly-15k
What is the task you're going to implement with the dataset? QA I assume
@@mlworks yes a QA, and I'm suppose to use LLM model to make it more interactive and that's when I got confused because when I passed the data my bot is responding Grammatically incorrect sentences
@@rps6949 RAG helps LLMs to provide accurate and precise information based on the knowledge base. Are you using pretrained LLM or a custom LLM which you've got after fine tuning llm for your dataset, that has learnt the mapping between QA. If yes, then you can generate embeddings of your answers & store in vector store and ask the query to the system.
@@rps6949 if you mean interactive as in chatbot, you can set the system prompt for the LLM and this act as conversation agent.
@@mlworks i'm using a pretrained model , as in your code you are using datasets and then huggingface loader to load , what i have to do is ui from where user is uploading a csv file so i used CSVLoader but just like context column i have a text column but i'm not able to provide that column for embedding i just loader data from loader.load(), what i can do here?