Shared inference interfaces (TextModel, Backend, Token). Zero deps, compiles everywhere.
Find a file
Snider 33414f608d chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
docs docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
CLAUDE.md docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
discover.go feat: add Discover() for scanning model directories 2026-02-19 23:37:30 +00:00
discover_test.go test(inference): add comprehensive tests for all exported API 2026-02-20 02:06:49 +00:00
go.mod chore: bump go directive to 1.26.0 2026-02-22 20:33:48 +00:00
go.sum test(inference): add comprehensive tests for all exported API 2026-02-20 02:06:49 +00:00
inference.go fix: add json struct tags to Message for API serialization 2026-02-20 02:05:46 +00:00
inference_test.go test(inference): complete Phase 1 foundation tests 2026-02-20 11:45:59 +00:00
options.go feat: add batch inference API (Classify, BatchGenerate) 2026-02-19 23:29:28 +00:00
options_test.go test(inference): complete Phase 1 foundation tests 2026-02-20 11:45:59 +00:00
README.md docs: add README with quick start and docs links 2026-02-20 15:11:19 +00:00

go-inference

Shared interface contract for text generation backends in the Core Go ecosystem. Defines TextModel, Backend, Token, Message, and associated configuration types that GPU-specific backends implement and consumers depend on. Zero external dependencies — stdlib only — and compiles on all platforms regardless of GPU availability. The backend registry supports automatic selection (Metal preferred on macOS, ROCm on Linux) and explicit pinning.

Module: forge.lthn.ai/core/go-inference Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import (
    "forge.lthn.ai/core/go-inference"
    _ "forge.lthn.ai/core/go-mlx"   // registers "metal" backend on darwin/arm64
)

model, err := inference.LoadModel("/path/to/safetensors/model/")
defer model.Close()

for tok := range model.Generate(ctx, "Hello", inference.WithMaxTokens(256)) {
    fmt.Print(tok.Text)
}

Documentation

  • Architecture — interfaces, registry, options, stability contract, ecosystem position
  • Development Guide — prerequisites, build, test patterns, coding standards
  • Project History — completed phases, commit log, known limitations

Build & Test

go test ./...
go vet ./...
go build ./...

Licence

European Union Public Licence 1.2 — see LICENCE for details.