fix: drop past-memory directive and placeholder from agent prompts when memory is empty (#572)
This commit is contained in:
5 files changed
+51
-16
No files matched your search
@@ -19,6 +19,17 @@ def create_bear_researcher(llm, memory):
|
||||
for i, rec in enumerate(past_memories, 1):
|
||||
past_memory_str += rec["recommendation"] + "\n\n"
|
||||
|
||||
memory_section = (
|
||||
f"Reflections from similar situations and lessons learned: {past_memory_str.strip()}\n"
|
||||
if past_memories
|
||||
else ""
|
||||
)
|
||||
memory_instruction = (
|
||||
" You must also address reflections and learn from lessons and mistakes you made in the past."
|
||||
if past_memories
|
||||
else ""
|
||||
)
|
||||
|
||||
prompt = f"""You are a Bear Analyst making the case against investing in the stock. Your goal is to present a well-reasoned argument emphasizing risks, challenges, and negative indicators. Leverage the provided research and data to highlight potential downsides and counter bullish arguments effectively.
|
||||
|
||||
Key points to focus on:
|
||||
@@ -37,8 +48,7 @@ Latest world affairs news: {news_report}
|
||||
Company fundamentals report: {fundamentals_report}
|
||||
Conversation history of the debate: {history}
|
||||
Last bull argument: {current_response}
|
||||
Reflections from similar situations and lessons learned: {past_memory_str}
|
||||
Use this information to deliver a compelling bear argument, refute the bull's claims, and engage in a dynamic debate that demonstrates the risks and weaknesses of investing in the stock. You must also address reflections and learn from lessons and mistakes you made in the past.
|
||||
{memory_section}Use this information to deliver a compelling bear argument, refute the bull's claims, and engage in a dynamic debate that demonstrates the risks and weaknesses of investing in the stock.{memory_instruction}
|
||||
"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
Reference in new issue
Block a user