ChatSage
ChatSage is a multi-model chatbot application that allows users to interact with various language models including GPT-3, GPT-4, Claude, and custom models.
Features
- Support for multiple language models (GPT-3, GPT-4, Claude, LLaMA, and custom models)
- Web-based chat interface
- API endpoints for chat functionality
- Configurable settings for different environments
- Basic rate limiting
- Chat history management
Installation
Clone the repository:
git clone https://github.com/KouhouMed/chatsage.git cd chatsage
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
Install the package and its dependencies:
pip install -e .
Create a
.env
file in the project root and add your API keys:OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key
Usage
Run the application:
python run.py
Open a web browser and navigate to
http://localhost:5000
to access the chat interface.Select a model from the dropdown menu, type your message, and click “Send” to chat with the selected model.
API Endpoints
POST /api/chat
: Send a chat message- Request body:
{"message": "Your message", "model": "gpt3"}
- Response:
{"response": "Model's response"}
- Request body:
GET /api/models
: Get available models- Response:
{"models": ["gpt3", "gpt4", "claude", "llama", "custom"]}
- Response:
GET /api/history
: Get chat history- Response:
{"history": ["Human: Hello", "AI: Hi there!"]}
- Response:
POST /api/clear_history
: Clear chat history- Response:
{"message": "Chat history cleared"}
- Response:
Development
To install development dependencies:
pip install -e .[dev]
To run tests:
python -m unittest discover tests
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.