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.

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:

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

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

You can also combine multiple extras together:

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:

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 LICENSE 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.dev1.tar.gz (570.7 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.dev1-py3-none-any.whl (659.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gochat_python-0.1.0.dev1.tar.gz
  • Upload date:
  • Size: 570.7 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.dev1.tar.gz
Algorithm Hash digest
SHA256 c0194e7ed79d05039ea2b2273e01f06ed9b6b42a57b0688ed94d4de8c2819c75
MD5 4d80a0773b57b56786d853ae6d43e886
BLAKE2b-256 cdb76a0e41c6e54ef55c8c4a48a44987687bfe305141ec89d7b0f53ea5937f36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gochat_python-0.1.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 659.9 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.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 353dd2413f88ccbb770cdc6dde4986f208b83faf203eac5c94ef82a4ec2194e7
MD5 9b8f273cfd5c54213ac27e5b445a2d9b
BLAKE2b-256 44621c06f078cf5c7450fd85d1628e654da110d9077efd22970f00c144b69f6f

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