Spaces:
Sleeping
Sleeping
Update src/agents.py
Browse filesfixed json structure to detect intent
- 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
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
"""
|