---
title: Initial Prompt Template References
---


To meet the more customized requirements of LLMs for developers, Dify fully opens up the complete prompts in **Expert Mode** and provides initial templates in the orchestration interface. Here are references for four initial templates:

### 1. Template for Building Conversational Applications Using Chat Models

* **SYSTEM**

```
Use the following context as your learned knowledge, inside <context></context> XML tags.

<context>
{{#context#}}
</context>

When answering the user:
- If you don't know, just say that you don't know.
- If you are not sure, ask for clarification.
Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.
{{pre_prompt}}
```

* **USER**

```
{{Query}} // Input the query variable here
```

* **ASSISTANT**

```Python
"" 
```

#### **Template Structure:**

* Context (`Context`)
* Pre-prompt (`Pre-prompt`)
* Query Variable (`Query`)

### 2. Template for Building Text Generation Applications Using Chat Models

* **SYSTEM**

```
Use the following context as your learned knowledge, inside <context></context> XML tags.

<context>
{{#context#}}
</context>

When answering the user:
- If you don't know, just say that you don't know.
- If you are not sure, ask for clarification.
Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.
{{pre_prompt}}
```

* **USER**

```
{{Query}} // Input the query variable here, commonly in the form of a paragraph
```

* **ASSISTANT**

```Python
"" 
```

#### **Template Structure:**

* Context (`Context`)
* Pre-prompt (`Pre-prompt`)
* Query Variable (`Query`)

### 3. Template for Building Conversational Applications Using Text Completion Models

```Python
Use the following context as your learned knowledge, inside <context></context> XML tags.

<context>
{{#context#}}
</context>

When answering the user:
- If you don't know, just say that you don't know.
- If you are not sure, ask for clarification.
Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.

{{pre_prompt}}

Here are the chat histories between human and assistant, inside <histories></histories> XML tags.

<histories>
{{#histories#}}
</histories>

Human: {{#query#}}

Assistant: 
```

**Template Structure:**

* Context (`Context`)
* Pre-prompt (`Pre-prompt`)
* Conversation History (`History`)
* Query Variable (`Query`)

### 4. Template for Building Text Generation Applications Using Text Completion Models

```Python
Use the following context as your learned knowledge, inside <context></context> XML tags.

<context>
{{#context#}}
</context>

When answering the user:
- If you don't know, just say that you don't know.
- If you are not sure, ask for clarification.
Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.

{{pre_prompt}}
{{query}}
```

**Template Structure:**

* Context (`Context`)
* Pre-prompt (`Pre-prompt`)
* Query Variable (`Query`)

<Warning>
Dify and some model vendors have jointly optimized the system prompts deeply. Therefore, the initial templates under some models may differ from the examples above.
</Warning>

### Parameter Descriptions

* Context (`Context`): Used to insert relevant text from the dataset as the context of the complete prompt.
* Pre-prompt (`Pre-prompt`): In **Easy Mode**, the pre-prompt orchestrated will be inserted into the complete prompt.
* Conversation History (`History`): When building chat applications using text generation models, the system will insert the user's conversation history as context into the complete prompt. Since some models respond differently to role prefixes, you can also modify the role prefix in the conversation history settings, e.g., changing "Assistant" to "AI".
* Query (`Query`): The query content is the variable value used to insert the user's question in the chat.

{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}

---

[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/learn-more/prompt-engineering/prompt-engineering-1/prompt-engineering-template.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?title=Documentation%20Issue%3A%20t-engineering-templ&body=%23%23%20Issue%20Description%0A%3C%21--%20Please%20briefly%20describe%20the%20issue%20you%20found%20--%3E%0A%0A%23%23%20Page%20Link%0Ahttps%3A%2F%2Fgithub.com%2Flanggenius%2Fdify-docs%2Fblob%2Fmain%2Fen/learn-more/prompt-engineering/prompt-engineering-1%2Fprompt-engineering-template.mdx%0A%0A%23%23%20Suggested%20Changes%0A%3C%21--%20If%20you%20have%20specific%20suggestions%20for%20changes%2C%20please%20describe%20them%20here%20--%3E%0A%0A%3C%21--%20Thank%20you%20for%20helping%20improve%20our%20documentation%21%20--%3E)

