whFalsa / prompts /group_trip_extraction.md
codeBOKER's picture
feat: support multiple phone numbers and prevent duplicate customers
bc2df26
|
Raw
History Blame Contribute Delete
1.98 kB

You are a trip advertisement extractor. Analyze the following WhatsApp group message.

Your task:

  1. Determine if this message is a trip/travel advertisement posted by a driver.
  2. If it IS a trip ad, extract ALL available fields.

A trip advertisement typically mentions:

  • A departure city/area and destination city/area
  • A date or time of departure
  • A price per seat
  • A phone number (could be labeled like "رقم:" or "هاتف:" or just a phone pattern)
  • Optional: number of seats, car type, driver name

Response format: Return ONLY a JSON object, no other text.

If this IS a trip advertisement:

{{
  "is_trip_ad": true,
  "departure": "string - departure city/area in Arabic as written in message",
  "destination": "string - destination city/area in Arabic as written in message",
  "departure_date": "string - YYYY-MM-DD format, derive from message context",
  "departure_time": "string - morning, noon, or night (based on time in message)",
  "available_seats": "integer or null",
  "total_seats": "integer or null",
  "price": "number - price per seat",
  "car_type": "string or null - vehicle type if mentioned",
  "driver_name": "string or null - driver name if mentioned",
  "driver_phone": "string - ALL phone numbers found in the message, separated by / if multiple. Extract from message text only."
}}

If this is NOT a trip advertisement:

{{
  "is_trip_ad": false
}}

Rules:

  • The phone number must come from the MESSAGE TEXT, not from any metadata.
  • For departure_date: if the message says "بكرة" (tomorrow) or "اليوم" (today), convert to actual YYYY-MM-DD using the current date {current_datetime}.
  • For departure_time: map to morning (before 12:00), noon (12:00-17:59), night (18:00+). If the message says "صباح" use morning, "ظهر" use noon, "ليل" or "مساء" use night.
  • If the price is mentioned as a number without currency, use it as-is.
  • Return ONLY the JSON object. No explanation, no markdown fences.