# prompt_strategies.dpo.chat_template

`prompt_strategies.dpo.chat_template`

DPO prompt strategies for using tokenizer chat templates.

## Functions

Name | Description
--- | ---
argilla_chat | DPO chat template strategy for argilla-style datasets.

### argilla_chat

    prompt_strategies.dpo.chat_template.argilla_chat(cfg, dataset_idx=0, **kwargs)

DPO chat template strategy for argilla-style datasets.

For argilla-style datasets where chosen/rejected contain full conversations instead of single response messages. Extracts the conversation history from the chosen field and formats both chosen/rejected responses using the configured chat template.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
cfg |  | Configuration object containing chat_template and dataset settings | required
dataset_idx |  | Index of the dataset in the config (default: 0) | `0`
**kwargs |  | Additional keyword arguments (unused) | `{}`

#### Returns

Name | Type | Description
--- | --- | ---
tuple |  | (transform_fn, dataset_kwargs) where: - transform_fn: Function to transform dataset samples - dataset_kwargs: Dict with ‘remove_columns’ specifying columns to drop

#### Dataset format

{ “chosen”: [ {“role”: “user”, “content”: “…”}, {“role”: “assistant”, “content”: “…”} ], “rejected”: [ {“role”: “user”, “content”: “…”}, {“role”: “assistant”, “content”: “…”} ] }