update prompt
Browse files- app.py +3 -2
- configs/prompts.toml +23 -5
app.py
CHANGED
|
@@ -57,6 +57,7 @@ def echo(message, history, state):
|
|
| 57 |
model="gemini-1.5-flash",
|
| 58 |
contents=state['messages']
|
| 59 |
)
|
|
|
|
| 60 |
|
| 61 |
# make summary
|
| 62 |
if state['summary'] == "":
|
|
@@ -69,13 +70,13 @@ def echo(message, history, state):
|
|
| 69 |
prompt_tmpl['summarization']['prompt']
|
| 70 |
).safe_substitute(
|
| 71 |
previous_summary=state['summary'],
|
| 72 |
-
latest_conversation=str({"user": message['text'], "assistant":
|
| 73 |
)
|
| 74 |
]
|
| 75 |
)
|
| 76 |
state['summary'] = response.text
|
| 77 |
|
| 78 |
-
return
|
| 79 |
|
| 80 |
def main(args):
|
| 81 |
style_css = open(args.css_path, "r").read()
|
|
|
|
| 57 |
model="gemini-1.5-flash",
|
| 58 |
contents=state['messages']
|
| 59 |
)
|
| 60 |
+
model_response = response.text
|
| 61 |
|
| 62 |
# make summary
|
| 63 |
if state['summary'] == "":
|
|
|
|
| 70 |
prompt_tmpl['summarization']['prompt']
|
| 71 |
).safe_substitute(
|
| 72 |
previous_summary=state['summary'],
|
| 73 |
+
latest_conversation=str({"user": message['text'], "assistant": model_response})
|
| 74 |
)
|
| 75 |
]
|
| 76 |
)
|
| 77 |
state['summary'] = response.text
|
| 78 |
|
| 79 |
+
return model_response, state, state['summary']
|
| 80 |
|
| 81 |
def main(args):
|
| 82 |
style_css = open(args.css_path, "r").read()
|
configs/prompts.toml
CHANGED
|
@@ -1,9 +1,27 @@
|
|
| 1 |
[summarization]
|
| 2 |
prompt = """
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"""
|
|
|
|
| 1 |
[summarization]
|
| 2 |
prompt = """
|
| 3 |
+
Below is the initial summary of our conversation.
|
| 4 |
+
Based on the summary and the last conversation between you(assistant) and me(user), I want to update the summary.
|
| 5 |
|
| 6 |
+
**Initial Summary:**
|
| 7 |
+
$previous_summary
|
| 8 |
+
|
| 9 |
+
**Last Conversation:**
|
| 10 |
+
$latest_conversation
|
| 11 |
+
|
| 12 |
+
When updating the summary:
|
| 13 |
+
* **Focus:** Only include information we have explicitly discussed in this session. Do not introduce any new information or topics, even if you have prior knowledge.
|
| 14 |
+
* **Accuracy:** Ensure the summary is factually accurate and reflects the nuances of our discussion.
|
| 15 |
+
* **Completeness:** Strive to be as comprehensive and detailed as possible, capturing all key points and insights.
|
| 16 |
+
* **Conciseness:** While being detailed, also aim for conciseness and clarity in the summary.
|
| 17 |
+
* **Update Strategy:** Instead of rewriting the entire summary each time, update only the specific portions necessary to reflect new information or changes in understanding.
|
| 18 |
+
|
| 19 |
+
By following these guidelines, you will maintain an evolving summary that accurately reflects my learning and the key takeaways from our conversation."
|
| 20 |
+
|
| 21 |
+
**Key improvements:**
|
| 22 |
+
|
| 23 |
+
* **Clearer Instructions:** More explicit instructions on how to update the summary (i.e., updating specific portions instead of rewriting).
|
| 24 |
+
* **Emphasis on Accuracy:** Stronger emphasis on factual accuracy and reflecting nuances.
|
| 25 |
+
* **Conciseness:** Added a direction to balance detail with conciseness.
|
| 26 |
+
* **Structure:** Improved organization and formatting for better readability.
|
| 27 |
"""
|