Shared inference interfaces (TextModel, Backend, Token). Zero deps, compiles everywhere.
Find a file
Snider 254b391f31
Some checks failed
security-scan.yml / feat(scheduler): driver-neutral request scheduler for inference.TextModel (push) Failing after 0s
test.yml / feat(scheduler): driver-neutral request scheduler for inference.TextModel (push) Failing after 0s
feat(scheduler): driver-neutral request scheduler for inference.TextModel
Lifts the package-first request scheduler from go-mlx into a
self-contained driver-neutral package. Symbols rename per the
folder-taxonomy rule:

  ScheduledModel       → scheduler.Model
  SchedulerConfig      → scheduler.Config
  NewScheduledModel    → scheduler.New
  scheduledJob         → job (private)
  emitSchedulerProbe   → (Model).emitProbe (private method)
  scheduledGenerateOptions → generateOptions (private)
  cloneSchedulerLabels → cloneLabels (private)

scheduler.Model wraps an inference.TextModel with bounded queueing,
cancellation, streaming backpressure, and ProbeEventScheduler probe
emission. Worker pool sized by Config.MaxConcurrent; queue bounded by
MaxQueue; per-request stream buffer set by StreamBuffer.

Coverage: queue + latency probe, full-queue rejection, cancellation,
Generate/Chat/Classify/BatchGenerate delegation, nil-scheduler defence
paths, fallback cancel via inference.CancellableModel, Err propagation,
generateOptions sampler conversion, cloneLabels defensive copy, millis
helpers. Six tests, ten examples, all green.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-05-11 18:00:20 +01:00
.core chore: add .core/ build and release configs 2026-03-06 18:52:36 +00:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:52 +00:00
docs feat(inference): state/ split + wire packages + per-file docs 2026-05-11 10:46:33 +01:00
external chore(repo): refresh submodules + go.work hygiene (Phase 2 cascade unblock) 2026-05-01 09:39:57 +01:00
go feat(scheduler): driver-neutral request scheduler for inference.TextModel 2026-05-11 18:00:20 +01:00
.editorconfig chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
.gitignore chore(inference): migrate module path to dappco.re/go/core/inference 2026-03-22 01:38:46 +00:00
.gitmodules refactor(go): restructure to /go/ subtree (Mantis #1236) 2026-05-01 05:32:02 +01:00
.golangci.yml chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:40 +00:00
.woodpecker.yml ci: woodpecker pipeline (Go) — golangci-lint/eslint/phpstan + sonar.lthn.sh 2026-04-29 00:03:08 +01:00
AGENTS.md refactor(core): align go-inference with hardened core/go reference shape 2026-04-29 05:54:49 +01:00
CLAUDE.md chore(inference): align module path references 2026-04-15 08:49:50 +01:00
CONTRIBUTING.md chore(inference): migrate module path to dappco.re/go/core/inference 2026-03-22 01:38:46 +00:00
go.work chore(repo): refresh submodules + go.work hygiene (Phase 2 cascade unblock) 2026-05-01 09:39:57 +01:00
LICENCE chore: add EUPL-1.2 LICENCE file (UK English canonical) 2026-05-01 08:34:16 +01:00
README.md chore(inference): align module path references 2026-04-15 08:49:50 +01:00
sonar-project.properties ci: woodpecker pipeline (Go) — golangci-lint/eslint/phpstan + sonar.lthn.sh 2026-04-28 23:33:24 +01: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: dappco.re/go/inference Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import (
    "dappco.re/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.