mirror of
https://github.com/farcasclaudiu/TradingAgents.git
synced 2026-06-29 11:01:40 +03:00
fix: drop past-memory directive and placeholder from agent prompts when memory is empty (#572)
This commit is contained in:
@@ -22,6 +22,17 @@ def create_portfolio_manager(llm, memory):
|
||||
for i, rec in enumerate(past_memories, 1):
|
||||
past_memory_str += rec["recommendation"] + "\n\n"
|
||||
|
||||
lessons_line = (
|
||||
f"- Lessons from past decisions: **{past_memory_str.strip()}**\n"
|
||||
if past_memories
|
||||
else ""
|
||||
)
|
||||
thesis_instruction = (
|
||||
"3. **Investment Thesis**: Detailed reasoning anchored in the analysts' debate and past reflections."
|
||||
if past_memories
|
||||
else "3. **Investment Thesis**: Detailed reasoning anchored in the analysts' debate."
|
||||
)
|
||||
|
||||
prompt = f"""As the Portfolio Manager, synthesize the risk analysts' debate and deliver the final trading decision.
|
||||
|
||||
{instrument_context}
|
||||
@@ -38,12 +49,11 @@ def create_portfolio_manager(llm, memory):
|
||||
**Context:**
|
||||
- Research Manager's investment plan: **{research_plan}**
|
||||
- Trader's transaction proposal: **{trader_plan}**
|
||||
- Lessons from past decisions: **{past_memory_str}**
|
||||
|
||||
{lessons_line}
|
||||
**Required Output Structure:**
|
||||
1. **Rating**: State one of Buy / Overweight / Hold / Underweight / Sell.
|
||||
2. **Executive Summary**: A concise action plan covering entry strategy, position sizing, key risk levels, and time horizon.
|
||||
3. **Investment Thesis**: Detailed reasoning anchored in the analysts' debate and past reflections.
|
||||
{thesis_instruction}
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user