t commited on
Commit
81b97ed
·
1 Parent(s): 94e598e

fix: escape curly braces in prompt templates to resolve KeyError during formatting

Browse files
Files changed (1) hide show
  1. nvidia_prompts.py +18 -17
nvidia_prompts.py CHANGED
@@ -1,3 +1,4 @@
 
1
  BIOLOGY_PROMPT_TEMPLATE = """**System Role:** You are a specialized Biology question classifier for NEET exams. Your task is to map questions to their corresponding chapter from the NCERT Biology syllabus.
2
 
3
  **Syllabus Chapters (Use these exact titles):**
@@ -48,19 +49,19 @@ BIOLOGY_PROMPT_TEMPLATE = """**System Role:** You are a specialized Biology ques
48
  **Output JSON Schema:**
49
 
50
  ```json
51
- {
52
  "data": [
53
- {
54
  "index": <integer matching question number>,
55
  "subject": "Biology",
56
  "chapter_index": <chapter number or 0>,
57
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
58
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
59
  "confidence": <0.0 to 1.0>
60
- }
61
  ],
62
  "success": [true]
63
- }
64
 
65
  ```
66
 
@@ -119,19 +120,19 @@ syllabus.
119
  **Output JSON Schema:**
120
 
121
  ```json
122
- {
123
  "data": [
124
- {
125
  "index": <integer matching question number>,
126
  "subject": "Chemistry",
127
  "chapter_index": <chapter number or 0>,
128
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
129
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
130
  "confidence": <0.0 to 1.0>
131
- }
132
  ],
133
  "success": [true]
134
- }
135
 
136
  ```
137
 
@@ -188,19 +189,19 @@ PHYSICS_PROMPT_TEMPLATE = """**System Role:** You are a specialized Physics ques
188
  **Output JSON Schema:**
189
 
190
  ```json
191
- {
192
  "data": [
193
- {
194
  "index": <integer matching question number>,
195
  "subject": "Physics",
196
  "chapter_index": <chapter number or 0>,
197
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
198
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
199
  "confidence": <0.0 to 1.0>
200
- }
201
  ],
202
  "success": [true]
203
- }
204
 
205
  ```
206
 
@@ -258,22 +259,22 @@ syllabus.
258
  **Output JSON Schema:**
259
 
260
  ```json
261
- {
262
  "data": [
263
- {
264
  "index": <integer matching question number>,
265
  "subject": "Mathematics",
266
  "chapter_index": <chapter number or 0>,
267
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
268
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
269
  "confidence": <0.0 to 1.0>
270
- }
271
  ],
272
  "success": [true]
273
- }
274
 
275
  ```
276
 
277
  **Input Questions:**
278
  {input_questions}
279
- """
 
1
+
2
  BIOLOGY_PROMPT_TEMPLATE = """**System Role:** You are a specialized Biology question classifier for NEET exams. Your task is to map questions to their corresponding chapter from the NCERT Biology syllabus.
3
 
4
  **Syllabus Chapters (Use these exact titles):**
 
49
  **Output JSON Schema:**
50
 
51
  ```json
52
+ {{
53
  "data": [
54
+ {{
55
  "index": <integer matching question number>,
56
  "subject": "Biology",
57
  "chapter_index": <chapter number or 0>,
58
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
59
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
60
  "confidence": <0.0 to 1.0>
61
+ }}
62
  ],
63
  "success": [true]
64
+ }}
65
 
66
  ```
67
 
 
120
  **Output JSON Schema:**
121
 
122
  ```json
123
+ {{
124
  "data": [
125
+ {{
126
  "index": <integer matching question number>,
127
  "subject": "Chemistry",
128
  "chapter_index": <chapter number or 0>,
129
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
130
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
131
  "confidence": <0.0 to 1.0>
132
+ }}
133
  ],
134
  "success": [true]
135
+ }}
136
 
137
  ```
138
 
 
189
  **Output JSON Schema:**
190
 
191
  ```json
192
+ {{
193
  "data": [
194
+ {{
195
  "index": <integer matching question number>,
196
  "subject": "Physics",
197
  "chapter_index": <chapter number or 0>,
198
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
199
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
200
  "confidence": <0.0 to 1.0>
201
+ }}
202
  ],
203
  "success": [true]
204
+ }}
205
 
206
  ```
207
 
 
259
  **Output JSON Schema:**
260
 
261
  ```json
262
+ {{
263
  "data": [
264
+ {{
265
  "index": <integer matching question number>,
266
  "subject": "Mathematics",
267
  "chapter_index": <chapter number or 0>,
268
  "chapter_title": "<exact chapter title from list or 'Unclassified'>",
269
  "other_possible_chapters": ["<alternative chapter 1>", "<alternative chapter 2>"],
270
  "confidence": <0.0 to 1.0>
271
+ }}
272
  ],
273
  "success": [true]
274
+ }}
275
 
276
  ```
277
 
278
  **Input Questions:**
279
  {input_questions}
280
+ """