Skip to main content

fh-chat

fh-chat is a flexible library built for FastHTML applications, enabling easy integration of AI-powered chat functionality with support for multiple AI backends.

Features

  • Support for multiple AI backends: Anthropic, OpenAI, and Claudette
  • Real-time streaming responses for a responsive chat experience
  • Chat UI using DaisyUI and Tailwind CSS
  • Message state stored client side in the HTML
  • Easy-to-use API for quick implementation

Installation

pip install fh-chat

Quick Start

Check out the examples here to get started. As with any FastHTML app you can run them using python like:

python examples/min_example.py

Supported AI Clients

  • Anthropic: Use the anthropic library

How It Works

fh-chat uses FastHTML's HTMX integration to handle real-time updates. The chat interface is rendered server-side, and messages are streamed to the client using chunked transfer encoding. The state is stored in the HTML using hidden tags. This approach ensures a smooth chat experience without the need for complex client-side JavaScript.

Customization

The chat interface uses DaisyUI and Tailwind CSS for styling. You can customise the Tailwind of the chat page and we plan to add more customisability options.

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository.

Metadata

Release files for fh-chat 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fh-chat 0.3.1
File Size Uploaded
fh-chat-0.3.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fh-chat 0.3.1
File Interpreter ABI Platform
fh_chat-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / fh-chat-0.3.1.tar.gz

Download URL fh-chat-0.3.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
12e02df2246dd753b571a7ce0f6df80f779ae235d4e98915a551e552c687df44
BLAKE2b-256 checksum
How to use checksums
b994fe2fee58b896de40dd5a080c26cf3b736ed9e8cfb5f8fb56411386c7a8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.5

Release files / fh_chat-0.3.1-py3-none-any.whl

Download URL fh_chat-0.3.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
576e40dbbdb249186e0e61bcc125f0b12fa4e6e7f15e682cade43cdb19ac6483
BLAKE2b-256 checksum
How to use checksums
338498ae39686832718fd2052f06f74bbb747ed5f0ba5dbb340acc4af818b725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page