const markOptimizable = (input: string) =>
`<_auto_optimizable>${input}</_auto_optimizable>`;
const markInput = (input: string) =>
`<_auto_input>${input}</_auto_input>`;
const messages = [
{
role: "system",
// We mark this optimizable, because it's an instruction to the LLM
content: markOptimizable("You are a helpful assistant that answers question."),
},
{
role: "user",
// We do not mark this optimizable, because it's a past chat message
content: "How do I make a peanut butter and jelly sandwich?",
},
{
role: "assistant",
// We do not mark this optimizable, because it's a past chat message
content: "To make a peanut butter and jelly sandwich, you need to follow these steps: 1. Spread peanut butter on one slice of bread. 2. Spread jelly on the other slice of bread. 3. Put the two slices of bread together.",
},
{
role: "user",
// This message has optimizable parts that should be changed
// But it also has inputs that should not be changed
content: markOptimizable(`Use the following documents to answer your question:
${markInput(doc1)}
${markInput(doc2)}
Please follow the following instructions:
- Be concise and to the point
- Use the provided documents to answer the question
- If the documents do not contain the answer, say so
- If the answer is not clear, ask follow-up questions
User query: ${markInput(userQuery)}`
)
},
]