Update README.md
Browse files
README.md
CHANGED
|
@@ -113,10 +113,13 @@ headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
|
|
| 113 |
model = "mistralai/Mistral-Small-Instruct-2501"
|
| 114 |
|
| 115 |
messages = [
|
| 116 |
-
{
|
|
|
|
|
|
|
|
|
|
| 117 |
{
|
| 118 |
"role": "user",
|
| 119 |
-
"content": "
|
| 120 |
},
|
| 121 |
]
|
| 122 |
|
|
@@ -125,7 +128,19 @@ data = {"model": model, "messages": messages}
|
|
| 125 |
response = requests.post(url, headers=headers, data=json.dumps(data))
|
| 126 |
print(response.json()["choices"][0]["message"]["content"])
|
| 127 |
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
```
|
| 130 |
|
| 131 |
#### Offline
|
|
@@ -135,9 +150,9 @@ from vllm import LLM
|
|
| 135 |
from vllm.sampling_params import SamplingParams
|
| 136 |
from datetime import datetime, timedelta
|
| 137 |
|
| 138 |
-
SYSTEM_PROMPT = "
|
| 139 |
|
| 140 |
-
user_prompt = "
|
| 141 |
|
| 142 |
messages = [
|
| 143 |
{
|
|
@@ -158,8 +173,19 @@ sampling_params = SamplingParams(max_tokens=512)
|
|
| 158 |
outputs = llm.chat(messages, sampling_params=sampling_params)
|
| 159 |
|
| 160 |
print(outputs[0].outputs[0].text)
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
```
|
| 164 |
|
| 165 |
### Transformers (TODO)
|
|
|
|
| 113 |
model = "mistralai/Mistral-Small-Instruct-2501"
|
| 114 |
|
| 115 |
messages = [
|
| 116 |
+
{
|
| 117 |
+
"role": "system",
|
| 118 |
+
"content": "You are a conversational agent that always answers straight to the point, always end your accurate response with an ASCII drawing of a cat."
|
| 119 |
+
},
|
| 120 |
{
|
| 121 |
"role": "user",
|
| 122 |
+
"content": "Give me 5 non-formal ways to say 'See you later' in French."
|
| 123 |
},
|
| 124 |
]
|
| 125 |
|
|
|
|
| 128 |
response = requests.post(url, headers=headers, data=json.dumps(data))
|
| 129 |
print(response.json()["choices"][0]["message"]["content"])
|
| 130 |
|
| 131 |
+
# Sure, here are five non-formal ways to say "See you later" in French:
|
| 132 |
+
#
|
| 133 |
+
# 1. À plus tard
|
| 134 |
+
# 2. À plus
|
| 135 |
+
# 3. Salut
|
| 136 |
+
# 4. À toute
|
| 137 |
+
# 5. Bisous
|
| 138 |
+
#
|
| 139 |
+
# ```
|
| 140 |
+
# /\_/\
|
| 141 |
+
# ( o.o )
|
| 142 |
+
# > ^ <
|
| 143 |
+
# ```
|
| 144 |
```
|
| 145 |
|
| 146 |
#### Offline
|
|
|
|
| 150 |
from vllm.sampling_params import SamplingParams
|
| 151 |
from datetime import datetime, timedelta
|
| 152 |
|
| 153 |
+
SYSTEM_PROMPT = "You are a conversational agent that always answers straight to the point, always end your accurate response with an ASCII drawing of a cat."
|
| 154 |
|
| 155 |
+
user_prompt = "Give me 5 non-formal ways to say 'See you later' in French."
|
| 156 |
|
| 157 |
messages = [
|
| 158 |
{
|
|
|
|
| 173 |
outputs = llm.chat(messages, sampling_params=sampling_params)
|
| 174 |
|
| 175 |
print(outputs[0].outputs[0].text)
|
| 176 |
+
# Sure, here are five non-formal ways to say "See you later" in French:
|
| 177 |
+
#
|
| 178 |
+
# 1. À plus tard
|
| 179 |
+
# 2. À plus
|
| 180 |
+
# 3. Salut
|
| 181 |
+
# 4. À toute
|
| 182 |
+
# 5. Bisous
|
| 183 |
+
#
|
| 184 |
+
# ```
|
| 185 |
+
# /\_/\
|
| 186 |
+
# ( o.o )
|
| 187 |
+
# > ^ <
|
| 188 |
+
# ```
|
| 189 |
```
|
| 190 |
|
| 191 |
### Transformers (TODO)
|