https://promptfoo.dev/ logo
two sets of messages
# ❓|questions
b
How can I create two sets of messages in that example? https://promptfoo.dev/docs/configuration/chat > > Creating a conversation history fixture > > Using nunjucks templates, we can combine multiple chat messages. Here's an example in which the previous conversation is a fixture for all tests. Each case tests a different follow-up message: > > # Set up the conversation history > .... > In the prompt template, we construct the conversation history followed by a user message containing the question: >
Copy code
> [
>   {
>     "role": "system",
>     "content": {{ system_message | dump }}
>   },
>   {% for message in messages %}
>     {% for role, content in message %}
>       {
>         "role": "{{ role }}",
>         "content": {{ content | dump }}
>       },
>     {% endfor %}
>   {% endfor %}
>   {
>     "role": "user",
>     "content": {{ question | dump }}
>   }
> ]



This and this doesn't work:
defaultTest: > vars: > system_message: Answer concisely > - messages: > - user: Who founded Facebook? > - assistant: Mark Zuckerberg > - user: What's his favorite food? > - assistant: Pizza > - messages: > - user: Who was the first person to walk on the moon? > - assistant: Neil Armstrong > - user: In what year did this happen? > - assistant: 1969 > - user: Which mission was it? > - assistant: Apollo 11 -------------------------- defaultTest: > vars: > system_message: Answer concisely > messages: > - - user: Who founded Facebook? > - assistant: Mark Zuckerberg > - user: What's his favorite food? > - assistant: Pizza > - - user: Who was the first person to walk on the moon? > - assistant: Neil Armstrong > - user: In what year did this happen? > - assistant: 1969 > - user: Which mission was it? > - assistant: Apollo 11`
i
it looks like there may be an issue with your indentation. specifically,
assistant
should be at the same level as
user
this could be a discord format issue, please wrap your message in a markdown code block to be sure \`\`\`
b
Thank you, I fixed it.
I fixed the indentation issue in my message, but the problem with promptfoo remains
i
you are including
messages
as a list, as indicated by the
-
before it. Have a look at the example at the chat conversation docs you linked 🙂
5 Views