abi

๐Ÿš€ Abi AI Framework

Ultra-high-performance AI framework with GPU acceleration, lock-free concurrency, advanced monitoring, and platform-optimized implementations for Zig development.

Zig Version โ€ข Docs โ€ข CI: Pages License Platform Build Status Tests Performance

โœ… Key Improvements

โœจ Key Features

๐Ÿš€ Performance & Acceleration

๐Ÿค– AI & Machine Learning

๐Ÿ›ก๏ธ Production-Ready Infrastructure

๐Ÿ”Œ Extensible Plugin System

๐Ÿš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/donaldfilimon/abi.git
cd abi

# Build
zig build

# Run tests
zig build test

# Docs (GitHub Pages)
zig build docs

# Benchmarks
zig build bench-all

# Run CLI
zig build run

# Run SIMD micro-benchmark
zig build bench-simd

Basic Usage

const std = @import("std");
const abi = @import("abi");

pub fn main() !void {
    // Initialize framework with monitoring
    var framework = try abi.init(std.heap.page_allocator, .{
        .enable_gpu = true,
        .enable_simd = true,
        .enable_memory_tracking = true,
        .enable_performance_profiling = true,
    });
    defer framework.deinit();

    // Create AI agent
    var agent = try abi.ai.Agent.init(std.heap.page_allocator, .creative);
    defer agent.deinit();

    // Generate response
    const response = try agent.generate("Hello, how can you help me?", .{});
    defer std.heap.page_allocator.free(response.content);

    std.debug.print("๐Ÿค– Agent: {s}\n", .{response.content});
}

Vector Database Example

// Create vector database
var db = try abi.database.Db.open("vectors.wdbx", true);
defer db.close();

try db.init(384); // 384-dimensional vectors

// Add embeddings
const embedding = [_]f32{0.1, 0.2, 0.3, /* ... */};
const row_id = try db.addEmbedding(&embedding);

// Search for similar vectors
const query = [_]f32{0.15, 0.25, 0.35, /* ... */};
const results = try db.search(&query, 10, allocator);
defer allocator.free(results);

WDBX Vector Database Features

The WDBX-AI vector database provides enterprise-grade performance with:

Command Line Usage

# Query k-nearest neighbors
zig build run -- knn "1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1" 5

# Query nearest neighbor
zig build run -- query "1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1"

# Add vector to database
zig build run -- add "1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0"

# Start HTTP REST API server
zig build run -- http 8080

HTTP REST API

Start the server and access endpoints:

zig build run -- http 8080

API Endpoints:

๐Ÿ“Š Performance Benchmarks

Component Performance Hardware
Text Processing 3.2 GB/s SIMD-accelerated with alignment safety
Vector Operations 15 GFLOPS SIMD dot product with memory tracking
Neural Networks <1ms inference 32x32 network with memory safety
LSP Completions <10ms response Sub-10ms completion responses
GPU Rendering 500+ FPS Terminal UI with GPU acceleration
Lock-free Queue 10M ops/sec Single producer, minimal contention
WDBX Database 2,777+ ops/sec Production-validated performance

๐Ÿ› ๏ธ Command Line Interface

# AI Chat (Interactive)
abi chat --persona creative --backend openai --interactive

# AI Chat (Single Message)
abi chat "Hello, how can you help me?" --persona analytical

# Model Training
abi llm train --data training_data.csv --output model.bin --epochs 100 --lr 0.001

# Model Training with GPU
abi llm train --data data.csv --gpu --threads 8 --batch-size 64

# Vector Database Operations
abi llm embed --db vectors.wdbx --text "Sample text for embedding"
abi llm query --db vectors.wdbx --text "Query text" --k 5

# Web Server
abi web --port 8080

# Performance Benchmarking
abi benchmark --iterations 1000 --memory-track

# Memory Profiling
abi --memory-profile benchmark

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Abi AI Framework                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿค– AI Agents    ๐Ÿง  Neural Nets    ๐Ÿ—„๏ธ Vector Database    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿš€ SIMD Ops     ๐Ÿ”’ Lock-free      ๐ŸŒ Network Servers    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ“Š Monitoring   ๐Ÿ” Profiling      ๐Ÿงช Testing Suite      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ”Œ Plugin Sys   ๐Ÿ“ฑ CLI Interface  ๐ŸŒ Platform Ops      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Documentation

๐Ÿงช Testing & Quality

Quick commands

Comprehensive Test Suite

# Run all tests
zig build test

# Memory management tests
zig test tests/test_memory_management.zig

# Performance regression tests
zig test tests/test_performance_regression.zig

# CLI integration tests
zig test tests/test_cli_integration.zig

Quality Metrics

Test Categories

๐ŸŒ Web API

Start the web server and access REST endpoints:

abi web --port 8080

Available Endpoints:

๐Ÿ”Œ Plugin Development

Create custom plugins for the framework:

// Example plugin
pub const ExamplePlugin = struct {
    pub const name = "example_plugin";
    pub const version = "1.0.0";
    
    pub fn init(allocator: std.mem.Allocator) !*@This() {
        // Plugin initialization
    }
    
    pub fn deinit(self: *@This()) void {
        // Plugin cleanup
    }
};

See Plugin System Documentation for detailed development guide.

๐Ÿš€ Production Deployment

The framework includes production-ready deployment configurations:

See Production Deployment Guide for complete deployment instructions.

๐ŸŒ Cross-Platform Guide (Zig 0.16-dev)

Targets

# Examples
zig build -Dtarget=x86_64-linux-gnu
zig build -Dtarget=aarch64-linux-gnu
zig build -Dtarget=x86_64-macos
zig build -Dtarget=aarch64-macos
zig build -Dtarget=wasm32-wasi

Conditional Compilation

const builtin = @import("builtin");

pub fn main() void {
    if (comptime builtin.os.tag == .windows) {
        // Windows-specific code
    } else if (comptime builtin.os.tag == .linux) {
        // Linux-specific code
    } else if (comptime builtin.os.tag == .macos) {
        // macOS-specific code
    }
}

Cross-Platform Build Step

zig build cross-platform   # builds CLI for multiple targets into zig-out/cross/

Windows Networking Notes

๐Ÿค Contributing

We welcome contributions! Please read our Contributing Guide for details.

Development Workflow

  1. Fork and Clone: Create a feature branch
  2. Run Tests: Ensure all tests pass with monitoring
  3. Memory Safety: Verify no leaks in your changes
  4. Performance: Run performance tests to ensure no regressions
  5. Documentation: Update docs for new features
  6. Submit PR: Create pull request with comprehensive coverage

๐Ÿ“„ License

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

๐Ÿ†˜ Support

๐Ÿ™ Acknowledgments


โญ Star this repository if you find it useful!

๐Ÿš€ Ready to build the future of AI with Zig? Get started with Abi AI Framework today!