From 07d2c4923544d0d71beddad08c67a65c910bec7c Mon Sep 17 00:00:00 2001 From: Jeffrey Chu Date: Wed, 22 Oct 2025 19:54:47 +0800 Subject: [PATCH] support traditional and simplified Chinese as agents' output --- cli/main.py | 10 +++++++ cli/utils.py | 15 +++++++++++ .../agents/analysts/fundamentals_analyst.py | 14 ++++++++-- .../agents/analysts/market_analyst.py | 14 ++++++++-- tradingagents/agents/analysts/news_analyst.py | 13 +++++++++- .../agents/analysts/social_media_analyst.py | 15 +++++++++-- .../agents/managers/research_manager.py | 15 +++++++++-- tradingagents/agents/managers/risk_manager.py | 15 +++++++++-- .../agents/researchers/bear_researcher.py | 14 ++++++++-- .../agents/researchers/bull_researcher.py | 14 ++++++++-- .../agents/risk_mgmt/aggresive_debator.py | 15 +++++++++-- .../agents/risk_mgmt/conservative_debator.py | 16 ++++++++++-- .../agents/risk_mgmt/neutral_debator.py | 15 +++++++++-- tradingagents/agents/trader/trader.py | 15 +++++++++-- tradingagents/default_config.py | 1 + tradingagents/graph/setup.py | 26 ++++++++++--------- tradingagents/graph/trading_graph.py | 1 + 17 files changed, 193 insertions(+), 35 deletions(-) diff --git a/cli/main.py b/cli/main.py index 2e06d50c..01edd085 100644 --- a/cli/main.py +++ b/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"] diff --git a/cli/utils.py b/cli/utils.py index ec7b0f78..eaabef62 100644 --- a/cli/utils.py +++ b/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 diff --git a/tradingagents/agents/analysts/fundamentals_analyst.py b/tradingagents/agents/analysts/fundamentals_analyst.py index e20139cb..05e4a95b 100644 --- a/tradingagents/agents/analysts/fundamentals_analyst.py +++ b/tradingagents/agents/analysts/fundamentals_analyst.py @@ -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( diff --git a/tradingagents/agents/analysts/market_analyst.py b/tradingagents/agents/analysts/market_analyst.py index c955dd76..16243d08 100644 --- a/tradingagents/agents/analysts/market_analyst.py +++ b/tradingagents/agents/analysts/market_analyst.py @@ -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( diff --git a/tradingagents/agents/analysts/news_analyst.py b/tradingagents/agents/analysts/news_analyst.py index 03b4fae4..6042f5fe 100644 --- a/tradingagents/agents/analysts/news_analyst.py +++ b/tradingagents/agents/analysts/news_analyst.py @@ -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( diff --git a/tradingagents/agents/analysts/social_media_analyst.py b/tradingagents/agents/analysts/social_media_analyst.py index b25712d7..37a350f1 100644 --- a/tradingagents/agents/analysts/social_media_analyst.py +++ b/tradingagents/agents/analysts/social_media_analyst.py @@ -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( diff --git a/tradingagents/agents/managers/research_manager.py b/tradingagents/agents/managers/research_manager.py index c537fa2f..143c1e92 100644 --- a/tradingagents/agents/managers/research_manager.py +++ b/tradingagents/agents/managers/research_manager.py @@ -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 = { diff --git a/tradingagents/agents/managers/risk_manager.py b/tradingagents/agents/managers/risk_manager.py index fba763d6..e4eec1cc 100644 --- a/tradingagents/agents/managers/risk_manager.py +++ b/tradingagents/agents/managers/risk_manager.py @@ -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) diff --git a/tradingagents/agents/researchers/bear_researcher.py b/tradingagents/agents/researchers/bear_researcher.py index 6634490a..33072a1c 100644 --- a/tradingagents/agents/researchers/bear_researcher.py +++ b/tradingagents/agents/researchers/bear_researcher.py @@ -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) diff --git a/tradingagents/agents/researchers/bull_researcher.py b/tradingagents/agents/researchers/bull_researcher.py index b03ef755..2cacbf1a 100644 --- a/tradingagents/agents/researchers/bull_researcher.py +++ b/tradingagents/agents/researchers/bull_researcher.py @@ -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) diff --git a/tradingagents/agents/risk_mgmt/aggresive_debator.py b/tradingagents/agents/risk_mgmt/aggresive_debator.py index 7e2b4937..e233ef0b 100644 --- a/tradingagents/agents/risk_mgmt/aggresive_debator.py +++ b/tradingagents/agents/risk_mgmt/aggresive_debator.py @@ -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) diff --git a/tradingagents/agents/risk_mgmt/conservative_debator.py b/tradingagents/agents/risk_mgmt/conservative_debator.py index c56e16ad..1d1b74cd 100644 --- a/tradingagents/agents/risk_mgmt/conservative_debator.py +++ b/tradingagents/agents/risk_mgmt/conservative_debator.py @@ -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) diff --git a/tradingagents/agents/risk_mgmt/neutral_debator.py b/tradingagents/agents/risk_mgmt/neutral_debator.py index a6d2ef5c..a3e0767e 100644 --- a/tradingagents/agents/risk_mgmt/neutral_debator.py +++ b/tradingagents/agents/risk_mgmt/neutral_debator.py @@ -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) diff --git a/tradingagents/agents/trader/trader.py b/tradingagents/agents/trader/trader.py index 1b05c35d..3b105e47 100644 --- a/tradingagents/agents/trader/trader.py +++ b/tradingagents/agents/trader/trader.py @@ -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, ] diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py index 1f40a2a2..61b5e2ae 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -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", } diff --git a/tradingagents/graph/setup.py b/tradingagents/graph/setup.py index b270ffc0..a130b8b6 100644 --- a/tradingagents/graph/setup.py +++ b/tradingagents/graph/setup.py @@ -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 diff --git a/tradingagents/graph/trading_graph.py b/tradingagents/graph/trading_graph.py index 3de9ee89..9428f50e 100644 --- a/tradingagents/graph/trading_graph.py +++ b/tradingagents/graph/trading_graph.py @@ -110,6 +110,7 @@ class TradingAgentsGraph: self.invest_judge_memory, self.risk_manager_memory, self.conditional_logic, + config=self.config, ) self.propagator = Propagator()