forked from NVIDIA/NeMo-Guardrails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
147 lines (118 loc) · 4.16 KB
/
config.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
models:
- type: main
engine: hf_pipeline_llama2_13b
parameters:
path: "meta-llama/Llama-2-13b-chat-hf"
# number of GPUs you have , do nvidia-smi to check
num_gpus: 2
# This can be: "cpu" or "cuda". "mps" is not supported.
device: "cuda"
rails:
output:
flows:
- self check facts
instructions:
- type: general
content: |
Below is a conversation between a bot and a user about the recent job reports.
The bot is factual and concise. If the bot does not know the answer to a
question, it truthfully says it does not know.
sample_conversation: |
user "Hello there!"
express greeting
bot express greeting
"Hello! How can I assist you today?"
user "What can you do for me?"
ask about capabilities
bot respond about capabilities
"I am an AI assistant which helps answer questions based on a given knowledge base."
# The prompts below are the same as the ones from `nemoguardrails/llm/prompts/dolly.yml`.
prompts:
- task: general
models:
- hf_pipeline_llama2_13b
content: |-
{{ general_instructions }}
{{ history | user_assistant_sequence }}
Assistant:
# Prompt for detecting the user message canonical form.
- task: generate_user_intent
models:
- hf_pipeline_llama2_13b
content: |-
"""
{{ general_instructions }}
"""
# This is how a conversation between a user and the bot can go:
{{ sample_conversation | verbose_v1 }}
# This is how the user talks:
{{ examples | verbose_v1 }}
# This is the current conversation between the user and the bot:
{{ sample_conversation | first_turns(2) | verbose_v1 }}
{{ history | colang | verbose_v1 }}
output_parser: "verbose_v1"
# Prompt for generating the next steps.
- task: generate_next_steps
models:
- hf_pipeline_llama2_13b
content: |-
"""
{{ general_instructions }}
"""
# This is how a conversation between a user and the bot can go:
{{ sample_conversation | remove_text_messages | verbose_v1 }}
# This is how the bot thinks:
{{ examples | remove_text_messages | verbose_v1 }}
# This is the current conversation between the user and the bot:
{{ sample_conversation | first_turns(2) | remove_text_messages | verbose_v1 }}
{{ history | colang | remove_text_messages | verbose_v1 }}
output_parser: "verbose_v1"
# Prompt for generating the bot message from a canonical form.
- task: generate_bot_message
models:
- hf_pipeline_llama2_13b
content: |-
"""
{{ general_instructions }}
"""
# This is how a conversation between a user and the bot can go:
{{ sample_conversation | verbose_v1 }}
{% if relevant_chunks %}
# This is some additional context:
```markdown
{{ relevant_chunks }}
```
{% endif %}
# This is how the bot talks:
{{ examples | verbose_v1 }}
# This is the current conversation between the user and the bot:
{{ sample_conversation | first_turns(2) | verbose_v1 }}
{{ history | colang | verbose_v1 }}
output_parser: "verbose_v1"
# Prompt for generating the value of a context variable.
- task: generate_value
models:
- hf_pipeline_llama2_13b
content: |-
"""
{{ general_instructions }}
"""
# This is how a conversation between a user and the bot can go:
{{ sample_conversation | verbose_v1 }}
# This is how the bot thinks:
{{ examples | verbose_v1 }}
# This is the current conversation between the user and the bot:
{{ sample_conversation | first_turns(2) | verbose_v1 }}
{{ history | colang | verbose_v1 }}
# {{ instructions }}
${{ var_name }} =
output_parser: "verbose_v1"
- task: self_check_facts
models:
- hf_pipeline_llama2_13b
content: |-
<<SYS>>
You are given a task to identify if the hypothesis is grounded and entailed to the evidence.
You will only use the contents of the evidence and not rely on external knowledge.
<</SYS>>
[INST]Answer with yes/no. "evidence": {{ evidence }} "hypothesis": {{ response }} "entails":[/INST]