This repository contains the code and resources needed to build a Retrieval-Augmented Generation (RAG) based chatbot application using LangFlow. This chatbot can answer questions based on the content of a provided PDF document, making it ideal for scenarios such as restaurant FAQs or any other context where common questions are frequently asked.
In this project, you'll find all the necessary components to create your own AI application that utilizes RAG without writing a single line of code. The application is built using LangFlow, a visual tool that allows for intuitive connection of pre-built components, enabling the creation and deployment of AI workflows effortlessly.
- User Interaction: The chatbot can accept and respond to user questions.
- Contextual Responses: Uses content from a provided PDF to generate relevant responses.
- Memory Retention: Remembers conversation history for continuous interaction.
- Customizable: Easily import and export flows using JSON files.
- Python: Version 3.10 or above.
- LangFlow: Installed via pip.
- Astra DB: From DataStax for vector storage.
- OpenAI API Key: For embedding and generating responses.
-
Clone the Repository:
git clone https://github.com/HasanBeker2/Langflow_RAG_Chatbot cd Langflow_RAG_Chatbot
-
Install LangFlow:
pip install langflow --pre --force-reinstall
-
Setup Astra DB:
- Create an account on DataStax Astra.
- Create a serverless vector database.
- Generate the necessary endpoint and token.
-
Setup OpenAI API:
- Create an account on OpenAI.
- Generate an API key.
-
Run LangFlow:
langflow run
-
Load the Flow:
- Open your browser and navigate to
localhost
(URL provided by LangFlow upon running). - Import the provided
json
file from this repository. - Load the PDF document you want to use for the chatbot responses.
- Open your browser and navigate to
-
Set Environment Variables:
- OpenAI API Key
- Astra DB Endpoint
- Astra DB Token
- Collection name for your PDF data
-
Start the Application:
- After setting up the flow, click
PlayGround
in LangFlow. - Interact with the chatbot by entering your name and asking questions.
- After setting up the flow, click
-
Change User:
- To change the user and reset the conversation history, simply enter a new name.
Restaurant Virtual Assistant (without API keys).json
: The JSON file containing the flow setup for LangFlow.Resturaunt Q&A.pdf
: Sample PDF document used for testing.