This repository showcases an implementation of Retrieval-Augmented Generation (RAG) using the Langflow framework. RAG enhances generative models by incorporating a document retrieval process, enabling more accurate and context-aware outputs.
RAG (Retrieval-Augmented Generation) merges the benefits of information retrieval with large language models (LLMs) to generate more informed responses. This project leverages Langflow for managing the retrieval and generation pipeline, using external document sources to answer questions and summarize information.
- Langflow Integration: Leverages Langflow’s orchestration to manage RAG workflows.
- Document Chunking: Breaks down large documents into manageable chunks for better retrieval and generation.
- Vector Store Integration: Supports databases like Astra DB for document retrieval.
- Efficient Generative Models: Utilizes Large Language Models (LLMs) to generate contextually-aware text.
- OpenAPI LLM Support: Integrates with OpenAPI-based LLMs to enhance the retrieval and generation pipeline.
The project is divided into two main components:
- Document Retrieval: This module retrieves relevant documents based on a user query, leveraging a vector store like Astra DB.
- Generative Response: The retrieved documents are passed to a Large Language Model (LLM) via Langflow, which generates a coherent and informative answer.
- Langflow: Orchestrates the RAG pipeline, managing retrieval and generation.
- Python: Core language used for development.
- Vector Databases: Utilizes databases like Astra DB for document storage and retrieval.
- LLM (Large Language Models): GPT-based models for text generation.
- Python 3.10+
- Langflow
- Vector Database (e.g., Astra DB or any other supported vector database)
- LLM API Key (Optional for integrating external language models)
-
Clone the repository:
git clone https://github.com/yourusername/rag-langflow.git cd rag-langflow -
Install the required dependencies:
pip install -r requirements.txt
-
Configure the API_keys And Tokens:
ASTRA_DB_TOKEN=<your_astra_db_token> LLM_API_KEY=<your_llm_api_key>
-
Run the Langflow pipeline:
python run_pipeline.py
To use this system, send a query related to your document collection. The system will retrieve relevant documents, pass them through the LLM, and generate a response.
- Place your documents in a folder.
- Update the Langflow configuration to point to your new data source.
- Re-run the pipeline to regenerate vector embeddings for document retrieval.
You can modify the document chunking size by changing the chunk_size parameter in the pipeline configuration to optimize retrieval based on your document length.
This project is licensed under the MIT License. See the LICENSE file for more details.
