Skip to content

pckimlong/kai_engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Kai Engine

GitHub CI

A modular, extensible AI chat engine built with a pipeline-based architecture.

Battle-tested in production - Powers Resonate, a modern AI chat application.

Packages

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

Overview

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.

Features

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.

Features

  • 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.

Getting Started

Add the dependency to your pubspec.yaml:

dependencies:
  kai_engine:
    git:
      url: https://github.com/pckimlong/kai_engine.git
      ref: main
      path: packages/kai_engine

For structured prompt blocks:

dependencies:
  prompt_block:
    git:
      url: https://github.com/pckimlong/kai_engine.git
      ref: main
      path: packages/prompt_block

For Firebase AI integration:

dependencies:
  kai_engine_firebase_ai:
    git:
      url: https://github.com/pckimlong/kai_engine.git
      ref: main
      path: packages/kai_engine_firebase_ai

For debugging and inspection capabilities (development only):

dev_dependencies:
  kai_inspector:
    git:
      url: https://github.com/pckimlong/kai_engine.git
      ref: main
      path: packages/kai_inspector

Documentation

See the individual package READMEs for detailed documentation:

Contributing

Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, or request features.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Modular AI chat engine with pipeline architecture

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages