mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-08-01 19:34:24 +03:00
fix(analysts): align the news prompt with the get_news tool signature
- prompt advertised get_news(query, ...) but the tool takes a ticker, so the model hallucinated free-text query calls - advertise get_news(ticker, start_date, end_date) #1116
This commit is contained in:
25
tests/test_news_analyst_prompt.py
Normal file
25
tests/test_news_analyst_prompt.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Guard the news analyst prompt against tool-signature drift (#1116).
|
||||
|
||||
The prompt used to advertise ``get_news(query, ...)`` while the tool takes a
|
||||
``ticker``, tricking the LLM into hallucinating free-text query calls.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
|
||||
import tradingagents.agents.analysts.news_analyst as na
|
||||
from tradingagents.agents.utils.news_data_tools import get_news
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_get_news_takes_ticker_not_query():
|
||||
arg_names = set(get_news.args.keys())
|
||||
assert "ticker" in arg_names
|
||||
assert "query" not in arg_names
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_news_prompt_matches_get_news_signature():
|
||||
src = inspect.getsource(na)
|
||||
assert "get_news(ticker, start_date, end_date)" in src
|
||||
assert "get_news(query" not in src
|
||||
Reference in New Issue
Block a user