ajaykumar0712 commited on
Commit
bc4b3e7
·
verified ·
1 Parent(s): 5c48228

Update src/agents.py

Browse files

fixed json structure to detect intent

Files changed (1) hide show
  1. src/agents.py +18 -14
src/agents.py CHANGED
@@ -50,20 +50,24 @@ llm = LLM(
50
  def detect_intent(user_query):
51
 
52
  prompt = f"""
53
- You are an intent classification and entity extraction engine for a cricket analytics app.
54
- You understand common cricketing abbreviations and culture.
55
-
56
- Return STRICT JSON only.
57
-
58
- Supported intents:
59
- - match_prediction
60
- - group_progression
61
- - tournament_prediction
62
- - context_update
63
-
64
- Rules:
65
- - Team names should be cricket country names or abbreviations
66
- - If not found → return null
 
 
 
 
67
 
68
  User: {user_query}
69
  """
 
50
  def detect_intent(user_query):
51
 
52
  prompt = f"""
53
+ You are an intent classifier for a cricket app.
54
+ Return ONLY valid JSON. No explanation. No markdown.
55
+
56
+ The JSON must have EXACTLY these fields:
57
+ {{
58
+ "intent": "match_prediction" | "group_progression" | "tournament_prediction" | "unknown",
59
+ "teamA": "country name or null",
60
+ "teamB": "country name or null",
61
+ "group": "group letter like A, B, C or null",
62
+ "venue": "city or null",
63
+ "tournament_team": "country 1" | "country 2" | "country 3" | "country 4" | "null"
64
+ }}
65
+
66
+ Examples:
67
+ - "Who wins if India take on the Aussies" → intent: match_prediction, teamA: India, teamB: Australia
68
+ - "Who advances from Group C" → intent: group_progression, group: C
69
+ - "Who are the favourites to win" → intent: tournament_prediction
70
+ - "Give me the semi finalists" → intent: tournament_prediction
71
 
72
  User: {user_query}
73
  """