Retrieval Augmented Generation demo using Microsoft's phi-2 LLM and langchain
19
stars
7
commits
Python
primary language
Feb 12, 2024
updated
The context size of the Phi-2 model is 2048 tokens, so even this medium size wikipedia page (11.5k tokens) does not fit in the context window. Retrieval Augmented Generation (RAG) enables us to retrieve just the few small chunks of the document that are relevant to the our query and inject it into our prompt.
The model is then able to answer questions by incorporating knowledge from the newly provided document. RAG can be used with thousands of documents, but this demo is limited to just one txt file.
This demo was built using the Hugging Face transformers library, langchain, and gradio.
The demo has been depolyed to the following HuggingFace space.
https://huggingface.co/spaces/rasyosef/RAG-with-Phi-2-and-LangChain
7 commits
Python
100.0%
Retrieval Augmented Generation demo using Microsoft's phi-2 LLM and langchain
19
stars
7
commits
Python
primary language
Feb 12, 2024
updated
The context size of the Phi-2 model is 2048 tokens, so even this medium size wikipedia page (11.5k tokens) does not fit in the context window. Retrieval Augmented Generation (RAG) enables us to retrieve just the few small chunks of the document that are relevant to the our query and inject it into our prompt.
The model is then able to answer questions by incorporating knowledge from the newly provided document. RAG can be used with thousands of documents, but this demo is limited to just one txt file.
This demo was built using the Hugging Face transformers library, langchain, and gradio.
The demo has been depolyed to the following HuggingFace space.
https://huggingface.co/spaces/rasyosef/RAG-with-Phi-2-and-LangChain
7 commits
Python
100.0%