How to Add Background Information in Dialogue Templates?
When performing Retrieval-Augmented Generation (RAG), we may need to add background information (context) to the dialogue, allowing the large model to reference the background information to generate answers and evaluate the quality of those answers using metrics.
You can insert the variable name {{context}}
into the dialogue template. When synthesizing message samples, it will be replaced by the context list values defined in the variable list.
For example, in the System role content of the dialogue template, you can input:
Please answer the question based on the following background information:
{{context}}
Assuming the context values for a set of variables are:
context 1
, context 2
, context 3
After the sample synthesis, the actual message content will be:
Please answer the question based on the following background information:
- context 1
- context 2
- context 3