mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-11-03 16:12:44 +02:00
fix(agents): keep the labelled rating lines in English in every output language (#1435)
- the language instruction exempts the lines the program reads, the "**Rating**:" line and the transaction proposal, so a decision written in another language keeps a rating that can be read
This commit is contained in:
@@ -46,6 +46,15 @@ class TestLanguageInstruction:
|
||||
assert "中文" in out
|
||||
assert "entire response" in out
|
||||
|
||||
def test_the_labelled_lines_stay_as_the_format_gives_them(self):
|
||||
# The rating is read from its "**Rating**:" line; a translated label
|
||||
# leaves the reader a translated negation ("不建议卖出 (Sell)") to find
|
||||
# instead, and a Buy reads as Sell (#1435).
|
||||
from tradingagents.dataflows.config import set_config
|
||||
set_config({"output_language": "中文"})
|
||||
out = get_language_instruction()
|
||||
assert "**Rating**:" in out and "FINAL TRANSACTION PROPOSAL" in out
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.parametrize("rel", REPORT_AGENTS)
|
||||
|
||||
@@ -25,7 +25,14 @@ def get_language_instruction() -> str:
|
||||
lang = get_config().get("output_language", "English")
|
||||
if lang.strip().lower() == "english":
|
||||
return ""
|
||||
return f" Write your entire response in {lang}."
|
||||
# The labelled lines are read by the program, so they keep their English
|
||||
# label and value: a translated rating line leaves the reader prose to
|
||||
# search, where a negated rating ("not a Sell") reads as the call (#1435).
|
||||
return (
|
||||
f" Write your entire response in {lang}, except the labelled lines the format"
|
||||
f" asks for (the \"**Rating**:\" line, \"FINAL TRANSACTION PROPOSAL:\"):"
|
||||
f" keep their label and value in English, exactly as specified."
|
||||
)
|
||||
|
||||
|
||||
def opponent_argument_or_opening(text: str, opponent: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user