diff --git a/fern/pages/text-generation/prompt-engineering/prompting-command-r.mdx b/fern/pages/text-generation/prompt-engineering/prompting-command-r.mdx index e38f01da..1b6d39de 100644 --- a/fern/pages/text-generation/prompt-engineering/prompting-command-r.mdx +++ b/fern/pages/text-generation/prompt-engineering/prompting-command-r.mdx @@ -66,11 +66,64 @@ Single-step tool use (or “Function Calling”) allows Command R/R+ to interact You can learn more about single step tool use [in our documentation](https://docs.cohere.com/docs/tool-use). Let’s go over the prompt template for Tool Section, and for Response Generation. +#### A) Tool Selection Prompt Template + +> singlestep_tool_selection_prompt_template = +> """\\<|START_OF_TURN_TOKEN|>\<|SYSTEM_TOKEN|># Safety Preamble +> \{SAFETY_PREAMBLE} +>
+> # System Preamble +> ## Basic Rules +> \{BASIC_RULES} +>
+> # User Preamble +> ## Task and Context +> \{TASK_CONTEXT} +>
+> ## Style Guide +> \{STYLE_GUIDE} +>
+> ## Available Tools +> \{TOOLS}\<|END_OF_TURN_TOKEN|>\{CHAT_HISTORY}\<|START_OF_TURN_TOKEN|>\<|SYSTEM_TOKEN|>\{INSTRUCTIONS_FOR_SINGLE_STEP_TOOL_USE}\<|END_OF_TURN_TOKEN|>\<|START_OF_TURN_TOKEN|>\<|CHATBOT_TOKEN|>""" + +The prompt template for Tool Selection is similar to the Augmented Generation prompt template. There are, however, two spots that differ which are highlighted. The first is that we have added the tool definitions which come after the style guide (you can see that there’s now an ## Available Tools section), and the second is that we’ve removed the section with the retrieved snippets or text to summarize. + + +#### B) Response Generation Template + +At this point, Command R/R+ has decided which tools to call and with what parameters (see previous section). Developers are expected to execute these tool calls, and to receive tool results in return. + +In this Response Generation step, the goal is to generate the final model response, given the tool results. This is another case of… Augmented Generation! + +Therefore, the prompt template is very similar to the augmented generation prompt used for RAG and Summarization. The only difference is that we replace the RAG snippets and/or text to summarize with tool outputs (TOOL_OUTPUTS). + +> singlestep_augmented_generation_prompt_template = +> """\\<|START_OF_TURN_TOKEN|>\<|SYSTEM_TOKEN|># Safety Preamble +> \{SAFETY_PREAMBLE} +>
+> # System Preamble +> ## Basic Rules +> \{BASIC_RULES} +>
+> # User Preamble +> ## Task and Context +> \{TASK_CONTEXT} +>
+> ## Style Guide +> \{STYLE_GUIDE}\<|END_OF_TURN_TOKEN|>\{CHAT_HISTORY}\<|START_OF_TURN_TOKEN|>\<|SYSTEM_TOKEN|>\{TOOL_OUTPUTS}\<|END_OF_TURN_TOKEN|>\<|START_OF_TURN_TOKEN|>\<|SYSTEM_TOKEN|>\{INSTRUCTIONS_FOR_SINGLE_STEP_TOOL_USE}\<|END_OF_TURN_TOKEN|>\<|START_OF_TURN_TOKEN|>\<|CHATBOT_TOKEN|>""" + + +### Multi step Tool Use with Command R/R+ (Agents) + +#### A) Prompt template for Step 1 of the agent + +#### B) Prompt template for subsequent steps of the agent +## Detailed Prompt Templates