# tinker_cookbook.rl.RLDataset ## *class* [**tinker_cookbook.rl.RLDataset**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L445)(*ABC*) A dataset that produces batches of [`EnvGroupBuilder`](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/envgroupbuilder/index.md) instances. This is the primary dataset interface consumed by RL training loops. Implementations must define `get_batch` and `__len__`. ```python class MyDataset(RLDataset): def __init__(self, builders: list[EnvGroupBuilder], batch_size: int): self.builders = builders self.batch_size = batch_size def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: start = index * self.batch_size return self.builders[start : start + self.batch_size] def __len__(self) -> int: return len(self.builders) // self.batch_size ``` ### [**get_batch**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L467)(*index*) Return a batch of EnvGroupBuilder instances at the given index. **Parameters:** - [**index**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L467) (*int*) – The batch index (`0 <= index < len(self)`). **Returns:** *Sequence\[[EnvGroupBuilder](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/envgroupbuilder/index.md)\]* – The environment group builders for this batch. *Abstract method.* ## Referenced by - [tinker_cookbook.distillation.PromptOnlyDataset](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/distillation/promptonlydataset/index.md) - [tinker_cookbook.rl.RLDatasetBuilder.__call__](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/rldatasetbuilder/#rldatasetbuilder-call)