Skip to content

Commit d58fbcf

Browse files
committed
Enhance JSON prompt reliability and validation
Improve the prompt to ensure generation of valid JSON by: - Adding explicit formatting requirements and validation rules. - Providing a detailed JSON schema with mandatory fields. - Specifying parsing rules for multi-day, multi-track events. - Including constraints for date/time formats and attendance. - Adding example input/output for clarity and adherence. - Emphasizing strict compliance with the JSON schema.
1 parent 22e6fbf commit d58fbcf

1 file changed

Lines changed: 155 additions & 1 deletion

File tree

RFPResponsePOC/RFPResponsePOC.Client/wwwroot/Prompts/Proposal.prompt

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,158 @@ The expected JSON output would be:
147147
"notes": "3-day elevator engineering conference; Banquet style seating, 1h lunch"
148148
}
149149
]
150-
```json
150+
```json
151+
````````
152+
153+
This is the description of what the code block changes:
154+
Improve the prompt to produce more reliable JSON output by adding explicit formatting requirements, validation rules, and fixing syntax issues
155+
156+
This is the code block that represents the suggested code change:
157+
158+
````````
159+
You are a JSON data extraction specialist. Your task is to parse RFP content and return ONLY valid JSON.
160+
161+
CRITICAL: Your response must contain ONLY valid JSON. No explanations, no text before or after, no markdown formatting.
162+
163+
### RFP CONTENTS START
164+
{{OCRResult}}
165+
### RFP CONTENTS STOP
166+
167+
EXTRACT the venue room requirements into a JSON array using this exact structure:
168+
169+
REQUIRED JSON SCHEMA:
170+
[
171+
{
172+
"name": "string (required, descriptive room/session name)",
173+
"start_date": "string (YYYY-MM-DD format or empty string "")",
174+
"start_time": "string (required, HH:MM:SS format)",
175+
"end_date": "string (YYYY-MM-DD format or empty string "")",
176+
"end_time": "string (required, HH:MM:SS format)",
177+
"room_type": "string (required, must be one of: Banquet, Conference, Theatre, Classroom, U-Shape, Boardroom, Hollow Square, Crescent Rounds, Reception)",
178+
"attendance": "number (required, integer > 0)",
179+
"notes": "string (required, can be empty string "")"
180+
}
181+
]
182+
183+
PARSING RULES:
184+
1. Identify total event duration (days/hours)
185+
2. Create separate entries for each distinct session/activity/meal
186+
3. For multi-day events, create entries for each day
187+
4. For multi-track events, create entries for each track per day
188+
5. Include meals/breaks as separate entries if mentioned
189+
6. If dates not specified, use empty strings ("") for start_date and end_date
190+
7. Times must be in 24-hour HH:MM:SS format (e.g., "08:00:00", "17:30:00")
191+
8. Attendance must be a positive integer
192+
9. Choose the closest room_type from the allowed list
193+
10. All string fields must be properly escaped for JSON
194+
195+
VALIDATION REQUIREMENTS:
196+
- Output must be valid JSON array
197+
- All required fields must be present
198+
- No null values allowed
199+
- room_type must match exactly one of the predefined options
200+
- Times must follow HH:MM:SS format
201+
- Dates must follow YYYY-MM-DD format or be empty strings
202+
- attendance must be positive integer
203+
204+
EXAMPLE INPUT: "3 day conference for elevator engineers. 2 tracks for 1.5 hour sessions from 8:00am to 5:00pm with breaks and 1 hour lunch for 300 attendees. Theatre style seating, max 150 per room."
205+
206+
EXAMPLE OUTPUT:
207+
[
208+
{
209+
"name": "Session Track 1 - Day 1",
210+
"start_date": "",
211+
"start_time": "08:00:00",
212+
"end_date": "",
213+
"end_time": "17:00:00",
214+
"room_type": "Theatre",
215+
"attendance": 150,
216+
"notes": "Track 1 sessions with theatre style seating, includes breaks"
217+
},
218+
{
219+
"name": "Session Track 2 - Day 1",
220+
"start_date": "",
221+
"start_time": "08:00:00",
222+
"end_date": "",
223+
"end_time": "17:00:00",
224+
"room_type": "Theatre",
225+
"attendance": 150,
226+
"notes": "Track 2 sessions with theatre style seating, includes breaks"
227+
},
228+
{
229+
"name": "Lunch - Day 1",
230+
"start_date": "",
231+
"start_time": "12:00:00",
232+
"end_date": "",
233+
"end_time": "13:00:00",
234+
"room_type": "Banquet",
235+
"attendance": 300,
236+
"notes": "Lunch for all attendees"
237+
},
238+
{
239+
"name": "Session Track 1 - Day 2",
240+
"start_date": "",
241+
"start_time": "08:00:00",
242+
"end_date": "",
243+
"end_time": "17:00:00",
244+
"room_type": "Theatre",
245+
"attendance": 150,
246+
"notes": "Track 1 sessions with theatre style seating, includes breaks"
247+
},
248+
{
249+
"name": "Session Track 2 - Day 2",
250+
"start_date": "",
251+
"start_time": "08:00:00",
252+
"end_date": "",
253+
"end_time": "17:00:00",
254+
"room_type": "Theatre",
255+
"attendance": 150,
256+
"notes": "Track 2 sessions with theatre style seating, includes breaks"
257+
},
258+
{
259+
"name": "Lunch - Day 2",
260+
"start_date": "",
261+
"start_time": "12:00:00",
262+
"end_date": "",
263+
"end_time": "13:00:00",
264+
"room_type": "Banquet",
265+
"attendance": 300,
266+
"notes": "Lunch for all attendees"
267+
},
268+
{
269+
"name": "Session Track 1 - Day 3",
270+
"start_date": "",
271+
"start_time": "08:00:00",
272+
"end_date": "",
273+
"end_time": "17:00:00",
274+
"room_type": "Theatre",
275+
"attendance": 150,
276+
"notes": "Track 1 sessions with theatre style seating, includes breaks"
277+
},
278+
{
279+
"name": "Session Track 2 - Day 3",
280+
"start_date": "",
281+
"start_time": "08:00:00",
282+
"end_date": "",
283+
"end_time": "17:00:00",
284+
"room_type": "Theatre",
285+
"attendance": 150,
286+
"notes": "Track 2 sessions with theatre style seating, includes breaks"
287+
},
288+
{
289+
"name": "Lunch - Day 3",
290+
"start_date": "",
291+
"start_time": "12:00:00",
292+
"end_date": "",
293+
"end_time": "13:00:00",
294+
"room_type": "Banquet",
295+
"attendance": 300,
296+
"notes": "Lunch for all attendees"
297+
}
298+
]
299+
300+
REMEMBER: Return ONLY the JSON array. No additional text or formatting.
301+
````````
302+
303+
304+
# Response

0 commit comments

Comments
 (0)