# Recording an answer

`jadpo ai record` asks the model once, in development, and keeps its
answer as a recording a test can answer with.

- **The command** is `jadpo ai record <prompt> --as <name>`, the prompt by
  its name or its type's as `jadpo ai show` takes it. `--as` is required
  and lower_snake_case, as `recorded("<name>")` writes it and its file is
  named (`cli.ai_arguments` otherwise, as for a misspelt prompt, with the
  nearest). It runs in development, with the settings `jadpo dev` starts
  with, `.env.local` included.
- **What it asks with.** By default the values of the prompt's last call
  in `jadpo dev`'s call log (`build/dev/calls.jsonl`), which now keeps,
  for a prompt asked of a model, its values beside the call: each field
  its text writes as its type's JSON and a conversation's turns as `{
  content, role }`, read back through the prompt's types now. With
  `--fixture <fixture>`, the value a fixture of the project makes, one
  that takes nothing and returns the prompt's type, run as `Program`
  runs a callable alone: no database and every outside call faked, so a
  fixture that reads or writes records can't make one
  (`recording.failed`). No call logged with values and no fixture, or
  logged values the prompt's types no longer read, is
  `recording.refused`, with nothing sent.
- **How it asks.** As the prompt's first `ai.generate` call in the
  program asks: with its `as:` type, model, schema, `attempts:` and
  `timeout:`. That is the call `recorded(...)` already answers through.
  Every type a call asks for still decodes the recording in
  `jadpo test`. A prompt no call asks is `recording.refused`.
- **Never live.** Through a package's connection, it refuses before
  anything is sent, with the same code `jadpo package record` refuses
  with: an environment that chooses `live`, and a credential,
  environment or address nothing sets. The built-in driver,
  `Driver.openai_compatible`, has no environment and no key, so it asks
  whatever `url:` names, as `jadpo dev` does.
- **What it keeps** is a recording as
  [Embeddings and recordings](embeddings-and-recordings.md) describes: the
  answer decoded as the call's type and written again as `json.write`
  writes it, with plain texts and numbers as placeholders by the same
  code as a package's recordings, and the prompt's version; members in
  name order, two spaces deep. Nothing is kept (`recording.failed`,
  saying `Nothing was recorded.`) after a refusal, `malformed` after
  every attempt, no answer within `timeout:`, a cut-off answer, a prompt
  too long, or a model that can't be reached or refuses the connection.
  The same answer again leaves the file as it was.
- **The stale recording's alert** names it as the next step: the hint
  after `jadpo test`'s footer is `jadpo ai record <prompt> --as <name>`
  for the first stale recording, and each `data.alerts` entry carries it
  as `next`.
