support traditional and simplified Chinese as agents' output
This commit is contained in:
parent
dc5232d769
commit
07d2c49235
10
cli/main.py
10
cli/main.py
|
|
@ -429,6 +429,14 @@ def get_user_selections():
|
|||
box_content += f"\n[dim]Default: {default}[/dim]"
|
||||
return Panel(box_content, border_style="blue", padding=(1, 2))
|
||||
|
||||
# Step 0: Language Selection
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 0: Language Selection", "Choose language for agent outputs"
|
||||
)
|
||||
)
|
||||
selected_language = select_language()
|
||||
|
||||
# Step 1: Ticker symbol
|
||||
console.print(
|
||||
create_question_box(
|
||||
|
|
@ -493,6 +501,7 @@ def get_user_selections():
|
|||
"backend_url": backend_url,
|
||||
"shallow_thinker": selected_shallow_thinker,
|
||||
"deep_thinker": selected_deep_thinker,
|
||||
"language": selected_language,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -741,6 +750,7 @@ def run_analysis():
|
|||
|
||||
# Create config with selected research depth
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config["output_language"] = selections["language"]
|
||||
config["max_debate_rounds"] = selections["research_depth"]
|
||||
config["max_risk_discuss_rounds"] = selections["research_depth"]
|
||||
config["quick_think_llm"] = selections["shallow_thinker"]
|
||||
|
|
|
|||
15
cli/utils.py
15
cli/utils.py
|
|
@ -281,3 +281,18 @@ def select_llm_provider() -> tuple[str, str]:
|
|||
print(f"You selected: {display_name}\tURL: {url}")
|
||||
|
||||
return display_name, url
|
||||
|
||||
|
||||
def select_language() -> str:
|
||||
"""Select output language for agent responses."""
|
||||
choices = [
|
||||
questionary.Choice("English (default)", "en"),
|
||||
questionary.Choice("Traditional Chinese", "zh-tw"),
|
||||
questionary.Choice("Simplified Chinese", "zh-cn"),
|
||||
]
|
||||
return questionary.select(
|
||||
"Select Output Language for Agents:",
|
||||
choices=choices,
|
||||
default="en",
|
||||
style=questionary.Style([("selected", "fg:cyan noinherit")])
|
||||
).ask() or "en" # Default to 'en' if None
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ from tradingagents.agents.utils.agent_utils import get_fundamentals, get_balance
|
|||
from tradingagents.dataflows.config import get_config
|
||||
|
||||
|
||||
def create_fundamentals_analyst(llm):
|
||||
def create_fundamentals_analyst(llm, config):
|
||||
"""Create the fundamentals analyst node with language support."""
|
||||
def fundamentals_analyst_node(state):
|
||||
current_date = state["trade_date"]
|
||||
ticker = state["company_of_interest"]
|
||||
|
|
@ -18,10 +19,19 @@ def create_fundamentals_analyst(llm):
|
|||
get_income_statement,
|
||||
]
|
||||
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
system_message = (
|
||||
"You are a researcher tasked with analyzing fundamental information over the past week about a company. Please write a comprehensive report of the company's fundamental information such as financial documents, company profile, basic company financials, and company financial history to gain a full view of the company's fundamental information to inform traders. Make sure to include as much detail as possible. Do not simply state the trends are mixed, provide detailed and finegrained analysis and insights that may help traders make decisions."
|
||||
+ " Make sure to append a Markdown table at the end of the report to organize key points in the report, organized and easy to read."
|
||||
+ " Use the available tools: `get_fundamentals` for comprehensive company analysis, `get_balance_sheet`, `get_cashflow`, and `get_income_statement` for specific financial statements.",
|
||||
+ " Use the available tools: `get_fundamentals` for comprehensive company analysis, `get_balance_sheet`, `get_cashflow`, and `get_income_statement` for specific financial statements."
|
||||
+ "\n***{language_prompt}***"
|
||||
)
|
||||
|
||||
prompt = ChatPromptTemplate.from_messages(
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from tradingagents.agents.utils.agent_utils import get_stock_data, get_indicator
|
|||
from tradingagents.dataflows.config import get_config
|
||||
|
||||
|
||||
def create_market_analyst(llm):
|
||||
|
||||
def create_market_analyst(llm, config):
|
||||
"""Create the market analyst node with language support."""
|
||||
def market_analyst_node(state):
|
||||
current_date = state["trade_date"]
|
||||
ticker = state["company_of_interest"]
|
||||
|
|
@ -17,6 +17,15 @@ def create_market_analyst(llm):
|
|||
get_indicators,
|
||||
]
|
||||
|
||||
language = config["output_language"]
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
system_message = (
|
||||
"""You are a trading assistant tasked with analyzing financial markets. Your role is to select the **most relevant indicators** for a given market condition or trading strategy from the following list. The goal is to choose up to **8 indicators** that provide complementary insights without redundancy. Categories and each category's indicators are:
|
||||
|
||||
|
|
@ -44,6 +53,7 @@ Volume-Based Indicators:
|
|||
|
||||
- Select indicators that provide diverse and complementary information. Avoid redundancy (e.g., do not select both rsi and stochrsi). Also briefly explain why they are suitable for the given market context. When you tool call, please use the exact name of the indicators provided above as they are defined parameters, otherwise your call will fail. Please make sure to call get_stock_data first to retrieve the CSV that is needed to generate indicators. Then use get_indicators with the specific indicator names. Write a very detailed and nuanced report of the trends you observe. Do not simply state the trends are mixed, provide detailed and finegrained analysis and insights that may help traders make decisions."""
|
||||
+ """ Make sure to append a Markdown table at the end of the report to organize key points in the report, organized and easy to read."""
|
||||
+ "\n***{language_prompt}***"
|
||||
)
|
||||
|
||||
prompt = ChatPromptTemplate.from_messages(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ from tradingagents.agents.utils.agent_utils import get_news, get_global_news
|
|||
from tradingagents.dataflows.config import get_config
|
||||
|
||||
|
||||
def create_news_analyst(llm):
|
||||
def create_news_analyst(llm, config):
|
||||
"""Create the news analyst node with language support."""
|
||||
def news_analyst_node(state):
|
||||
current_date = state["trade_date"]
|
||||
ticker = state["company_of_interest"]
|
||||
|
|
@ -15,9 +16,19 @@ def create_news_analyst(llm):
|
|||
get_global_news,
|
||||
]
|
||||
|
||||
language = config["output_language"]
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
system_message = (
|
||||
"You are a news researcher tasked with analyzing recent news and trends over the past week. Please write a comprehensive report of the current state of the world that is relevant for trading and macroeconomics. Use the available tools: get_news(query, start_date, end_date) for company-specific or targeted news searches, and get_global_news(curr_date, look_back_days, limit) for broader macroeconomic news. Do not simply state the trends are mixed, provide detailed and finegrained analysis and insights that may help traders make decisions."
|
||||
+ """ Make sure to append a Markdown table at the end of the report to organize key points in the report, organized and easy to read."""
|
||||
+ "\n***{language_prompt}***"
|
||||
)
|
||||
|
||||
prompt = ChatPromptTemplate.from_messages(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ from tradingagents.agents.utils.agent_utils import get_news
|
|||
from tradingagents.dataflows.config import get_config
|
||||
|
||||
|
||||
def create_social_media_analyst(llm):
|
||||
def create_social_media_analyst(llm, config):
|
||||
"""Create the social media analyst node with language support."""
|
||||
def social_media_analyst_node(state):
|
||||
current_date = state["trade_date"]
|
||||
ticker = state["company_of_interest"]
|
||||
|
|
@ -15,9 +16,19 @@ def create_social_media_analyst(llm):
|
|||
get_news,
|
||||
]
|
||||
|
||||
language = config["output_language"]
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
system_message = (
|
||||
"You are a social media and company specific news researcher/analyst tasked with analyzing social media posts, recent company news, and public sentiment for a specific company over the past week. You will be given a company's name your objective is to write a comprehensive long report detailing your analysis, insights, and implications for traders and investors on this company's current state after looking at social media and what people are saying about that company, analyzing sentiment data of what people feel each day about the company, and looking at recent company news. Use the get_news(query, start_date, end_date) tool to search for company-specific news and social media discussions. Try to look at all sources possible from social media to sentiment to news. Do not simply state the trends are mixed, provide detailed and finegrained analysis and insights that may help traders make decisions."
|
||||
+ """ Make sure to append a Markdown table at the end of the report to organize key points in the report, organized and easy to read.""",
|
||||
+ """ Make sure to append a Markdown table at the end of the report to organize key points in the report, organized and easy to read."""
|
||||
+ "\n***{language_prompt}***"
|
||||
)
|
||||
|
||||
prompt = ChatPromptTemplate.from_messages(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_research_manager(llm, memory):
|
||||
def create_research_manager(llm, memory, config):
|
||||
"""Create the research manager node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def research_manager_node(state) -> dict:
|
||||
history = state["investment_debate_state"].get("history", "")
|
||||
market_research_report = state["market_report"]
|
||||
|
|
@ -35,7 +44,9 @@ Here are your past reflections on mistakes:
|
|||
|
||||
Here is the debate:
|
||||
Debate History:
|
||||
{history}"""
|
||||
{history}
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
new_investment_debate_state = {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_risk_manager(llm, memory):
|
||||
def create_risk_manager(llm, memory, config):
|
||||
"""Create the risk manager node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def risk_manager_node(state) -> dict:
|
||||
|
||||
company_name = state["company_of_interest"]
|
||||
|
|
@ -41,7 +50,9 @@ Deliverables:
|
|||
|
||||
---
|
||||
|
||||
Focus on actionable insights and continuous improvement. Build on past lessons, critically evaluate all perspectives, and ensure each decision advances better outcomes."""
|
||||
Focus on actionable insights and continuous improvement. Build on past lessons, critically evaluate all perspectives, and ensure each decision advances better outcomes.
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_bear_researcher(llm, memory):
|
||||
def create_bear_researcher(llm, memory, config):
|
||||
"""Create the bear researcher node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def bear_node(state) -> dict:
|
||||
investment_debate_state = state["investment_debate_state"]
|
||||
history = investment_debate_state.get("history", "")
|
||||
|
|
@ -42,7 +51,8 @@ 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.
|
||||
"""
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_bull_researcher(llm, memory):
|
||||
def create_bull_researcher(llm, memory, config):
|
||||
"""Create the bull researcher node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def bull_node(state) -> dict:
|
||||
investment_debate_state = state["investment_debate_state"]
|
||||
history = investment_debate_state.get("history", "")
|
||||
|
|
@ -40,7 +49,8 @@ Conversation history of the debate: {history}
|
|||
Last bear argument: {current_response}
|
||||
Reflections from similar situations and lessons learned: {past_memory_str}
|
||||
Use this information to deliver a compelling bull argument, refute the bear's concerns, and engage in a dynamic debate that demonstrates the strengths of the bull position. You must also address reflections and learn from lessons and mistakes you made in the past.
|
||||
"""
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_risky_debator(llm):
|
||||
def create_risky_debator(llm, config):
|
||||
"""Create the risky debator node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def risky_node(state) -> dict:
|
||||
risk_debate_state = state["risk_debate_state"]
|
||||
history = risk_debate_state.get("history", "")
|
||||
|
|
@ -30,7 +39,9 @@ Latest World Affairs Report: {news_report}
|
|||
Company Fundamentals Report: {fundamentals_report}
|
||||
Here is the current conversation history: {history} Here are the last arguments from the conservative analyst: {current_safe_response} Here are the last arguments from the neutral analyst: {current_neutral_response}. If there are no responses from the other viewpoints, do not halluncinate and just present your point.
|
||||
|
||||
Engage actively by addressing any specific concerns raised, refuting the weaknesses in their logic, and asserting the benefits of risk-taking to outpace market norms. Maintain a focus on debating and persuading, not just presenting data. Challenge each counterpoint to underscore why a high-risk approach is optimal. Output conversationally as if you are speaking without any special formatting."""
|
||||
Engage actively by addressing any specific concerns raised, refuting the weaknesses in their logic, and asserting the benefits of risk-taking to outpace market norms. Maintain a focus on debating and persuading, not just presenting data. Challenge each counterpoint to underscore why a high-risk approach is optimal. Output conversationally as if you are speaking without any special formatting.
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,17 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_safe_debator(llm):
|
||||
def create_safe_debator(llm, config):
|
||||
"""Create the safe debator node with language support."""
|
||||
language = config["output_language"]
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def safe_node(state) -> dict:
|
||||
risk_debate_state = state["risk_debate_state"]
|
||||
history = risk_debate_state.get("history", "")
|
||||
|
|
@ -31,7 +41,9 @@ Latest World Affairs Report: {news_report}
|
|||
Company Fundamentals Report: {fundamentals_report}
|
||||
Here is the current conversation history: {history} Here is the last response from the risky analyst: {current_risky_response} Here is the last response from the neutral analyst: {current_neutral_response}. If there are no responses from the other viewpoints, do not halluncinate and just present your point.
|
||||
|
||||
Engage by questioning their optimism and emphasizing the potential downsides they may have overlooked. Address each of their counterpoints to showcase why a conservative stance is ultimately the safest path for the firm's assets. Focus on debating and critiquing their arguments to demonstrate the strength of a low-risk strategy over their approaches. Output conversationally as if you are speaking without any special formatting."""
|
||||
Engage by questioning their optimism and emphasizing the potential downsides they may have overlooked. Address each of their counterpoints to showcase why a conservative stance is ultimately the safest path for the firm's assets. Focus on debating and critiquing their arguments to demonstrate the strength of a low-risk strategy over their approaches. Output conversationally as if you are speaking without any special formatting.
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_neutral_debator(llm):
|
||||
def create_neutral_debator(llm, config):
|
||||
"""Create the neutral debator node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def neutral_node(state) -> dict:
|
||||
risk_debate_state = state["risk_debate_state"]
|
||||
history = risk_debate_state.get("history", "")
|
||||
|
|
@ -30,7 +39,9 @@ Latest World Affairs Report: {news_report}
|
|||
Company Fundamentals Report: {fundamentals_report}
|
||||
Here is the current conversation history: {history} Here is the last response from the risky analyst: {current_risky_response} Here is the last response from the safe analyst: {current_safe_response}. If there are no responses from the other viewpoints, do not halluncinate and just present your point.
|
||||
|
||||
Engage actively by analyzing both sides critically, addressing weaknesses in the risky and conservative arguments to advocate for a more balanced approach. Challenge each of their points to illustrate why a moderate risk strategy might offer the best of both worlds, providing growth potential while safeguarding against extreme volatility. Focus on debating rather than simply presenting data, aiming to show that a balanced view can lead to the most reliable outcomes. Output conversationally as if you are speaking without any special formatting."""
|
||||
Engage actively by analyzing both sides critically, addressing weaknesses in the risky and conservative arguments to advocate for a more balanced approach. Challenge each of their points to illustrate why a moderate risk strategy might offer the best of both worlds, providing growth potential while safeguarding against extreme volatility. Focus on debating rather than simply presenting data, aiming to show that a balanced view can lead to the most reliable outcomes. Output conversationally as if you are speaking without any special formatting.
|
||||
|
||||
\n***{language_prompt}***"""
|
||||
|
||||
response = llm.invoke(prompt)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,16 @@ import time
|
|||
import json
|
||||
|
||||
|
||||
def create_trader(llm, memory):
|
||||
def create_trader(llm, memory, config):
|
||||
"""Create the trader node with language support."""
|
||||
language = config["output_language"]
|
||||
language_prompts = {
|
||||
"en": "",
|
||||
"zh-tw": "Use Traditional Chinese as the output.",
|
||||
"zh-cn": "Use Simplified Chinese as the output.",
|
||||
}
|
||||
language_prompt = language_prompts.get(language, "")
|
||||
|
||||
def trader_node(state, name):
|
||||
company_name = state["company_of_interest"]
|
||||
investment_plan = state["investment_plan"]
|
||||
|
|
@ -30,7 +39,9 @@ def create_trader(llm, memory):
|
|||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": f"""You are a trading agent analyzing market data to make investment decisions. Based on your analysis, provide a specific recommendation to buy, sell, or hold. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation. Do not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situatiosn you traded in and the lessons learned: {past_memory_str}""",
|
||||
"content": f"""You are a trading agent analyzing market data to make investment decisions. Based on your analysis, provide a specific recommendation to buy, sell, or hold. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation. Do not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situations you traded in and the lessons learned: {past_memory_str}
|
||||
|
||||
\n***{language_prompt}***""",
|
||||
},
|
||||
context,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ DEFAULT_CONFIG = {
|
|||
# Example: "get_stock_data": "alpha_vantage", # Override category default
|
||||
# Example: "get_news": "openai", # Override category default
|
||||
},
|
||||
"output_language": "en",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class GraphSetup:
|
|||
invest_judge_memory,
|
||||
risk_manager_memory,
|
||||
conditional_logic: ConditionalLogic,
|
||||
config: Dict[str, Any],
|
||||
):
|
||||
"""Initialize with required components."""
|
||||
self.quick_thinking_llm = quick_thinking_llm
|
||||
|
|
@ -36,6 +37,7 @@ class GraphSetup:
|
|||
self.invest_judge_memory = invest_judge_memory
|
||||
self.risk_manager_memory = risk_manager_memory
|
||||
self.conditional_logic = conditional_logic
|
||||
self.config = config
|
||||
|
||||
def setup_graph(
|
||||
self, selected_analysts=["market", "social", "news", "fundamentals"]
|
||||
|
|
@ -59,50 +61,50 @@ class GraphSetup:
|
|||
|
||||
if "market" in selected_analysts:
|
||||
analyst_nodes["market"] = create_market_analyst(
|
||||
self.quick_thinking_llm
|
||||
self.quick_thinking_llm, self.config
|
||||
)
|
||||
delete_nodes["market"] = create_msg_delete()
|
||||
tool_nodes["market"] = self.tool_nodes["market"]
|
||||
|
||||
if "social" in selected_analysts:
|
||||
analyst_nodes["social"] = create_social_media_analyst(
|
||||
self.quick_thinking_llm
|
||||
self.quick_thinking_llm, self.config
|
||||
)
|
||||
delete_nodes["social"] = create_msg_delete()
|
||||
tool_nodes["social"] = self.tool_nodes["social"]
|
||||
|
||||
if "news" in selected_analysts:
|
||||
analyst_nodes["news"] = create_news_analyst(
|
||||
self.quick_thinking_llm
|
||||
self.quick_thinking_llm, self.config
|
||||
)
|
||||
delete_nodes["news"] = create_msg_delete()
|
||||
tool_nodes["news"] = self.tool_nodes["news"]
|
||||
|
||||
if "fundamentals" in selected_analysts:
|
||||
analyst_nodes["fundamentals"] = create_fundamentals_analyst(
|
||||
self.quick_thinking_llm
|
||||
self.quick_thinking_llm, self.config
|
||||
)
|
||||
delete_nodes["fundamentals"] = create_msg_delete()
|
||||
tool_nodes["fundamentals"] = self.tool_nodes["fundamentals"]
|
||||
|
||||
# Create researcher and manager nodes
|
||||
bull_researcher_node = create_bull_researcher(
|
||||
self.quick_thinking_llm, self.bull_memory
|
||||
self.quick_thinking_llm, self.bull_memory, self.config
|
||||
)
|
||||
bear_researcher_node = create_bear_researcher(
|
||||
self.quick_thinking_llm, self.bear_memory
|
||||
self.quick_thinking_llm, self.bear_memory, self.config
|
||||
)
|
||||
research_manager_node = create_research_manager(
|
||||
self.deep_thinking_llm, self.invest_judge_memory
|
||||
self.deep_thinking_llm, self.invest_judge_memory, self.config
|
||||
)
|
||||
trader_node = create_trader(self.quick_thinking_llm, self.trader_memory)
|
||||
trader_node = create_trader(self.quick_thinking_llm, self.trader_memory, self.config)
|
||||
|
||||
# Create risk analysis nodes
|
||||
risky_analyst = create_risky_debator(self.quick_thinking_llm)
|
||||
neutral_analyst = create_neutral_debator(self.quick_thinking_llm)
|
||||
safe_analyst = create_safe_debator(self.quick_thinking_llm)
|
||||
risky_analyst = create_risky_debator(self.quick_thinking_llm, self.config)
|
||||
neutral_analyst = create_neutral_debator(self.quick_thinking_llm, self.config)
|
||||
safe_analyst = create_safe_debator(self.quick_thinking_llm, self.config)
|
||||
risk_manager_node = create_risk_manager(
|
||||
self.deep_thinking_llm, self.risk_manager_memory
|
||||
self.deep_thinking_llm, self.risk_manager_memory, self.config
|
||||
)
|
||||
|
||||
# Create workflow
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ class TradingAgentsGraph:
|
|||
self.invest_judge_memory,
|
||||
self.risk_manager_memory,
|
||||
self.conditional_logic,
|
||||
config=self.config,
|
||||
)
|
||||
|
||||
self.propagator = Propagator()
|
||||
|
|
|
|||
Loading…
Reference in New Issue