From 531ebd2737a23bbcce2ba60f5cb79bd6cae03a06 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Mon, 5 Jan 2026 00:33:28 +0700 Subject: [PATCH] Enhance LlmController with detailed data analysis workflow and proactive tool usage - Expanded system message to include a comprehensive critical analysis workflow for data retrieval and analysis. - Added specific guidelines for retrieving complete data and providing in-depth analysis for backtests, bundles, and indicators. - Emphasized the importance of proactive engagement and multiple tool iterations to ensure thorough responses. - Updated tool usage instructions to improve clarity and effectiveness in user interactions. --- src/Managing.Api/Controllers/LlmController.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Managing.Api/Controllers/LlmController.cs b/src/Managing.Api/Controllers/LlmController.cs index 98156afe..c7200571 100644 --- a/src/Managing.Api/Controllers/LlmController.cs +++ b/src/Managing.Api/Controllers/LlmController.cs @@ -250,12 +250,32 @@ public class LlmController : BaseController TOOL USAGE: - Use tools ONLY for system operations: backtesting, retrieving user data, or real-time market data - - When users ask about their data ("best backtest", "my indicators", "my backtests"), use tools proactively with smart defaults: + - When users ask about their data, use tools proactively with smart defaults: * "Best backtest" → get_backtests_paginated(sortBy='Score', sortOrder='desc', pageSize=10) * "My indicators" → list_indicators() * "Recent backtests" → get_backtests_paginated(sortOrder='desc', pageSize=20) - - Execute multiple tool iterations to provide complete answers - - Only ask for clarification when truly necessary + * "Bundle backtest analysis" → analyze_bundle_backtest(bundleRequestId='X') + + CRITICAL ANALYSIS WORKFLOW (APPLIES TO ALL DATA): + 1. RETRIEVE COMPLETE DATA: + - When asked to analyze ANY entity, ALWAYS fetch FULL details first (never rely on summary/paginated data alone) + - Backtests: get_backtest_by_id() for positions + complete metrics + - Bundles: analyze_bundle_backtest() for aggregated statistics + - Indicators: get_indicator_info() for detailed specs + - Use conversation context: "that X" or "this Y" → extract ID from previous messages + + 2. ANALYZE WITH EXPERTISE: + After retrieving data, provide comprehensive analysis: + + Backtests: Performance (PnL, growth, ROI), Risk (Sharpe, drawdown), Win rate, Position patterns, Strengths/weaknesses, Recommendations + Bundles: Aggregate performance, Best/worst combinations, Optimal parameters, Robustness + Indicators: Use cases, Parameter sensitivity, Combination suggestions, Pitfalls + General: Compare to benchmarks, Statistical significance, Actionable insights + + 3. BE PROACTIVE: + - Execute multiple tool iterations for complete data + - Interpret data, don't just return it + - Only ask for clarification when truly ambiguous Be concise, accurate, and proactive. """;