This page contains detailed instructions about:
Command A is configured as a conversational model, meaning it is optimized for interactive experiences, such as chatbots, where the model engages in dialogue. This kind of behavior is conditioned with a system message; system messages vary for different models, and in the case of Command A, it is written such that the model will reply in a conversational fashion, provide introductory statements and follow-up questions, and use Markdown as well as LaTeX where appropriate.
The (conversational) system instruction for Command A looks like this:
In the above, {Safety Preamble} can represent either the contextual or the strict safety mode system instruction, about which more below.
Observe that the system instruction (preamble) contains the following instructions explicitly asking for interactivity:
These instructions are useful in conversational settings. However, in other circumstances a non-interactive model might be preferred, such as when asking the model to generate structured data formats that are parsed directly and automatically.
System instructions can be used to achieve such non-interactive behavior. For example, when asking the model to “Please generate a JSON summarizing the first five Wes Anderson movies”, the model might output something along these lines
Here’s a JSON summarization of the first five Wes Anderson movies, including their titles, release years, and brief descriptions:
For this prompt, the system instruction can be used to change the model behavior such that the completion only contains the JSON object, without any Markdown code block markers:
And here’s a sample output:
Safety Modes define what model behaviors will look like under specific scenarios. Command A can be configured with two safety modes: contextual mode or strict mode (learn more here).
By default, Command A is configured in contextual mode. Under the hood, the following {Safety Preamble} paragraph is added to Command A’s standard system message:
Here’s a code snippet to configure Command A in contextual safety mode.
If instead you would like to set the Safety Mode to strict, you would do that like so:
The following safety instruction is added into the Cohere system message under the hood:
Command A has been trained specifically for tasks like summarization and the final step of Retrieval Augmented Generation (RAG). The model takes a conversation as input (with an optional user-supplied system message, indicating task, context and desired output style), along with a list of document snippets. This behavior has been trained into the model via a mixture of supervised fine-tuning and preference fine-tuning.
For these tasks, you can use Command A in two ways.
Grounded generation in Command A is supported through chat templates in Transformers. Simply provide document snippets using the documents parameter of Hugging Face’s apply_chat_template(). Document snippets should be short chunks, rather than long documents, typically around 100-400 words per chunk, formatted as key-value pairs. The keys should be short descriptive strings, the values can be text or semi-structured. Under the hood, this builds a specific prompt template that the model has been trained on. The code snippet below shows a minimal working example.
You may find that simply including relevant documents directly in a user message works just as well, or better than using the documents parameter to render the special grounded generation template. Grounded Generation is generally a strong default, but Regular Generation can offer more control and customization over the prompt, at the cost of some effort to find an optimal prompt. We encourage users to play with both Grounded Generation and Regular Generation, and to evaluate which mode works best for their specific use case.
Command A has been specifically trained with conversational tool use capabilities. This allows the model to interact with external tools like APIs, databases, or search engines. These capabilities have been trained into the model via a mixture of supervised fine-tuning and preference fine-tuning, using a specific prompt template. Deviating from this prompt template will likely reduce performance, but we encourage experimentation.
These tool use capabilities unlock two use cases:
Both function calling and agents work in the same way. Given a conversation as input (with an optional system message), along with a list of available tools, the model will generate one of the following:
Tool use in Command A is supported through chat templates in Transformers. We recommend providing tool descriptions using JSON schema. Here is a quick example showing tool use.
In this case, the model decides to select tools.
Below is what the answer would have looked like, if the model had decided to respond directly (by, for example, asking the user a follow up question.)
If the model generates tool calls, you should add them to the chat history like so:
And then call the tool and append the result, with the tool role, like below. It is crucial to format the tool results as a dictionary:
After that, you can generate() again to let the model use the tool result in the chat.
In this case, the model decides to select tools.