ChillThrills commited on
Commit
1baf3d6
ยท
verified ยท
1 Parent(s): 638392d

prompt update

Browse files
Files changed (1) hide show
  1. app.py +89 -73
app.py CHANGED
@@ -1787,79 +1787,95 @@ def agent_interface(
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,
 
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
+
1795
+ "## Input Parameters:\n"
1796
+ "* **Match Context:** {match_str}\n"
1797
+ "* **Market Odds:** {odds_str} | Implied Probability: {implied_probs_str}\n"
1798
+ "* **Statistical Model Prediction:** {prediction_str}\n"
1799
+ "* **Statistical Model Probabilities Breakdown:** {probs_str}\n"
1800
+ "* **Probability Delta:** {prob_comparison_sentence}\n\n"
1801
+
1802
+ "{formatted_search_results}\n\n"
1803
+
1804
+ "## STRICT PRE-PROCESSING INSTRUCTIONS:\n"
1805
+ "1. **OUTCOME SELECTION CRITERIA (MUST FOLLOW):**\n"
1806
+ " - Extract the TOP 2 SINGLE OUTCOMES from the combined analysis\n"
1807
+ " - Combine probabilities from: Statistical Model ({model_conf_pct:.1f}%) + Contextual weighting\n"
1808
+ " - Select the TWO highest probability SINGLE outcomes (Home Win, Draw, or Away Win ONLY)\n"
1809
+ " - **ABSOLUTELY NO DOUBLE CHANCE OUTCOMES (X2, 1X, 12)**\n"
1810
+ " - **ABSOLUTELY NO COMBINED OUTCOMES**\n"
1811
+ " - If Statistical Model and Contextual Analysis agree, still output 2 distinct single outcomes\n"
1812
+ "\n"
1813
+ "2. **Calculate `confidence_stars`:** โ˜…โ˜†โ˜†โ˜†โ˜† to โ˜…โ˜…โ˜…โ˜…โ˜… based on Statistical Model confidence (rounded)\n"
1814
+ "3. **`confidence_range`:** [{model_conf_pct:.1f}-5]% to [{model_conf_pct:.1f}+5]%\n"
1815
+ "4. **If no historical odds:** set `line_movement` = 0%\n"
1816
+ "5. **`expiration_time`:** 1 hour before match or earlier if breaking news\n"
1817
+ "6. **`contextual_summary`:** summarize key findings from search results\n"
1818
+ "7. **`weighting_logic`:** explain how Statistical Model and Contextual data were combined\n"
1819
+ "\n"
1820
+ "## OUTPUT STRUCTURE REQUIREMENTS (CRITICAL):\n"
1821
+ "**FORMAT RULES (NON-NEGOTIABLE):**\n"
1822
+ "1. ABSOLUTELY NO SECTION MARKERS (###...###) IN FINAL OUTPUT\n"
1823
+ "2. Use ONLY these exact section headers:\n"
1824
+ " - **Recommendation**\n"
1825
+ " - **Conflict Resolution Analysis**\n"
1826
+ " - **Market Efficiency Analysis**\n"
1827
+ " - **Risk Analysis**\n"
1828
+ " - **Prediction Validity Window**\n"
1829
+ "\n"
1830
+ "## MANDATORY OUTPUT FORMAT:\n"
1831
+ "**Recommendation**\n"
1832
+ "๐Ÿ† DUAL RECOMMENDATION: [Outcome 1] @ [Market Odds for Outcome 1] OR [Outcome 2] @ [Market Odds for Outcome 2] | Confidence: [โ˜…โ˜…โ˜…โ˜†โ˜†] ([55% to 65%])\n"
1833
+ "**MUST BE ONLY 2 SINGLE OUTCOMES FROM: Home Win, Draw, Away Win**\n"
1834
+ "๐Ÿ” [Key Insight 1] (brief explanation)\n"
1835
+ "๐Ÿ” [Key Insight 2] (brief explanation)\n"
1836
+ "๐Ÿ” [Key Insight 3] (brief explanation)\n"
1837
+ "\n"
1838
+ "โ–ฎ Recommendation Approach:\n"
1839
+ "โšฝ Preferred Outcome: [Either Outcome 1 or Outcome 2, whichever has stronger support] (show why it's stronger)\n"
1840
+ "\n"
1841
+ "**Conflict Resolution Analysis**\n"
1842
+ "โ–ฎ Source Discrepancy Breakdown\n"
1843
+ "โ–ธ Statistical Model Perspective ({model_conf_pct:.1f}%) - [statistical rationale for top 2 outcomes]\n"
1844
+ "๏ฟฝ๏ฟฝ External Contextual Analysis - [contextual summary supporting the 2 outcomes]\n"
1845
+ "โ–ธ Resolution Framework - [weighting logic explaining why THESE 2 outcomes were selected]\n"
1846
+ "\n"
1847
+ "**Market Efficiency Analysis**\n"
1848
+ "โ–ธ [Statistical vs implied probability analysis for the 2 selected outcomes]\n"
1849
+ "โ–ธ [Market pattern recognition specifically for these outcomes]\n"
1850
+ "\n"
1851
+ "**Risk Analysis**\n"
1852
+ "โ€ข Statistical Model Uncertainty: [low/med/high] - [reason specific to the 2 outcomes]\n"
1853
+ "โ€ข Context Volatility: [low/med/high] - [reason specific to the 2 outcomes]\n"
1854
+ "โ€ข Market Correlation: [low/med/high] - [hedging insight between the 2 outcomes]\n"
1855
+ "\n"
1856
+ "**Prediction Validity Window**\n"
1857
+ "This recommendation is valid until:\n"
1858
+ "โ€ข [Expiration time]\n"
1859
+ "\n"
1860
+ "## VALIDATION CHECKS (CRITICAL):\n"
1861
+ "BEFORE FINALIZING OUTPUT, VERIFY ALL:\n"
1862
+ "1. โœ… DUAL RECOMMENDATION contains EXACTLY 2 SINGLE OUTCOMES (no double chance)\n"
1863
+ "2. โœ… Outcomes are from: Home Win, Draw, OR Away Win ONLY\n"
1864
+ "3. โœ… No section markers present\n"
1865
+ "4. โœ… All 5 required sections exist with exact headers\n"
1866
+ "5. โœ… Confidence range matches model confidence ยฑ5%\n"
1867
+ "6. โœ… Three key insights in executive summary\n"
1868
+ "7. โœ… Market odds correspond to the correct selected outcomes\n"
1869
+ "\n"
1870
+ "## EXAMPLE OF CORRECT FORMAT:\n"
1871
+ "**Recommendation**\n"
1872
+ "๐Ÿ† DUAL RECOMMENDATION: Home Win @ 2.10 OR Draw @ 3.50 | Confidence: โ˜…โ˜…โ˜…โ˜†โ˜† (45% to 55%)\n"
1873
+ "(NOT: Home Win @ 2.10 OR Away Win or Draw @ 1.75 โ† THIS IS WRONG)\n"
1874
+ "(NOT: Home Win @ 2.10 OR Draw @ 3.50 OR Away Win @ 3.80 โ† THIS IS WRONG)\n"
1875
+ "๐Ÿ” Insight 1...\n"
1876
+ "๐Ÿ” Insight 2...\n"
1877
+ "๐Ÿ” Insight 3...\n"
1878
+ )
1879
 
1880
  analysis_prompt = analysis_prompt_template.format(
1881
  match_str=match_str,