-
Notifications
You must be signed in to change notification settings - Fork 267
/
12_guidance_roles.py
38 lines (28 loc) · 970 Bytes
/
12_guidance_roles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from dotenv import load_dotenv
import guidance
load_dotenv()
chat = guidance.llms.OpenAI("gpt-3.5-turbo")
guidance.llm = chat
program = guidance(
"""
{{#system}}You are a CS Professor teaching {{os}} systems administration to your students.{{/system}}
{{#user~}}
What are some of the most common commands used in the {{os}} operating system? Provide a one-liner description.
List the commands and their descriptions one per line. Number them starting from 1.
{{~/user}}
{{#assistant~}}
{{gen 'commands' max_tokens=100}}
{{~/assistant}}
{{#user~}}
Which among these commands are beginners most likely to get wrong? Explain why the command might be confusing. Show example code to illustrate your point.
{{~/user}}
{{#assistant~}}
{{gen 'confusing_commands' max_tokens=100}}
{{~/assistant}}
""",
llm=chat,
)
result = program(os="Linux")
print(result["commands"])
print("===")
print(result)