Shared inference interfaces (TextModel, Backend, Token). Zero deps, compiles everywhere.
Find a file
Snider 63c3d6aa53
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 1m55s
chore: refresh go.sum for missing transitive deps
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:58:20 +00:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:52 +00:00
docs docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
.editorconfig chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
.golangci.yml chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
CLAUDE.md docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
CONTRIBUTING.md chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
discover.go feat: modernise to Go 1.26 — iterators, slices.Sorted, maps.Keys 2026-02-23 05:07:50 +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: sync workspace dependency versions 2026-02-22 21:41:56 +00:00
go.sum chore: refresh go.sum for missing transitive deps 2026-02-23 06:58:20 +00:00
inference.go feat: modernise to Go 1.26 — iterators, slices.Sorted, maps.Keys 2026-02-23 05:07:50 +00:00
inference_test.go feat: modernise to Go 1.26 — iterators, slices.Sorted, maps.Keys 2026-02-23 05:07:50 +00:00
options.go refactor: apply go fix modernizers for Go 1.26 2026-02-22 21:00:16 +00:00
options_test.go refactor: apply go fix modernizers for Go 1.26 2026-02-22 21:00:16 +00:00
README.md chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
Taskfile.yml chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00

Go Reference License: EUPL-1.2 Go Version

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.