runtime

package
v0.7.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 5 Imported by: ? 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 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