mtoledo2
06/19/2024, 11:23 PMprompts: [lmn_chat.json]
providers:
- "openai:gpt-3.5-turbo"
defaultTest:
vars:
system_message: file://prompt.txt
tests:
- vars:
response: "Miguel"
assert:
- type: contains
value: bar
prompt json file
[
{
"role": "system",
"content": "{{ system_message }}"
},
{% for completion in _conversation %}
{
"role": "user",
"content": "{{ completion.prompt[completion.prompt.length - 1].content }}"
},
{
"role": "assistant",
"content": "{{ completion.output }}"
},
{% endfor %}
{
"role": "user",
"content": "{{ response }}"
}
]
Example txt file
foo
bar
Error I get is
[FAIL] Error: Chat Completion prompt is not a valid JSON │
│ │ string: SyntaxError: Bad control character in string literal │
│ │ in JSON at position 47 (line 4 column 20)mtoledo2
06/19/2024, 11:46 PMian
06/20/2024, 12:26 AM"content": {{ system_message | dump }}
That will serialize it to json by wrapping it in quotes and escaping newlines, quotes etcmtoledo2
06/20/2024, 1:17 PM