only_ever_generator 0.3.1 → 0.3.3

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.
@@ -13,8 +13,8 @@ exports.OnlyEverGenerator = void 0;
13
13
  const generate_cards_1 = require("../card_gen/generate_cards");
14
14
  const parse_source_content_1 = require("../parse/parse_source_content");
15
15
  const open_ai_service_1 = require("../services/open_ai_service");
16
- const card_gen_prompt_1 = require("../constants/prompts/card_gen_prompt");
17
- const typology_prompt_1 = require("../constants/prompts/typology_prompt");
16
+ // import { returnCardGenPrompt } from "../constants/prompts/card_gen_prompt";
17
+ // import { returnTypologyPrompt } from "../constants/prompts/typology_prompt";
18
18
  const generate_typology_1 = require("../typology_gen/generate_typology");
19
19
  const generate_args_1 = require("../utils/generate_args");
20
20
  const calculate_gap_fill_1 = require("../gap_fill/calculate_gap_fill");
@@ -41,8 +41,8 @@ class OnlyEverGenerator {
41
41
  // parsedData.type == 'cards' ? this.typologyResponse = parsedData.taxonomy : this.typologyResponse = null;
42
42
  this.typologyResponse = generationContent.content.taxonomy;
43
43
  this.expectedFields = generationContent.content.fields; //returnFields();
44
- this.promptForTypology = (0, typology_prompt_1.returnTypologyPrompt)(generationContent.prompt.typology);
45
- this.promptForCardGen = (0, card_gen_prompt_1.returnCardGenPrompt)(generationContent.prompt.card_generation);
44
+ this.promptForTypology = generationContent.prompt.typology;
45
+ this.promptForCardGen = generationContent.prompt.card_generation;
46
46
  }
47
47
  generate() {
48
48
  return __awaiter(this, arguments, void 0, function* (generate_typology = false, generate_card = false) {
@@ -87,14 +87,15 @@ class OnlyEverGenerator {
87
87
  response = yield this.generateCard(this.promptForCardGen +
88
88
  "Generate cards only suitable for the given remaining concepts and facts" +
89
89
  JSON.stringify(gapFill) +
90
- "Exclude generating these cards", JSON.stringify(cardGenData.cards_data), true);
90
+ "Exclude generating cards with content in the following", JSON.stringify(cardGenData.cards_data), true);
91
91
  }
92
92
  return response;
93
93
  });
94
94
  }
95
95
  generateCard(prompt, additionalContent, isGapFill) {
96
96
  return __awaiter(this, void 0, void 0, function* () {
97
- let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService).generateCards(prompt !== null && prompt !== void 0 ? prompt : "", this.parsedContent + additionalContent, isGapFill);
97
+ var _a;
98
+ let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService).generateCards(prompt !== null && prompt !== void 0 ? prompt : "", JSON.stringify(this.parsedContent) + additionalContent, isGapFill, (_a = this.parsedContent.headings) !== null && _a !== void 0 ? _a : []);
98
99
  // let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
99
100
  // response['type'] = 'card_gen';
100
101
  return generateCardsResp;
@@ -15,7 +15,7 @@ class GenerateCards {
15
15
  constructor(openAiService) {
16
16
  this.openAiService = openAiService;
17
17
  }
18
- generateCards(prompt, parsedContent, isGapFill) {
18
+ generateCards(prompt, parsedContent, isGapFill, headings) {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
20
  var _a, _b, _c;
21
21
  let response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(prompt, parsedContent));
@@ -31,7 +31,7 @@ class GenerateCards {
31
31
  if (response.status_code == 200) {
32
32
  response.metadata.status = "completed";
33
33
  //return response;
34
- return this.parse(response, isGapFill);
34
+ return this.parse(response, isGapFill, headings);
35
35
  }
36
36
  else {
37
37
  response.metadata.status = "failed";
@@ -39,7 +39,7 @@ class GenerateCards {
39
39
  }
40
40
  });
41
41
  }
42
- parse(generatedData, isGapFill) {
42
+ parse(generatedData, isGapFill, headings) {
43
43
  try {
44
44
  const cardData = [];
45
45
  let usage_data = generatedData.metadata;
@@ -50,6 +50,11 @@ class GenerateCards {
50
50
  const type = generatedData.type;
51
51
  if (unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
52
52
  for (let elem of unparsedTestCards) {
53
+ if (headings.includes(elem.card_reference)) {
54
+ }
55
+ else {
56
+ elem.card_reference = '';
57
+ }
53
58
  if (elem.type == "flash") {
54
59
  cardData.push(this.parseFlashCard(elem));
55
60
  }
@@ -192,32 +197,28 @@ class GenerateCards {
192
197
  return `${question} ---- ${optionsString}`;
193
198
  }
194
199
  parseMatchCard(cardData) {
195
- let data = cardData.card_content;
200
+ let content = cardData.card_content;
196
201
  const transformedData = {};
197
- for (let key in data) {
198
- if (data.hasOwnProperty(key)) {
199
- transformedData[key] = [data[key]];
200
- // let value = data[key].replace(/[\[\]]/g, '');
201
- // let items = data[key].split(',').map((item: string) => item.trim());
202
- // map.set(key, items);
203
- // }
202
+ for (let key in content) {
203
+ if (content.hasOwnProperty(key)) {
204
+ transformedData[key] = [content[key]];
204
205
  }
205
- let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
206
- let matchCard = {
207
- type: {
208
- category: 'learning',
209
- sub_type: data.type,
210
- },
211
- heading: cardData.card_reference,
212
- content: transformedData,
213
- // content: cardData.card_content,
214
- displayTitle: displayTitle,
215
- concepts: cardData.concepts,
216
- facts: cardData.facts,
217
- bloomLevel: cardData.bloom_level,
218
- };
219
- return matchCard;
220
206
  }
207
+ let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
208
+ let matchCard = {
209
+ type: {
210
+ category: 'learning',
211
+ sub_type: cardData.type,
212
+ },
213
+ heading: cardData.card_reference,
214
+ content: transformedData,
215
+ // content: cardData.card_content,
216
+ displayTitle: displayTitle,
217
+ concepts: cardData.concepts,
218
+ facts: cardData.facts,
219
+ bloomLevel: cardData.bloom_level,
220
+ };
221
+ return matchCard;
221
222
  }
222
223
  generateMatchCardDisplayTitle(answers) {
223
224
  let titles = [];
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.returnPromptData = void 0;
4
+ const card_gen_prompt_1 = require("./prompts/card_gen_prompt");
5
+ const typology_prompt_1 = require("./prompts/typology_prompt");
4
6
  const promptData = {
5
7
  typology: {
6
8
  role: `
@@ -293,6 +295,9 @@ const promptData = {
293
295
  }
294
296
  };
295
297
  function returnPromptData() {
296
- return promptData;
298
+ return {
299
+ "typology": (0, typology_prompt_1.returnTypologyPrompt)(),
300
+ "card_generation": (0, card_gen_prompt_1.returnCardGenPrompt)(''),
301
+ };
297
302
  }
298
303
  exports.returnPromptData = returnPromptData;
@@ -1,163 +1,6 @@
1
1
  "use strict";
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:
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.returnCardGenPrompt = void 0;
7
- // 1. Title of the source
8
- // 2. Main headings
9
- // 3. The content
10
- // 4. The field of knowledge it belongs
11
- // 5. Key concepts in the source
12
- // 6. Important facts in the source.
13
- // 7. Summary of the content using cards
14
- // Follow these steps:
15
- // 1. Analyze the content to identify any key concepts missing from the provided list.
16
- // 2. Analyze the content to identify any important facts missing from the provided list.
17
- // 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
18
- // 4. Ensure all concepts and facts have at least one test card.
19
- // Please format your response in the following format.
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
- // ]
32
- // **Criteria**
33
- // • Atleast one test card must be generated.
34
- // • Each test card must include at least one concept or fact.
35
- // • Each test card must include bloom_level.
36
- // • Flashcards must not exceed 15% of the total number of cards.
37
- // • Each concept and fact must have at least one test card.
38
- // Further instructions are provided below.
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.
43
- // 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
44
- // List the concepts in the following JSON format:
45
- // {
46
- // "missing_concepts":
47
- // [
48
- // "concept1",
49
- // "concept2",
50
- // "concept3",
51
- // "..."
52
- // ]
53
- // }
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.
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
- // Record the facts in the following JSON format:
60
- // {
61
- // "missing_facts": ["fact1", "fact2", "fact3", "..."]
62
- // }
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).
74
- // Test cards must be one of the following types:
75
- // 1. Flashcards: Have a front and back.
76
- // json:
77
- // {
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>
87
- // }
88
- // - Each side must not exceed 300 characters.
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
- // }
106
- // • Minimum choices required: 2
107
- // • Maximum choices allowed: 8
108
- // • Minimum correct choices required: 1
109
- // • Maximum character length for the prompt: 320
110
- // • Maximum character length for each choice: 42
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
113
- // {
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>
129
- // }
130
- // • Minimum choices required: 2
131
- // • Maximum choices allowed: 8
132
- // • Minimum correct choices required: 1
133
- // • Maximum character length for the prompt: 320
134
- // • Maximum character length for an individual cloze: 90
135
- // 4. Match: Pairing items.
136
- // json
137
- // {
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>
148
- // }
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.
153
- // Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
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.
155
- // Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
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
4
  const promptString = `
162
5
  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
6
 
@@ -183,8 +26,8 @@ json
183
26
  "test_cards": [
184
27
  {
185
28
  "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",
29
+ "card_content": {schema for content is explained below in detail}
30
+ "card_reference": "heading",
188
31
  "concepts": ["Concept1", "Concept2", "..."],
189
32
  "facts": ["Fact1", "Fact2", "..."]
190
33
  }
@@ -248,7 +91,7 @@ json
248
91
  "front": "<content for the front>",
249
92
  "back": "<content for the back>"
250
93
  },
251
- "card_reference": "source_title#heading",
94
+ "card_reference": "heading",
252
95
  "concepts": ["Concept1", "Concept2", "..."],
253
96
  "facts": ["Fact1", "Fact2", "..."],
254
97
  "bloom_level": <1-5>
@@ -267,7 +110,7 @@ json
267
110
  "... up to 8 choices"
268
111
  ]
269
112
  },
270
- "card_reference": "source_title#heading",
113
+ "card_reference": "heading",
271
114
  "concepts": ["Concept1", "Concept2", "..."],
272
115
  "facts": ["Fact1", "Fact2", "..."],
273
116
  "bloom_level": <1-5>
@@ -293,7 +136,7 @@ json
293
136
  "... up to 8 choices"
294
137
  ]
295
138
  },
296
- "card_reference": "source_title#heading",
139
+ "card_reference": "heading",
297
140
  "concepts": ["Concept1", "Concept2", "..."],
298
141
  "facts": ["Fact1", "Fact2", "..."],
299
142
  "bloom_level": <1-5>
@@ -313,14 +156,14 @@ json
313
156
  "right_choice 2": "left_choice 2",
314
157
  "... up to 8 total pairs"
315
158
  },
316
- "card_reference": "source_title#heading",
159
+ "card_reference": "heading",
317
160
  "concepts": ["Concept1", "Concept2", "..."],
318
161
  "facts": ["Fact1", "Fact2", "..."],
319
162
  "bloom_level": <1-5>
320
163
  }
321
164
  • Maximum character length for each item in a pair: 42
322
165
 
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.
166
+ 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: ""main_heading, where #main_heading is optional.
324
167
  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
168
 
326
169
  Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
@@ -1,108 +1,30 @@
1
1
  "use strict";
2
- // const typologyPromptString = `
3
- // As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.returnTypologyPrompt = void 0;
6
- // 1. Classify the content into one to three predefined fields of knowledge.
7
- // 2. Identify key concepts within the content.
8
- // 3. Detect concrete facts that are empirically verified and relevant to the subject.
9
- // 4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
10
- // 5. If the generate_cards is true then summarize the content using a series of summary cards.
11
- // Please format your findings in this JSON schema:
12
- // json
13
- // {
14
- // "field": ["primary_field", "secondary_field", "tertiary_field"],
15
- // "concepts": ["concept1", "concept2", "concept3", "..."],
16
- // "facts": ["fact1", "fact2", "fact3", "..."],
17
- // "generate_cards": [
18
- // state: true or false,
19
- // false_reason: "reason for marking the source as false. Leave empty for true."
20
- // ],
21
- // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
22
- // }
23
- // Further instruction on how to perform these tasks are below.
24
- // Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
25
- // 1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
26
- // 2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
27
- // 3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
28
- // 4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
29
- // 5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
30
- // 6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
31
- // 7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
32
- // 8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
33
- // 9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
34
- // 10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
35
- // 11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
36
- // 12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
37
- // 13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
38
- // 14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
39
- // 15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
40
- // 16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
41
- // 17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
42
- // 18. Other: Use for content that doesn’t fit into the above categories.
43
- // Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
44
- // 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
45
- // 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
46
- // List the concepts in the following JSON format:
47
- // json
48
- // {
49
- // "concepts": ["concept1", "concept2", "concept3", "..."]
50
- // }
51
- // After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
52
- // 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
53
- // 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.
54
- // Record the facts in the following JSON format:
55
- // json
56
- // {
57
- // "facts": ["fact1", "fact2", "fact3", "..."]
58
- // }
59
- // After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
60
- // 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
61
- // 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
62
- // Make your decision using this criterion and reflect it in the JSON format as follows:
63
- // json
64
- // "generate_cards":
65
- // { state: true or false,
66
- // false_reason: "reason for marking the source as false. Leave empty for true."
67
- // }
68
- // After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
69
- // 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
70
- // 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
71
- // 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
72
- // 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
73
- // Format your output in JSON as follows:
74
- // json
75
- // {
76
- // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
77
- // }
78
- // `;
79
- const typologyPromptString = {
80
- role: `
4
+ const typologyPromptString = `
81
5
  As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
82
6
 
83
7
  1. Classify the content into one to three predefined fields of knowledge.
84
- 2. Extract key concepts within the content.
85
- 3. Extract concrete facts that are relevant to the subject and referenced in the content.
8
+ 2. Identify key concepts within the content.
9
+ 3. Detect concrete facts that are empirically verified and relevant to the subject.
86
10
  4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
87
11
  5. If the generate_cards is true then summarize the content using a series of summary cards.
88
12
 
89
13
  Please format your findings in this JSON schema:
14
+ json
90
15
  {
91
- "field": ["primary_field", "secondary_field", "tertiary_field"],
92
- "concepts": ["concept1", "concept2", "concept3", "..."],
93
- "facts": ["fact1", "fact2", "fact3", "..."],
94
- "generate_cards": {
95
- "state": true or false,
96
- "false_reason": "reason for marking the source as false. Leave empty for true."
97
- },
98
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
16
+ "field": ["primary_field", "secondary_field", "tertiary_field"],
17
+ "concepts": ["concept1", "concept2", "concept3", "..."],
18
+ "facts": ["fact1", "fact2", "fact3", "..."],
19
+ "generate_cards": [
20
+ state: true or false,
21
+ false_reason: "reason for marking the source as false. Leave empty for true."
22
+ ],
23
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
99
24
  }
100
25
 
101
-
102
26
  Further instruction on how to perform these tasks are below.
103
- `,
104
- fields: `
105
- Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
27
+ Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
106
28
 
107
29
  1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
108
30
  2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
@@ -122,62 +44,54 @@ Further instruction on how to perform these tasks are below.
122
44
  16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
123
45
  17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
124
46
  18. Other: Use for content that doesn’t fit into the above categories.
125
- `,
126
- concepts: `
127
- Extract key concepts within the content after classifying the field. Please be as exhaustive as possible.
128
47
 
129
- 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.
130
- Inclusion Criteria: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
131
- List the concepts in the following JSON format:
48
+ Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
49
+
50
+ 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
51
+ 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
132
52
 
53
+ List the concepts in the following JSON format:
54
+ json
133
55
  {
134
- "concepts":
135
- [
136
- "concept1",
137
- "concept2",
138
- "concept3",
139
- "..."
140
- ]
56
+ "concepts": ["concept1", "concept2", "concept3", "..."]
141
57
  }
142
- `,
143
- facts: `
144
- After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
58
+ After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
145
59
 
146
- Definition of a Fact: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
147
- 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.
148
- Record the facts in the following JSON format:
60
+ 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
61
+ 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.
149
62
 
63
+ Record the facts in the following JSON format:
64
+ json
150
65
  {
151
- "facts": ["fact1", "fact2", "fact3", "..."]
66
+ "facts": ["fact1", "fact2", "fact3", "..."]
152
67
  }
153
- `,
154
- generate: `
155
68
  After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
156
69
 
157
- Value Assessment: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
158
- Criteria for Material Generation: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
159
- Make your decision using this criterion and reflect it in the JSON format as follows:
70
+ 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
71
+ 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
160
72
 
73
+ Make your decision using this criterion and reflect it in the JSON format as follows:
74
+ json
161
75
  "generate_cards":
162
- { state: true or false,
163
- false_reason: "reason for marking the source as false. Leave empty for true."
164
- }
165
- `,
166
- summarize: `
76
+ { state: true or false,
77
+ false_reason: "reason for marking the source as false. Leave empty for true."
78
+ }
79
+
167
80
  After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
168
81
 
169
- Inclusion Criteria: The generate_cards should be true. Return an empty array if the generate_cards is false.
170
- Summarization Objective: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
171
- Character Limit: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
172
- Engagement and Flow: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
173
- Format your output in JSON as follows:
174
82
 
83
+ 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
84
+ 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
85
+ 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
86
+ 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
87
+
88
+ Format your output in JSON as follows:
89
+ json
175
90
  {
176
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
91
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
177
92
  }
178
- `,
179
- };
180
- function returnTypologyPrompt(typologyPrompt) {
181
- return typologyPrompt;
93
+ `;
94
+ function returnTypologyPrompt() {
95
+ return typologyPromptString;
182
96
  }
183
97
  exports.returnTypologyPrompt = returnTypologyPrompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "only_ever_generator",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "start": "npm run build && nodemon dist/index.js",
@@ -1,8 +1,8 @@
1
1
  import { GenerateCards } from "../card_gen/generate_cards";
2
2
  import { ParseSourceContent } from "../parse/parse_source_content";
3
3
  import { OpenAiService } from "../services/open_ai_service";
4
- import { returnCardGenPrompt } from "../constants/prompts/card_gen_prompt";
5
- import { returnTypologyPrompt } from "../constants/prompts/typology_prompt";
4
+ // import { returnCardGenPrompt } from "../constants/prompts/card_gen_prompt";
5
+ // import { returnTypologyPrompt } from "../constants/prompts/typology_prompt";
6
6
  import { GenerateTypology } from "../typology_gen/generate_typology";
7
7
  import { GenerateArgs } from "../utils/generate_args";
8
8
  import { gapFilling } from "../gap_fill/calculate_gap_fill";
@@ -48,8 +48,8 @@ export class OnlyEverGenerator {
48
48
  this.typologyResponse = generationContent.content.taxonomy
49
49
 
50
50
  this.expectedFields = generationContent.content.fields; //returnFields();
51
- this.promptForTypology = returnTypologyPrompt(generationContent.prompt.typology);
52
- this.promptForCardGen = returnCardGenPrompt(generationContent.prompt.card_generation);
51
+ this.promptForTypology = generationContent.prompt.typology;
52
+ this.promptForCardGen =generationContent.prompt.card_generation;
53
53
  }
54
54
 
55
55
 
@@ -110,7 +110,7 @@ export class OnlyEverGenerator {
110
110
  this.promptForCardGen +
111
111
  "Generate cards only suitable for the given remaining concepts and facts" +
112
112
  JSON.stringify(gapFill) +
113
- "Exclude generating these cards",
113
+ "Exclude generating cards with content in the following",
114
114
  JSON.stringify(cardGenData.cards_data),
115
115
  true
116
116
  );
@@ -124,8 +124,9 @@ export class OnlyEverGenerator {
124
124
  async generateCard(prompt: string, additionalContent: string, isGapFill: boolean) {
125
125
  let generateCardsResp = await new GenerateCards(this.openAiService).generateCards(
126
126
  prompt ?? "",
127
- this.parsedContent + additionalContent,
128
- isGapFill
127
+ JSON.stringify(this.parsedContent) + additionalContent,
128
+ isGapFill,
129
+ this.parsedContent.headings ?? [],
129
130
  );
130
131
 
131
132
  // let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
@@ -7,7 +7,7 @@ export class GenerateCards {
7
7
  this.openAiService = openAiService;
8
8
  }
9
9
 
10
- async generateCards(prompt: string, parsedContent: string, isGapFill: boolean) {
10
+ async generateCards(prompt: string, parsedContent: string,isGapFill: boolean,headings: Array<any>) {
11
11
  let response = await this.openAiService?.sendRequest(prompt, parsedContent);
12
12
  // console.log("response to card generation ", response);
13
13
  response["type"] = isGapFill ? "gap_fill":"card_gen";
@@ -21,14 +21,14 @@ export class GenerateCards {
21
21
  if(response.status_code == 200){
22
22
  response.metadata.status = "completed";
23
23
  //return response;
24
- return this.parse(response, isGapFill);
24
+ return this.parse(response, isGapFill,headings);
25
25
  } else {
26
26
  response.metadata.status = "failed";
27
27
  return response;
28
28
  }
29
29
  }
30
30
 
31
- parse(generatedData: any, isGapFill: boolean) {
31
+ parse(generatedData: any, isGapFill: boolean, headings:Array<any>) {
32
32
  try{
33
33
  const cardData = [];
34
34
  let usage_data = generatedData.metadata;
@@ -39,6 +39,11 @@ export class GenerateCards {
39
39
  const type = generatedData.type;
40
40
  if(unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
41
41
  for (let elem of unparsedTestCards) {
42
+ if(headings.includes(elem.card_reference)){
43
+
44
+ }else{
45
+ elem.card_reference = '';
46
+ }
42
47
  if (elem.type == "flash") {
43
48
  cardData.push(this.parseFlashCard(elem));
44
49
  } else if (elem.type == "mcq") {
@@ -200,35 +205,32 @@ return question;
200
205
  }
201
206
 
202
207
  parseMatchCard(cardData: any) {
203
- let data = cardData.card_content;
208
+ let content = cardData.card_content;
204
209
  const transformedData: { [key: string]: string[] } = {};
205
210
 
206
- for (let key in data) {
207
- if (data.hasOwnProperty(key)) {
208
- transformedData[key] = [data[key]];
209
- // let value = data[key].replace(/[\[\]]/g, '');
210
- // let items = data[key].split(',').map((item: string) => item.trim());
211
- // map.set(key, items);
212
- // }
211
+ for (let key in content) {
212
+ if (content.hasOwnProperty(key)) {
213
+ transformedData[key] = [content[key]];
213
214
  }
214
- let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
215
- let matchCard = {
216
- type: {
217
- category: 'learning',
218
- sub_type: data.type,
219
- },
220
- heading: cardData.card_reference,
221
- content: transformedData,
222
- // content: cardData.card_content,
223
- displayTitle: displayTitle,
224
- concepts: cardData.concepts,
225
- facts: cardData.facts,
226
- bloomLevel: cardData.bloom_level,
227
-
228
- };
229
-
230
- return matchCard;
231
215
  }
216
+ let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
217
+ let matchCard = {
218
+ type: {
219
+ category: 'learning',
220
+ sub_type: cardData.type,
221
+ },
222
+ heading: cardData.card_reference,
223
+ content: transformedData,
224
+ // content: cardData.card_content,
225
+ displayTitle: displayTitle,
226
+ concepts: cardData.concepts,
227
+ facts: cardData.facts,
228
+ bloomLevel: cardData.bloom_level,
229
+
230
+ };
231
+
232
+ return matchCard;
233
+
232
234
  }
233
235
 
234
236
  generateMatchCardDisplayTitle(answers: any) {
@@ -249,3 +251,5 @@ return question;
249
251
  return displayTitle;
250
252
  }
251
253
  }
254
+
255
+
@@ -1,3 +1,6 @@
1
+ import { returnCardGenPrompt } from "./prompts/card_gen_prompt";
2
+ import { returnTypologyPrompt } from "./prompts/typology_prompt";
3
+
1
4
  const promptData: any = {
2
5
  typology: {
3
6
  role: `
@@ -293,5 +296,8 @@ const promptData: any = {
293
296
  }
294
297
 
295
298
  export function returnPromptData(){
296
- return promptData;
299
+ return {
300
+ "typology": returnTypologyPrompt(),
301
+ "card_generation": returnCardGenPrompt(''),
302
+ };
297
303
  }
@@ -1,192 +1,3 @@
1
- // const promptString : any = {
2
- // role: `
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:
4
-
5
- // 1. Title of the source
6
- // 2. Main headings
7
- // 3. The content
8
- // 4. The field of knowledge it belongs
9
- // 5. Key concepts in the source
10
- // 6. Important facts in the source.
11
- // 7. Summary of the content using cards
12
-
13
- // Follow these steps:
14
-
15
- // 1. Analyze the content to identify any key concepts missing from the provided list.
16
- // 2. Analyze the content to identify any important facts missing from the provided list.
17
- // 3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
18
- // 4. Ensure all concepts and facts have at least one test card.
19
-
20
- // Please format your response in the following format.
21
-
22
- // "missing_concepts": ["concept1", "concept2", "concept3", "..."],
23
- // "missing_facts": ["fact1", "fact2", "fact3", "..."],
24
- // "test_cards": [
25
- // {
26
- // "type": "flash" | "mcq" | "cloze" | "match",
27
- // "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "...": "...", "....": "..." },
28
- // "card_reference": "source_title#heading",
29
- // "concepts": ["Concept1", "Concept2", "..."],
30
- // "facts": ["Fact1", "Fact2", "..."],
31
- // "bloom_level": <1-5>
32
- // }
33
- // ]
34
- // **Criteria**
35
- // • Atleast one test card must be generated.
36
- // • Each test card must include at least one concept or fact.
37
- // • Each test card must include bloom_level.
38
- // • Flashcards must not exceed 15% of the total number of cards.
39
- // • Each concept and fact must have at least one test card.
40
-
41
- // Further instructions are provided below.
42
- // `,
43
- // concepts : `
44
- // You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
45
-
46
- // 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.
47
- // 2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
48
-
49
- // List the concepts in the following JSON format:
50
- // {
51
- // "missing_concepts":
52
- // [
53
- // "concept1",
54
- // "concept2",
55
- // "concept3",
56
- // "..."
57
- // ]
58
- // }
59
- // `,
60
- // facts :`
61
- // You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
62
-
63
- // 1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
64
- // 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.
65
-
66
- // Record the facts in the following JSON format:
67
- // {
68
- // "missing_facts": ["fact1", "fact2", "fact3", "..."]
69
- // }
70
- // `,
71
- // card_gen: `
72
- // After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
73
-
74
- // 1. Clarity: Ensure the test content is clear and unambiguous.
75
- // 2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
76
- // 3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
77
- // 4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
78
-
79
- // Include the following property for each card:
80
-
81
- // 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.
82
-
83
- // Make sure to include this field in each card.
84
- // 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).
85
-
86
- // Test cards must be one of the following types:
87
-
88
- // 1. Flashcards: Have a front and back.
89
-
90
- // json:
91
- // {
92
- // "type": "flash",
93
- // "card_content": {
94
- // "front": "<content for the front>",
95
- // "back": "<content for the back>"
96
- // },
97
- // "card_reference": "source_title#heading",
98
- // "concepts": ["Concept1", "Concept2", "..."],
99
- // "facts": ["Fact1", "Fact2", "..."],
100
- // "bloom_level": <1-5>
101
- // }
102
-
103
- // - Each side must not exceed 300 characters.
104
- // 2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
105
-
106
- // json:
107
- // {
108
- // "type": "mcq",
109
- // "card_content": {
110
- // "prompt": "<question text>",
111
- // "choices": [
112
- // {"choice": "choice 1", "is_correct": true or false},
113
- // {"choice": "choice 2", "is_correct": true or false},
114
- // "... up to 8 choices"
115
- // ]
116
- // },
117
- // "card_reference": "source_title#heading",
118
- // "concepts": ["Concept1", "Concept2", "..."],
119
- // "facts": ["Fact1", "Fact2", "..."],
120
- // "bloom_level": <1-5>
121
- // }
122
-
123
- // • Minimum choices required: 2
124
- // • Maximum choices allowed: 8
125
- // • Minimum correct choices required: 1
126
- // • Maximum character length for the prompt: 320
127
- // • Maximum character length for each choice: 42
128
-
129
- // 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.
130
-
131
- // json
132
- // {
133
- // "type": "cloze",
134
- // "card_content": {
135
- // "prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
136
- // "options": [
137
- // {"option": "notes", "cloze": "c0"},
138
- // {"option": "scale", "cloze": "c1"},
139
- // {"option": "mode", "cloze": "c2"},
140
- // {"option": "chords", "cloze": "null"},
141
- // "... up to 8 choices"
142
- // ]
143
- // },
144
- // "card_reference": "source_title#heading",
145
- // "concepts": ["Concept1", "Concept2", "..."],
146
- // "facts": ["Fact1", "Fact2", "..."],
147
- // "bloom_level": <1-5>
148
- // }
149
-
150
- // • Minimum choices required: 2
151
- // • Maximum choices allowed: 8
152
- // • Minimum correct choices required: 1
153
- // • Maximum character length for the prompt: 320
154
- // • Maximum character length for an individual cloze: 90
155
-
156
- // 4. Match: Pairing items.
157
-
158
- // json
159
- // {
160
- // "type": "match",
161
- // "card_content": {
162
- // "left_choice 1": "right_choice 1",
163
- // "left_choice 2": "right_choice 2",
164
- // "... up to 8 total pairs"
165
- // },
166
- // "card_reference": "source_title#heading",
167
- // "concepts": ["Concept1", "Concept2", "..."],
168
- // "facts": ["Fact1", "Fact2", "..."],
169
- // "bloom_level": <1-5>
170
- // }
171
-
172
- // • Maximum character length for each item in a pair: 42
173
- // `,
174
- // 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.`,
175
- // 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.
176
-
177
- // Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
178
-
179
- // 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.
180
-
181
- // Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
182
-
183
- // 1. Ensure every concept and fact has at least one test card (if not more).
184
- // 2. If any concept or fact is missing a test card, create one for it.
185
- // 3. Repeat this step until all concepts and facts are covered.
186
-
187
- // 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.`
188
-
189
- // }
190
1
  const promptString: string = `
191
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:
192
3
 
@@ -212,8 +23,8 @@ json
212
23
  "test_cards": [
213
24
  {
214
25
  "type": "flash" | "mcq" | "cloze" | "match",
215
- "card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "right_choice 1": "...", "left_choice 1": "..." },
216
- "card_reference": "source_title#heading",
26
+ "card_content": {schema for content is explained below in detail}
27
+ "card_reference": "heading",
217
28
  "concepts": ["Concept1", "Concept2", "..."],
218
29
  "facts": ["Fact1", "Fact2", "..."]
219
30
  }
@@ -277,7 +88,7 @@ json
277
88
  "front": "<content for the front>",
278
89
  "back": "<content for the back>"
279
90
  },
280
- "card_reference": "source_title#heading",
91
+ "card_reference": "heading",
281
92
  "concepts": ["Concept1", "Concept2", "..."],
282
93
  "facts": ["Fact1", "Fact2", "..."],
283
94
  "bloom_level": <1-5>
@@ -296,7 +107,7 @@ json
296
107
  "... up to 8 choices"
297
108
  ]
298
109
  },
299
- "card_reference": "source_title#heading",
110
+ "card_reference": "heading",
300
111
  "concepts": ["Concept1", "Concept2", "..."],
301
112
  "facts": ["Fact1", "Fact2", "..."],
302
113
  "bloom_level": <1-5>
@@ -322,7 +133,7 @@ json
322
133
  "... up to 8 choices"
323
134
  ]
324
135
  },
325
- "card_reference": "source_title#heading",
136
+ "card_reference": "heading",
326
137
  "concepts": ["Concept1", "Concept2", "..."],
327
138
  "facts": ["Fact1", "Fact2", "..."],
328
139
  "bloom_level": <1-5>
@@ -342,14 +153,14 @@ json
342
153
  "right_choice 2": "left_choice 2",
343
154
  "... up to 8 total pairs"
344
155
  },
345
- "card_reference": "source_title#heading",
156
+ "card_reference": "heading",
346
157
  "concepts": ["Concept1", "Concept2", "..."],
347
158
  "facts": ["Fact1", "Fact2", "..."],
348
159
  "bloom_level": <1-5>
349
160
  }
350
161
  • Maximum character length for each item in a pair: 42
351
162
 
352
- 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.
163
+ 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: ""main_heading, where #main_heading is optional.
353
164
  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.
354
165
 
355
166
  Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
@@ -1,121 +1,27 @@
1
- // const typologyPromptString = `
2
- // As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
3
-
4
- // 1. Classify the content into one to three predefined fields of knowledge.
5
- // 2. Identify key concepts within the content.
6
- // 3. Detect concrete facts that are empirically verified and relevant to the subject.
7
- // 4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
8
- // 5. If the generate_cards is true then summarize the content using a series of summary cards.
9
-
10
- // Please format your findings in this JSON schema:
11
- // json
12
- // {
13
- // "field": ["primary_field", "secondary_field", "tertiary_field"],
14
- // "concepts": ["concept1", "concept2", "concept3", "..."],
15
- // "facts": ["fact1", "fact2", "fact3", "..."],
16
- // "generate_cards": [
17
- // state: true or false,
18
- // false_reason: "reason for marking the source as false. Leave empty for true."
19
- // ],
20
- // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
21
- // }
22
-
23
- // Further instruction on how to perform these tasks are below.
24
- // Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
25
-
26
- // 1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
27
- // 2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
28
- // 3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
29
- // 4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
30
- // 5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
31
- // 6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
32
- // 7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
33
- // 8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
34
- // 9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
35
- // 10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
36
- // 11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
37
- // 12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
38
- // 13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
39
- // 14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
40
- // 15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
41
- // 16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
42
- // 17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
43
- // 18. Other: Use for content that doesn’t fit into the above categories.
44
-
45
- // Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
46
-
47
- // 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
48
- // 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
49
-
50
- // List the concepts in the following JSON format:
51
- // json
52
- // {
53
- // "concepts": ["concept1", "concept2", "concept3", "..."]
54
- // }
55
- // After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
56
-
57
- // 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
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.
59
-
60
- // Record the facts in the following JSON format:
61
- // json
62
- // {
63
- // "facts": ["fact1", "fact2", "fact3", "..."]
64
- // }
65
- // After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
66
-
67
- // 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
68
- // 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
69
-
70
- // Make your decision using this criterion and reflect it in the JSON format as follows:
71
- // json
72
- // "generate_cards":
73
- // { state: true or false,
74
- // false_reason: "reason for marking the source as false. Leave empty for true."
75
- // }
76
-
77
- // After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
78
-
79
-
80
- // 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
81
- // 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
82
- // 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
83
- // 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
84
-
85
- // Format your output in JSON as follows:
86
- // json
87
- // {
88
- // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
89
- // }
90
- // `;
91
-
92
- const typologyPromptString : any = {
93
- role: `
1
+ const typologyPromptString = `
94
2
  As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
95
3
 
96
4
  1. Classify the content into one to three predefined fields of knowledge.
97
- 2. Extract key concepts within the content.
98
- 3. Extract concrete facts that are relevant to the subject and referenced in the content.
5
+ 2. Identify key concepts within the content.
6
+ 3. Detect concrete facts that are empirically verified and relevant to the subject.
99
7
  4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
100
8
  5. If the generate_cards is true then summarize the content using a series of summary cards.
101
9
 
102
10
  Please format your findings in this JSON schema:
11
+ json
103
12
  {
104
- "field": ["primary_field", "secondary_field", "tertiary_field"],
105
- "concepts": ["concept1", "concept2", "concept3", "..."],
106
- "facts": ["fact1", "fact2", "fact3", "..."],
107
- "generate_cards": {
108
- "state": true or false,
109
- "false_reason": "reason for marking the source as false. Leave empty for true."
110
- },
111
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
13
+ "field": ["primary_field", "secondary_field", "tertiary_field"],
14
+ "concepts": ["concept1", "concept2", "concept3", "..."],
15
+ "facts": ["fact1", "fact2", "fact3", "..."],
16
+ "generate_cards": [
17
+ state: true or false,
18
+ false_reason: "reason for marking the source as false. Leave empty for true."
19
+ ],
20
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
112
21
  }
113
22
 
114
-
115
23
  Further instruction on how to perform these tasks are below.
116
- `,
117
- fields: `
118
- Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
24
+ Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
119
25
 
120
26
  1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
121
27
  2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
@@ -135,63 +41,58 @@ Further instruction on how to perform these tasks are below.
135
41
  16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
136
42
  17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
137
43
  18. Other: Use for content that doesn’t fit into the above categories.
138
- `,
139
- concepts: `
140
- Extract key concepts within the content after classifying the field. Please be as exhaustive as possible.
141
44
 
142
- 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.
143
- Inclusion Criteria: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
144
- List the concepts in the following JSON format:
45
+ Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
145
46
 
47
+ 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
48
+ 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
49
+
50
+ List the concepts in the following JSON format:
51
+ json
146
52
  {
147
- "concepts":
148
- [
149
- "concept1",
150
- "concept2",
151
- "concept3",
152
- "..."
153
- ]
53
+ "concepts": ["concept1", "concept2", "concept3", "..."]
154
54
  }
155
- `,
156
- facts: `
157
- After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
55
+ After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
158
56
 
159
- Definition of a Fact: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
160
- 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.
161
- Record the facts in the following JSON format:
57
+ 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
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.
162
59
 
60
+ Record the facts in the following JSON format:
61
+ json
163
62
  {
164
- "facts": ["fact1", "fact2", "fact3", "..."]
63
+ "facts": ["fact1", "fact2", "fact3", "..."]
165
64
  }
166
- `,
167
- generate: `
168
65
  After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
169
66
 
170
- Value Assessment: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
171
- Criteria for Material Generation: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
172
- Make your decision using this criterion and reflect it in the JSON format as follows:
67
+ 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
68
+ 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
173
69
 
70
+ Make your decision using this criterion and reflect it in the JSON format as follows:
71
+ json
174
72
  "generate_cards":
175
- { state: true or false,
176
- false_reason: "reason for marking the source as false. Leave empty for true."
177
- }
178
- `,
179
- summarize:`
73
+ { state: true or false,
74
+ false_reason: "reason for marking the source as false. Leave empty for true."
75
+ }
76
+
180
77
  After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
181
78
 
182
- Inclusion Criteria: The generate_cards should be true. Return an empty array if the generate_cards is false.
183
- Summarization Objective: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
184
- Character Limit: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
185
- Engagement and Flow: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
186
- Format your output in JSON as follows:
187
79
 
80
+ 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
81
+ 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
82
+ 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
83
+ 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
84
+
85
+ Format your output in JSON as follows:
86
+ json
188
87
  {
189
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
88
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
190
89
  }
191
- `,
192
-
193
- }
90
+ `;
91
+
92
+
93
+
94
+
194
95
 
195
- export function returnTypologyPrompt(typologyPrompt: any){
196
- return typologyPrompt;
96
+ export function returnTypologyPrompt(){
97
+ return typologyPromptString;
197
98
  }