baml.csv.decode_one

Typed parse of an input with exactly one data record.

Reference version

Signature

function baml.csv.decode_one<T>(
source: string | uint8array,
options: baml.csv.ReaderOptions | null = …
) -> T throws baml.csv.Error

Typed parse of an input with exactly one data record.

Fits LLM output that was requested as exactly one row: has_header: false for a bare row (positional decode), or the default options when the model was asked to emit a header plus one data row.

Throws

  • Error { kind: NotFound } if the input holds no data record.
  • Error { kind: TooManyRows } if it holds more than one.
  • Error for anything decode<T> throws.

Source:<builtin>/baml/ns_csv/csv.bamlbytes 3697337553