A modular, extensible AI chat engine built with a pipeline-based architecture.
Battle-tested in production - Powers Resonate, a modern AI chat application.
This repository is a monorepo containing the following packages:
| Package | Description |
|---|---|
kai_engine |
The core AI chat engine with a pipeline-based architecture |
kai_engine_firebase_ai |
Firebase AI adapter for the Kai Engine |
kai_inspector |
A powerful debugging and inspection tool for the Kai Engine |
prompt_block |
A powerful Dart package for creating and managing structured prompt blocks in AI applications |
The Kai Engine is a flexible framework for building AI-powered chat applications with a clean, modular architecture. It follows a pipeline-first pattern, allowing developers to easily customize and extend the processing pipeline with domain-specific logic.
The Prompt Block package provides a flexible framework for creating, managing, and organizing prompt blocks used in AI applications. Combined with the Kai Engine, it offers a complete solution for building sophisticated AI applications.
The core framework provides essential abstractions for building conversational AI applications while remaining unopinionated about concrete implementations, allowing maximum flexibility.
The Kai Engine is a flexible framework for building AI-powered chat applications with a clean, modular architecture. It follows a pipeline-first pattern, allowing developers to easily customize and extend the processing pipeline with domain-specific logic.
The core framework provides essential abstractions for building conversational AI applications while remaining unopinionated about concrete implementations, allowing maximum flexibility.
- Modular Pipeline Architecture: Each processing step is a separate component that can be customized or replaced.
- Extensible Design: Unlimited extensibility through component composition.
- Generic Type Support: Full generic support for using your own message types with MessageAdapter.
- Stream-Based Responses: Real-time streaming responses for better user experience.
- Optimistic UI Updates: Immediate UI feedback with rollback on errors.
- Flexible Context Building: Advanced prompt engineering with parallel and sequential context building.
- Tool Calling Support: Native support for AI function/tool calling with type-safe schemas.
- Template Engine: Built-in flexible template engine for dynamic content generation.
- Structured Prompt Blocks: Create and manage structured prompt blocks with the Prompt Block package.
- Post-Response Processing: Process AI responses after generation with custom pipelines.
- Real-time Inspection: Debug and monitor AI processing pipelines with Kai Inspector.
- Type Safety: Strong typing throughout the system for better developer experience.
- Comprehensive Testability: Designed for easy unit and integration testing.
Add the dependency to your pubspec.yaml:
dependencies:
kai_engine:
git:
url: https://github.com/pckimlong/kai_engine.git
ref: main
path: packages/kai_engineFor structured prompt blocks:
dependencies:
prompt_block:
git:
url: https://github.com/pckimlong/kai_engine.git
ref: main
path: packages/prompt_blockFor Firebase AI integration:
dependencies:
kai_engine_firebase_ai:
git:
url: https://github.com/pckimlong/kai_engine.git
ref: main
path: packages/kai_engine_firebase_aiFor debugging and inspection capabilities (development only):
dev_dependencies:
kai_inspector:
git:
url: https://github.com/pckimlong/kai_engine.git
ref: main
path: packages/kai_inspectorSee the individual package READMEs for detailed documentation:
Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, or request features.
This project is licensed under the MIT License - see the LICENSE file for details.