Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arnabsaha7/chatbot-with-llm_rag
Chatbot with OpenAI, FAISS, and Langchain
https://github.com/arnabsaha7/chatbot-with-llm_rag
faiss langchain openai-api streamlit
Last synced: 3 days ago
JSON representation
Chatbot with OpenAI, FAISS, and Langchain
- Host: GitHub
- URL: https://github.com/arnabsaha7/chatbot-with-llm_rag
- Owner: arnabsaha7
- Created: 2024-07-08T05:00:15.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-08T05:26:17.000Z (4 months ago)
- Last Synced: 2024-07-08T06:23:30.091Z (4 months ago)
- Topics: faiss, langchain, openai-api, streamlit
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Streamlit Chatbot with OpenAI, FAISS, & Langchain 🦜️🔗
This repository contains a Streamlit application for a chatbot that utilizes OpenAI's language model, FAISS for document retrieval, and Langchain for managing conversation chains. The chatbot engages in conversations and retrieves relevant documents based on the user's input.
## Features
- **OpenAI Language Model:** Provides natural language understanding and generation.
- **FAISS for Document Retrieval:** Efficiently retrieves relevant documents based on user queries.
- **Langchain for Conversation Management:** Manages conversation chains with memory capabilities.
- **Conversation History:** Maintains conversation history within the session.
- **Customizable UI:** Includes custom CSS for enhanced user experience.## Setup
### Prerequisites
>- Python 3.11+
>- Streamlit
>- OpenAI API key
>- LangChain
>- FAISS library### Installation
1. **Clone the repository:**
```bash
git clone https://github.com/arnabsaha7/Chatbot-with-LLM_RAG.git
cd Chatbot-with-LLM_RAG
```2. **Install the required packages:**
```bash
pip install -r requirements.txt
```3. **Set up your OpenAI API key:**
Replace the placeholder API key in the code with your actual OpenAI API key.
```python
os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
```4. **Prepare the FAISS index and documents:**
Ensure you have the FAISS index (`faiss_index_1`) and documents file (`documents.json`) in the project directory.
## Running the Application
1. **Start the Streamlit app:**
```bash
streamlit run app.py
```2. **Open your browser:**
The application will be available at `http://localhost:8501`.
## Usage
- `Welcome Screen:` The app starts with a welcome screen. You can begin interacting with the chatbot by typing your message in the input box.
- `Conversation History:` The conversation history is displayed on the screen. User messages are shown in one style, while the bot's responses are shown in another.
- `Document Retrieval:` When you send a message, the chatbot retrieves relevant documents from the FAISS index and uses them to provide a more informed response.
- `Reset Conversation:` Use the "Reset Conversation" button to clear the conversation history and start a new session.
## File Structure
- `Chatbot.py` --> The main Streamlit application file.
- `requirements.txt` --> Lists all Python dependencies.
- `faiss_index_1` --> The FAISS index file.
- `documents.json` --> JSON file containing documents with metadata.
- `styles.css` --> Custom CSS for styling the app.## Acknowledgements
- [OpenAI](https://www.openai.com/)
- [FAISS](https://github.com/facebookresearch/faiss.git)
- [Streamlit](https://www.streamlit.io/)
- [Langchain](https://github.com/langchain-ai/langchain.git)## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
## Contact
For any questions or inquiries, please contact [Email]([email protected]).