# Dash AI Chat
[](https://pypi.org/project/dash-ai-chat/)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
> Stop building chat UIs from scratch every time. Get a fully-functional AI chat interface with 3 lines of code, then infinitely customize and extend without starting over every time.
## ✨ Key Features
- **🚀 Quick Setup**: Get a chat UI running in 3 lines of code
- **🎨 Highly Customizable**: Override any component to match your design
- **🔌 Multi-Provider Support**: OpenAI, Anthropic, Google Gemini, or any other provider
- **💾 Persistent Storage**: Chat history saved automatically
- **📱 Responsive Design**: Works beautifully on desktop and mobile
- **🎯 Production Ready**: Built on proven Plotly Dash framework
## 🚀 Quick Start
### Installation
```bash
pip install dash-ai-chat[openai]
```
### Basic Usage
```python
from dash_ai_chat import DashAIChat
# Set your OPENAI_API_KEY environment variable
app = DashAIChat(base_dir="./chat_data")
if __name__ == "__main__":
app.run(debug=True)
```
That's it! Visit `http://localhost:8050` to start chatting.
## Examples are worth a thousand words!
Explore the comprehensive examples to see what's possible:
- **[00_minimal_chat.py](examples/00_minimal_chat.py)** - The absolute quickest way to get a fully-functional AI chat system running with just 3 lines of code
- **[01_python_assistant.py](examples/01_python_assistant.py)** - Create specialized AI assistants with custom system prompts, demonstrating how to build a Python programming helper named PyHero
- **[02_disclaimer_chat.py](examples/02_disclaimer_chat.py)** - Add custom UI elements like disclaimers and warnings to your chat interface without breaking existing functionality
- **[03_gemini_provider.py](examples/03_gemini_provider.py)** - Switch to Google's Gemini AI with just two configuration parameters, showing how easy provider switching can be
- **[04_signature_chat.py](examples/04_signature_chat.py)** - Extract token usage from API responses and add professional signatures to assistant messages with custom styling
- **[05_anthropic_model_selector.py](examples/05_anthropic_model_selector.py)** - Configure Anthropic Claude models with runtime switching capabilities and interactive model selection dropdowns
- **[06_runtime_provider_switching.py](examples/06_runtime_provider_switching.py)** - Dynamically switch between OpenAI, Anthropic, and Gemini providers **and their models** mid-conversation with simple attribute assignments
- **[07_interactive_components.py](examples/07_interactive_components.py)** - Embed interactive Dash components like dropdowns and buttons directly into AI responses for enhanced user engagement
- **[08_corporate_dashboard.py](examples/08_corporate_dashboard.py)** - Complete enterprise-grade dashboard showcasing the extreme customization possibilities with corporate branding, navigation, and multi-panel layouts
- **[09_zen_minimal.py](examples/09_zen_minimal.py)** - Minimalist design aesthetic demonstrating creative UI possibilities with floating elements, split-screen views, and zen-like simplicity
### Running Examples
```bash
git clone https://github.com/eliasdabbas/dash-ai-chat.git
cd dash-ai-chat
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install with all providers
pip install -e .[openai,anthropic,gemini]
# Try any example
python examples/00_minimal_chat.py
```
## Provider Support
Install optional dependencies for different AI providers:
```bash
# OpenAI (GPT models)
pip install dash-ai-chat[openai]
# Anthropic (Claude models)
pip install dash-ai-chat[anthropic]
# Google Gemini
pip install dash-ai-chat[gemini]
# All providers
pip install dash-ai-chat[openai,anthropic,gemini]
```
## What is it?
The `dash-ai-chat` library is a Dash app distributed as a Python package.
It contains basic UI elements and data persistence logic, and designed to be entirely customizable.
The default implementation contains only the essential elements with basic defaults, and pretty much everything is designed to be customized and changed.
Additional interactivity can easily be introduced using standard Dash callbacks. If you know Dash, it should be easy to pick up.
## Core API
### Basic Configuration
```python
from dash_ai_chat import DashAIChat
app = DashAIChat( # A Dash sub-class
base_dir="./chat_data", # Chat storage directory
provider_spec="openai:chat.completions", # AI provider specification
provider_model="gpt-4o", # Default model
**kwargs # Additional Dash app parameters
)
```
## Customization
General workflow:
1. Create a class (sub-class of `DashAIChat`):
```python
from dash_ai_chat import DashAIChat
class MyCustomAIChat(DashAIChat):
def default_method(self, ...):
default_data = super().default_method()
# add custom logic to default_data
```
2. Create an `app` instance, just you like you do with Dash:
```python
app = MyCustomAIChat(base_dir="my_base_dir")
if __name__ == "__main__":
app.run(debug=True)
```
#### In more detail:
### Custom System Messages
```python
class MyAssistant(DashAIChat):
# override the default load_messages method:
def load_messages(self, user_id: str, conversation_id: str):
# default_data:
messages = super().load_messages(user_id, conversation_id)
# futher logic to customize what to do with loaded messages
if not messages:
messages = [{
"role": "system",
"content": "You are a helpful Python programming assistant."
}]
return messages
```
### UI Customization
Override any component to customize the interface:
```python
from dash import html
class CustomChat(DashAIChat):
def header(self):
default_header = super().header()
return html.Div([
html.H1("My Custom Chat", className="text-center"),
html.Hr(),
default_header
])
def input_area(self):
# Add custom elements to input area
original = super().input_area()
disclaimer = html.Div("AI responses may contain errors")
return html.Div([original, disclaimer])
```
## Architecture
Dash AI Chat uses a clean, extensible architecture:
- **DashAIChat**: Main application class with overridable methods
- **Provider System**: Pluggable AI provider backends
- **Message Storage**: JSON-based persistent chat history
- **Component System**: Override any UI component
## Advanced Usage
### Custom Providers
```python
class MyCustomProvider:
def client_factory(self):
# Create your AI client
return YourAIClient(api_key="your-key")
def call(self, client, messages, model, **kwargs):
# Call your AI API
return client.chat(messages=messages, model=model, **kwargs)
def extract(self, response):
# Extract text from API response
return response.choices[0].message.content
def format_messages(self, messages):
# Format messages for your API
return messages
# Register and use your provider
app = DashAIChat(base_dir="./chat_data")
app.AI_REGISTRY["custom:provider"] = MyCustomProvider()
app.provider_spec = "custom:provider"
```
**Ready to build amazing AI chat interfaces?** Start with the [examples](examples/) and customize to your heart's content! 🚀
Raw data
{
"_id": null,
"home_page": null,
"name": "dash-ai-chat",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Elias Dabbas <eliasdabbas@gmail.com>",
"keywords": "ai, anthropic, chat, chatbot, dash, framework, gemini, llm, openai, plotly, ui",
"author": null,
"author_email": "Elias Dabbas <eliasdabbas@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f8/84/d240f48ead761d857e80e7f2312c64c9dc57d6742e11e4017602a2548730/dash_ai_chat-0.0.4.tar.gz",
"platform": null,
"description": "# Dash AI Chat\n\n[](https://pypi.org/project/dash-ai-chat/)\n[](https://www.python.org/downloads/)\n[](https://opensource.org/licenses/MIT)\n\n> Stop building chat UIs from scratch every time. Get a fully-functional AI chat interface with 3 lines of code, then infinitely customize and extend without starting over every time.\n\n## \u2728 Key Features\n\n- **\ud83d\ude80 Quick Setup**: Get a chat UI running in 3 lines of code\n- **\ud83c\udfa8 Highly Customizable**: Override any component to match your design\n- **\ud83d\udd0c Multi-Provider Support**: OpenAI, Anthropic, Google Gemini, or any other provider\n- **\ud83d\udcbe Persistent Storage**: Chat history saved automatically\n- **\ud83d\udcf1 Responsive Design**: Works beautifully on desktop and mobile\n- **\ud83c\udfaf Production Ready**: Built on proven Plotly Dash framework\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install dash-ai-chat[openai]\n```\n\n### Basic Usage\n\n```python\nfrom dash_ai_chat import DashAIChat\n\n# Set your OPENAI_API_KEY environment variable\napp = DashAIChat(base_dir=\"./chat_data\")\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n```\n\nThat's it! Visit `http://localhost:8050` to start chatting.\n\n## Examples are worth a thousand words!\n\nExplore the comprehensive examples to see what's possible:\n\n- **[00_minimal_chat.py](examples/00_minimal_chat.py)** - The absolute quickest way to get a fully-functional AI chat system running with just 3 lines of code\n- **[01_python_assistant.py](examples/01_python_assistant.py)** - Create specialized AI assistants with custom system prompts, demonstrating how to build a Python programming helper named PyHero\n- **[02_disclaimer_chat.py](examples/02_disclaimer_chat.py)** - Add custom UI elements like disclaimers and warnings to your chat interface without breaking existing functionality\n- **[03_gemini_provider.py](examples/03_gemini_provider.py)** - Switch to Google's Gemini AI with just two configuration parameters, showing how easy provider switching can be\n- **[04_signature_chat.py](examples/04_signature_chat.py)** - Extract token usage from API responses and add professional signatures to assistant messages with custom styling\n- **[05_anthropic_model_selector.py](examples/05_anthropic_model_selector.py)** - Configure Anthropic Claude models with runtime switching capabilities and interactive model selection dropdowns\n- **[06_runtime_provider_switching.py](examples/06_runtime_provider_switching.py)** - Dynamically switch between OpenAI, Anthropic, and Gemini providers **and their models** mid-conversation with simple attribute assignments\n- **[07_interactive_components.py](examples/07_interactive_components.py)** - Embed interactive Dash components like dropdowns and buttons directly into AI responses for enhanced user engagement\n- **[08_corporate_dashboard.py](examples/08_corporate_dashboard.py)** - Complete enterprise-grade dashboard showcasing the extreme customization possibilities with corporate branding, navigation, and multi-panel layouts\n- **[09_zen_minimal.py](examples/09_zen_minimal.py)** - Minimalist design aesthetic demonstrating creative UI possibilities with floating elements, split-screen views, and zen-like simplicity\n\n### Running Examples\n\n```bash\ngit clone https://github.com/eliasdabbas/dash-ai-chat.git\ncd dash-ai-chat\n\n# Create and activate virtual environment\npython3 -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\n\n# Install with all providers\npip install -e .[openai,anthropic,gemini]\n\n# Try any example\npython examples/00_minimal_chat.py\n```\n\n## Provider Support\n\nInstall optional dependencies for different AI providers:\n\n```bash\n# OpenAI (GPT models)\npip install dash-ai-chat[openai]\n\n# Anthropic (Claude models)\npip install dash-ai-chat[anthropic]\n\n# Google Gemini\npip install dash-ai-chat[gemini]\n\n# All providers\npip install dash-ai-chat[openai,anthropic,gemini]\n```\n\n## What is it?\n\nThe `dash-ai-chat` library is a Dash app distributed as a Python package.\n\nIt contains basic UI elements and data persistence logic, and designed to be entirely customizable.\n\nThe default implementation contains only the essential elements with basic defaults, and pretty much everything is designed to be customized and changed.\n\nAdditional interactivity can easily be introduced using standard Dash callbacks. If you know Dash, it should be easy to pick up.\n\n## Core API\n\n### Basic Configuration\n\n```python\nfrom dash_ai_chat import DashAIChat\n\napp = DashAIChat( # A Dash sub-class\n base_dir=\"./chat_data\", # Chat storage directory\n provider_spec=\"openai:chat.completions\", # AI provider specification\n provider_model=\"gpt-4o\", # Default model\n **kwargs # Additional Dash app parameters\n)\n```\n\n## Customization\n\nGeneral workflow:\n\n1. Create a class (sub-class of `DashAIChat`):\n\n```python\nfrom dash_ai_chat import DashAIChat\n\nclass MyCustomAIChat(DashAIChat):\n def default_method(self, ...):\n default_data = super().default_method()\n # add custom logic to default_data\n```\n\n2. Create an `app` instance, just you like you do with Dash:\n\n```python\napp = MyCustomAIChat(base_dir=\"my_base_dir\")\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n```\n\n#### In more detail:\n\n### Custom System Messages\n\n```python\nclass MyAssistant(DashAIChat):\n # override the default load_messages method:\n def load_messages(self, user_id: str, conversation_id: str):\n # default_data:\n messages = super().load_messages(user_id, conversation_id)\n # futher logic to customize what to do with loaded messages\n if not messages:\n messages = [{\n \"role\": \"system\",\n \"content\": \"You are a helpful Python programming assistant.\"\n }]\n\n return messages\n```\n\n### UI Customization\n\nOverride any component to customize the interface:\n\n```python\nfrom dash import html\n\nclass CustomChat(DashAIChat):\n def header(self):\n default_header = super().header()\n return html.Div([\n html.H1(\"My Custom Chat\", className=\"text-center\"),\n html.Hr(),\n default_header\n ])\n\n def input_area(self):\n # Add custom elements to input area\n original = super().input_area()\n disclaimer = html.Div(\"AI responses may contain errors\")\n return html.Div([original, disclaimer])\n```\n\n## Architecture\n\nDash AI Chat uses a clean, extensible architecture:\n\n- **DashAIChat**: Main application class with overridable methods\n- **Provider System**: Pluggable AI provider backends\n- **Message Storage**: JSON-based persistent chat history\n- **Component System**: Override any UI component\n\n## Advanced Usage\n\n### Custom Providers\n\n```python\nclass MyCustomProvider:\n def client_factory(self):\n # Create your AI client\n return YourAIClient(api_key=\"your-key\")\n \n def call(self, client, messages, model, **kwargs):\n # Call your AI API\n return client.chat(messages=messages, model=model, **kwargs)\n \n def extract(self, response):\n # Extract text from API response\n return response.choices[0].message.content\n \n def format_messages(self, messages):\n # Format messages for your API\n return messages\n\n# Register and use your provider\napp = DashAIChat(base_dir=\"./chat_data\")\napp.AI_REGISTRY[\"custom:provider\"] = MyCustomProvider()\napp.provider_spec = \"custom:provider\"\n```\n\n**Ready to build amazing AI chat interfaces?** Start with the [examples](examples/) and customize to your heart's content! \ud83d\ude80",
"bugtrack_url": null,
"license": "MIT",
"summary": "A customizable LLM chat UI framework built on Plotly Dash",
"version": "0.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/eliasdabbas/dash-ai-chat/issues",
"Changelog": "https://github.com/eliasdabbas/dash-ai-chat/releases",
"Documentation": "https://github.com/eliasdabbas/dash-ai-chat#readme",
"Homepage": "https://github.com/eliasdabbas/dash-ai-chat",
"Repository": "https://github.com/eliasdabbas/dash-ai-chat.git",
"Source Code": "https://github.com/eliasdabbas/dash-ai-chat"
},
"split_keywords": [
"ai",
" anthropic",
" chat",
" chatbot",
" dash",
" framework",
" gemini",
" llm",
" openai",
" plotly",
" ui"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "80c665ac742342168790a6adeb225eb5ae4cd0a414a725c17a250cc76d12b641",
"md5": "5b08850c68f3a90f58e807e29ad6b814",
"sha256": "14d1f09c0f65cdeb5ee19bee581f639f0607d010bd07d5cceb029db210886aef"
},
"downloads": -1,
"filename": "dash_ai_chat-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b08850c68f3a90f58e807e29ad6b814",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 13051,
"upload_time": "2025-08-10T11:36:29",
"upload_time_iso_8601": "2025-08-10T11:36:29.907819Z",
"url": "https://files.pythonhosted.org/packages/80/c6/65ac742342168790a6adeb225eb5ae4cd0a414a725c17a250cc76d12b641/dash_ai_chat-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f884d240f48ead761d857e80e7f2312c64c9dc57d6742e11e4017602a2548730",
"md5": "bb004b47d6d73f7f2cfcb4b057c1e5e8",
"sha256": "d5e991fe7bfd7218c70bbb9bb28ebb67b7ef61bd21c21e6d7f1edfd3e1a20456"
},
"downloads": -1,
"filename": "dash_ai_chat-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "bb004b47d6d73f7f2cfcb4b057c1e5e8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5384221,
"upload_time": "2025-08-10T11:36:38",
"upload_time_iso_8601": "2025-08-10T11:36:38.203449Z",
"url": "https://files.pythonhosted.org/packages/f8/84/d240f48ead761d857e80e7f2312c64c9dc57d6742e11e4017602a2548730/dash_ai_chat-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-10 11:36:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eliasdabbas",
"github_project": "dash-ai-chat",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "dash-ai-chat"
}