Spaces:
Running
Running
agent prompt update
Browse files
app.py
CHANGED
|
@@ -1786,80 +1786,80 @@ def agent_interface(
|
|
| 1786 |
elif WEB_SEARCH_ENABLED and not teams: formatted_search_results = "Web search not performed: Team names were not extracted from your input."
|
| 1787 |
elif not WEB_SEARCH_ENABLED: formatted_search_results = "Web search feature is disabled."
|
| 1788 |
|
| 1789 |
-
analysis_prompt_template = (
|
| 1790 |
-
|
| 1791 |
-
|
| 1792 |
-
|
| 1793 |
-
|
| 1794 |
-
|
| 1795 |
-
|
| 1796 |
-
|
| 1797 |
-
|
| 1798 |
-
|
| 1799 |
-
|
| 1800 |
-
|
| 1801 |
-
|
| 1802 |
-
|
| 1803 |
-
|
| 1804 |
-
|
| 1805 |
-
|
| 1806 |
-
|
| 1807 |
-
|
| 1808 |
-
|
| 1809 |
-
|
| 1810 |
-
|
| 1811 |
-
|
| 1812 |
-
|
| 1813 |
-
|
| 1814 |
-
|
| 1815 |
-
|
| 1816 |
-
|
| 1817 |
-
|
| 1818 |
-
|
| 1819 |
-
|
| 1820 |
-
|
| 1821 |
-
|
| 1822 |
-
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
|
| 1826 |
-
|
| 1827 |
-
|
| 1828 |
-
|
| 1829 |
-
|
| 1830 |
-
|
| 1831 |
-
|
| 1832 |
-
|
| 1833 |
-
|
| 1834 |
-
|
| 1835 |
-
|
| 1836 |
-
|
| 1837 |
-
|
| 1838 |
-
|
| 1839 |
-
|
| 1840 |
-
|
| 1841 |
-
|
| 1842 |
-
|
| 1843 |
-
|
| 1844 |
-
|
| 1845 |
-
|
| 1846 |
-
|
| 1847 |
-
|
| 1848 |
-
|
| 1849 |
-
|
| 1850 |
-
|
| 1851 |
-
|
| 1852 |
-
|
| 1853 |
-
|
| 1854 |
-
|
| 1855 |
-
|
| 1856 |
-
|
| 1857 |
-
|
| 1858 |
-
|
| 1859 |
-
|
| 1860 |
-
|
| 1861 |
-
|
| 1862 |
-
)
|
| 1863 |
|
| 1864 |
analysis_prompt = analysis_prompt_template.format(
|
| 1865 |
match_str=match_str,
|
|
|
|
| 1786 |
elif WEB_SEARCH_ENABLED and not teams: formatted_search_results = "Web search not performed: Team names were not extracted from your input."
|
| 1787 |
elif not WEB_SEARCH_ENABLED: formatted_search_results = "Web search feature is disabled."
|
| 1788 |
|
| 1789 |
+
analysis_prompt_template = (
|
| 1790 |
+
"**Analytical Framework:** Hybrid inference system combining:\n"
|
| 1791 |
+
"1. Statistical Model (historical performance data)\n"
|
| 1792 |
+
"2. Contextual analysis engine (external search results)\n"
|
| 1793 |
+
"3. Market efficiency analyzer (odds movement tracking)\n\n"
|
| 1794 |
+
"## Input Parameters:\n"
|
| 1795 |
+
"* **Match Context:** {match_str}\n"
|
| 1796 |
+
"* **Market Odds:** {odds_str} | Implied Probability: {implied_probs_str}\n"
|
| 1797 |
+
"* **Statistical Model Prediction:** {prediction_str}\n"
|
| 1798 |
+
"* **Statistical Model Probabilities Breakdown:** {probs_str}\n"
|
| 1799 |
+
"* **Probability Delta:** {prob_comparison_sentence}\n\n"
|
| 1800 |
+
"{formatted_search_results}\n\n"
|
| 1801 |
+
"## Pre-processing Instructions:\n"
|
| 1802 |
+
"- From Statistical Model Probabilities Breakdown, identify:\n"
|
| 1803 |
+
" - `top_outcome`: the single outcome (Home Win, Draw, or Away Win) with the highest probability\n"
|
| 1804 |
+
" - `top_prob`: its probability value\n"
|
| 1805 |
+
" - `second_outcome`: the single outcome with the second highest probability (must be different from top_outcome; if tie, prioritize based on better market value or arbitrarily)\n"
|
| 1806 |
+
" - `second_prob`: its probability value\n"
|
| 1807 |
+
"- `top_odds`: market odds for top_outcome from {odds_str}\n"
|
| 1808 |
+
"- `second_odds`: market odds for second_outcome from {odds_str}\n"
|
| 1809 |
+
"- Calculate `confidence_stars`: โ
โโโโ to โ
โ
โ
โ
โ
based on top_prob (rounded to nearest star, e.g., 40% โ โ
โ
โโโ)\n"
|
| 1810 |
+
"- `confidence_range`: [{top_prob:.1f}-5]% to [{top_prob:.1f}+5]%\n"
|
| 1811 |
+
"- If no historical odds data: set `line_movement` = 0%\n"
|
| 1812 |
+
"- Extract `top_factor`, `secondary_factor`, and weights from external search context\n"
|
| 1813 |
+
"- `expiration_time`: 1 hour before match or earlier if breaking news is found\n"
|
| 1814 |
+
"- `contextual_summary`: summarize key findings from search results\n"
|
| 1815 |
+
"- `contextual_rationale`: summarize contextual reasoning\n"
|
| 1816 |
+
"- `weighting_logic`: explain how Statistical Model and Contextual data were combined\n"
|
| 1817 |
+
"- `hedging_insight`: explain how to hedge between top_outcome and second_outcome\n"
|
| 1818 |
+
"- `preferred_outcome`: top_outcome if contextual supports it stronger; otherwise second_outcome (include brief why)\n\n"
|
| 1819 |
+
"## Output Structure Requirements:\n"
|
| 1820 |
+
"**CRITICAL FORMATTING RULES:**\n"
|
| 1821 |
+
"1. ABSOLUTELY NO SECTION MARKERS (###...###) IN FINAL OUTPUT\n"
|
| 1822 |
+
"2. Use ONLY these exact section headers:\n"
|
| 1823 |
+
" - **Recommendation**\n"
|
| 1824 |
+
" - **Conflict Resolution Analysis**\n"
|
| 1825 |
+
" - **Market Efficiency Analysis**\n"
|
| 1826 |
+
" - **Risk Analysis**\n"
|
| 1827 |
+
" - **Prediction Validity Window**\n"
|
| 1828 |
+
"3. Confidence range matches top_prob ยฑ5%\n"
|
| 1829 |
+
"4. Dual recommendation contains exactly the top two model outcomes (no more, no less)\n"
|
| 1830 |
+
"5. Three key insights in executive summary\n"
|
| 1831 |
+
"6. All outcomes in recommendations must be single: Home Win, Draw, or Away Win. Strictly prohibit combined outcomes like 'Aston Villa or Draw (X2)', 'Double Chance', '1X', etc.\n\n"
|
| 1832 |
+
"## Mandatory Output Format:\n"
|
| 1833 |
+
"**Recommendation**\n"
|
| 1834 |
+
"๐ DUAL RECOMMENDATION: [top_outcome] @ [top_odds] OR [second_outcome] @ [second_odds] | Confidence: [confidence_stars] ([confidence_range])\n"
|
| 1835 |
+
"๐ [Key Insight 1] (brief explanation)\n"
|
| 1836 |
+
"๐ [Key Insight 2] (brief explanation)\n"
|
| 1837 |
+
"๐ [Key Insight 3] (brief explanation)\n\n"
|
| 1838 |
+
"โฎ Recommendation Approach:\n"
|
| 1839 |
+
"โฝ Preferred Outcome: [preferred_outcome] (show why it's stronger)\n\n"
|
| 1840 |
+
"**Conflict Resolution Analysis**\n"
|
| 1841 |
+
"โฎ Source Discrepancy Breakdown\n"
|
| 1842 |
+
"โธ Statistical Model Perspective ({top_prob:.1f}%) - [statistical rationale for top_outcome and second_outcome]\n"
|
| 1843 |
+
"โธ External Contextual Analysis - [contextual summary]\n"
|
| 1844 |
+
"โธ Resolution Framework - [weighting logic]\n\n"
|
| 1845 |
+
"**Market Efficiency Analysis**\n"
|
| 1846 |
+
"โธ [Statistical vs implied probability analysis for top two outcomes]\n"
|
| 1847 |
+
"โธ [Market pattern recognition]\n\n"
|
| 1848 |
+
"**Risk Analysis**\n"
|
| 1849 |
+
"โข Statistical Model Uncertainty: [low/med/high] - [reason]\n"
|
| 1850 |
+
"โข Context Volatility: [low/med/high] - [reason]\n"
|
| 1851 |
+
"โข Market Correlation: [low/med/high] - [hedging insight]\n\n"
|
| 1852 |
+
"**Prediction Validity Window**\n"
|
| 1853 |
+
"This recommendation is valid until:\n"
|
| 1854 |
+
"โข [expiration_time]\n\n"
|
| 1855 |
+
"## Validation Checks:\n"
|
| 1856 |
+
"BEFORE FINALIZING, VERIFY:\n"
|
| 1857 |
+
"1. No section markers present\n"
|
| 1858 |
+
"2. All 5 required sections exist with exact headers\n"
|
| 1859 |
+
"3. Confidence range matches top_prob ยฑ5%\n"
|
| 1860 |
+
"4. Dual recommendation contains exactly two single outcomes\n"
|
| 1861 |
+
"5. Three key insights in executive summary\n"
|
| 1862 |
+
)
|
| 1863 |
|
| 1864 |
analysis_prompt = analysis_prompt_template.format(
|
| 1865 |
match_str=match_str,
|