only_ever_generator 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/card_gen/generate_cards.js +1 -0
  2. package/dist/constants/prompt_data.js +273 -273
  3. package/dist/constants/prompts/card_gen_prompt.js +180 -180
  4. package/dist/constants/prompts/typology_prompt.js +93 -93
  5. package/package.json +33 -33
  6. package/readme.md +23 -23
  7. package/src/bootstrap/app.ts +150 -154
  8. package/src/card_gen/generate_cards.ts +251 -251
  9. package/src/config.ts +6 -6
  10. package/src/constants/api_constants.ts +2 -2
  11. package/src/constants/prompt_data.ts +296 -296
  12. package/src/constants/prompts/card_gen_prompt.ts +372 -372
  13. package/src/constants/prompts/typology_prompt.ts +202 -202
  14. package/src/constants/source_data.ts +47 -47
  15. package/src/gap_fill/calculate_gap_fill.ts +52 -52
  16. package/src/index.ts +61 -61
  17. package/src/logger.ts +30 -30
  18. package/src/parse/parse_card_response.ts +289 -289
  19. package/src/parse/parse_source_content.ts +94 -94
  20. package/src/parse/response_format_card.ts +210 -210
  21. package/src/parse/response_format_typology.ts +43 -43
  22. package/src/services/open_ai_service.ts +55 -55
  23. package/src/typology_gen/generate_typology.ts +71 -71
  24. package/src/utils/generate_args.ts +28 -28
  25. package/src/utils/parse_openai_response.ts +20 -20
  26. package/tsconfig.json +12 -12
  27. package/dist/class/parse/parse_source_content.js +0 -62
  28. package/dist/class/services/open_ai_service.js +0 -25
  29. package/dist/parse_response/parse_card_response.js +0 -288
  30. package/dist/parse_response/response_format_card.js +0 -210
  31. package/dist/parse_response/response_format_typology.js +0 -47
  32. package/dist/service/open_ai_request.js +0 -57
@@ -1,372 +1,372 @@
1
- // const promptString = `
2
- // As a dedicated assistant at a learning company, your role is to analyze educational content and create test cards that help learners understand and remember key concepts and facts. You will be provided with:
3
-
4
- // 1. Title of the source
5
- // 2. Main headings
6
- // 3. The content
7
- // 4. The field of knowledge it belongs
8
- // 5. Key concepts in the source
9
- // 6. Important facts in the source.
10
- // 7. Summary of the content using cards
11
-
12
- // Follow these steps:
13
-
14
- // 1. Analyze the content to identify any key concepts missing from the provided list.
15
- // 2. Analyze the content to identify any important facts missing from the provided list.
16
- // 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
17
- // 4. Ensure all concepts and facts have at least one test card.
18
-
19
- // Please format your response in the following format.
20
- // json
21
- // "missing_concepts": ["concept1", "concept2", "concept3", "..."],
22
- // "missing_facts": ["fact1", "fact2", "fact3", "..."],
23
- // "test_cards": [
24
- // {
25
- // "type": "flash" | "mcq" | "cloze" | "match",
26
- // "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "right_choice 1": "...", "left_choice 1": "..." },
27
- // "card_reference": "heading",
28
- // "concepts": ["Concept1", "Concept2", "..."],
29
- // "facts": ["Fact1", "Fact2", "..."]
30
- // }
31
- // ]
32
-
33
- // **Criteria**
34
- // • Each test card must include at least one concept or fact.
35
- // • Flashcards must not exceed 15% of the total number of cards.
36
- // • Each concept and fact must have at least one test card.
37
-
38
- // Further instructions are provided below.
39
- // Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
40
-
41
- // You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
42
-
43
- // 1. **Definition of a Concept**: Concepts should be significant ideas within the content that are essential for understanding the main themes.
44
- // 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
45
-
46
- // List the concepts in the following JSON format:
47
-
48
- // json
49
- // {
50
- // "missing_concepts": ["concept1", "concept2", "concept3", "..."]
51
- // }
52
-
53
- // Facts are objective statements supported by empirical evidence or observation, such as data on events, people, numbers, dates, or well-established ideas.
54
-
55
- // You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
56
-
57
- // 1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
58
- // 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject. Only inlcude those that have not present in the list provided to you.
59
-
60
- // Record the facts in the following JSON format:
61
-
62
- // json
63
- // {
64
- // "missing_facts": ["fact1", "fact2", "fact3", "..."]
65
- // }
66
- // After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
67
-
68
- // 1. Clarity: Ensure the test content is clear and unambiguous.
69
- // 2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
70
- // 3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
71
- // 4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
72
-
73
- // Test cards must be one of the following types:
74
-
75
- // 1. Flashcards: Have a front and back.
76
- // 2. A flashcard consists of two sides: a front and a back. Both the front and back text content must not exceed more than 300 characters in length.
77
-
78
- // json schema for Flash Cards:
79
- // {
80
- // "type": "flash",
81
- // "card_content": {
82
- // "front": "<content for the front of the flashcard>",
83
- // "back": "<content for the back of the flashcard>"
84
- // },
85
- // "card_reference": "heading",
86
- // "concepts": ["Concept1", "Concept2", "..."],
87
- // "facts": ["Fact1", "Fact2", "..."]
88
- // }
89
-
90
-
91
- // 2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
92
- // • Minimum choices required: 2
93
- // • Maximum choices allowed: 8
94
- // • Minimum correct choices required: 1
95
- // • Maximum character length for the prompt: 320
96
- // • Maximum character length for each choice: 42
97
-
98
- // json schema for mcqs
99
- // {
100
- // "type": "mcq",
101
- // "card_content": {
102
- // "prompt": "<question text>",
103
- // "choices": [
104
- // {"choice": "choice 1", "is_correct": true or false},
105
- // {"choice": "choice 2", "is_correct": true or false},
106
- // "... up to 8 choices"
107
- // ]
108
- // },
109
- // "card_reference": "heading",
110
- // "concepts": ["Concept1", "Concept2", "..."],
111
- // "facts": ["Fact1", "Fact2", "..."]
112
- // }
113
-
114
- // 3. Cloze:
115
- // Fill-in-the-blank style test card. Use double curly braces {{}} to indicate a cloze this is absolute necessagr
116
- // • Minimum choices required: 2
117
- // • Maximum choices allowed: 8
118
- // • Minimum correct choices required: 1
119
- // • Maximum character length for the prompt: 320
120
- // • Maximum character length for an individual cloze: 90
121
-
122
- // json schema for cloze
123
- // {
124
- // "type": "cloze",
125
- // "card_content": {
126
- // "text": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
127
- // "options": [
128
- // {"option": "notes", "cloze": "c0"},
129
- // {"option": "scale", "cloze": "c1"},
130
- // {"option": "mode", "cloze": "c2"},
131
- // {"option": "chords", "cloze": null},
132
- // "... up to 8 choices"
133
- // ]
134
- // },
135
- // "card_reference": "heading",
136
- // "concepts": ["Concept1", "Concept2", "..."],
137
- // "facts": ["Fact1", "Fact2", "..."]
138
- // }
139
-
140
-
141
-
142
- // 4. Match: Pairing items.
143
- // • Maximum character length for each item in a pair: 42
144
-
145
- // json schema for match
146
- // {
147
- // "type": "match",
148
- // "card_content": {
149
- // "right_choice 1": "left_choice 1",
150
- // "right_choice 2": "left_choice 2",
151
- // "... up to 8 total pairs"
152
- // },
153
- // "card_reference": "heading",
154
- // "concepts": ["Concept1", "Concept2", "..."],
155
- // "facts": ["Fact1", "Fact2", "..."]
156
- // }
157
-
158
- // Once you are done generating the test cards. Go back and evaulate the full list of concepts and fact that include any of the missing concepts or facts along with the list that was provided as the input.
159
-
160
- // Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
161
-
162
- // Once you are done creating come back to this step again to check if you have full coverage of all the concepts and facts in the source. You can stop generating test questions once you achieve full coverage.
163
-
164
- // Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
165
-
166
- // 1. Ensure every concept and fact has at least one test card (if not more).
167
- // 2. If any concept or fact is missing a test card, create one for it.
168
- // 3. Repeat this step until all concepts and facts are covered.
169
-
170
- // Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.
171
- // `;
172
-
173
- const promptString : any = {
174
- role: `
175
- As a dedicated assistant at a learning company, your role is to analyze educational content and create test cards that help learners understand and remember key concepts and facts. You will be provided with:
176
-
177
- 1. Title of the source
178
- 2. Main headings
179
- 3. The content
180
- 4. The field of knowledge it belongs
181
- 5. Key concepts in the source
182
- 6. Important facts in the source.
183
- 7. Summary of the content using cards
184
-
185
- Follow these steps:
186
-
187
- 1. Analyze the content to identify any key concepts missing from the provided list.
188
- 2. Analyze the content to identify any important facts missing from the provided list.
189
- 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
190
- 4. Ensure all concepts and facts have at least one test card.
191
-
192
- Please format your response in the following format.
193
-
194
- "missing_concepts": ["concept1", "concept2", "concept3", "..."],
195
- "missing_facts": ["fact1", "fact2", "fact3", "..."],
196
- "test_cards": [
197
- {
198
- "type": "flash" | "mcq" | "cloze" | "match",
199
- "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "...": "...", "....": "..." },
200
- "card_reference": "source_title#heading",
201
- "concepts": ["Concept1", "Concept2", "..."],
202
- "facts": ["Fact1", "Fact2", "..."],
203
- "bloom_level": <1-5>
204
- }
205
- ]
206
- **Criteria**
207
- • Atleast one test card must be generated.
208
- • Each test card must include at least one concept or fact.
209
- • Each test card must include bloom_level.
210
- • Flashcards must not exceed 15% of the total number of cards.
211
- • Each concept and fact must have at least one test card.
212
-
213
- Further instructions are provided below.
214
- `,
215
- concepts : `
216
- You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
217
-
218
- 1. **Definition of a Concept**: Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
219
- 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
220
-
221
- List the concepts in the following JSON format:
222
- {
223
- "missing_concepts":
224
- [
225
- "concept1",
226
- "concept2",
227
- "concept3",
228
- "..."
229
- ]
230
- }
231
- `,
232
- facts :`
233
- You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
234
-
235
- 1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
236
- 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject. Only inlcude those that have not present in the list provided to you.
237
-
238
- Record the facts in the following JSON format:
239
- {
240
- "missing_facts": ["fact1", "fact2", "fact3", "..."]
241
- }
242
- `,
243
- card_gen: `
244
- After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
245
-
246
- 1. Clarity: Ensure the test content is clear and unambiguous.
247
- 2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
248
- 3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
249
- 4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
250
-
251
- Include the following property for each card:
252
-
253
- bloom_level: Indicate the level of Bloom’s Taxonomy the card corresponds to (from level 1 to level 5). Ensure that you produce a balanced number of cards across all levels, focusing on levels 1 through 5. Aim for a diverse range of cognitive challenges.
254
-
255
- Make sure to include this field in each card.
256
- Ensure that you produce at least one card for each concept and fact. Do not skip any concepts or facts, and be thorough in your coverage. Cards should span across different levels of Bloom’s Taxonomy, from level 1 (Remembering) to level 5 (Evaluating), but exclude level 6 (Creating).
257
-
258
- Test cards must be one of the following types:
259
-
260
- 1. Flashcards: Have a front and back.
261
-
262
- json:
263
- {
264
- "type": "flash",
265
- "card_content": {
266
- "front": "<content for the front>",
267
- "back": "<content for the back>"
268
- },
269
- "card_reference": "source_title#heading",
270
- "concepts": ["Concept1", "Concept2", "..."],
271
- "facts": ["Fact1", "Fact2", "..."],
272
- "bloom_level": <1-5>
273
- }
274
-
275
- - Each side must not exceed 300 characters.
276
- 2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
277
-
278
- json:
279
- {
280
- "type": "mcq",
281
- "card_content": {
282
- "prompt": "<question text>",
283
- "choices": [
284
- {"choice": "choice 1", "is_correct": true or false},
285
- {"choice": "choice 2", "is_correct": true or false},
286
- "... up to 8 choices"
287
- ]
288
- },
289
- "card_reference": "source_title#heading",
290
- "concepts": ["Concept1", "Concept2", "..."],
291
- "facts": ["Fact1", "Fact2", "..."],
292
- "bloom_level": <1-5>
293
- }
294
-
295
- • Minimum choices required: 2
296
- • Maximum choices allowed: 8
297
- • Minimum correct choices required: 1
298
- • Maximum character length for the prompt: 320
299
- • Maximum character length for each choice: 42
300
-
301
- 3. Cloze: A test card where a portion of text is masked for the learner to identify from the provided options. Use double curly braces {{c<n>: cloze_text}} to indicate a cloze, where n is the index number of the cloze (starting from 0) and cloze_text is the word or phrase being clozed.
302
-
303
- json
304
- {
305
- "type": "cloze",
306
- "card_content": {
307
- "prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
308
- "options": [
309
- {"option": "notes", "cloze": "c0"},
310
- {"option": "scale", "cloze": "c1"},
311
- {"option": "mode", "cloze": "c2"},
312
- {"option": "chords", "cloze": "null"},
313
- "... up to 8 choices"
314
- ]
315
- },
316
- "card_reference": "source_title#heading",
317
- "concepts": ["Concept1", "Concept2", "..."],
318
- "facts": ["Fact1", "Fact2", "..."],
319
- "bloom_level": <1-5>
320
- }
321
-
322
- • Minimum choices required: 2
323
- • Maximum choices allowed: 8
324
- • Minimum correct choices required: 1
325
- • Maximum character length for the prompt: 320
326
- • Maximum character length for an individual cloze: 90
327
-
328
- 4. Match: Pairing items.
329
-
330
- json
331
- {
332
- "type": "match",
333
- "card_content": {
334
- "left_choice 1": "right_choice 1",
335
- "left_choice 2": "right_choice 2",
336
- "... up to 8 total pairs"
337
- },
338
- "card_reference": "source_title#heading",
339
- "concepts": ["Concept1", "Concept2", "..."],
340
- "facts": ["Fact1", "Fact2", "..."],
341
- "bloom_level": <1-5>
342
- }
343
-
344
- • Maximum character length for each item in a pair: 42
345
- `,
346
- reference : `Each test card needs a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The reference schema is as follows: source_title#main_heading, where #main_heading is optional.`,
347
- checkcoverage: `Once you are done generating the test cards. Go back and evaulate the full list of concepts and fact that include any of the missing concepts or facts along with the list that was provided as the input.
348
-
349
- Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
350
-
351
- Once you are done creating come back to this step again to check if you have full coverage of all the concepts and facts in the source. You can stop generating test questions once you achieve full coverage.
352
-
353
- Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
354
-
355
- 1. Ensure every concept and fact has at least one test card (if not more).
356
- 2. If any concept or fact is missing a test card, create one for it.
357
- 3. Repeat this step until all concepts and facts are covered.
358
-
359
- Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.`
360
-
361
- }
362
-
363
- export function returnCardGenPrompt(cardGenPrompt: any){
364
- let concatenatedString: string = '';
365
- for (let key in cardGenPrompt) {
366
- if (cardGenPrompt.hasOwnProperty(key)) {
367
- concatenatedString += cardGenPrompt[key];
368
- }
369
- }
370
- return concatenatedString;
371
- }
372
-
1
+ // const promptString = `
2
+ // As a dedicated assistant at a learning company, your role is to analyze educational content and create test cards that help learners understand and remember key concepts and facts. You will be provided with:
3
+
4
+ // 1. Title of the source
5
+ // 2. Main headings
6
+ // 3. The content
7
+ // 4. The field of knowledge it belongs
8
+ // 5. Key concepts in the source
9
+ // 6. Important facts in the source.
10
+ // 7. Summary of the content using cards
11
+
12
+ // Follow these steps:
13
+
14
+ // 1. Analyze the content to identify any key concepts missing from the provided list.
15
+ // 2. Analyze the content to identify any important facts missing from the provided list.
16
+ // 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
17
+ // 4. Ensure all concepts and facts have at least one test card.
18
+
19
+ // Please format your response in the following format.
20
+ // json
21
+ // "missing_concepts": ["concept1", "concept2", "concept3", "..."],
22
+ // "missing_facts": ["fact1", "fact2", "fact3", "..."],
23
+ // "test_cards": [
24
+ // {
25
+ // "type": "flash" | "mcq" | "cloze" | "match",
26
+ // "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "right_choice 1": "...", "left_choice 1": "..." },
27
+ // "card_reference": "heading",
28
+ // "concepts": ["Concept1", "Concept2", "..."],
29
+ // "facts": ["Fact1", "Fact2", "..."]
30
+ // }
31
+ // ]
32
+
33
+ // **Criteria**
34
+ // • Each test card must include at least one concept or fact.
35
+ // • Flashcards must not exceed 15% of the total number of cards.
36
+ // • Each concept and fact must have at least one test card.
37
+
38
+ // Further instructions are provided below.
39
+ // Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
40
+
41
+ // You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
42
+
43
+ // 1. **Definition of a Concept**: Concepts should be significant ideas within the content that are essential for understanding the main themes.
44
+ // 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
45
+
46
+ // List the concepts in the following JSON format:
47
+
48
+ // json
49
+ // {
50
+ // "missing_concepts": ["concept1", "concept2", "concept3", "..."]
51
+ // }
52
+
53
+ // Facts are objective statements supported by empirical evidence or observation, such as data on events, people, numbers, dates, or well-established ideas.
54
+
55
+ // You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
56
+
57
+ // 1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
58
+ // 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject. Only inlcude those that have not present in the list provided to you.
59
+
60
+ // Record the facts in the following JSON format:
61
+
62
+ // json
63
+ // {
64
+ // "missing_facts": ["fact1", "fact2", "fact3", "..."]
65
+ // }
66
+ // After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
67
+
68
+ // 1. Clarity: Ensure the test content is clear and unambiguous.
69
+ // 2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
70
+ // 3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
71
+ // 4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
72
+
73
+ // Test cards must be one of the following types:
74
+
75
+ // 1. Flashcards: Have a front and back.
76
+ // 2. A flashcard consists of two sides: a front and a back. Both the front and back text content must not exceed more than 300 characters in length.
77
+
78
+ // json schema for Flash Cards:
79
+ // {
80
+ // "type": "flash",
81
+ // "card_content": {
82
+ // "front": "<content for the front of the flashcard>",
83
+ // "back": "<content for the back of the flashcard>"
84
+ // },
85
+ // "card_reference": "heading",
86
+ // "concepts": ["Concept1", "Concept2", "..."],
87
+ // "facts": ["Fact1", "Fact2", "..."]
88
+ // }
89
+
90
+
91
+ // 2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
92
+ // • Minimum choices required: 2
93
+ // • Maximum choices allowed: 8
94
+ // • Minimum correct choices required: 1
95
+ // • Maximum character length for the prompt: 320
96
+ // • Maximum character length for each choice: 42
97
+
98
+ // json schema for mcqs
99
+ // {
100
+ // "type": "mcq",
101
+ // "card_content": {
102
+ // "prompt": "<question text>",
103
+ // "choices": [
104
+ // {"choice": "choice 1", "is_correct": true or false},
105
+ // {"choice": "choice 2", "is_correct": true or false},
106
+ // "... up to 8 choices"
107
+ // ]
108
+ // },
109
+ // "card_reference": "heading",
110
+ // "concepts": ["Concept1", "Concept2", "..."],
111
+ // "facts": ["Fact1", "Fact2", "..."]
112
+ // }
113
+
114
+ // 3. Cloze:
115
+ // Fill-in-the-blank style test card. Use double curly braces {{}} to indicate a cloze this is absolute necessagr
116
+ // • Minimum choices required: 2
117
+ // • Maximum choices allowed: 8
118
+ // • Minimum correct choices required: 1
119
+ // • Maximum character length for the prompt: 320
120
+ // • Maximum character length for an individual cloze: 90
121
+
122
+ // json schema for cloze
123
+ // {
124
+ // "type": "cloze",
125
+ // "card_content": {
126
+ // "text": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
127
+ // "options": [
128
+ // {"option": "notes", "cloze": "c0"},
129
+ // {"option": "scale", "cloze": "c1"},
130
+ // {"option": "mode", "cloze": "c2"},
131
+ // {"option": "chords", "cloze": null},
132
+ // "... up to 8 choices"
133
+ // ]
134
+ // },
135
+ // "card_reference": "heading",
136
+ // "concepts": ["Concept1", "Concept2", "..."],
137
+ // "facts": ["Fact1", "Fact2", "..."]
138
+ // }
139
+
140
+
141
+
142
+ // 4. Match: Pairing items.
143
+ // • Maximum character length for each item in a pair: 42
144
+
145
+ // json schema for match
146
+ // {
147
+ // "type": "match",
148
+ // "card_content": {
149
+ // "right_choice 1": "left_choice 1",
150
+ // "right_choice 2": "left_choice 2",
151
+ // "... up to 8 total pairs"
152
+ // },
153
+ // "card_reference": "heading",
154
+ // "concepts": ["Concept1", "Concept2", "..."],
155
+ // "facts": ["Fact1", "Fact2", "..."]
156
+ // }
157
+
158
+ // Once you are done generating the test cards. Go back and evaulate the full list of concepts and fact that include any of the missing concepts or facts along with the list that was provided as the input.
159
+
160
+ // Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
161
+
162
+ // Once you are done creating come back to this step again to check if you have full coverage of all the concepts and facts in the source. You can stop generating test questions once you achieve full coverage.
163
+
164
+ // Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
165
+
166
+ // 1. Ensure every concept and fact has at least one test card (if not more).
167
+ // 2. If any concept or fact is missing a test card, create one for it.
168
+ // 3. Repeat this step until all concepts and facts are covered.
169
+
170
+ // Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.
171
+ // `;
172
+
173
+ const promptString : any = {
174
+ role: `
175
+ As a dedicated assistant at a learning company, your role is to analyze educational content and create test cards that help learners understand and remember key concepts and facts. You will be provided with:
176
+
177
+ 1. Title of the source
178
+ 2. Main headings
179
+ 3. The content
180
+ 4. The field of knowledge it belongs
181
+ 5. Key concepts in the source
182
+ 6. Important facts in the source.
183
+ 7. Summary of the content using cards
184
+
185
+ Follow these steps:
186
+
187
+ 1. Analyze the content to identify any key concepts missing from the provided list.
188
+ 2. Analyze the content to identify any important facts missing from the provided list.
189
+ 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
190
+ 4. Ensure all concepts and facts have at least one test card.
191
+
192
+ Please format your response in the following format.
193
+
194
+ "missing_concepts": ["concept1", "concept2", "concept3", "..."],
195
+ "missing_facts": ["fact1", "fact2", "fact3", "..."],
196
+ "test_cards": [
197
+ {
198
+ "type": "flash" | "mcq" | "cloze" | "match",
199
+ "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "...": "...", "....": "..." },
200
+ "card_reference": "source_title#heading",
201
+ "concepts": ["Concept1", "Concept2", "..."],
202
+ "facts": ["Fact1", "Fact2", "..."],
203
+ "bloom_level": <1-5>
204
+ }
205
+ ]
206
+ **Criteria**
207
+ • Atleast one test card must be generated.
208
+ • Each test card must include at least one concept or fact.
209
+ • Each test card must include bloom_level.
210
+ • Flashcards must not exceed 15% of the total number of cards.
211
+ • Each concept and fact must have at least one test card.
212
+
213
+ Further instructions are provided below.
214
+ `,
215
+ concepts : `
216
+ You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
217
+
218
+ 1. **Definition of a Concept**: Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
219
+ 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
220
+
221
+ List the concepts in the following JSON format:
222
+ {
223
+ "missing_concepts":
224
+ [
225
+ "concept1",
226
+ "concept2",
227
+ "concept3",
228
+ "..."
229
+ ]
230
+ }
231
+ `,
232
+ facts :`
233
+ You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
234
+
235
+ 1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
236
+ 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject. Only inlcude those that have not present in the list provided to you.
237
+
238
+ Record the facts in the following JSON format:
239
+ {
240
+ "missing_facts": ["fact1", "fact2", "fact3", "..."]
241
+ }
242
+ `,
243
+ card_gen: `
244
+ After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
245
+
246
+ 1. Clarity: Ensure the test content is clear and unambiguous.
247
+ 2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
248
+ 3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
249
+ 4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
250
+
251
+ Include the following property for each card:
252
+
253
+ bloom_level: Indicate the level of Bloom’s Taxonomy the card corresponds to (from level 1 to level 5). Ensure that you produce a balanced number of cards across all levels, focusing on levels 1 through 5. Aim for a diverse range of cognitive challenges.
254
+
255
+ Make sure to include this field in each card.
256
+ Ensure that you produce at least one card for each concept and fact. Do not skip any concepts or facts, and be thorough in your coverage. Cards should span across different levels of Bloom’s Taxonomy, from level 1 (Remembering) to level 5 (Evaluating), but exclude level 6 (Creating).
257
+
258
+ Test cards must be one of the following types:
259
+
260
+ 1. Flashcards: Have a front and back.
261
+
262
+ json:
263
+ {
264
+ "type": "flash",
265
+ "card_content": {
266
+ "front": "<content for the front>",
267
+ "back": "<content for the back>"
268
+ },
269
+ "card_reference": "source_title#heading",
270
+ "concepts": ["Concept1", "Concept2", "..."],
271
+ "facts": ["Fact1", "Fact2", "..."],
272
+ "bloom_level": <1-5>
273
+ }
274
+
275
+ - Each side must not exceed 300 characters.
276
+ 2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
277
+
278
+ json:
279
+ {
280
+ "type": "mcq",
281
+ "card_content": {
282
+ "prompt": "<question text>",
283
+ "choices": [
284
+ {"choice": "choice 1", "is_correct": true or false},
285
+ {"choice": "choice 2", "is_correct": true or false},
286
+ "... up to 8 choices"
287
+ ]
288
+ },
289
+ "card_reference": "source_title#heading",
290
+ "concepts": ["Concept1", "Concept2", "..."],
291
+ "facts": ["Fact1", "Fact2", "..."],
292
+ "bloom_level": <1-5>
293
+ }
294
+
295
+ • Minimum choices required: 2
296
+ • Maximum choices allowed: 8
297
+ • Minimum correct choices required: 1
298
+ • Maximum character length for the prompt: 320
299
+ • Maximum character length for each choice: 42
300
+
301
+ 3. Cloze: A test card where a portion of text is masked for the learner to identify from the provided options. Use double curly braces {{c<n>: cloze_text}} to indicate a cloze, where n is the index number of the cloze (starting from 0) and cloze_text is the word or phrase being clozed.
302
+
303
+ json
304
+ {
305
+ "type": "cloze",
306
+ "card_content": {
307
+ "prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
308
+ "options": [
309
+ {"option": "notes", "cloze": "c0"},
310
+ {"option": "scale", "cloze": "c1"},
311
+ {"option": "mode", "cloze": "c2"},
312
+ {"option": "chords", "cloze": "null"},
313
+ "... up to 8 choices"
314
+ ]
315
+ },
316
+ "card_reference": "source_title#heading",
317
+ "concepts": ["Concept1", "Concept2", "..."],
318
+ "facts": ["Fact1", "Fact2", "..."],
319
+ "bloom_level": <1-5>
320
+ }
321
+
322
+ • Minimum choices required: 2
323
+ • Maximum choices allowed: 8
324
+ • Minimum correct choices required: 1
325
+ • Maximum character length for the prompt: 320
326
+ • Maximum character length for an individual cloze: 90
327
+
328
+ 4. Match: Pairing items.
329
+
330
+ json
331
+ {
332
+ "type": "match",
333
+ "card_content": {
334
+ "left_choice 1": "right_choice 1",
335
+ "left_choice 2": "right_choice 2",
336
+ "... up to 8 total pairs"
337
+ },
338
+ "card_reference": "source_title#heading",
339
+ "concepts": ["Concept1", "Concept2", "..."],
340
+ "facts": ["Fact1", "Fact2", "..."],
341
+ "bloom_level": <1-5>
342
+ }
343
+
344
+ • Maximum character length for each item in a pair: 42
345
+ `,
346
+ reference : `Each test card needs a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The reference schema is as follows: source_title#main_heading, where #main_heading is optional.`,
347
+ checkcoverage: `Once you are done generating the test cards. Go back and evaulate the full list of concepts and fact that include any of the missing concepts or facts along with the list that was provided as the input.
348
+
349
+ Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
350
+
351
+ Once you are done creating come back to this step again to check if you have full coverage of all the concepts and facts in the source. You can stop generating test questions once you achieve full coverage.
352
+
353
+ Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
354
+
355
+ 1. Ensure every concept and fact has at least one test card (if not more).
356
+ 2. If any concept or fact is missing a test card, create one for it.
357
+ 3. Repeat this step until all concepts and facts are covered.
358
+
359
+ Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.`
360
+
361
+ }
362
+
363
+ export function returnCardGenPrompt(cardGenPrompt: any){
364
+ let concatenatedString: string = '';
365
+ for (let key in cardGenPrompt) {
366
+ if (cardGenPrompt.hasOwnProperty(key)) {
367
+ concatenatedString += cardGenPrompt[key];
368
+ }
369
+ }
370
+ return concatenatedString;
371
+ }
372
+