# tinker_cookbook.supervised.FromConversationFileBuilder

## _class_ [**tinker_cookbook.supervised.FromConversationFileBuilder**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L231)( _[ChatDatasetBuilder](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/supervised/chatdatasetbuilder/)_)

Build a supervised dataset from a JSONL file of chat conversations.

Each line of the file must be a JSON object with a `"messages"` key whose
value is a list of chat messages (dicts with `"role"` and `"content"`).

```python
builder = FromConversationFileBuilder(
    file_path="data/conversations.jsonl",
    test_size=50,
    common_config=ChatDatasetBuilderCommonConfig(
        model_name_for_tokenizer="Qwen/Qwen3-8B",
        renderer_name="qwen3",
        max_length=2048,
        batch_size=8,
    ),
)
train_ds, test_ds = builder()
```

**Fields:**

- [**file_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L259) ( _str_)
- [**test_size**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L260) ( _int_, default: `0`)
- [**shuffle_seed**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L261) ( _int_, default: `0`)

### [**__call__**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L263)()

Load the JSONL file and return (train_dataset, test_dataset).

**Returns:** _tuple[ [SupervisedDataset](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/supervised/superviseddataset/), [SupervisedDataset](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/supervised/superviseddataset/) | None ]_ – Training dataset and an optional held-out evaluation dataset.

**Raises:**

- DataFormatError: If any line in the file lacks a `"messages"` key.
