@@ -14,63 +14,37 @@ def print_outputs(outputs):
14
14
15
15
print ("=" * 80 )
16
16
17
- # In this script, we demonstrate two ways to pass input to the chat method of the LLM class :
17
+ # In this script, we demonstrate two ways to pass input to the chat method:
18
18
19
19
# Conversation with a list of dictionaries
20
20
conversation = [
21
+ {"role" : "system" , "content" : "You are a helpful assistant" },
22
+ {"role" : "user" , "content" : "Hello" },
23
+ {"role" : "assistant" , "content" : "Hello! How can I assist you today?" },
21
24
{
22
- 'role' : 'system' ,
23
- 'content' : "You are a helpful assistant"
24
- },
25
- {
26
- 'role' : 'user' ,
27
- 'content' : "Hello"
28
- },
29
- {
30
- 'role' : 'assistant' ,
31
- 'content' : "Hello! How can I assist you today?"
32
- },
33
- {
34
- 'role' : 'user' ,
35
- 'content' : "Write an essay about the importance of higher education."
25
+ "role" : "user" ,
26
+ "content" : "Write an essay about the importance of higher education." ,
36
27
},
37
28
]
38
- outputs = llm .chat (conversation ,
39
- sampling_params = sampling_params ,
40
- use_tqdm = False )
29
+ outputs = llm .chat (
30
+ conversation , sampling_params = sampling_params , use_tqdm = False
31
+ )
41
32
print_outputs (outputs )
42
33
43
- # Multiple conversations
34
+ # Multiple conversations
44
35
conversations = [
45
36
[
46
- {
47
- 'role' : 'system' ,
48
- 'content' : "You are a helpful assistant"
49
- },
50
- {
51
- 'role' : 'user' ,
52
- 'content' : "What is dark matter?"
53
- },
37
+ {"role" : "system" , "content" : "You are a helpful assistant" },
38
+ {"role" : "user" , "content" : "What is dark matter?" },
54
39
],
55
40
[
41
+ {"role" : "system" , "content" : "You are a helpful assistant" },
42
+ {"role" : "user" , "content" : "How are you?" },
56
43
{
57
- 'role' : 'system' ,
58
- 'content' : "You are a helpful assistant"
59
- },
60
- {
61
- 'role' : 'user' ,
62
- 'content' : "How are you?"
63
- },
64
- {
65
- 'role' :
66
- 'assistant' ,
67
- 'content' :
68
- "I'm an AI, so I don't have feelings, but I'm here to help you!"
69
- },
70
- {
71
- 'role' : 'user' ,
72
- 'content' : "Tell me a joke."
44
+ "role" : "assistant" ,
45
+ "content" : "I'm an AI without feelings, but I'm here to help!" ,
73
46
},
47
+ {"role" : "user" , "content" : "Tell me a joke." },
74
48
],
75
49
]
76
50
0 commit comments