runtime

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package runtime manages the lifecycle of a Provider with optional hooks and a post-processing Pipeline. It is the top-level entry point for traced, observable LLM interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

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

Runtime manages the lifecycle of a Provider with hooks and an optional post-processing Pipeline.

For simple use cases, calling Provider.Generate directly is fine. Runtime adds value when you want:

  • Telemetry hooks on every generation
  • Consistent post-processing pipeline

func New

func New(p niro.Provider) *Runtime

New creates a Runtime with the given Provider.

func (*Runtime) Generate

func (r *Runtime) Generate(ctx context.Context, req *niro.Request) (*niro.Stream, error)

Generate sends a request to the provider and returns a stream of frames, optionally processed through the attached pipeline. Hooks are invoked at each stage.

func (*Runtime) WithCacheEngine

func (r *Runtime) WithCacheEngine(engine niro.CacheEngine) *Runtime

WithCacheEngine attaches an optional cache engine for provider adapters.

func (*Runtime) WithHook

func (r *Runtime) WithHook(h hook.Hook) *Runtime

WithHook attaches a telemetry/observability Hook. Use hook.Compose() to combine multiple hooks.

func (*Runtime) WithPipeline

func (r *Runtime) WithPipeline(p *pipe.Pipeline) *Runtime

WithPipeline attaches a post-processing Pipeline to the Runtime.

func (*Runtime) WithPrefixNormalizer

func (r *Runtime) WithPrefixNormalizer(normalizer niro.PrefixNormalizer) *Runtime

WithPrefixNormalizer sets a deterministic prefix normalizer for cache key derivation.

Jump to

Keyboard shortcuts

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