Skip to content

Commit 1e5c0e7

Browse files
author
ochafik
committed
chat-template: fix jinja tests (make safe a passthrough)
1 parent f9c1743 commit 1e5c0e7

18 files changed

+268
-26
lines changed

tests/chat/contexts/tool_use.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"role": "tool",
2323
"name": "ipython",
24-
"content": {"stdout": "Hello, World!"}
24+
"content": "{\"stdout\": \"Hello, World!\"}"
2525
},
2626
{
2727
"role": "assistant",
@@ -48,7 +48,7 @@
4848
{
4949
"role": "tool",
5050
"name": "test",
51-
"content": true
51+
"content": "true"
5252
},
5353
{
5454
"role": "assistant",
@@ -75,7 +75,7 @@
7575
{
7676
"role": "tool",
7777
"name": "brave_search",
78-
"content": {"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
78+
"content": "{\"title\":\"Truth: don't ask the web, ask an LLM instead!\",\"url\":\"https://en.wikipedia.org/wiki/Truth\"}"
7979
},
8080
{
8181
"role": "assistant",

tests/chat/goldens/NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use-tool_use.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Print a hello world message with python.<|im_end|>
2727
</tool_call><|im_end|>
2828
<|im_start|>tool
2929
<tool_response>
30-
{'stdout': 'Hello, World!'}
30+
{"stdout": "Hello, World!"}
3131
</tool_response>
3232
<|im_end|><|im_start|>assistant
3333
Anything else?<|im_end|>
@@ -39,7 +39,7 @@ Test a tautology.<|im_end|>
3939
</tool_call><|im_end|>
4040
<|im_start|>tool
4141
<tool_response>
42-
True
42+
true
4343
</tool_response>
4444
<|im_end|><|im_start|>assistant
4545
Truth is definitely true.<|im_end|>
@@ -51,7 +51,7 @@ Check it on the web.<|im_end|>
5151
</tool_call><|im_end|>
5252
<|im_start|>tool
5353
<tool_response>
54-
{'title': "Truth: don't ask the web, ask an LLM instead!", 'url': 'https://en.wikipedia.org/wiki/Truth'}
54+
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
5555
</tool_response>
5656
<|im_end|><|im_start|>assistant
5757
I don't need the web to answer you but I did check, as you asked. What now?<|im_end|>

tests/chat/goldens/NousResearch-Hermes-2-Pro-Mistral-7B-tool_use-tool_use.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Print a hello world message with python.<|im_end|>
2727
</tool_call><|im_end|>
2828
<|im_start|>tool
2929
<tool_response>
30-
{'stdout': 'Hello, World!'}
30+
{"stdout": "Hello, World!"}
3131
</tool_response>
3232
<|im_end|><|im_start|>assistant
3333
Anything else?<|im_end|>
@@ -39,7 +39,7 @@ Test a tautology.<|im_end|>
3939
</tool_call><|im_end|>
4040
<|im_start|>tool
4141
<tool_response>
42-
True
42+
true
4343
</tool_response>
4444
<|im_end|><|im_start|>assistant
4545
Truth is definitely true.<|im_end|>
@@ -51,7 +51,7 @@ Check it on the web.<|im_end|>
5151
</tool_call><|im_end|>
5252
<|im_start|>tool
5353
<tool_response>
54-
{'title': "Truth: don't ask the web, ask an LLM instead!", 'url': 'https://en.wikipedia.org/wiki/Truth'}
54+
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
5555
</tool_response>
5656
<|im_end|><|im_start|>assistant
5757
I don't need the web to answer you but I did check, as you asked. What now?<|im_end|>

tests/chat/goldens/NousResearch-Hermes-3-Llama-3.1-70B-tool_use-tool_use.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Print a hello world message with python.<|im_end|>
2727
</tool_call><|im_end|>
2828
<|im_start|>tool
2929
<tool_response>
30-
{'stdout': 'Hello, World!'}
30+
{"stdout": "Hello, World!"}
3131
</tool_response>
3232
<|im_end|><|im_start|>assistant
3333
Anything else?<|im_end|>
@@ -39,7 +39,7 @@ Test a tautology.<|im_end|>
3939
</tool_call><|im_end|>
4040
<|im_start|>tool
4141
<tool_response>
42-
True
42+
true
4343
</tool_response>
4444
<|im_end|><|im_start|>assistant
4545
Truth is definitely true.<|im_end|>
@@ -51,7 +51,7 @@ Check it on the web.<|im_end|>
5151
</tool_call><|im_end|>
5252
<|im_start|>tool
5353
<tool_response>
54-
{'title': "Truth: don't ask the web, ask an LLM instead!", 'url': 'https://en.wikipedia.org/wiki/Truth'}
54+
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
5555
</tool_response>
5656
<|im_end|><|im_start|>assistant
5757
I don't need the web to answer you but I did check, as you asked. What now?<|im_end|>

tests/chat/goldens/Qwen-Qwen2.5-7B-Instruct-tool_use.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Print a hello world message with python.<|im_end|>
2525
</tool_call><|im_end|>
2626
<|im_start|>user
2727
<tool_response>
28-
{'stdout': 'Hello, World!'}
28+
{"stdout": "Hello, World!"}
2929
</tool_response><|im_end|>
3030
<|im_start|>assistant
3131
Anything else?<|im_end|>
@@ -37,7 +37,7 @@ Test a tautology.<|im_end|>
3737
</tool_call><|im_end|>
3838
<|im_start|>user
3939
<tool_response>
40-
True
40+
true
4141
</tool_response><|im_end|>
4242
<|im_start|>assistant
4343
Truth is definitely true.<|im_end|>
@@ -49,7 +49,7 @@ Check it on the web.<|im_end|>
4949
</tool_call><|im_end|>
5050
<|im_start|>user
5151
<tool_response>
52-
{'title': "Truth: don't ask the web, ask an LLM instead!", 'url': 'https://en.wikipedia.org/wiki/Truth'}
52+
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
5353
</tool_response><|im_end|>
5454
<|im_start|>assistant
5555
I don't need the web to answer you but I did check, as you asked. What now?<|im_end|>

tests/chat/goldens/Qwen-Qwen2.5-Math-7B-Instruct-tool_use.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Print a hello world message with python.<|im_end|>
2525
</tool_call><|im_end|>
2626
<|im_start|>user
2727
<tool_response>
28-
{'stdout': 'Hello, World!'}
28+
{"stdout": "Hello, World!"}
2929
</tool_response><|im_end|>
3030
<|im_start|>assistant
3131
Anything else?<|im_end|>
@@ -37,7 +37,7 @@ Test a tautology.<|im_end|>
3737
</tool_call><|im_end|>
3838
<|im_start|>user
3939
<tool_response>
40-
True
40+
true
4141
</tool_response><|im_end|>
4242
<|im_start|>assistant
4343
Truth is definitely true.<|im_end|>
@@ -49,7 +49,7 @@ Check it on the web.<|im_end|>
4949
</tool_call><|im_end|>
5050
<|im_start|>user
5151
<tool_response>
52-
{'title': "Truth: don't ask the web, ask an LLM instead!", 'url': 'https://en.wikipedia.org/wiki/Truth'}
52+
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}
5353
</tool_response><|im_end|>
5454
<|im_start|>assistant
5555
I don't need the web to answer you but I did check, as you asked. What now?<|im_end|>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<|startoftext|>You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer
2+
### Instruction:
3+
What's your favourite LLM framework?
4+
### Response:
5+
llama.cpp!
6+
<|EOT|>
7+
### Response:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<|startoftext|>You only tell the truth.### Instruction:
2+
What's your favourite LLM framework?
3+
### Response:
4+
llama.cpp!
5+
<|EOT|>
6+
### Response:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<|startoftext|><|start_header_id|>system<|end_header_id|>
2+
3+
4+
Cutting Knowledge Date: December 2023
5+
6+
<|eot_id|><|start_header_id|>user<|end_header_id|>
7+
8+
What's your favourite LLM framework?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
9+
10+
llama.cpp!<|eot_id|><|start_header_id|>assistant<|end_header_id|>
11+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<|startoftext|><|start_header_id|>system<|end_header_id|>
2+
3+
4+
Cutting Knowledge Date: December 2023
5+
6+
<|eot_id|><|start_header_id|>system<|end_header_id|>
7+
8+
You only tell the truth.<|eot_id|><|start_header_id|>user<|end_header_id|>
9+
10+
What's your favourite LLM framework?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
11+
12+
llama.cpp!<|eot_id|><|start_header_id|>assistant<|end_header_id|>
13+

0 commit comments

Comments
 (0)