From a1c631c850045d09200c58a5f40abe17200dc60a Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sun, 7 Jun 2026 19:10:03 -0400 Subject: [PATCH] fix(EX-0000): improve parser prompt Add a sample booking input and expected JSON output to guide extraction. Clarify missing value handling, ISO dates, and decimal conversion. --- internal/driver/parser/client.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/internal/driver/parser/client.go b/internal/driver/parser/client.go index 5cf9774..d2f1f0c 100644 --- a/internal/driver/parser/client.go +++ b/internal/driver/parser/client.go @@ -23,7 +23,9 @@ func NewBookingAgentParser(model string) *BookingAgentParser { return &BookingAgentParser{ llmClient: openai.NewClient(), model: model, - systemPrompt: ` Extract the following fields from the booking content and return a JSON object with this exact structure (all fields required, use null or empty string if not available): + systemPrompt: ` Extract booking reservation fields from the booking content and return a JSON object with this exact structure. + All fields are required. Use an empty string for missing string values, 0 for missing integer values, and "0" for missing number strings. + Use ISO dates in YYYY-MM-DD format. Convert comma decimals to dot decimals. { "data": { @@ -43,6 +45,30 @@ func NewBookingAgentParser(model string) *BookingAgentParser { } Respond ONLY with the JSON object above, wrapped in a top-level "data" field as shown, no code fences. + + Example input: + Date d'arrivee jeu. 3 avr. 2025 Date de depart dim. 6 avr. 2025 Duree de sejour : 3 nuits Nombre de personnes : 2 + Montant total EUR 186 Nom du client : Olga Korovina okorov.905387@guest.booking.com + Numero de reservation : 4453602306 Montant soumis a commission : EUR 177 Commission : EUR 31,86 + Maison 1 Chambre T2 - VillaFleurie au bourg du Gosier EUR 186 Standard Rate EUR 59 Sous-total EUR 177 Conversation avec le client Aucun message + + Example output: + { + "data": { + "arrival_date": "2025-04-03", + "booking_fees": "31.86", + "booking_id": "4453602306", + "departure_date": "2025-04-06", + "stay_length": 3, + "guest_email": "okorov.905387@guest.booking.com", + "guest_name": "Olga Korovina", + "guest_number": 2, + "guest_phone": "", + "room_booked": "Maison 1 Chambre T2 - VillaFleurie au bourg du Gosier", + "standard_rate": "59", + "special_requests": "" + } + } Booking content:`, }