engine

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package engine routes completion requests to loaded runtime Instances, applying governor admission and telemetry accounting. It is the single serving funnel shared by the local OpenAI API and the tunnel dispatcher.

Index

Constants

This section is empty.

Variables

View Source
var ErrModelNotFound = errors.New("engine: model not loaded")

ErrModelNotFound is returned for unknown model ids.

Functions

This section is empty.

Types

type Admitter

type Admitter interface {
	Admit(ctx context.Context, id string) (context.Context, func(), error)
}

Admitter gates requests (usually *governor.Governor).

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine implements tunnel.Engine and backs localapi.

func New

func New(admit Admitter, stats *telemetry.Stats, touch func(string)) *Engine

New builds an Engine. admit may be nil (no gating), stats may be nil.

func (*Engine) Complete

func (e *Engine) Complete(ctx context.Context, req rt.CompletionRequest) (rt.TokenStream, error)

Complete runs one request through admission, the runtime, and telemetry.

func (*Engine) DefaultModel

func (e *Engine) DefaultModel() string

DefaultModel returns the fallback model id.

func (*Engine) Health

func (e *Engine) Health(ctx context.Context, model string) (rt.Stats, error)

Health proxies the default (or named) instance health.

func (*Engine) Models

func (e *Engine) Models() []*ModelEntry

Models lists loaded entries.

func (*Engine) Register

func (e *Engine) Register(spec rt.ModelSpec, inst rt.Instance)

Register adds a loaded model; the first registered becomes the default.

func (*Engine) Stats

func (e *Engine) Stats() *telemetry.Stats

Stats exposes the telemetry accumulator.

func (*Engine) Unregister

func (e *Engine) Unregister(id string) *ModelEntry

Unregister removes a model (eviction); callers shut the instance down.

type ModelEntry

type ModelEntry struct {
	Spec     rt.ModelSpec
	Instance rt.Instance
}

ModelEntry pairs a loaded instance with its metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL