Files
tradingagents/tests/test_news_analyst_prompt.py
T
Yijia-Xiao 052a98d6eb fix(agents): serve the run's instrument, whatever symbol the model passes
- the nine ticker-taking tools read company_of_interest from graph state, like trade_date; the model no longer supplies a symbol (it had passed indicator names such as RSI, a real ticker)
- the News Analyst prompt and the tool descriptions no longer ask for a ticker
2026-09-29 05:57:17 +00:00

26 lines
804 B
Python

"""Guard the news analyst prompt against tool-signature drift (#1116).
The prompt used to advertise ``get_news(query, ...)``, tricking the LLM into
hallucinating free-text query calls. The instrument now comes from the run's
state, so the model passes only the window.
"""
import inspect
import pytest
import tradingagents.agents.analysts.news_analyst as na
from tradingagents.agents.tools import get_news
@pytest.mark.unit
def test_get_news_takes_the_window_not_a_query():
arg_names = set(get_news.tool_call_schema.model_json_schema()["properties"])
assert arg_names == {"start_date", "end_date"}
@pytest.mark.unit
def test_news_prompt_matches_get_news_signature():
src = inspect.getsource(na)
assert "get_news(start_date, end_date)" in src
assert "get_news(query" not in src