mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
Prevent AI hallucination of runtime parameters by hiding them from the tool schema. Architecture: - Public tool functions (buy/sell) only expose symbol and amount to AI - Use **kwargs to accept hidden parameters (signature, job_id, today_date, session_id) - Internal _impl functions contain the actual business logic - ContextInjector injects parameters into kwargs (invisible to AI) Benefits: - AI cannot see or hallucinate signature/job_id/session_id parameters - Cleaner tool schema focuses on trading-relevant parameters only - Defense-in-depth: ContextInjector still overrides any provided values - More maintainable: clear separation of public API vs internal implementation Example AI sees: buy(symbol: str, amount: int) -> dict Actual execution: buy(symbol="AAPL", amount=10, signature="gpt-5", job_id="...", ...) Fixes #TBD