https://github.com/hasanghaffari93/llm-apps
A Streamlit-based chatbot application that leverages LangChain framework to interact with multiple LLM providers.
https://github.com/hasanghaffari93/llm-apps
chatbot gpt-4 gpt-4o-mini langchain langraph large-language-models llama3 openai retrieval-augmented-generation
Last synced: 26 days ago
JSON representation
A Streamlit-based chatbot application that leverages LangChain framework to interact with multiple LLM providers.
- Host: GitHub
- URL: https://github.com/hasanghaffari93/llm-apps
- Owner: hasanghaffari93
- License: mit
- Created: 2024-12-24T18:58:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-08T16:33:45.000Z (over 1 year ago)
- Last Synced: 2025-02-08T17:26:12.253Z (over 1 year ago)
- Topics: chatbot, gpt-4, gpt-4o-mini, langchain, langraph, large-language-models, llama3, openai, retrieval-augmented-generation
- Language: Python
- Homepage: https://llm-app.streamlit.app
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LLM Apps
This project includes applications leveraging Large Language Models (LLMs) for various tasks such as chatbots, document summarization, and retrieval-augmented generation (RAG). The applications are built using LangChain and LangGraph for the backend processing and Streamlit for the UI.
## Features
### Chatbots
- Support for multiple LLM providers (e.g. `OpenAI` and `Groq`)
- Message history with auto-trimming
- Audio capabilities:
- Voice input using OpenAI's `Whisper` for speech-to-text
- Text-to-speech responses using OpenAI's `TTS`
- Automatic audio playback of responses
### Document Summarization
- Two summarization techniques:
- `Stuff`: For shorter documents that fit within context window
- `Map-Reduce`: For longer documents that exceed context limits
- PDF document support
### Retrieval Augmented Generation (RAG)
- Agentic RAG: QA with Memory
- **Tool-calling**: Tool calling enables the model to decide if a retrieval step is needed. If required, user queries are rewritten based on the chat history (contextualization). If not, the model responds directly without a retrieval step (e.g., in response to a generic greeting).
- `FAISS` vector store for efficient similarity search
- `OpenAI` embeddings integration
### Technical Features
- Built with `Streamlit` for interactive UI
- `LangChain` and `LangGraph` integration for LLM operations
- Modular architecture with separate pages
- Simple Authentication via API key or password
## Demo App
[](https://llm-app.streamlit.app/)
## Setup
1. Clone the repository:
```sh
git clone https://github.com/yourusername/llm-app-collection.git
cd llm-app-suite
```
2. Configure API keys in [`.streamlit/secrets.toml`](.streamlit/secrets.toml) file:
```toml
OPENAI_API_KEY_DEV = "your-openai-key"
GROQ_API_KEY_DEV = "your-groq-key"
PASSWORDS = ["your-password"]
```
3. Create and activate virtual environment:
Ubuntu/Linux Terminal
```sh
pip install virtualenv
virtualenv .venv
source .venv/bin/activate
```
Windows PowerShell:
```sh
pip install virtualenv
virtualenv venv
venv\Scripts\activate.ps1
```
4. Install dependencies:
```sh
pip install -r requirements.txt
```
5. Run the application:
```sh
streamlit run app.py
```
## Resources
- Two ways of text summarization, Stuff and Map-reduce ([link](https://python.langchain.com/docs/tutorials/summarization/))
- Retrieval Augmented Generation (RAG) using LangChain ([link](https://python.langchain.com/docs/tutorials/qa_chat_history/))