Dsxir.Optimizer.COPRO.Proposer (dsxir v0.4.0)

Copy Markdown

Instruction proposer for Dsxir.Optimizer.COPRO. Dispatches to Basic (round 0, from the current instruction) or GivenAttempts (later rounds, from the sorted attempt history). Both return exactly n instructions.

Summary

Functions

Truncate list to n items, or repeat fallback until the result has exactly n items.

Parse an LM completion into a list of instruction strings.

Render a signature's field list as a name (type) block, one field per line. Used by both proposers to ground the prompt in the predictor's shape.

Types

ctx()

@type ctx() :: map()

Functions

pad(list, n, fallback)

@spec pad([String.t()], pos_integer(), String.t()) :: [String.t()]

Truncate list to n items, or repeat fallback until the result has exactly n items.

parse(text)

@spec parse(String.t()) :: [String.t()]

Parse an LM completion into a list of instruction strings.

propose(ctx)

@spec propose(ctx()) :: {:ok, [String.t()]} | {:error, Exception.t()}

render_fields(fields)

@spec render_fields([Dsxir.Signature.Field.t()]) :: String.t()

Render a signature's field list as a name (type) block, one field per line. Used by both proposers to ground the prompt in the predictor's shape.