Spaces:
Running
Running
Updated config.
Browse files- config.yml +169 -339
- meta_prompt/meta_prompt.py +8 -5
config.yml
CHANGED
@@ -90,53 +90,86 @@ prompt_templates:
|
|
90 |
acceptance_criteria_developer:
|
91 |
- role: system
|
92 |
message: |
|
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 |
- role: human
|
126 |
message: |
|
127 |
-
|
128 |
-
|
129 |
-
{
|
130 |
-
|
131 |
-
# User Message
|
132 |
-
|
133 |
-
{user_message}
|
134 |
-
|
135 |
-
# Expected Output
|
136 |
-
|
137 |
-
{expected_output}
|
138 |
-
|
139 |
-
# Acceptance Criteria
|
140 |
|
141 |
prompt_initial_developer:
|
142 |
- role: system
|
@@ -245,70 +278,60 @@ prompt_templates:
|
|
245 |
output_history_analyzer:
|
246 |
- role: system
|
247 |
message: |
|
248 |
-
You are a text comparing program. You read the Acceptance Criteria, compare the compare the Expected Output with two different outputs, and decide which one is closer to the Expected Output. When comparing the outputs, ignore the differences which are acceptable or ignorable according to the Acceptance Criteria.
|
249 |
-
|
250 |
-
You output the following analysis according to the Acceptance Criteria:
|
251 |
-
|
252 |
-
* Your analysis.
|
253 |
-
* Indicates an output ID that is closer to the Expected Output.
|
254 |
-
|
255 |
-
Requirements:
|
256 |
-
1. Read and understand the provided Acceptance Criteria carefully.
|
257 |
-
2. Compare the Expected Output with two different outputs (Output 1 and Output 2).
|
258 |
-
3. Ignore the differences that are specified as acceptable or ignorable in the Acceptance Criteria.
|
259 |
-
4. Determine which output (Output 1 or Output 2) is closer to the Expected Output based on the Acceptance Criteria.
|
260 |
-
5. Provide a detailed analysis of your comparison and decision-making process.
|
261 |
-
6. Clearly indicate the output ID (either 1 or 2) that is closer to the Expected Output.
|
262 |
-
|
263 |
-
Output Format:
|
264 |
-
Your output should be in the following JSON format:
|
265 |
-
{{
|
266 |
-
"analysis": "[Your detailed analysis here. Explain your comparison and decision-making process based on the Acceptance Criteria.]",
|
267 |
-
"closerOutputID": [1 or 2 or 0]
|
268 |
-
}}
|
269 |
-
|
270 |
-
Note:
|
271 |
-
- Use "closerOutputID": 1 if Output 1 is closer to the Expected Output.
|
272 |
-
- Use "closerOutputID": 2 if Output 2 is closer to the Expected Output.
|
273 |
-
- Use "closerOutputID": 0 if both outputs are exactly the same or equally close to the Expected Output.
|
274 |
-
|
275 |
-
Examples:
|
276 |
-
Example 1:
|
277 |
{{
|
278 |
-
"
|
279 |
-
"
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}}
|
287 |
-
|
288 |
-
Remember to adhere to the Acceptance Criteria when comparing the outputs and provide a clear and detailed analysis to support your decision. Confirm that your output follows the specified format and includes the required information.
|
289 |
- role: human
|
290 |
message: |
|
291 |
-
|
292 |
-
|
293 |
-
{acceptance_criteria}
|
294 |
-
|
295 |
-
# Expected Output
|
296 |
-
|
297 |
-
```
|
298 |
-
{expected_output}
|
299 |
-
```
|
300 |
-
|
301 |
-
# Output ID: 1
|
302 |
-
|
303 |
-
```
|
304 |
-
{best_output}
|
305 |
-
```
|
306 |
-
|
307 |
-
# Output ID: 2
|
308 |
-
|
309 |
-
```
|
310 |
-
{output}
|
311 |
-
```
|
312 |
|
313 |
prompt_analyzer:
|
314 |
- role: system
|
@@ -360,20 +383,47 @@ prompt_templates:
|
|
360 |
prompt_suggester:
|
361 |
- role: system
|
362 |
message: |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
- role: human
|
378 |
message: |
|
379 |
<|Start_System_Message|>
|
@@ -1053,223 +1103,3 @@ prompt_templates:
|
|
1053 |
<|Start_Analysis|>
|
1054 |
{analysis}
|
1055 |
<|End_Analysis|>
|
1056 |
-
|
1057 |
-
deprecated:
|
1058 |
-
prompt_initial_developer:
|
1059 |
-
- role: system
|
1060 |
-
message: |
|
1061 |
-
# Expert Prompt Engineer
|
1062 |
-
|
1063 |
-
You are an expert prompt engineer tasked with creating system messages for AI assistants.
|
1064 |
-
|
1065 |
-
## Instructions
|
1066 |
-
|
1067 |
-
1. Create a system message based on the given user message and expected output.
|
1068 |
-
2. Ensure the system message can handle similar user messages.
|
1069 |
-
3. The output should start directly with the system message, without any preceding blank lines, introductory phrases, or explanatory text. Do not include extra lines at the beginning or end of the output.
|
1070 |
-
4. Expected Output text should not appear in System Message as an example. But it's OK to use some similar text as an example instead.
|
1071 |
-
5. In the System Message, do not use `Expected Output` to refer to the example you want to illustrate. Instead, directly describe the specific features you need.
|
1072 |
-
6. Format the system message well, which should be in the form of instructions for the AI assistant, such as "You should...". Never format the system message in the form of introductions, such as "I will...".
|
1073 |
-
|
1074 |
-
## Output
|
1075 |
-
|
1076 |
-
Provide only the system message, adhering to the above guidelines.
|
1077 |
-
- role: human
|
1078 |
-
message: |
|
1079 |
-
# User Message
|
1080 |
-
|
1081 |
-
{user_message}
|
1082 |
-
|
1083 |
-
# Expected Output
|
1084 |
-
|
1085 |
-
{expected_output}
|
1086 |
-
|
1087 |
-
# System Message
|
1088 |
-
|
1089 |
-
prompt_developer:
|
1090 |
-
- role: system
|
1091 |
-
message: |
|
1092 |
-
# Expert Prompt Engineer
|
1093 |
-
|
1094 |
-
You are an expert prompt engineer tasked with updating system messages for AI assistants. You Update System Message according to Suggestions, to improve Output and match Expected Output more closely.
|
1095 |
-
|
1096 |
-
## Instructions
|
1097 |
-
|
1098 |
-
1. Update the system message based on the given Suggestion, User Message, and Expected Output.
|
1099 |
-
2. Ensure the updated system message can handle similar user messages.
|
1100 |
-
3. Modify only the content mentioned in the Suggestion. Do not change the parts that are not related to the Suggestion.
|
1101 |
-
4. The output should start directly with the system message, without any preceding blank lines, introductory phrases, or explanatory text. Do not include extra lines at the beginning or end of the output.
|
1102 |
-
5. Avoiding the behavior should be explicitly requested (e.g. `Don't ...`) in the System Message, if the behavior is: asked to be avoid by the Suggestions; but not mentioned in the Current System Message.
|
1103 |
-
6. Expected Output text should not appear in System Message as an example. But it's OK to use some similar text as an example instead.
|
1104 |
-
7. In the System Message, do not use `Expected Output` to refer to the example you want to illustrate. Instead, directly describe the specific features you need.
|
1105 |
-
8. Remove the Expected Output text or text highly similar to Expected Output from System Message, if it's present.
|
1106 |
-
9. Format the system message well, which should be in the form of instructions for the AI assistant, such as "You should...". Never format the system message in the form of introductions, such as "I will...".
|
1107 |
-
|
1108 |
-
## Output
|
1109 |
-
|
1110 |
-
Provide only the updated System Message, adhering to the above guidelines.
|
1111 |
-
- role: human
|
1112 |
-
message: |
|
1113 |
-
# Current System Message
|
1114 |
-
|
1115 |
-
{system_message}
|
1116 |
-
|
1117 |
-
# User Message
|
1118 |
-
|
1119 |
-
{user_message}
|
1120 |
-
|
1121 |
-
# Expected Output
|
1122 |
-
|
1123 |
-
{expected_output}
|
1124 |
-
|
1125 |
-
# Suggestions
|
1126 |
-
|
1127 |
-
{suggestions}
|
1128 |
-
|
1129 |
-
# Updated System Message
|
1130 |
-
|
1131 |
-
prompt_executor:
|
1132 |
-
- role: system
|
1133 |
-
message: "{system_message}"
|
1134 |
-
- role: human
|
1135 |
-
message: "{user_message}"
|
1136 |
-
|
1137 |
-
output_history_analyzer:
|
1138 |
-
- role: system
|
1139 |
-
message: |
|
1140 |
-
You are a text comparing program. You read the Acceptance Criteria, compare the compare the Expected Output with two different outputs, and decide which one is closer to the Expected Output. When comparing the outputs, ignore the differences which are acceptable or ignorable according to the Acceptance Criteria.
|
1141 |
-
|
1142 |
-
You output the following analysis according to the Acceptance Criteria:
|
1143 |
-
|
1144 |
-
* Your analysis in a Markdown list.
|
1145 |
-
* Indicates an output ID that is closer to the Expected Output, in the following format:
|
1146 |
-
|
1147 |
-
```
|
1148 |
-
# Analysis
|
1149 |
-
|
1150 |
-
...
|
1151 |
-
|
1152 |
-
# Output ID closer to Expected Output: [ID]
|
1153 |
-
```
|
1154 |
-
|
1155 |
-
You must choose one of the two outputs. If both outputs are exactly the same, output the following:
|
1156 |
-
|
1157 |
-
```
|
1158 |
-
# Analysis
|
1159 |
-
|
1160 |
-
...
|
1161 |
-
|
1162 |
-
# Draw
|
1163 |
-
```
|
1164 |
-
- role: human
|
1165 |
-
message: |
|
1166 |
-
# Output ID: A
|
1167 |
-
|
1168 |
-
```
|
1169 |
-
{best_output}
|
1170 |
-
```
|
1171 |
-
|
1172 |
-
# Output ID: B
|
1173 |
-
|
1174 |
-
```
|
1175 |
-
{output}
|
1176 |
-
```
|
1177 |
-
|
1178 |
-
# Acceptance Criteria
|
1179 |
-
|
1180 |
-
Compared with Expected Output [EO]:
|
1181 |
-
{acceptance_criteria}
|
1182 |
-
|
1183 |
-
# Expected Output
|
1184 |
-
|
1185 |
-
```
|
1186 |
-
{expected_output}
|
1187 |
-
```
|
1188 |
-
|
1189 |
-
prompt_analyzer:
|
1190 |
-
- role: system
|
1191 |
-
message: |
|
1192 |
-
You are a text comparing program. You compare the following output texts, analysis the System Message and provide a detailed analysis according to [`Acceptance Criteria`]. Then you decide whether [`Actual Output`] is acceptable.
|
1193 |
-
|
1194 |
-
Provide your analysis in the following format:
|
1195 |
-
|
1196 |
-
```
|
1197 |
-
- Acceptable Differences: [List acceptable differences succinctly]
|
1198 |
-
- Unacceptable Differences: [List unacceptable differences succinctly]
|
1199 |
-
- Accept: [Yes/No]
|
1200 |
-
```
|
1201 |
-
|
1202 |
-
* Compare Expected Output and Actual Output with the guidance of Accept Criteria.
|
1203 |
-
* Only set 'Accept' to 'Yes', if Accept Criteria are all met. Otherwise, set 'Accept' to 'No'.
|
1204 |
-
* List only the acceptable differences according to Accept Criteria in 'acceptable Differences' section.
|
1205 |
-
* List only the unacceptable differences according to Accept Criteria in 'Unacceptable Differences' section.
|
1206 |
-
|
1207 |
-
# Acceptance Criteria
|
1208 |
-
|
1209 |
-
Compared with Expected Output [EO]:
|
1210 |
-
```
|
1211 |
-
{acceptance_criteria}
|
1212 |
-
```
|
1213 |
-
- role: human
|
1214 |
-
message: |
|
1215 |
-
# System Message
|
1216 |
-
|
1217 |
-
```
|
1218 |
-
{system_message}
|
1219 |
-
```
|
1220 |
-
|
1221 |
-
# Expected Output
|
1222 |
-
|
1223 |
-
```
|
1224 |
-
{expected_output}
|
1225 |
-
```
|
1226 |
-
|
1227 |
-
# Actual Output
|
1228 |
-
|
1229 |
-
```
|
1230 |
-
{output}
|
1231 |
-
```
|
1232 |
-
|
1233 |
-
prompt_suggester:
|
1234 |
-
- role: system
|
1235 |
-
message: |
|
1236 |
-
Read the following inputs and outputs of an LLM prompt, and also analysis about them. Then suggest how to improve System Message.
|
1237 |
-
|
1238 |
-
* The goal is to improve the System Message to match the Expected Output better.
|
1239 |
-
* Ignore all Acceptable Differences and focus on Unacceptable Differences.
|
1240 |
-
* Suggest formal changes first, then semantic changes.
|
1241 |
-
* Provide your suggestions in a Markdown list, nothing else. Output only the suggestions related with Unacceptable Differences.
|
1242 |
-
* Start every suggestion with [`The System Message should ...`].
|
1243 |
-
* Figue out the contexts of the System Message that conflict with the suggestions, and suggest modification or deletion.
|
1244 |
-
* While the Expected Output won't be shown to the prompt developer who will read your suggestions, do not simply describe the output as being the same/similar/different from the Expected Output, such as [`the output should not use a different format and style compared to the Expected Output`] or [`the output should match the expected output exactly`]; instead, describe the expected characteristics specifically and suggest a detailed example.
|
1245 |
-
* Avoiding the behavior should be explicitly requested (e.g. [`The System Message should explicitly state that the output shoud not ...`]) in the System Message, if the behavior is: asked to be removed by the Suggestions; appeared in the Actual Output; but not mentioned in the Current System Message.
|
1246 |
-
* Expected Output text should not appear in System Message as an example. But it's OK to use some similar but distinct text as an example instead.
|
1247 |
-
* Ask to remove the Expected Output text or text highly similar to Expected Output from System Message, if it's present.
|
1248 |
-
* Provide format examples (but don't use Expected Output text as the example) or detected format name, if System Message does not.
|
1249 |
-
* Specify the detected format name (e.g. XML, JSON, etc.) of Expected Output, if System Message does not mention it.
|
1250 |
-
- role: human
|
1251 |
-
message: |
|
1252 |
-
<|Start_System_Message|>
|
1253 |
-
{system_message}
|
1254 |
-
<|End_System_Message|>
|
1255 |
-
|
1256 |
-
<|Start_User_Message|>
|
1257 |
-
{user_message}
|
1258 |
-
<|End_User_Message|>
|
1259 |
-
|
1260 |
-
<|Start_Expected_Output|>
|
1261 |
-
{expected_output}
|
1262 |
-
<|End_Expected_Output|>
|
1263 |
-
|
1264 |
-
<|Start_Actual_Output|>
|
1265 |
-
{output}
|
1266 |
-
<|End_Actual_Output|>
|
1267 |
-
|
1268 |
-
<|Start_Acceptance Criteria|>
|
1269 |
-
Compared with Expected Output [EO]:
|
1270 |
-
{acceptance_criteria}
|
1271 |
-
<|End_Acceptance Criteria|>
|
1272 |
-
|
1273 |
-
<|Start_Analysis|>
|
1274 |
-
{analysis}
|
1275 |
-
<|End_Analysis|>
|
|
|
90 |
acceptance_criteria_developer:
|
91 |
- role: system
|
92 |
message: |
|
93 |
+
{{
|
94 |
+
"task_description": "Create acceptance criteria in JSON format for a given task type based on a specific example with User Message (input) and Expected Output (output).",
|
95 |
+
"requirements": [
|
96 |
+
"Analyze the provided User Message and Expected Output to understand the task type",
|
97 |
+
"Identify key elements that the output should include and exclude",
|
98 |
+
"Always specify the language and format used in the Expected Output",
|
99 |
+
"Specify language, formatting, structure, style, and any specific requirements",
|
100 |
+
"Focus on unacceptable and acceptable differences compared to the Expected Output",
|
101 |
+
"No extra text or intro before and after JSON"
|
102 |
+
],
|
103 |
+
"output_format": {{
|
104 |
+
"type": "object",
|
105 |
+
"properties": {{
|
106 |
+
"Overall Criteria": {{
|
107 |
+
"type": "string",
|
108 |
+
"description": "Brief overall criteria for the task type (no more than 30 words)"
|
109 |
+
}},
|
110 |
+
"Language": {{
|
111 |
+
"type": "string",
|
112 |
+
"description": "The language of the Expected Output"
|
113 |
+
}},
|
114 |
+
"Format": {{
|
115 |
+
"type": "string",
|
116 |
+
"description": "The format of the Expected Output, if applicable"
|
117 |
+
}},
|
118 |
+
"Unacceptable differences": {{
|
119 |
+
"type": "array",
|
120 |
+
"items": {{
|
121 |
+
"type": "string",
|
122 |
+
"description": "Differences compared to the Expected Output that are not acceptable"
|
123 |
+
}}
|
124 |
+
}},
|
125 |
+
"Acceptable differences": {{
|
126 |
+
"type": "array",
|
127 |
+
"items": {{
|
128 |
+
"type": "string",
|
129 |
+
"description": "Differences compared to the Expected Output that are acceptable"
|
130 |
+
}}
|
131 |
+
}}
|
132 |
+
}},
|
133 |
+
"required": [
|
134 |
+
"Overall Criteria",
|
135 |
+
"Language",
|
136 |
+
"Format",
|
137 |
+
"Unacceptable differences",
|
138 |
+
"Acceptable differences"
|
139 |
+
]
|
140 |
+
}},
|
141 |
+
"output_example": {{
|
142 |
+
"Overall Criteria": "The output should summarize key points concisely, using clear language and proper formatting.",
|
143 |
+
"Language": "English",
|
144 |
+
"Format": "Plain text",
|
145 |
+
"Unacceptable differences": [
|
146 |
+
"In a different language",
|
147 |
+
"Incorrect or inconsistent formatting",
|
148 |
+
"Using jargon or overly complex language"
|
149 |
+
],
|
150 |
+
"Acceptable differences": [
|
151 |
+
"Minor rephrasing that preserves the original meaning",
|
152 |
+
"Changing passive voice to active voice for clarity"
|
153 |
+
]
|
154 |
+
}},
|
155 |
+
"evaluation_criteria": [
|
156 |
+
"The acceptance criteria accurately reflect the requirements for the given task type",
|
157 |
+
"The language and format of the Expected Output are correctly specified",
|
158 |
+
"The unacceptable and acceptable differences are clearly defined and relevant",
|
159 |
+
"The overall criteria provide a concise summary of the key requirements",
|
160 |
+
"No extra text or intro before and after JSON"
|
161 |
+
],
|
162 |
+
"error_handling": [
|
163 |
+
"If the provided example is unclear or incomplete, request additional information or clarification",
|
164 |
+
"If the task type is unfamiliar, research best practices and conventions for that type of output"
|
165 |
+
],
|
166 |
+
"conclusion": "Review the generated acceptance criteria to ensure they comprehensively cover the requirements for the task type and provide clear guidance for evaluating outputs."
|
167 |
+
}}
|
168 |
- role: human
|
169 |
message: |
|
170 |
+
<|Start_Task_Brief|>{system_message}<|End_Task_Brief|>
|
171 |
+
<|Start_User_Message|>{user_message}<|End_User_Message|>
|
172 |
+
<|Start_Expected_Output|>{expected_output}<|End_Expected_Output|>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
prompt_initial_developer:
|
175 |
- role: system
|
|
|
278 |
output_history_analyzer:
|
279 |
- role: system
|
280 |
message: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
{{
|
282 |
+
"task_description": "You are a text comparing program. Your task is to read the Acceptance Criteria, compare the Expected Output with two different outputs (Output 1 and Output 2), and decide which one is closer to the Expected Output, ignoring the differences that are acceptable or ignorable according to the Acceptance Criteria. Provide an analysis of your comparison and clearly indicate the output ID that is closer to the Expected Output. Note that if the Acceptance Criteria mention language and format requirements, these always have the highest priority. Outputs with significant differences in language or format compared to the Expected Output should always be evaluated as having greater differences.",
|
283 |
+
"requirements": [
|
284 |
+
"Read and understand the provided Acceptance Criteria carefully.",
|
285 |
+
"Compare the Expected Output with two different outputs (Output 1 and Output 2).",
|
286 |
+
"Ignore the differences that are specified as acceptable or ignorable in the Acceptance Criteria.",
|
287 |
+
"Determine which output (Output 1 or Output 2) is closer to the Expected Output based on the Acceptance Criteria.",
|
288 |
+
"Provide a detailed analysis of your comparison and decision-making process.",
|
289 |
+
"Clearly indicate the output ID (either 1 or 2) that is closer to the Expected Output."
|
290 |
+
],
|
291 |
+
"output_format": {{
|
292 |
+
"type": "object",
|
293 |
+
"properties": {{
|
294 |
+
"analysis": {{
|
295 |
+
"type": "string",
|
296 |
+
"description": "A detailed analysis explaining the comparison and decision-making process based on the Acceptance Criteria."
|
297 |
+
}},
|
298 |
+
"closerOutputID": {{
|
299 |
+
"type": "integer",
|
300 |
+
"description": "The output ID (1 or 2) that is closer to the Expected Output, or 0 if both outputs are equally close."
|
301 |
+
}}
|
302 |
+
}},
|
303 |
+
"required": [
|
304 |
+
"analysis",
|
305 |
+
"closerOutputID"
|
306 |
+
]
|
307 |
+
}},
|
308 |
+
"output_example": {{
|
309 |
+
"analysis": "The Acceptance Criteria specified that the output should be in English and follow a specific JSON format. Output 1 matches these high-priority requirements, while Output 2 is in Spanish and uses XML format. Although both outputs contain similar information, the language and format differences in Output 2 are considered significant. Therefore, Output 1 is closer to the Expected Output despite some minor content differences.",
|
310 |
+
"closerOutputID": 1
|
311 |
+
}},
|
312 |
+
|
313 |
+
"evaluation_criteria": [
|
314 |
+
"The analysis should demonstrate a clear understanding of the Acceptance Criteria, with the highest priority given to language and format requirements if specified.",
|
315 |
+
"The comparison should accurately identify and ignore acceptable or ignorable differences, while emphasizing significant language or format discrepancies.",
|
316 |
+
"The decision should be based on a thorough analysis of the outputs in relation to the Expected Output, prioritizing language and format matching when required.",
|
317 |
+
"The output ID indicated as closer to the Expected Output should align with the analysis, reflecting the importance of language and format requirements."
|
318 |
+
],
|
319 |
+
"error_handling": [
|
320 |
+
"If the Acceptance Criteria are unclear or contradictory, provide an analysis explaining the ambiguity and suggest possible interpretations.",
|
321 |
+
"If neither output is closer to the Expected Output, provide an analysis explaining why and use \"closerOutputID\": 0."
|
322 |
+
],
|
323 |
+
"ethical_considerations": [
|
324 |
+
"Ensure that the comparison process is unbiased and solely based on the Acceptance Criteria.",
|
325 |
+
"Do not introduce personal opinions or preferences into the analysis."
|
326 |
+
],
|
327 |
+
"conclusion": "Confirm that your output adheres to the specified language and format, includes a detailed analysis, and clearly indicates the closer output ID based on the Acceptance Criteria."
|
328 |
}}
|
|
|
|
|
329 |
- role: human
|
330 |
message: |
|
331 |
+
<|Start_Output_ID_1|>{best_output}<|End_Output_ID_1|>
|
332 |
+
<|Start_Output_ID_2|>{output}<|End_Output_ID_2|>
|
333 |
+
<|Start_Acceptance_Criteria|>{acceptance_criteria}<|End_Acceptance_Criteria|>
|
334 |
+
<|Start_Expected_Output|>{expected_output}<|End_Expected_Output|>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
|
336 |
prompt_analyzer:
|
337 |
- role: system
|
|
|
383 |
prompt_suggester:
|
384 |
- role: system
|
385 |
message: |
|
386 |
+
{{
|
387 |
+
"requirements": [
|
388 |
+
"Analyze the provided inputs, outputs, and analysis of an LLM prompt",
|
389 |
+
"Understand the relationship between User Message and Expected Output",
|
390 |
+
"User Message has the highest priority. If System Message cannot handle User Message, update the System Message to handle User Message, don't reject User Message.",
|
391 |
+
"Focus on addressing Unacceptable Differences between Actual Output and Expected Output",
|
392 |
+
"Find out how to update System Message to generate output more similar to Expected Output",
|
393 |
+
"Ignore Acceptable Differences",
|
394 |
+
"Provide suggestions in a Markdown list format",
|
395 |
+
"Start each suggestion with 'The System Message should ...'",
|
396 |
+
"Avoid simply describing output as similar or different from Expected Output",
|
397 |
+
"Specify expected characteristics and provide detailed examples",
|
398 |
+
"Do not use Expected Output text directly in examples",
|
399 |
+
"Explicitly request avoidance of behaviors asked to be removed",
|
400 |
+
"Suggest removal of Expected Output raw text if present in System Message",
|
401 |
+
"Provide format examples or specify detected format name if not mentioned"
|
402 |
+
],
|
403 |
+
"output_format": {{
|
404 |
+
"type": "json",
|
405 |
+
"description": "A JSON object including an array named `suggestions` of suggestions for improving the System Message"
|
406 |
+
}},
|
407 |
+
"output_example": [
|
408 |
+
"The System Message should explicitly state that the output should not include personal opinions or biases.",
|
409 |
+
"The System Message should provide an example of the desired output format, such as: ```json\n{{\n \"key\": \"value\"\n}}\n```",
|
410 |
+
"The System Message should specify that the output should be in JSON format.",
|
411 |
+
"The System Message should remove the raw text of the Expected Output and replace it with a similar but distinct example."
|
412 |
+
],
|
413 |
+
"evaluation_criteria": [
|
414 |
+
"Suggestions address Unacceptable Differences",
|
415 |
+
"Suggestions ignore Acceptable Differences",
|
416 |
+
"Suggestions are provided in a Markdown list format",
|
417 |
+
"Each suggestion starts with 'The System Message should ...'",
|
418 |
+
"Suggestions avoid simply describing output as similar or different from Expected Output",
|
419 |
+
"Suggestions specify expected characteristics and provide detailed examples",
|
420 |
+
"Examples do not use Expected Output text directly",
|
421 |
+
"Suggestions explicitly request avoidance of behaviors asked to be removed",
|
422 |
+
"Removal of Expected Output raw text is suggested if present in System Message",
|
423 |
+
"Format examples or detected format name are provided if not mentioned in System Message"
|
424 |
+
],
|
425 |
+
"conclusion": "Ensure that all requirements are met and the suggestions provided effectively address the Unacceptable Differences between the Actual Output and Expected Output, while adhering to the specified format and guidelines."
|
426 |
+
}}
|
427 |
- role: human
|
428 |
message: |
|
429 |
<|Start_System_Message|>
|
|
|
1103 |
<|Start_Analysis|>
|
1104 |
{analysis}
|
1105 |
<|End_Analysis|>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta_prompt/meta_prompt.py
CHANGED
@@ -116,7 +116,11 @@ class MetaPromptGraph:
|
|
116 |
self.prompt_templates.update(prompts)
|
117 |
|
118 |
self.aggressive_exploration = aggressive_exploration
|
119 |
-
|
|
|
|
|
|
|
|
|
120 |
|
121 |
def _create_acceptance_criteria_workflow(self) -> StateGraph:
|
122 |
"""
|
@@ -465,8 +469,7 @@ class MetaPromptGraph:
|
|
465 |
})
|
466 |
|
467 |
|
468 |
-
|
469 |
-
response = json_llm.invoke(prompt)
|
470 |
|
471 |
logger.debug({
|
472 |
'node': NODE_OUTPUT_HISTORY_ANALYZER,
|
@@ -532,8 +535,7 @@ class MetaPromptGraph:
|
|
532 |
'message': message.content
|
533 |
})
|
534 |
|
535 |
-
|
536 |
-
response = json_llm.invoke(prompt)
|
537 |
logger.debug({
|
538 |
'node': NODE_PROMPT_ANALYZER,
|
539 |
'action': 'response',
|
@@ -592,3 +594,4 @@ class MetaPromptGraph:
|
|
592 |
str: The decision to continue or end the workflow.
|
593 |
"""
|
594 |
return "continue" if not state["accepted"] else END
|
|
|
|
116 |
self.prompt_templates.update(prompts)
|
117 |
|
118 |
self.aggressive_exploration = aggressive_exploration
|
119 |
+
|
120 |
+
# Bind response_format to llm here
|
121 |
+
nodes_to_bind = [NODE_OUTPUT_HISTORY_ANALYZER, NODE_PROMPT_ANALYZER, NODE_PROMPT_SUGGESTER]
|
122 |
+
for node in nodes_to_bind:
|
123 |
+
self.llms[node] = self.llms[node].bind(response_format={"type": "json_object"})
|
124 |
|
125 |
def _create_acceptance_criteria_workflow(self) -> StateGraph:
|
126 |
"""
|
|
|
469 |
})
|
470 |
|
471 |
|
472 |
+
response = self.llms[NODE_OUTPUT_HISTORY_ANALYZER].invoke(prompt)
|
|
|
473 |
|
474 |
logger.debug({
|
475 |
'node': NODE_OUTPUT_HISTORY_ANALYZER,
|
|
|
535 |
'message': message.content
|
536 |
})
|
537 |
|
538 |
+
response = self.llms[NODE_PROMPT_ANALYZER].invoke(prompt)
|
|
|
539 |
logger.debug({
|
540 |
'node': NODE_PROMPT_ANALYZER,
|
541 |
'action': 'response',
|
|
|
594 |
str: The decision to continue or end the workflow.
|
595 |
"""
|
596 |
return "continue" if not state["accepted"] else END
|
597 |
+
|