# prompt_strategies.chat_template { #axolotl.prompt_strategies.chat_template }

`prompt_strategies.chat_template`

HF Chat Templates prompt strategy

## Classes

| Name | Description |
| --- | --- |
| [ChatTemplatePrompter](#axolotl.prompt_strategies.chat_template.ChatTemplatePrompter) | Prompter for HF chat templates |
| [ChatTemplateStrategy](#axolotl.prompt_strategies.chat_template.ChatTemplateStrategy) | Tokenizing strategy for instruction-based prompts. |
| [StrategyLoader](#axolotl.prompt_strategies.chat_template.StrategyLoader) | Load chat template strategy based on configuration. |

### ChatTemplatePrompter { #axolotl.prompt_strategies.chat_template.ChatTemplatePrompter }

```python
prompt_strategies.chat_template.ChatTemplatePrompter(
    self,
    tokenizer,
    chat_template,
    processor=None,
    max_length=2048,
    message_property_mappings=None,
    message_field_training=None,
    message_field_training_detail=None,
    field_messages='messages',
    roles=None,
    drop_system_message=False,
)
```

Prompter for HF chat templates

### ChatTemplateStrategy { #axolotl.prompt_strategies.chat_template.ChatTemplateStrategy }

```python
prompt_strategies.chat_template.ChatTemplateStrategy(
    self,
    prompter,
    tokenizer,
    train_on_inputs,
    sequence_len,
    roles_to_train=None,
    train_on_eos=None,
)
```

Tokenizing strategy for instruction-based prompts.

#### Methods

| Name | Description |
| --- | --- |
| [find_turn](#axolotl.prompt_strategies.chat_template.ChatTemplateStrategy.find_turn) | Locate the starting and ending indices of the specified turn in a conversation. |
| [tokenize_prompt](#axolotl.prompt_strategies.chat_template.ChatTemplateStrategy.tokenize_prompt) | Public method that can handle either a single prompt or a batch of prompts. |

##### find_turn { #axolotl.prompt_strategies.chat_template.ChatTemplateStrategy.find_turn }

```python
prompt_strategies.chat_template.ChatTemplateStrategy.find_turn(turns, turn_idx)
```

Locate the starting and ending indices of the specified turn in a conversation.

##### tokenize_prompt { #axolotl.prompt_strategies.chat_template.ChatTemplateStrategy.tokenize_prompt }

```python
prompt_strategies.chat_template.ChatTemplateStrategy.tokenize_prompt(prompt)
```

Public method that can handle either a single prompt or a batch of prompts.

### StrategyLoader { #axolotl.prompt_strategies.chat_template.StrategyLoader }

```python
prompt_strategies.chat_template.StrategyLoader()
```

Load chat template strategy based on configuration.
