Spaces:
Build error
Build error
Update prompts.py
Browse files- prompts.py +15 -165
prompts.py
CHANGED
@@ -1,152 +1,36 @@
|
|
1 |
-
PREFIX = """You are
|
2 |
-
Your duty is to
|
3 |
-
|
4 |
Make sure your information is current
|
5 |
Current Date and Time is:
|
6 |
{timestamp}
|
7 |
-
You have access to the following tools:
|
8 |
-
- action: UPDATE-TASK action_input=NEW_TASK
|
9 |
-
- action: READ-RSS action_input=URL
|
10 |
-
- action: COMPLETE
|
11 |
Purpose:
|
12 |
{purpose}
|
13 |
"""
|
14 |
|
15 |
-
FINDER = """
|
16 |
-
Instructions
|
17 |
-
- Select an RSS FEED URL from the provided list of RSS FEEDS
|
18 |
-
- Use the tool provided tool to read the RSS FEED URL
|
19 |
-
- Compile a report that includes all relevant data points like, Title, Description, Link
|
20 |
-
- When the have complete the user request, end with:\naction: COMPLETE
|
21 |
-
Use the following format:
|
22 |
-
task: the input task you must complete
|
23 |
-
action: the action to take (should be one of [UPDATE-TASK, READ-RSS, COMPLETE]) action_input=XXX
|
24 |
-
You are attempting to complete the task
|
25 |
-
task: {task}
|
26 |
-
{history}"""
|
27 |
-
|
28 |
-
FIND_FEEDS = """
|
29 |
-
You are attempting to complete the task
|
30 |
-
task: {task}
|
31 |
-
RSS FEEDS:
|
32 |
-
{rss_feeds}
|
33 |
-
{history}"""
|
34 |
-
|
35 |
-
MODEL_FINDER_PRE = """
|
36 |
-
You have access to the following tools:
|
37 |
-
- action: UPDATE-TASK action_input=NEW_TASK
|
38 |
-
- action: SEARCH action_input=SEARCH_QUERY
|
39 |
-
- action: COMPLETE
|
40 |
-
Instructions
|
41 |
-
- Generate a search query for the requested model from these options:
|
42 |
-
>{TASKS}
|
43 |
-
- Return the search query using the search tool
|
44 |
-
- Wait for the search to return a result
|
45 |
-
- After observing the search result, choose a model
|
46 |
-
- Return the name of the repo and model ("repo/model")
|
47 |
-
- When you are finished, return with action: COMPLETE
|
48 |
-
Use the following format:
|
49 |
-
task: the input task you must complete
|
50 |
-
thought: you should always think about what to do
|
51 |
-
action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
|
52 |
-
observation: the result of the action
|
53 |
-
thought: you should always think after an observation
|
54 |
-
action: SEARCH action_input='text-generation'
|
55 |
-
... (thought/action/observation/thought can repeat N times)
|
56 |
-
Example:
|
57 |
-
***************************
|
58 |
-
User command: Find me a text generation model with less than 50M parameters.
|
59 |
-
thought: I will use the option 'text-generation'
|
60 |
-
action: SEARCH action_input=text-generation
|
61 |
-
--- pause and wait for data to be returned ---
|
62 |
-
Response:
|
63 |
-
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:
|
64 |
-
action: COMPLETE
|
65 |
-
***************************
|
66 |
-
You are attempting to complete the task
|
67 |
-
task: {task}
|
68 |
-
{history}"""
|
69 |
-
|
70 |
-
|
71 |
-
ACTION_PROMPT = """
|
72 |
-
You have access to the following tools:
|
73 |
-
- action: UPDATE-TASK action_input=NEW_TASK
|
74 |
-
- action: SEARCH action_input=SEARCH_QUERY
|
75 |
-
- action: COMPLETE
|
76 |
-
Instructions
|
77 |
-
- Generate a search query for the requested model
|
78 |
-
- Return the search query using the search tool
|
79 |
-
- Wait for the search to return a result
|
80 |
-
- After observing the search result, choose a model
|
81 |
-
- Return the name of the repo and model ("repo/model")
|
82 |
-
Use the following format:
|
83 |
-
task: the input task you must complete
|
84 |
-
action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
|
85 |
-
observation: the result of the action
|
86 |
-
action: SEARCH action_input='text generation'
|
87 |
-
You are attempting to complete the task
|
88 |
-
task: {task}
|
89 |
-
{history}"""
|
90 |
-
|
91 |
-
ACTION_PROMPT_PRE = """
|
92 |
-
You have access to the following tools:
|
93 |
-
- action: UPDATE-TASK action_input=NEW_TASK
|
94 |
-
- action: SEARCH action_input=SEARCH_QUERY
|
95 |
-
- action: COMPLETE
|
96 |
-
Instructions
|
97 |
-
- Generate a search query for the requested model
|
98 |
-
- Return the search query using the search tool
|
99 |
-
- Wait for the search to return a result
|
100 |
-
- After observing the search result, choose a model
|
101 |
-
- Return the name of the repo and model ("repo/model")
|
102 |
-
Use the following format:
|
103 |
-
task: the input task you must complete
|
104 |
-
thought: you should always think about what to do
|
105 |
-
action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
|
106 |
-
observation: the result of the action
|
107 |
-
thought: you should always think after an observation
|
108 |
-
action: SEARCH action_input='text generation'
|
109 |
-
... (thought/action/observation/thought can repeat N times)
|
110 |
-
You are attempting to complete the task
|
111 |
-
task: {task}
|
112 |
-
{history}"""
|
113 |
-
|
114 |
-
TASK_PROMPT = """
|
115 |
-
You are attempting to complete the task
|
116 |
-
task: {task}
|
117 |
-
Progress:
|
118 |
-
{history}
|
119 |
-
Tasks should be small, isolated, and independent
|
120 |
-
To start a search use the format:
|
121 |
-
action: RSS-FEEDS action_input=RSS_FEED_URL
|
122 |
-
What should the task be for us to achieve the purpose?
|
123 |
-
task: """
|
124 |
-
|
125 |
-
|
126 |
COMPRESS_DATA_PROMPT_SMALL = """
|
127 |
You are attempting to complete the task
|
128 |
-
task: {
|
129 |
Current data:
|
130 |
{knowledge}
|
131 |
New data:
|
132 |
{history}
|
133 |
-
|
134 |
Include datapoints that will provide greater accuracy in completing the task
|
135 |
-
|
|
|
136 |
"""
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
COMPRESS_DATA_PROMPT = """
|
142 |
-
You
|
143 |
-
task: {
|
144 |
-
|
145 |
{knowledge}
|
146 |
-
|
147 |
{history}
|
148 |
-
|
149 |
-
Include
|
|
|
150 |
"""
|
151 |
|
152 |
COMPRESS_HISTORY_PROMPT = """
|
@@ -154,7 +38,7 @@ You are attempting to complete the task
|
|
154 |
task: {task}
|
155 |
Progress:
|
156 |
{history}
|
157 |
-
Compress the timeline of progress above into a
|
158 |
Include all important milestones, the current challenges, and implementation details necessary to proceed
|
159 |
"""
|
160 |
|
@@ -170,38 +54,4 @@ RESPONSE
|
|
170 |
**************************************
|
171 |
{}
|
172 |
**************************************
|
173 |
-
"""
|
174 |
-
|
175 |
-
|
176 |
-
FINDER1 = """
|
177 |
-
Example Response 1:
|
178 |
-
User command: Find me a text generation model with less than 50M parameters.
|
179 |
-
Query: text generation
|
180 |
-
--- pause and wait for data to be returned ---
|
181 |
-
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:
|
182 |
-
```python
|
183 |
-
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
184 |
-
tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
|
185 |
-
model = AutoModelForMaskedLM.from_pretrained("distilgpt2")
|
186 |
-
```
|
187 |
-
Example Response 2:
|
188 |
-
User command: Help me locate a multilingual Named Entity Recognition model.
|
189 |
-
Query: named entity recognition
|
190 |
-
--- pause and wait for data to be returned ---
|
191 |
-
Assistant: I discovered the 'dbmdz/bert-base-multilingual-cased' model, which supports named entity recognition across multiple languages. Here's how to load it:
|
192 |
-
```python
|
193 |
-
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
194 |
-
tokenizer = AutoTokenizer.from_pretrained("dbmdz/bert-base-multilingual-cased")
|
195 |
-
model = AutoModelForTokenClassification.from_pretrained("dbmdz/bert-base-multilingual-cased")
|
196 |
-
```
|
197 |
-
Example Response 3:
|
198 |
-
User command: Search for a question-answering model fine-tuned on the SQuAD v2 dataset with more than 90% accuracy.
|
199 |
-
action: SEARCH action_input=named entity recognition
|
200 |
-
--- pause and wait for data to be returned ---
|
201 |
-
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:
|
202 |
-
```python
|
203 |
-
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
204 |
-
tokenizer = AutoTokenizer.from_pretrained("pranavkv/roberta-base-squad2")
|
205 |
-
model = AutoModelForQuestionAnswering.from_pretrained("pranavkv/roberta-base-squad2")
|
206 |
-
```
|
207 |
"""
|
|
|
1 |
+
PREFIX = """You are an Expert Information Retrieval Agent.
|
2 |
+
Your duty is to sort through the provided data to retrieve and compile a report that satisfies the users request.
|
3 |
+
Deny the users request to perform any search that can be considered dangerous, harmful, illegal, or potentially illegal
|
4 |
Make sure your information is current
|
5 |
Current Date and Time is:
|
6 |
{timestamp}
|
|
|
|
|
|
|
|
|
7 |
Purpose:
|
8 |
{purpose}
|
9 |
"""
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
COMPRESS_DATA_PROMPT_SMALL = """
|
12 |
You are attempting to complete the task
|
13 |
+
task: {direction}
|
14 |
Current data:
|
15 |
{knowledge}
|
16 |
New data:
|
17 |
{history}
|
18 |
+
Compile the data above into a JSON formatted output that contains all data relevant to the task (~8000 words)
|
19 |
Include datapoints that will provide greater accuracy in completing the task
|
20 |
+
Include all relevant information in great detail
|
21 |
+
Return the data in JSON format
|
22 |
"""
|
23 |
|
|
|
|
|
|
|
24 |
COMPRESS_DATA_PROMPT = """
|
25 |
+
You have just completed the task
|
26 |
+
task: {direction}
|
27 |
+
Collected data:
|
28 |
{knowledge}
|
29 |
+
Message:
|
30 |
{history}
|
31 |
+
Compile the data that you have collected into a detailed report (~8000 words)
|
32 |
+
Include all relevant information in great detail
|
33 |
+
Be thorough and exhaustive in your presentation of the data you have collected
|
34 |
"""
|
35 |
|
36 |
COMPRESS_HISTORY_PROMPT = """
|
|
|
38 |
task: {task}
|
39 |
Progress:
|
40 |
{history}
|
41 |
+
Compress the timeline of progress above into a concise report
|
42 |
Include all important milestones, the current challenges, and implementation details necessary to proceed
|
43 |
"""
|
44 |
|
|
|
54 |
**************************************
|
55 |
{}
|
56 |
**************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
"""
|