zig-ai
zig-ai

FOLLGAD/zig-ai

-

OpenAI SDK with streaming support

20 20 0 0
3
build.zig.zon  build.zig 
View on Github  
Updated: 10:32:58 AM Thu Dec 26 2024 Size: 16KB Created: 9:23:56 PM Sat Nov 30 2024
Dependencies:
No known dependencies
zig  fetch  --save  git+https://github.com/FOLLGAD/zig-ai

zig-ai

A simple OpenAI API client for Zig with streaming support.

Find examples in the examples directory.

Installation

$ zig fetch --save git+https://github.com/FOLLGAD/zig-ai

and add zig-ai to your build.zig file:

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "stream-cli",
        .root_source_file = b.path("examples/stream-cli.zig"),
        .target = target,
        .optimize = optimize,
    });

    const module = b.dependency("zig-ai", .{
        .root_source_file = b.path("src/llm.zig"),
    });
    exe.root_module.addImport("zig-ai", module.module("zig-ai"));
}

Usage

See the examples directory for usage examples.