Skip to main content

Module streamfn

Module streamfn 

Source
Expand description

LLM stream-function seam + default rig (OpenAI-compatible) adapter.

This module is the only place rig types appear in the kernel. A StreamFn turns harness conversation context into a LlmStream of LlmStreamEvents; rig_stream_fn is the default implementation built on rig’s Chat Completions API client.

Structs§

LlmOpts
LlmProfile
A per-model provider profile: how to reach the model when it differs from the launch provider. Every field is optional — None means “leave the launch provider’s value”, so an empty profile is a no-op and a profile may override only base_url without resetting the endpoint.
LlmProvider
The provider a session starts on — what a model switch falls back to when the model has no [models.<id>] entry. Captured at boot AFTER env/flag overrides, so flags/env/config globals define the DEFAULT provider.
ModelProfiles
id → provider profile resolved once at boot from [models.<id>], plus the launch provider (base) an unmapped model falls back to. The Default (no base) does NOT manage providers: every operation is a no-op, so a bare kernel embedder’s LlmOpts::default() is never touched. A BTreeMap (not HashMap) keeps debug/--dump-* output deterministic.
RetryPolicy
Retry policy for a stream call: the transient-connect retries plus the stall (idle / time-to-first-token) timeouts.

Enums§

LlmEndpoint

Functions§

list_models
List models via GET {base_url}/models using the same client config as streaming. Ids are sorted for stable display. The endpoint only returns id/name metadata — no capability flags — so effort support stays user-managed.
probe_endpoint
Probe base_url for a live OpenAI-compatible endpoint: GET {base_url}/models under a hard timeout. true iff the endpoint answered with a model list (an empty list still counts — the endpoint is up). Any error (refused, DNS, non-2xx, timeout) is false; the caller treats false as “not this endpoint” and moves on.
rig_stream_fn
Default adapter: OpenAI-compatible Chat Completions endpoint via rig.

Type Aliases§

LlmStream
StreamFn