This commit is contained in:
parent
2f79956694
commit
7bb51aa7a0
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_research_manager(llm, memory):
|
def create_research_manager(llm, memory):
|
||||||
|
|
@ -99,6 +100,10 @@ def create_research_manager(llm, memory):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Research_Manager")
|
||||||
|
|
||||||
# 更新投資辯論狀態
|
# 更新投資辯論狀態
|
||||||
new_investment_debate_state = {
|
new_investment_debate_state = {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
from langchain_core.messages import AIMessage
|
from langchain_core.messages import AIMessage
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_bear_researcher(llm, memory):
|
def create_bear_researcher(llm, memory):
|
||||||
|
|
@ -103,6 +104,10 @@ def create_bear_researcher(llm, memory):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering to fix common LLM errors
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Bear_Researcher")
|
||||||
|
|
||||||
# 格式化論點
|
# 格式化論點
|
||||||
argument = f"看跌分析師:{response.content}"
|
argument = f"看跌分析師:{response.content}"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
```python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from langchain_core.messages import AIMessage
|
from langchain_core.messages import AIMessage
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_bull_researcher(llm, memory):
|
def create_bull_researcher(llm, memory):
|
||||||
|
|
@ -103,6 +105,10 @@ def create_bull_researcher(llm, memory):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering to fix common LLM errors
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Bull_Researcher")
|
||||||
|
|
||||||
# 格式化論點
|
# 格式化論點
|
||||||
argument = f"看漲分析師:{response.content}"
|
argument = f"看漲分析師:{response.content}"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_risky_debator(llm):
|
def create_risky_debator(llm):
|
||||||
|
|
@ -92,6 +93,10 @@ def create_risky_debator(llm):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Aggressive_Debator")
|
||||||
|
|
||||||
# 格式化論點
|
# 格式化論點
|
||||||
argument = f"激進分析師:{response.content}"
|
argument = f"激進分析師:{response.content}"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
from langchain_core.messages import AIMessage
|
from langchain_core.messages import AIMessage
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_safe_debator(llm):
|
def create_safe_debator(llm):
|
||||||
|
|
@ -93,6 +94,10 @@ def create_safe_debator(llm):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Conservative_Debator")
|
||||||
|
|
||||||
# 格式化論點
|
# 格式化論點
|
||||||
argument = f"安全分析師:{response.content}"
|
argument = f"安全分析師:{response.content}"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
from tradingagents.agents.utils.output_filter import fix_common_llm_errors, validate_and_warn
|
||||||
|
|
||||||
|
|
||||||
def create_neutral_debator(llm):
|
def create_neutral_debator(llm):
|
||||||
|
|
@ -92,6 +93,10 @@ def create_neutral_debator(llm):
|
||||||
|
|
||||||
# 呼叫 LLM 生成回應
|
# 呼叫 LLM 生成回應
|
||||||
response = llm.invoke(prompt)
|
response = llm.invoke(prompt)
|
||||||
|
|
||||||
|
# CRITICAL FIX: Apply output filtering
|
||||||
|
response.content = fix_common_llm_errors(response.content)
|
||||||
|
validate_and_warn(response.content, "Neutral_Debator")
|
||||||
|
|
||||||
# 格式化論點
|
# 格式化論點
|
||||||
argument = f"中立分析師:{response.content}"
|
argument = f"中立分析師:{response.content}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue