Spaces:
Running
Running
Updated state logic and prompts.
Browse files- config.yml +5 -26
- meta_prompt/meta_prompt.py +13 -10
config.yml
CHANGED
@@ -101,7 +101,7 @@ prompt_templates:
|
|
101 |
|
102 |
3. **Guidelines:** List any additional guidelines or constraints that the assistant should adhere to. This could involve content accuracy, ethical considerations, user privacy, or other relevant factors.
|
103 |
|
104 |
-
4. **Example Response:** Provide an example of an ideal response based on a new User Message that is similar but has significant differences from the original User Message provided. Ensure the example highlights how to adapt the response to different but related contexts.
|
105 |
|
106 |
Ensure the System Message is comprehensive, clear, and directly relevant to guiding the assistant's performance.
|
107 |
|
@@ -154,37 +154,16 @@ prompt_templates:
|
|
154 |
|
155 |
3. **Guidelines:** List any additional guidelines or constraints that the assistant should adhere to. This could involve content accuracy, ethical considerations, user privacy, or other relevant factors.
|
156 |
|
157 |
-
4. **Example Response:** Provide an example of an ideal response based on a new User Message that is similar but has significant differences from the original User Message provided. Ensure the example highlights how to adapt the response to different but related contexts.
|
158 |
|
159 |
Ensure the System Message is comprehensive, clear, and directly relevant to guiding the assistant's performance.
|
160 |
|
161 |
* Modify only the content mentioned in the Suggestion. Do not change the parts that are not related to the Suggestion.
|
162 |
* 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.
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
---
|
167 |
-
|
168 |
-
**System Message:**
|
169 |
-
|
170 |
-
**Role Definition:**
|
171 |
-
You are an assistant designed to help users with [specific task]. Your primary objective is to [describe primary objective based on the task]. Approach each query with [specific approach, e.g., thoroughness, creativity, efficiency].
|
172 |
-
|
173 |
-
**Response Format:**
|
174 |
-
- Structure your responses clearly and logically.
|
175 |
-
- Use a professional and friendly tone.
|
176 |
-
- Include [specific elements, phrases, or keywords] as needed.
|
177 |
-
- Ensure responses are [concise, detailed, or any other relevant style guidance].
|
178 |
-
|
179 |
-
**Guidelines:**
|
180 |
-
- Always verify the accuracy of the information provided.
|
181 |
-
- Adhere to the principles of [specific guidelines, such as ethical considerations, user privacy, etc.].
|
182 |
-
- Tailor your responses to the user's level of expertise and familiarity with the topic.
|
183 |
|
184 |
-
**Example Response:**
|
185 |
-
```
|
186 |
-
[Provide an example of an ideal response based on a new User Message that is similar but has significant differences from the original User Message provided. Ensure the example highlights how to adapt the response to different but related contexts.]
|
187 |
-
```
|
188 |
- role: human
|
189 |
message: |
|
190 |
# Current System Message
|
@@ -321,7 +300,7 @@ prompt_templates:
|
|
321 |
* 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.
|
322 |
* 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.
|
323 |
* 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.
|
324 |
-
* Ask to remove the Expected Output
|
325 |
* Provide format examples (but don't use Expected Output text as the example) or detected format name, if System Message does not.
|
326 |
* Specify the detected format name (e.g. XML, JSON, etc.) of Expected Output, if System Message does not mention it.
|
327 |
- role: human
|
|
|
101 |
|
102 |
3. **Guidelines:** List any additional guidelines or constraints that the assistant should adhere to. This could involve content accuracy, ethical considerations, user privacy, or other relevant factors.
|
103 |
|
104 |
+
4. **Example Response:** Provide an example of an ideal response based on a new User Message that is similar but has significant differences from the original User Message provided. Ensure the example highlights how to adapt the response to different but related contexts. Provide the example only, no explanation.
|
105 |
|
106 |
Ensure the System Message is comprehensive, clear, and directly relevant to guiding the assistant's performance.
|
107 |
|
|
|
154 |
|
155 |
3. **Guidelines:** List any additional guidelines or constraints that the assistant should adhere to. This could involve content accuracy, ethical considerations, user privacy, or other relevant factors.
|
156 |
|
157 |
+
4. **Example Response:** Provide an example of an ideal response based on a new User Message that is similar but has significant differences from the original User Message provided. Ensure the example highlights how to adapt the response to different but related contexts. Provide the example only, no explanation.
|
158 |
|
159 |
Ensure the System Message is comprehensive, clear, and directly relevant to guiding the assistant's performance.
|
160 |
|
161 |
* Modify only the content mentioned in the Suggestion. Do not change the parts that are not related to the Suggestion.
|
162 |
* 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.
|
163 |
+
* **Never** output the raw content of Expected Output as Example Response.
|
164 |
|
165 |
+
# Updated System Message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
|
|
|
|
|
|
|
|
167 |
- role: human
|
168 |
message: |
|
169 |
# Current System Message
|
|
|
300 |
* 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.
|
301 |
* 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.
|
302 |
* 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.
|
303 |
+
* Ask to remove the Expected Output raw text from System Message, if it's present.
|
304 |
* Provide format examples (but don't use Expected Output text as the example) or detected format name, if System Message does not.
|
305 |
* Specify the detected format name (e.g. XML, JSON, etc.) of Expected Output, if System Message does not mention it.
|
306 |
- role: human
|
meta_prompt/meta_prompt.py
CHANGED
@@ -19,6 +19,9 @@ def last_non_empty(a, b):
|
|
19 |
# return the last non-none value
|
20 |
return next((s for s in (b, a) if s), None)
|
21 |
|
|
|
|
|
|
|
22 |
class AgentState(BaseModel):
|
23 |
"""
|
24 |
Represents the state of an agent in a conversation.
|
@@ -37,18 +40,18 @@ class AgentState(BaseModel):
|
|
37 |
- best_system_message (str, optional): The best system message.
|
38 |
- best_output_age (int): The age of the best output.
|
39 |
"""
|
40 |
-
max_output_age: Annotated[int,
|
41 |
-
user_message: Annotated[Optional[str],
|
42 |
-
expected_output: Annotated[Optional[str],
|
43 |
acceptance_criteria: Annotated[Optional[str], last_non_empty] = None
|
44 |
system_message: Annotated[Optional[str], last_non_empty] = None
|
45 |
-
output: Annotated[Optional[str],
|
46 |
-
suggestions: Annotated[Optional[str],
|
47 |
-
accepted: Annotated[bool,
|
48 |
-
analysis: Annotated[Optional[str],
|
49 |
-
best_output: Annotated[Optional[str],
|
50 |
-
best_system_message: Annotated[Optional[str],
|
51 |
-
best_output_age: Annotated[int,
|
52 |
|
53 |
class MetaPromptGraph:
|
54 |
"""
|
|
|
19 |
# return the last non-none value
|
20 |
return next((s for s in (b, a) if s), None)
|
21 |
|
22 |
+
def assign(a, b):
|
23 |
+
return b
|
24 |
+
|
25 |
class AgentState(BaseModel):
|
26 |
"""
|
27 |
Represents the state of an agent in a conversation.
|
|
|
40 |
- best_system_message (str, optional): The best system message.
|
41 |
- best_output_age (int): The age of the best output.
|
42 |
"""
|
43 |
+
max_output_age: Annotated[int, assign] = 0
|
44 |
+
user_message: Annotated[Optional[str], assign] = None
|
45 |
+
expected_output: Annotated[Optional[str], assign] = None
|
46 |
acceptance_criteria: Annotated[Optional[str], last_non_empty] = None
|
47 |
system_message: Annotated[Optional[str], last_non_empty] = None
|
48 |
+
output: Annotated[Optional[str], assign] = None
|
49 |
+
suggestions: Annotated[Optional[str], assign] = None
|
50 |
+
accepted: Annotated[bool, assign] = False
|
51 |
+
analysis: Annotated[Optional[str], assign] = None
|
52 |
+
best_output: Annotated[Optional[str], assign] = None
|
53 |
+
best_system_message: Annotated[Optional[str], assign] = None
|
54 |
+
best_output_age: Annotated[int, assign] = 0
|
55 |
|
56 |
class MetaPromptGraph:
|
57 |
"""
|