baml.csv.to_markdown

Renders rows of `T` as a GitHub-style Markdown table for prompt context.

Reference version

Signature

function baml.csv.to_markdown<T>(rows: T[], max_rows: int = …) -> string throws never

Renders rows of T as a GitHub-style Markdown table for prompt context.

Headers come from T's field names. | is escaped and embedded newlines become spaces; non-finite floats render as NaN / inf, since prompt text is not meant to round-trip. Past max_rows, output is truncated with a final … (N more rows) line whose count covers all of rows, so the model is told what it is not seeing.

Never fails, where the CSV writers are strict, and for the same reason: a prompt that renders "<unrepresentable>" in one cell is more useful than no prompt. Where CSV would reject a nested value, this falls back to its JSON form. A T that is not a class renders as a single value column.

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