CoderHassan commited on
Commit
77b78bf
·
verified ·
1 Parent(s): d240435

Delete agents/intent.py

Browse files
Files changed (1) hide show
  1. agents/intent.py +0 -32
agents/intent.py DELETED
@@ -1,32 +0,0 @@
1
- """Agent 1 — Intent Agent (Gemini API, no paid Maps needed)"""
2
- import os, json, re
3
- import google.generativeai as genai
4
-
5
- def run(message: str) -> dict:
6
- api_key = os.environ.get("GEMINI_API_KEY", "your_MapAI")
7
- if not api_key:
8
- raise ValueError("GEMINI_API_KEY secret not set in HuggingFace Space settings.")
9
-
10
- genai.configure(api_key=api_key)
11
- model = genai.GenerativeModel("gemini-1.5-flash") # free-tier model
12
-
13
- prompt = f"""You are a service request parser for Pakistan's informal economy.
14
- Extract structured info from the user message. Respond ONLY with valid JSON, no markdown.
15
-
16
- User message: "{message}"
17
-
18
- Return exactly this JSON structure:
19
- {{
20
- "service_type": "<one of: AC Technician, Plumber, Electrician, Tutor, Beautician, Carpenter, Painter, Driver, Maid, Delivery Worker>",
21
- "location": "<area name, e.g. G-13>",
22
- "time": "<e.g. tomorrow morning, today evening, asap>",
23
- "language": "<urdu | roman_urdu | english | mixed>",
24
- "confidence": <0.0 to 1.0>
25
- }}
26
-
27
- If a field cannot be determined, use null."""
28
-
29
- response = model.generate_content(prompt)
30
- raw = response.text.strip()
31
- raw = re.sub(r"```json|```", "", raw).strip()
32
- return json.loads(raw)