Skip to main content

Module runtime

Module runtime 

Source
Expand description

Typed model requests and runtime accounting, independent of any provider SDK. Every fragment requires a source and role. Estimates, tokenizer-measured document budgets, and reported usage are distinct; none implies the others.

Structs§

ByteEstimator
Explicit heuristic policy. Image transport bytes are never treated as text. This estimate excludes provider framing and is not a tokenizer count.
ModelRequest
A complete, attributed model request. Constructed only via ModelRequestBuilder.
ModelRequestBuilder
PromptFragment
A source-attributed piece of a model request. Fields are private; the only constructors require attribution at the call site.
ReportedUsage
Provider-reported usage for one model call. Input/cache lanes are disjoint; reasoning is a subset of output and must not be added to the output total.
RequestEstimate
Categorized estimate. Total derives from categories instead of being a separately mutable field that could drift from them.
SourceEstimate
One source’s heuristic allocation, not provider-reported category usage.
TokenUsage
Usage for one call. estimate: None means source attribution is unavailable (for example, a backend assembled the prompt), not zero category usage.
ToolDefinition
A tool definition offered to the model. Counted under ContentSource::ToolDefinitions in attribution.
ToolUseId
Opaque provider-neutral tool-call identity. The caller generates IDs; HTMLP has no UUID, clock, or random-number dependency.

Enums§

ContentBlock
Provider-neutral content block.
ContentSource
The origin category of a piece of model-bound content.
Role
Message role; source attribution remains independent of role.
ThinkingLevel
Reasoning/thinking effort. Providers map this to their native knob (Anthropic budget_tokens, OpenAI reasoning_effort).

Constants§

TEXT_ONLY_IMAGE_NOTE
Shown to the model in place of an image the active model cannot view. Reads as a bracketed aside so tool-result descriptions (“Image foo.png: 800×600 …”) still read as the metadata line it accompanies.