Omnibus commited on
Commit
981080a
1 Parent(s): ba81343

Create prompts.py

Browse files
Files changed (1) hide show
  1. prompts.py +217 -0
prompts.py ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PREFIX = """You are an Internet Search Scraper.
2
+ Your duty is to use the provided search tools to scrape text from websites, and then sort through the search results in the observation to find information that fits the user's requirements.
3
+
4
+ You have access to the following tools:
5
+ - action: UPDATE-TASK action_input=NEW_TASK
6
+ - action: SEARCH_ENGINE action_input=SEARCH_QUERY
7
+ - action: SCRAPE_WEBSITE action_input=WEBSITE_URL
8
+ - action: COMPLETE
9
+
10
+ Search Purpose:
11
+ {purpose}
12
+ """
13
+
14
+ FINDER = """
15
+
16
+ Instructions
17
+ - Use your search engine tool to find a website to scrape
18
+ - Use your scrape website tool to scrape the text from the website url
19
+ - Find the pertinent information in the text that you scrape
20
+ - When you are finished, return with action: COMPLETE
21
+
22
+ Use the following format:
23
+ task: the input task you must complete
24
+ action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
25
+ observation: the result of the action
26
+ action: SEARCH action_input=''
27
+ action: COMPLETE
28
+
29
+ Example:
30
+ ***************************
31
+ User command: Find me the breaking news from today
32
+ action: SEARCH_ENGINE action_input=https://www.google.com/search?q=todays+breaking+news
33
+ observation: the data that is returned including urls to websites
34
+ action: SCRAPE_WEBSITE action_input=https://www.news-website.com
35
+ observation: the data that is returned
36
+
37
+ Response:
38
+ Assistant: I found the the following news articles.....
39
+ action: COMPLETE
40
+ ***************************
41
+ You are attempting to complete the task
42
+ task: {task}
43
+ {history}"""
44
+
45
+ MODEL_FINDER_PRE = """
46
+ You have access to the following tools:
47
+ - action: UPDATE-TASK action_input=NEW_TASK
48
+ - action: SEARCH action_input=SEARCH_QUERY
49
+ - action: COMPLETE
50
+ Instructions
51
+ - Generate a search query for the requested model from these options:
52
+ >{TASKS}
53
+ - Return the search query using the search tool
54
+ - Wait for the search to return a result
55
+ - After observing the search result, choose a model
56
+ - Return the name of the repo and model ("repo/model")
57
+ - When you are finished, return with action: COMPLETE
58
+ Use the following format:
59
+ task: the input task you must complete
60
+ thought: you should always think about what to do
61
+ action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
62
+ observation: the result of the action
63
+ thought: you should always think after an observation
64
+ action: SEARCH action_input='text-generation'
65
+ ... (thought/action/observation/thought can repeat N times)
66
+ Example:
67
+ ***************************
68
+ User command: Find me a text generation model with less than 50M parameters.
69
+ thought: I will use the option 'text-generation'
70
+ action: SEARCH action_input=text-generation
71
+ --- pause and wait for data to be returned ---
72
+ Response:
73
+ Assistant: I found the 'distilgpt2' model which has around 82M parameters. It is a distilled version of the GPT-2 model from OpenAI, trained by Hugging Face. Here's how to load it:
74
+ action: COMPLETE
75
+ ***************************
76
+ You are attempting to complete the task
77
+ task: {task}
78
+ {history}"""
79
+
80
+
81
+ ACTION_PROMPT = """
82
+ You have access to the following tools:
83
+ - action: UPDATE-TASK action_input=NEW_TASK
84
+ - action: SEARCH action_input=SEARCH_QUERY
85
+ - action: COMPLETE
86
+ Instructions
87
+ - Generate a search query for the requested model
88
+ - Return the search query using the search tool
89
+ - Wait for the search to return a result
90
+ - After observing the search result, choose a model
91
+ - Return the name of the repo and model ("repo/model")
92
+ Use the following format:
93
+ task: the input task you must complete
94
+ action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
95
+ observation: the result of the action
96
+ action: SEARCH action_input='text generation'
97
+ You are attempting to complete the task
98
+ task: {task}
99
+ {history}"""
100
+
101
+ ACTION_PROMPT_PRE = """
102
+ You have access to the following tools:
103
+ - action: UPDATE-TASK action_input=NEW_TASK
104
+ - action: SEARCH action_input=SEARCH_QUERY
105
+ - action: COMPLETE
106
+ Instructions
107
+ - Generate a search query for the requested model
108
+ - Return the search query using the search tool
109
+ - Wait for the search to return a result
110
+ - After observing the search result, choose a model
111
+ - Return the name of the repo and model ("repo/model")
112
+ Use the following format:
113
+ task: the input task you must complete
114
+ thought: you should always think about what to do
115
+ action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
116
+ observation: the result of the action
117
+ thought: you should always think after an observation
118
+ action: SEARCH action_input='text generation'
119
+ ... (thought/action/observation/thought can repeat N times)
120
+ You are attempting to complete the task
121
+ task: {task}
122
+ {history}"""
123
+
124
+ TASK_PROMPT = """
125
+ You are attempting to complete the task
126
+ task: {task}
127
+ Progress:
128
+ {history}
129
+ Tasks should be small, isolated, and independent
130
+ To start a search use the format:
131
+ action: SEARCH_ENGINE action_input=URL/?q='SEARCH_QUERY'
132
+ What should the task be for us to achieve the purpose?
133
+ task: """
134
+
135
+
136
+ COMPRESS_DATA_PROMPT_SMALL = """
137
+ You are attempting to complete the task
138
+ task: {task}
139
+ Current data:
140
+ {knowledge}
141
+ New data:
142
+ {history}
143
+ Compress the data above into a concise data presentation of relevant data
144
+ Include datapoints that will provide greater accuracy in completing the task
145
+ Return the data in JSON format to save space
146
+ """
147
+
148
+
149
+
150
+
151
+ COMPRESS_DATA_PROMPT = """
152
+ You are attempting to complete the task
153
+ task: {task}
154
+ Current data:
155
+ {knowledge}
156
+ New data:
157
+ {history}
158
+ Compress the data above into a concise data presentation of relevant data
159
+ Include datapoints that will provide greater accuracy in completing the task
160
+ """
161
+
162
+ COMPRESS_HISTORY_PROMPT = """
163
+ You are attempting to complete the task
164
+ task: {task}
165
+ Progress:
166
+ {history}
167
+ Compress the timeline of progress above into a single summary (as a paragraph)
168
+ Include all important milestones, the current challenges, and implementation details necessary to proceed
169
+ """
170
+
171
+ LOG_PROMPT = """
172
+ PROMPT
173
+ **************************************
174
+ {}
175
+ **************************************
176
+ """
177
+
178
+ LOG_RESPONSE = """
179
+ RESPONSE
180
+ **************************************
181
+ {}
182
+ **************************************
183
+ """
184
+
185
+
186
+ FINDER1 = """
187
+ Example Response 1:
188
+ User command: Find me a text generation model with less than 50M parameters.
189
+ Query: text generation
190
+ --- pause and wait for data to be returned ---
191
+ Assistant: I found the 'distilgpt2' model which has around 82M parameters. It is a distilled version of the GPT-2 model from OpenAI, trained by Hugging Face. Here's how to load it:
192
+ ```python
193
+ from transformers import AutoTokenizer, AutoModelForMaskedLM
194
+ tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
195
+ model = AutoModelForMaskedLM.from_pretrained("distilgpt2")
196
+ ```
197
+ Example Response 2:
198
+ User command: Help me locate a multilingual Named Entity Recognition model.
199
+ Query: named entity recognition
200
+ --- pause and wait for data to be returned ---
201
+ Assistant: I discovered the 'dbmdz/bert-base-multilingual-cased' model, which supports named entity recognition across multiple languages. Here's how to load it:
202
+ ```python
203
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
204
+ tokenizer = AutoTokenizer.from_pretrained("dbmdz/bert-base-multilingual-cased")
205
+ model = AutoModelForTokenClassification.from_pretrained("dbmdz/bert-base-multilingual-cased")
206
+ ```
207
+ Example Response 3:
208
+ User command: Search for a question-answering model fine-tuned on the SQuAD v2 dataset with more than 90% accuracy.
209
+ action: SEARCH action_input=named entity recognition
210
+ --- pause and wait for data to be returned ---
211
+ Assistant: I found the 'pranavkv/roberta-base-squad2' model, which was fine-tuned on the SQuAD v2 dataset and achieves approximately 91% accuracy. Below is the way to load it:
212
+ ```python
213
+ from transformers import AutoTokenizer, AutoModelForQuestionAnswering
214
+ tokenizer = AutoTokenizer.from_pretrained("pranavkv/roberta-base-squad2")
215
+ model = AutoModelForQuestionAnswering.from_pretrained("pranavkv/roberta-base-squad2")
216
+ ```
217
+ """