Ultra-high-performance AI framework with GPU acceleration, lock-free concurrency, advanced monitoring, and platform-optimized implementations for Zig development.
mlugg/setup-zig@v2
with Zig 0.15.0)# 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
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});
}
// 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);
The WDBX-AI vector database provides enterprise-grade performance with:
# 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
Start the server and access endpoints:
zig build run -- http 8080
API Endpoints:
GET /health
- Health checkGET /stats
- Database statisticsPOST /add
- Add vector (requires admin token)GET /query?vec=1.0,2.0,3.0
- Query nearest neighborGET /knn?vec=1.0,2.0,3.0&k=5
- Query k-nearest neighborsComponent | 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 |
# 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
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
zig build
zig build test
zig build bench-all
zig build docs
zig build analyze
zig build cross-platform
# 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
Start the web server and access REST endpoints:
abi web --port 8080
Available Endpoints:
GET /health
- Health checkGET /api/status
- System statusPOST /api/agent/query
- Query AI agent (JSON: {"message": "your question"}
)POST /api/database/search
- Search vectorsGET /api/database/info
- Database informationWebSocket /ws
- Real-time chat with AI agentCreate 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.
The framework includes production-ready deployment configurations:
See Production Deployment Guide for complete deployment instructions.
# 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
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
}
}
zig build cross-platform # builds CLI for multiple targets into zig-out/cross/
zig build test-network
(Windows only)fix_windows_networking.ps1
We welcome contributions! Please read our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
โญ Star this repository if you find it useful!
๐ Ready to build the future of AI with Zig? Get started with Abi AI Framework today!