RAG Project with Ollama and LangChain via Gradio Interface
https://github.com/fanqingsong/rag-ollama-langchain
This repository hosts the implementation of a Retrieval-Augmented Generation (RAG) project leveraging the capabilities of Ollama to run open-source large language models (LLMs) locally, alongside LangChain for robust integration of language models with data retrieval functionalities. A Gradio interface is provided for easy and interactive user engagement.
Project Overview
Retrieval-Augmented Generation (RAG) combines the generative strengths of large language models with advanced information retrieval techniques to produce contextually rich and accurate outputs. This project showcases the power of RAG in various domains such as question answering, content creation, and data synthesis, by harnessing the latest in language modeling and retrieval technologies through Ollama and LangChain.
Features
Ollama Integration: Uses Ollama to locally run various open-source large language models, including Llama 2 and Code Llama, offering state-of-the-art language understanding and generation.
LangChain for Efficient Retrieval: Implements LangChain for effective retrieval of pertinent information from diverse data sources, enhancing the models' output with real-time data.
Interactive Gradio Interface: Provides a Gradio-based web interface for real-time user interaction, making it straightforward for both technical and non-technical users to input queries and receive responses.
Flexible Framework: Designed for easy extension across different use cases and data sets, facilitating broad applicability.
demo
使用 docker-compose up 執行3個services (rag application / ollama / ollama webui)
在ollama webui上下載 千問模型 qwen:0.5b
訪問 rag application web 介面,
輸入 url 和 問題
url 為 https://zhuanlan.zhihu.com/p/675924232
點選執行, 等待數分鐘後, 右側outputs給出響應。
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html#langchain.chains.retrieval_qa.base.RetrievalQA
https://api.python.langchain.com/en/stable/community_api_reference.html#module-langchain_community.embeddings
https://zhuanlan.zhihu.com/p/668082024