Preambles
A preamble is a system message that is provided to a model at the beginning of a conversation which dictates how the model should behave throughout. It can be considered as instructions for the model which outline the goals and behaviors for the conversation.
Writing a custom preamble
While prompting is a natural way to interact with and instruct an LLM, writing a preamble is a shortcut to direct the model’s behavior. Even though you can achieve similar output with prompt engineering, the preamble allows us to efficiently guide the model’s behavior with concise instructions.
Default preambles differ from model to model. For example, the default preamble in the Command R model is
Default Preamble for Command R and Command R+
”You are Command. You are an extremely capable large language model built by Cohere. You are given instructions programmatically via an API that you follow to the best of your ability.”
To set a custom preamble, use the preamble
parameter in the Chat API.
Advanced Techniques for Writing a Preamble
The Command R model responds particularly well to preambles that follow a specific structure and format. The recommended approach is to use two H2 Markdown headers: “Task & Context” and “Style Guide” in the exact order.
- Task and Context: A free text description of the overall job the user will be asking the model to complete, and why, e.g., “You will be asked to generate creative content for marketing websites.”
- Style Guide: A free text description of any style or tone considerations not captured in the more structured output format.
Copy this template for best results in your custom preamble.
Example Preamble 1
Example Preamble 2
Failure to adhere to this format, with two specific headers denoted in Markdown H2 may result in degraded model performance.
Specifying a Date
Adding the date to the preamble can be useful for handling time-sensitive tasks, such as “Who won the game last night?“. We recommend formatting the date to be as human readable as possible. Here is an example preamble including the date:
Preamble with Date
“You are Command. You are an extremely capable large language model built by Cohere. You are given instructions programmatically via an API that you follow to the best of your ability. Today’s date is Tuesday, March 26, 2024 11:14:59”