train sl expects. Use rlcli import to flatten content blocks, normalize roles, filter short threads, and pipe the results directly into training.
Usage
Positional argument
string
required
Path to the input file, or
- to read from stdin.Flags
choice
default:"messages"
Input format.
messages:{"messages": [...]}per line (default).openai: chat-completions dumps. Tool-calls turns are dropped.anthropic: Messages API dumps. Content blocks are flattened into plain text;tool_use,tool_result,image, andthinkingblocks are dropped. Top-levelsystemis kept as a system message.
string
default:"-"
Output path, or
- for stdout (default).int
default:"2"
Minimum number of messages a conversation must contain to be kept.
int
Maximum number of conversations to output.
Role normalization
rlcli normalizes roles as follows:human→userai/model→assistantsystem→systemtool,function,tool_result→ dropped
Content flattening
- Plain strings are kept as-is.
- Anthropic-style content blocks: only
type: "text"blocks are kept and joined with newlines. All other block types are dropped.
Validation
A conversation is kept only when it has at least--min-messages messages and at least one assistant message after normalization.
Errors
ImportFormatErroris raised with a line number on malformed JSON or unknown format strings.- If no usable conversations are found, the command exits with code
1.
Output
The command writes the normalized JSONL to stdout or--out and prints a count to stderr: