only_ever_generator 0.2.7 → 0.2.9

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