Skip to main content

A modern, responsive chat application framework built with FastAPI, HTMX, Tailwind CSS, and Google GenAI (Gemini).

Project description

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.


✨ 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:

pip install gochat-python

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):

pip install gochat-python[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:
    pip install gochat-python[gemini]
    
  • DuckDB database + Mock/Test Adapters:
    pip install gochat-python[mock]
    
  • PostgreSQL Database Support:
    pip install gochat-python[postgres]
    
  • Redis Stream Buffer / Caching Support:
    pip install gochat-python[redis]
    

You can also combine multiple extras together:

pip install gochat-python[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:

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:

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:

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:

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 the LICENSE file on GitHub for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gochat_python-0.1.0.dev2.tar.gz (571.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gochat_python-0.1.0.dev2-py3-none-any.whl (660.1 kB view details)

Uploaded Python 3

File details

Details for the file gochat_python-0.1.0.dev2.tar.gz.

File metadata

  • Download URL: gochat_python-0.1.0.dev2.tar.gz
  • Upload date:
  • Size: 571.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gochat_python-0.1.0.dev2.tar.gz
Algorithm Hash digest
SHA256 25f4b25b33d07ad6eb148cf314e6bc60ac9a4e85256d698b4f674c4f12668683
MD5 1d399b2bd0c8723dbc0fe03ff3a21789
BLAKE2b-256 963bd2d10d38191e34738e616ec98c56ce89346d03de9c59704edf659d0851a4

See more details on using hashes here.

File details

Details for the file gochat_python-0.1.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: gochat_python-0.1.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 660.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gochat_python-0.1.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 98786a6a51003c6792185c5bd8aeea4568e988047729d00809f7245e01f2fff5
MD5 e799bad4838b5e378eccbdf4c8199aed
BLAKE2b-256 751a5219746d737cd5f158ee16a1555151e6299183e3fd2ab1e3cf7ad37140d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page