# `Imp.Predict.ChainOfThought`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/predict/chain_of_thought.ex#L1)

Predict variant that asks for a `:reasoning` field before task outputs.

# `new`

Builds a program that asks for `:reasoning` before the signature's outputs.

Takes `Imp.Predict.new/2`'s options and two of its own. An unknown
option raises `ArgumentError`.

## Options

* `:lm` - The model the program calls. When absent, each call uses `Imp.Settings`' `:lm`.

* `:adapter` - The adapter that renders the request and parses the reply. When absent, each call uses `Imp.Settings`' `:adapter`.

* `:demos` (list of `t:term/0`) - Worked examples rendered before the inputs, as `Imp.Example` values or maps. The default value is `[]`.

* `:config` (`t:keyword/0`) - Request options sent with every call: sampling (`:temperature`, `:max_tokens`, `:n`, ...) and the other options the LM client takes. The default value is `[]`.

* `:adapter_opts` (`t:keyword/0`) - Options handed to the adapter's `format/3` on every call, beside `:demos`: how a program passes rendering data, and how a host injects renderers without writing a second adapter module. The default value is `[]`.

* `:metadata` (map of `t:term/0` keys and `t:term/0` values) - Free-form metadata kept on the program. The default value is `%{}`.

* `:rationale_field` - The reasoning field, as a field map, keyword list or `Imp.Signature.Field`; its name is always `:reasoning`. When absent or `nil`, a field of `:rationale_field_type`.

* `:rationale_field_type` (`t:term/0`) - The type of the default reasoning field; `:reasoning` asks a model that reasons natively for its own reasoning. The default value is `:string`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
