Metadata-Version: 2.4
Name: gochat-python
Version: 0.1.0.dev1
Summary: A modern, responsive chat application framework built with FastAPI, HTMX, Tailwind CSS, and Google GenAI (Gemini).
License-File: LICENSE.txt
Requires-Python: >=3.13
Requires-Dist: bcrypt>=5.0.0
Requires-Dist: fastapi>=0.136.3
Requires-Dist: jinja2>=3.1.6
Requires-Dist: python-multipart>=0.0.29
Requires-Dist: uvicorn>=0.48.0
Provides-Extra: gemini
Requires-Dist: google-cloud-aiplatform>=1.154.0; extra == 'gemini'
Requires-Dist: google-genai>=1.75.0; extra == 'gemini'
Provides-Extra: mock
Requires-Dist: duckdb>=1.5.3; extra == 'mock'
Requires-Dist: fakeredis>=2.35.1; extra == 'mock'
Requires-Dist: pillow>=12.2.0; extra == 'mock'
Provides-Extra: postgres
Requires-Dist: psycopg2-binary>=2.9.9; extra == 'postgres'
Provides-Extra: redis
Requires-Dist: redis>=5.0.0; extra == 'redis'
Provides-Extra: standard
Requires-Dist: duckdb>=1.5.3; extra == 'standard'
Requires-Dist: fakeredis>=2.35.1; extra == 'standard'
Requires-Dist: google-cloud-aiplatform>=1.154.0; extra == 'standard'
Requires-Dist: google-genai>=1.75.0; extra == 'standard'
Requires-Dist: pillow>=12.2.0; extra == 'standard'
Requires-Dist: psycopg2-binary>=2.9.9; extra == 'standard'
Requires-Dist: redis>=5.0.0; extra == 'standard'
Description-Content-Type: text/markdown

# GoChat 🚀

GoChat is a modern, responsive Python chat application framework built on **FastAPI**, **HTMX**, **Tailwind CSS**, and **Google GenAI (Gemini / Vertex AI)**. It allows you to instantly instantiate premium interactive web interfaces, terminal chat loops, and full-stack chat integrations with zero-config default settings, or fully customize providers and storage backends.

GoChat will be available on PyPI and can be imported directly into any Python application.

---

## ✨ Key Features

* **Zero-Config Standalone Mode**: Spin up a premium chat web application in two lines of code.
* **Unified GenAI Interface**: Easily swap between API Key (AI Studio), Vertex AI (Google Cloud Platform), or Mock generation models.
* **Interactive UI Partial Renders**: Implemented with FastAPI + HTMX for lightning-fast responses without page refreshes.
* **Responsive & Premium Aesthetics**: Modern responsive design with HSL-curated custom styles.
* **Multi-Modal Support**: Direct file uploads (images and text documents) natively supported.
* **Built-in Terminal Chat Loop**: Instantly run interactive AI testing sessions directly from your command-line interface.

---

## 📦 Installation

GoChat is highly modular and supports optional installation packages (extras) to keep your dependency footprint minimal:

### 1. Minimal Installation (FastAPI + Presenters Core)
Recommended if you are embedding GoChat and writing custom providers or repositories:
```bash
pip install gochat
```

### 2. Standard Full-Suite Installation
Installs the standard pre-configured package (includes DuckDB database repositories, Mock adapters, Google Gemini SDK, Redis support, and PostgreSQL binary adapters):
```bash
pip install gochat[standard]
```

### 3. Feature-Specific Installations
You can install only the specific components your application uses to keep production environments lean:

* **Google Gemini / Vertex AI Support**:
  ```bash
  pip install gochat[gemini]
  ```
* **DuckDB database + Mock/Test Adapters**:
  ```bash
  pip install gochat[mock]
  ```
* **PostgreSQL Database Support**:
  ```bash
  pip install gochat[postgres]
  ```
* **Redis Stream Buffer / Caching Support**:
  ```bash
  pip install gochat[redis]
  ```

You can also combine multiple extras together:
```bash
pip install gochat[gemini,redis]
```

---

## 🚀 Quick Start

### 1. Start the Web UI Application (Zero-Config Standalone)

Start a premium local chat web interface using pre-configured in-memory Mock adapters:

```python
from gochat import GoChat

# Create and launch the application server
app = GoChat()
app.start(host="127.0.0.1", port=8080)
```

Open your browser to `http://127.0.0.1:8080` to interact with your new chat interface.

---

### 2. Launch a Terminal-Based Chat Loop

Start a live interactive console chat session with a Gemini model using a Google AI Studio API key:

```python
import os
from gochat import GoChat
from gochat.genai_providers import GeminiProvider

# Initialize Gemini GenAI Provider
gemini_provider = GeminiProvider(
    name="gemini",
    description="Gemini via API Key",
    model="gemini-2.5-flash",
    api_key=os.environ["GEMINI_API_KEY"],
    use_vertexai=False,
)

# Launch interactive console loop
GoChat.start_chat(gemini_provider)
```

---

## 🛠️ Customization Guide

GoChat follows a clean, multi-layered architecture (Controller, Service, Presenter, GenAI Provider, Repository) with dependency injection. You can inject custom implementations or configurations during instantiation:

### Registering Custom AI Providers

You can register multiple AI models or custom wrappers for the user to choose from in the UI dropdown:

```python
from gochat import GoChat
from gochat.genai_providers import GeminiProvider, ImagenProvider

# Define your models
main_provider = GeminiProvider(
    name="gemini-pro",
    model="gemini-2.5-flash",
    api_key="YOUR_API_KEY",
)

image_provider = ImagenProvider(
    name="imagen",
    model="imagen-3.0-generate-002",
    project_id="my-gcp-project-id",
    region="us-central1",
    use_vertexai=True,
)

# Inject providers into GoChat
chat_app = GoChat(
    genai_providers=[main_provider, image_provider],
    title_genai_provider=main_provider,
)

chat_app.start(host="127.0.0.1", port=8080)
```

### Setting Configurations & Feature Flags

Inject customized configurations via typed Pydantic settings:

```python
from gochat import GoChat
from gochat.settings import FeatureSettings, CookieSettings

# Enable/disable application features
features = FeatureSettings(
    signin=True,
    signup=True,
    streaming=True,
    file_upload=True,
)

# Custom cookie configurations
cookies = CookieSettings(
    access_token_cookie_name="my_access_token",
    chat_id_cookie_name="my_chat_id",
)

chat_app = GoChat(
    feature_settings=features,
    cookie_settings=cookies,
)
```

---

## 📖 License

Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
