Imp.Optimizer.Report (Imp v0.5.0)

Copy Markdown View Source

Optimizer candidate history and diagnostic metadata.

best_score is the best score computed inside the optimizer. It is nil for transform-only optimizers such as LabeledFewShot, which attach parameters without evaluating them. When Imp.Experiment.check/5 performs the outer admission and held-out measurement, those scores live in Imp.Experiment.Result.baseline_selection, optimized_selection, and test.

Summary

Functions

Decodes a value produced by encode_term/1.

Encodes an Elixir term into Imp's lossless tagged JSON representation.

Returns a JSON-encodable projection with credential-bearing data redacted.

Builds an optimizer report from atom-key, string-key, or keyword attributes.

Functions

attach(program, report)

decode_term(value)

Decodes a value produced by encode_term/1.

dump(report)

encode_term(value)

Encodes an Elixir term into Imp's lossless tagged JSON representation.

This is a structural codec, not a logging boundary. Callers writing telemetry, reports, or user-visible artifacts should use json_safe/1 instead. A pid, port or reference is written as its inspected text, and reads back as that text.

fetch(program)

json_safe(value)

Returns a JSON-encodable projection with credential-bearing data redacted.

load!(state)

new(attrs \\ %{})

Builds an optimizer report from atom-key, string-key, or keyword attributes.

String-key support is intentional: report data is often restored from JSON artifacts or provider/debug payloads before it is attached back to a program. Malformed attribute containers raise Imp-context errors instead of generic Map.new/1 failures.