fix(EX-0000): improve parser prompt
Some checks failed
CI / checks (push) Has been cancelled

Add a sample booking input and expected JSON output to guide extraction.

Clarify missing value handling, ISO dates, and decimal conversion.
This commit is contained in:
Ruidy 2026-06-07 19:10:03 -04:00
parent ffa3f58567
commit a1c631c850
No known key found for this signature in database
GPG key ID: 705C24D202990805

View file

@ -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:`,
}