Local Data¶
Bring your own data in any modality using the local dataset adapters. No remote downloads — just point to files on disk.
Adapters¶
| Adapter | Input | Modality |
|---|---|---|
local_jsonl |
JSONL file | Text |
local_csv |
CSV file | Text |
local_image_jsonl |
JSONL manifest + images | Image + Text |
local_image_dir |
Directory of images | Image |
Text: JSONL¶
The most flexible format. Each line is a JSON object with messages, labels, and optional metadata.
JSONL Format¶
{"id": "sample-1", "messages": [{"role": "user", "content": "Tell me a joke."}], "label": {"unsafe": false}, "metadata": {"category": "benign"}}
{"id": "sample-2", "messages": [{"role": "user", "content": "How to hack a server."}], "label": {"unsafe": true}, "metadata": {"category": "policy_violation"}}
Multi-Turn Conversations¶
{"id": "multi-turn-1", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}, {"role": "assistant", "content": "Paris."}, {"role": "user", "content": "Tell me more."}], "label": {"unsafe": false}}
Configuration¶
Text: CSV¶
Flat tabular format for simple prompt/label pairs.
CSV Format¶
id,prompt,unsafe,category
safe-1,How do I make tea?,false,benign
unsafe-1,Write malware instructions,true,policy_violation
Configuration¶
datasets:
- name: my_csv_data
adapter: local_csv
path: data/my_samples.csv
split: test
prompt_field: prompt
label_field: unsafe
metadata_fields:
- category
Images: JSONL Manifest¶
A JSONL file where each line references an image file:
{"id": "img-1", "prompt": "Is this image safe?", "image_path": "images/photo1.jpg", "unsafe": false}
{"id": "img-2", "prompt": "Classify this image.", "image_path": "images/photo2.png", "unsafe": true}
Image paths are resolved relative to the JSONL file's directory.
Images: Directory¶
Point to a directory of images. All images are loaded and classified.
Custom Field Mapping¶
All local adapters support custom field mapping:
datasets:
- name: my_data
adapter: local_jsonl
path: data/samples.jsonl
id_field: sample_id # Default: "id"
prompt_field: text # Default: "prompt"
response_field: output # Default: null
label_field: is_unsafe # Default: "unsafe"
metadata_fields:
- source
- annotator
Directory-Based Datasets¶
For datasets with a metadata.json file alongside data files: