This is a simple web interface for interacting with multiple LLM providers (Google Gemini, OpenAI, Anthropic, Groq, and OpenRouter) using Streamlit and LangChain. The application has been refactored to follow object-oriented programming principles and a modular architecture, making it more maintainable and extensible. This project was created as part of my learning journey to practice working with LLMs, web interfaces, and API integration.
- Clean, user-friendly chat interface
- Support for multiple LLM providers (Google Gemini, OpenAI, Anthropic, Groq, OpenRouter)
- Secure API key input with automatic .env file saving
- Conversation history
- Real-time chat responses
- Provider-specific model selection
- Customizable system prompt
- Clear chat history functionality
- Modular architecture with separate files for configuration and chatbot logic
The application follows a modular design with separate files:
app.py: Main application entry point and UI flow managementconfig.py: Handles provider selection, API key management, model selection, and system promptschatbot.py: Manages chatbot functionality and communication with multiple LLM providers
- Python 3.8+
- Streamlit
- LangChain
- LangChain Google GenAI
- LangChain OpenAI
- LangChain Anthropic
- LangChain Groq
- python-dotenv
- Clone this repository
- Install the required packages:
pip install -r requirements.txt - Run the application:
streamlit run app.py - Select your preferred provider from the dropdown in the sidebar
- Enter your corresponding API key in the sidebar (the .env file will be automatically created)
- Select your preferred model from the dropdown
- Optionally customize the AI behavior with the system prompt
- Start chatting with the bot!
Note: The application will automatically create and update a .env file to store your API keys. You do not need to manually create this file.
This is a learning project and may be updated as I continue to develop my skills in working with LLMs and building web interfaces. The modular refactoring improves code organization, maintainability, and extensibility. Feel free to explore, modify, and use this code as a starting point for your own projects.