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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
```python
|
| 18 |
from transformers import AutoTokenizer
|
| 19 |
|
|
@@ -128,4 +319,5 @@ What's wrong with Cheems? What treatment does he need?<|end_of_text|>
|
|
| 128 |
|
| 129 |
<|start_header_id|>assistant<|end_header_id|>
|
| 130 |
Based 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|>
|
| 131 |
-
```
|
|
|
|
|
|
| 14 |
|
| 15 |
## How to use
|
| 16 |
|
| 17 |
+
<details>
|
| 18 |
+
<summary>Only conversation</summary>
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from transformers import AutoTokenizer
|
| 22 |
+
|
| 23 |
+
tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
|
| 24 |
+
|
| 25 |
+
conversation = [
|
| 26 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 27 |
+
{"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
|
| 28 |
+
{"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."},
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
inputs = tokenizer.apply_chat_template(
|
| 32 |
+
conversation=conversation,
|
| 33 |
+
tokenize=False,
|
| 34 |
+
)
|
| 35 |
+
print(inputs)
|
| 36 |
+
```
|
| 37 |
+
```shell
|
| 38 |
+
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 39 |
+
Cutting Knowledge Date: December 2024
|
| 40 |
+
Today Date: December 2025
|
| 41 |
+
You are a helpful assistant.<|end_of_text|>
|
| 42 |
+
|
| 43 |
+
<|start_header_id|>user<|end_header_id|>
|
| 44 |
+
What's wrong with Cheems? What treatment does he need?<|end_of_text|>
|
| 45 |
+
|
| 46 |
+
<|start_header_id|>assistant<|end_header_id|>
|
| 47 |
+
Based 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|>
|
| 48 |
+
```
|
| 49 |
+
</details>
|
| 50 |
+
|
| 51 |
+
<details>
|
| 52 |
+
<summary>With documents</summary>
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoTokenizer
|
| 56 |
+
|
| 57 |
+
tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
|
| 58 |
+
|
| 59 |
+
documents = [
|
| 60 |
+
{
|
| 61 |
+
"title": "Cheems's case",
|
| 62 |
+
"text": "Cheems is a 233-year-old alchemist, but he is very kidney deficient."
|
| 63 |
+
},
|
| 64 |
+
]
|
| 65 |
+
|
| 66 |
+
conversation = [
|
| 67 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 68 |
+
{"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
|
| 69 |
+
{"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."},
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
inputs = tokenizer.apply_chat_template(
|
| 73 |
+
documents=documents,
|
| 74 |
+
conversation=conversation,
|
| 75 |
+
tokenize=False,
|
| 76 |
+
)
|
| 77 |
+
print(inputs)
|
| 78 |
+
```
|
| 79 |
+
```shell
|
| 80 |
+
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 81 |
+
Cutting Knowledge Date: December 2024
|
| 82 |
+
Today Date: December 2025
|
| 83 |
+
You are a helpful assistant.<|end_of_text|>
|
| 84 |
+
|
| 85 |
+
<|start_header_id|>user<|end_header_id|>
|
| 86 |
+
Given the following documents, please use them to answer the user's question.
|
| 87 |
+
|
| 88 |
+
Title: Cheems' case
|
| 89 |
+
Content: Cheems is a 233-year-old alchemist, but he is very kidney deficient.
|
| 90 |
+
|
| 91 |
+
If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.
|
| 92 |
+
|
| 93 |
+
What's wrong with Cheems? What treatment does he need?<|end_of_text|>
|
| 94 |
+
|
| 95 |
+
<|start_header_id|>assistant<|end_header_id|>
|
| 96 |
+
Based 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|>
|
| 97 |
+
```
|
| 98 |
+
</details>
|
| 99 |
+
|
| 100 |
+
<details>
|
| 101 |
+
<summary>With tools</summary>
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
from transformers import AutoTokenizer
|
| 105 |
+
|
| 106 |
+
tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
|
| 107 |
+
|
| 108 |
+
tools = [
|
| 109 |
+
{
|
| 110 |
+
"name": "recommend_treatment",
|
| 111 |
+
"description": "Treatment is recommended based on patient symptoms and diagnosis.",
|
| 112 |
+
"parameters": {
|
| 113 |
+
"type": "object",
|
| 114 |
+
"properties": {
|
| 115 |
+
"diagnosis": {
|
| 116 |
+
"type": "string",
|
| 117 |
+
"description": "Patient diagnostic results"
|
| 118 |
+
},
|
| 119 |
+
"severity": {
|
| 120 |
+
"type": "string",
|
| 121 |
+
"enum": ["mild", "moderate", "severe"],
|
| 122 |
+
"description": "Severity of the condition, can be mild, moderate, or severe."
|
| 123 |
+
}
|
| 124 |
+
},
|
| 125 |
+
"required": ["diagnosis", "severity"]
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
+
conversation = [
|
| 131 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 132 |
+
{"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
|
| 133 |
+
{"role": "assistant", "tool_calls": [
|
| 134 |
+
{
|
| 135 |
+
"id": "call_1",
|
| 136 |
+
"function": {
|
| 137 |
+
"name": "recommend_treatment",
|
| 138 |
+
"arguments": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
]},
|
| 142 |
+
{"role": "tool", "tool_call_id": "call_1", "content": "For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
|
| 143 |
+
{"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."},
|
| 144 |
+
]
|
| 145 |
+
|
| 146 |
+
inputs = tokenizer.apply_chat_template(
|
| 147 |
+
tools=tools,
|
| 148 |
+
conversation=conversation,
|
| 149 |
+
tokenize=False,
|
| 150 |
+
)
|
| 151 |
+
print(inputs)
|
| 152 |
+
```
|
| 153 |
+
```shell
|
| 154 |
+
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 155 |
+
Environment: ipython
|
| 156 |
+
Cutting Knowledge Date: December 2024
|
| 157 |
+
Today Date: December 2025
|
| 158 |
+
You are a helpful assistant.<|end_of_text|>
|
| 159 |
+
|
| 160 |
+
<|start_header_id|>user<|end_header_id|>
|
| 161 |
+
Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
|
| 162 |
+
|
| 163 |
+
{
|
| 164 |
+
"name": "recommend_treatment",
|
| 165 |
+
"description": "Treatment is recommended based on patient symptoms and diagnosis.",
|
| 166 |
+
"parameters": {
|
| 167 |
+
"type": "object",
|
| 168 |
+
"properties": {
|
| 169 |
+
"diagnosis": {
|
| 170 |
+
"type": "string",
|
| 171 |
+
"description": "Patient diagnostic results"
|
| 172 |
+
},
|
| 173 |
+
"severity": {
|
| 174 |
+
"type": "string",
|
| 175 |
+
"enum": [
|
| 176 |
+
"mild",
|
| 177 |
+
"moderate",
|
| 178 |
+
"severe"
|
| 179 |
+
],
|
| 180 |
+
"description": "Severity of the condition, can be mild, moderate, or severe."
|
| 181 |
+
}
|
| 182 |
+
},
|
| 183 |
+
"required": [
|
| 184 |
+
"diagnosis",
|
| 185 |
+
"severity"
|
| 186 |
+
]
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
|
| 191 |
+
|
| 192 |
+
What's wrong with Cheems? What treatment does he need?<|end_of_text|>
|
| 193 |
+
|
| 194 |
+
<|start_header_id|>assistant<|end_header_id|>
|
| 195 |
+
{"name": "recommend_treatment", "parameters": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"}<|end_of_text|>
|
| 196 |
+
|
| 197 |
+
<|start_header_id|>ipython<|end_header_id|>
|
| 198 |
+
"For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."<|end_of_text|>
|
| 199 |
+
|
| 200 |
+
<|start_header_id|>assistant<|end_header_id|>
|
| 201 |
+
Based 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|>
|
| 202 |
+
```
|
| 203 |
+
</details>
|
| 204 |
+
|
| 205 |
+
<details>
|
| 206 |
+
<summary>With documents and tools</summary>
|
| 207 |
+
|
| 208 |
```python
|
| 209 |
from transformers import AutoTokenizer
|
| 210 |
|
|
|
|
| 319 |
|
| 320 |
<|start_header_id|>assistant<|end_header_id|>
|
| 321 |
Based 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|>
|
| 322 |
+
```
|
| 323 |
+
</details>
|