Views
No views yet
1from transformers import AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
4
5conversation = [
6 {"role": "system", "content": "You are a helpful assistant."},
7 {"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
8 {"role": "assistant", "content": "Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
9]
10
11inputs = tokenizer.apply_chat_template(
12 conversation=conversation,
13 tokenize=False,
14)
15print(inputs)1<|begin_of_text|><|start_header_id|>system<|end_header_id|>
2Cutting Knowledge Date: December 2024
3Today Date: December 2025
4You are a helpful assistant.<|end_of_text|>
5
6<|start_header_id|>user<|end_header_id|>
7What's wrong with Cheems? What treatment does he need?<|end_of_text|>
8
9<|start_header_id|>assistant<|end_header_id|>
10Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters.<|end_of_text|>1from transformers import AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
4
5documents = [
6 {
7 "title": "Cheems's case",
8 "text": "Cheems is a 233-year-old alchemist, but he is very kidney deficient."
9 },
10]
11
12conversation = [
13 {"role": "system", "content": "You are a helpful assistant."},
14 {"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
15 {"role": "assistant", "content": "Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
16]
17
18inputs = tokenizer.apply_chat_template(
19 documents=documents,
20 conversation=conversation,
21 tokenize=False,
22)
23print(inputs)1<|begin_of_text|><|start_header_id|>system<|end_header_id|>
2Cutting Knowledge Date: December 2024
3Today Date: December 2025
4You are a helpful assistant.<|end_of_text|>
5
6<|start_header_id|>user<|end_header_id|>
7Given the following documents, please use them to answer the user's question.
8
9Title: Cheems' case
10Content: Cheems is a 233-year-old alchemist, but he is very kidney deficient.
11
12If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.
13
14What's wrong with Cheems? What treatment does he need?<|end_of_text|>
15
16<|start_header_id|>assistant<|end_header_id|>
17Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters.<|end_of_text|>1from transformers import AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
4
5tools = [
6 {
7 "name": "recommend_treatment",
8 "description": "Treatment is recommended based on patient symptoms and diagnosis.",
9 "parameters": {
10 "type": "object",
11 "properties": {
12 "diagnosis": {
13 "type": "string",
14 "description": "Patient diagnostic results"
15 },
16 "severity": {
17 "type": "string",
18 "enum": ["mild", "moderate", "severe"],
19 "description": "Severity of the condition, can be mild, moderate, or severe."
20 }
21 },
22 "required": ["diagnosis", "severity"]
23 }
24 }
25]
26
27conversation = [
28 {"role": "system", "content": "You are a helpful assistant."},
29 {"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
30 {"role": "assistant", "tool_calls": [
31 {
32 "id": "call_1",
33 "function": {
34 "name": "recommend_treatment",
35 "arguments": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"
36 }
37 }
38 ]},
39 {"role": "tool", "tool_call_id": "call_1", "content": "For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
40 {"role": "assistant", "content": "Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
41]
42
43inputs = tokenizer.apply_chat_template(
44 tools=tools,
45 conversation=conversation,
46 tokenize=False,
47)
48print(inputs)1<|begin_of_text|><|start_header_id|>system<|end_header_id|>
2Environment: ipython
3Cutting Knowledge Date: December 2024
4Today Date: December 2025
5You are a helpful assistant.<|end_of_text|>
6
7<|start_header_id|>user<|end_header_id|>
8Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
9
10{
11 "name": "recommend_treatment",
12 "description": "Treatment is recommended based on patient symptoms and diagnosis.",
13 "parameters": {
14 "type": "object",
15 "properties": {
16 "diagnosis": {
17 "type": "string",
18 "description": "Patient diagnostic results"
19 },
20 "severity": {
21 "type": "string",
22 "enum": [
23 "mild",
24 "moderate",
25 "severe"
26 ],
27 "description": "Severity of the condition, can be mild, moderate, or severe."
28 }
29 },
30 "required": [
31 "diagnosis",
32 "severity"
33 ]
34 }
35}
36
37Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
38
39What's wrong with Cheems? What treatment does he need?<|end_of_text|>
40
41<|start_header_id|>assistant<|end_header_id|>
42{"name": "recommend_treatment", "parameters": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"}<|end_of_text|>
43
44<|start_header_id|>ipython<|end_header_id|>
45"For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."<|end_of_text|>
46
47<|start_header_id|>assistant<|end_header_id|>
48Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters.<|end_of_text|>1from transformers import AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
4
5documents = [
6 {
7 "title": "Cheems's case",
8 "text": "Cheems is a 233-year-old alchemist, but he is very kidney deficient."
9 },
10]
11
12tools = [
13 {
14 "name": "recommend_treatment",
15 "description": "Treatment is recommended based on patient symptoms and diagnosis.",
16 "parameters": {
17 "type": "object",
18 "properties": {
19 "diagnosis": {
20 "type": "string",
21 "description": "Patient diagnostic results"
22 },
23 "severity": {
24 "type": "string",
25 "enum": ["mild", "moderate", "severe"],
26 "description": "Severity of the condition, can be mild, moderate, or severe."
27 }
28 },
29 "required": ["diagnosis", "severity"]
30 }
31 }
32]
33
34conversation = [
35 {"role": "system", "content": "You are a helpful assistant."},
36 {"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
37 {"role": "assistant", "tool_calls": [
38 {
39 "id": "call_1",
40 "function": {
41 "name": "recommend_treatment",
42 "arguments": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"
43 }
44 }
45 ]},
46 {"role": "tool", "tool_call_id": "call_1", "content": "For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
47 {"role": "assistant", "content": "Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
48]
49
50inputs = tokenizer.apply_chat_template(
51 documents=documents,
52 tools=tools,
53 conversation=conversation,
54 tokenize=False,
55)
56print(inputs)1<|begin_of_text|><|start_header_id|>system<|end_header_id|>
2Environment: ipython
3Cutting Knowledge Date: December 2024
4Today Date: December 2025
5You are a helpful assistant.<|end_of_text|>
6
7<|start_header_id|>user<|end_header_id|>
8Given the following documents, please use them to answer the user's question.
9
10Title: Cheems' case
11Content: Cheems is a 233-year-old alchemist, but he is very kidney deficient.
12
13If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.
14
15Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
16
17{
18 "name": "recommend_treatment",
19 "description": "Treatment is recommended based on patient symptoms and diagnosis.",
20 "parameters": {
21 "type": "object",
22 "properties": {
23 "diagnosis": {
24 "type": "string",
25 "description": "Patient diagnostic results"
26 },
27 "severity": {
28 "type": "string",
29 "enum": [
30 "mild",
31 "moderate",
32 "severe"
33 ],
34 "description": "Severity of the condition, can be mild, moderate, or severe."
35 }
36 },
37 "required": [
38 "diagnosis",
39 "severity"
40 ]
41 }
42}
43
44Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
45
46What's wrong with Cheems? What treatment does he need?<|end_of_text|>
47
48<|start_header_id|>assistant<|end_header_id|>
49{"name": "recommend_treatment", "parameters": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"}<|end_of_text|>
50
51<|start_header_id|>ipython<|end_header_id|>
52"For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."<|end_of_text|>
53
54<|start_header_id|>assistant<|end_header_id|>
55Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters.<|end_of_text|>