only_ever_generator 0.9.5 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/bootstrap/app.js +120 -0
  2. package/dist/card_gen/generate_cards.js +59 -0
  3. package/dist/config.js +9 -0
  4. package/dist/constants/api_constants.js +10 -0
  5. package/dist/constants/prompt_data.js +302 -0
  6. package/dist/constants/prompts/card_gen_prompt.js +167 -0
  7. package/dist/constants/prompts/typology_prompt.js +138 -0
  8. package/dist/constants/source_data.js +973 -0
  9. package/dist/embedding_generation/consolidation/global_consolidation.js +75 -0
  10. package/dist/embedding_generation/consolidation/local_consolidation.js +104 -0
  11. package/dist/embedding_generation/consolidation/write_consolidated_data.js +68 -0
  12. package/dist/embedding_generation/generate_embeddings.js +53 -0
  13. package/dist/embedding_generation/parse_embedding_response.js +28 -0
  14. package/dist/gap_fill/calculate_gap_fill.js +42 -0
  15. package/dist/helper/qdrant_db_methods.js +62 -0
  16. package/dist/index.js +96 -0
  17. package/dist/logger.js +41 -0
  18. package/dist/parse/parse_card/parse_cloze_card.js +125 -0
  19. package/dist/parse/parse_card/parse_flash_cards.js +33 -0
  20. package/dist/parse/parse_card/parse_match_card.js +81 -0
  21. package/dist/parse/parse_card/parse_mcq_card.js +103 -0
  22. package/dist/parse/parse_card_response.js +99 -0
  23. package/dist/parse/parse_source_content.js +185 -0
  24. package/dist/parse/response_format_card.js +371 -0
  25. package/dist/parse/response_format_typology.js +46 -0
  26. package/dist/services/open_ai_service.js +91 -0
  27. package/dist/services/qdrant_service.js +13 -0
  28. package/dist/typology-parsed-response.js +1935 -0
  29. package/dist/typology_gen/generate_typology.js +103 -0
  30. package/dist/utils/generate_args.js +27 -0
  31. package/dist/utils/parse_openai_response.js +23 -0
  32. package/package.json +3 -2
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.returnCardGenPrompt = returnCardGenPrompt;
4
+ const promptString = `
5
+ As a dedicated teaching assistant at a learning company, your role is to create Bloom’s Taxonomy Level 1 test cards based on the provided content, concepts, and facts. Your response should be in JSON format.
6
+ Guidance for creating Bloom Level 1 questions Definition: retrieve, recall, or recognize relevant knowledge (concepts and facts) from long-term memory (e.g., recall dates of important events in U.S. history, remember the components of a bacterial cell).
7
+ Appropriate learning outcome verbs for this level include: cite, define, describe, identify, label, list, match, name, outline, quote, recall, report, reproduce, retrieve, show, state, tabulate, and tell.
8
+
9
+ You will be provided with the following:
10
+ 1. Title of the source
11
+ 2. The content
12
+ 3. Key concepts in the source
13
+ 4. Important facts in the source
14
+
15
+ **Types of cards to generate**
16
+ You will generate the following card types: cloze, flash, match and mcq.
17
+
18
+ **Format your response in the following JSON format:**
19
+
20
+ json
21
+ {
22
+ "test_cards": [
23
+ {
24
+ "type": "{card_type}",
25
+ "card_content": "{content}",
26
+ "concepts": ["concept1", "concept2", "..."],
27
+ "facts": ["fact1", "fact2", "..."]
28
+ },
29
+ {... as many cards as possible}
30
+ ]
31
+ }
32
+
33
+
34
+ **Note:** Detailed instructions for creating the content for each test card type will be provided subsequently.
35
+
36
+ **Success Criteria:**
37
+
38
+ * Each card must test at least one concept or fact.
39
+ * The concepts and facts in each card MUST MATCH EXACTLY with those provided in the input.
40
+ * Provide clear and concise content for each test card, ensuring it is relevant to the concepts and facts identified.
41
+ * Use appropriate and engaging language to enhance learning and retention.
42
+ * Ensure a balanced distribution of each card type in the final output.
43
+ * Keep generating cards till you have covered all the concepts and facts provided to you.
44
+
45
+ **Cloze**
46
+
47
+ A test card where a portion of text is masked for the learner to identify from the provided options.
48
+ Follow the schema below to create new cloze cards specially focus on how correct options are enclosed with in {{}}.
49
+
50
+ Use the schema below to create new cloze cards.
51
+
52
+ json
53
+ {
54
+ "type": "cloze",
55
+ "card_content":
56
+ {
57
+ "prompt": "This is some {{sample}} text for {{showing}} how to create clozes.",
58
+ "correct_options": ["sample", "showing"],
59
+ "incorrect_options": ["incorrect_option1", "incorrect_option2", "..."],
60
+ "explanation": "optional 320 character explanation"
61
+ },
62
+ "concepts": ["concept1", "concept2", "..."],
63
+ "facts": ["fact1", "fact2", ...]
64
+
65
+ }
66
+
67
+
68
+ * A valid cloze must include at least one or more words
69
+ * When appropriate, include a brief explanation (320 characters max) to help the learner understand the concept or fact and how to answer the question.
70
+ * Minimum clozes required: 1
71
+ * Minimum choices (correct options + incorrect options) required: 2
72
+ * Maximum choices (correct options + incorrect options) allowed: 8
73
+ * Maximum character length for the prompt: 320
74
+ * Maximum character length for an individual cloze: 90
75
+ **Flashcards**
76
+
77
+ Test cards that have a front and a back.
78
+
79
+ Use the schema below to create new flashcards.
80
+
81
+ json
82
+ {
83
+ "type": "flash",
84
+ "card_content": {
85
+ "front": "<content for the front>",
86
+ "back": "<content for the back>",
87
+ "explanation": "optional 320 character explanation"
88
+ },
89
+ "concepts": ["concept1", "concept2", "..."],
90
+ "facts": ["fact1", "fact2", "..."],
91
+ }
92
+
93
+
94
+ * Each side (front and back) must not exceed 320 characters.
95
+ * When appropriate, include a brief explanation (320 characters max) to help the learner understand the concept or fact and how to answer the question.
96
+
97
+ **Match**
98
+ Provide item pairs.
99
+ Use the schema below to create new match cards.
100
+
101
+ json
102
+ {
103
+ "type": "match",
104
+ "card_content":
105
+ [
106
+ {
107
+ "left_item" : "left_item text",
108
+ "right_item" : "right_item text"
109
+ },
110
+ {
111
+ "left_item" : "left_item text",
112
+ "right_item" : "right_item text"
113
+ },
114
+ {"... up to 8 total pairs"}
115
+ ],
116
+ "concepts": ["concept1", "concept2", "..."],
117
+ "facts": ["fact1", "fact2", ...]
118
+ }
119
+
120
+
121
+ * Maximum character length for each left/right item text : 30, strictly enforced.
122
+ * Duplicate items are allowed. Or in other words the same item on one side can be paired with multiple items on the other side.
123
+
124
+ **Multiple Choice Questions (MCQ)**
125
+ Provide multiple choices to pick from. One or more should be correct.
126
+ Use the schema below to create new MCQ cards.
127
+ json
128
+ {
129
+ "type": "mcq",
130
+ "card_content": {
131
+ "prompt": "<question text>",
132
+ "choices": [
133
+ {"choice": "choice content", "is_correct": true or false},
134
+ {"choice": "choice content", "is_correct": true or false},
135
+ "... up to 8 choices"
136
+ ],
137
+ "explanation": "optional 320 character explanation"
138
+ },
139
+ "concepts": ["concept1", "concept2", "..."],
140
+ "facts": ["fact1", "fact2", ...]
141
+ }
142
+
143
+
144
+ * When appropriate, include a brief explanation (320 characters max) to help the learner understand the concept or fact and how to answer the question.
145
+ * Minimum choices required: 2
146
+ * Maximum choices allowed: 8
147
+ * Minimum correct choices required: 1
148
+ * Maximum character length for the prompt: 320
149
+ * Maximum character length for each choice: 42
150
+ * DO NOT add numbering to the choice content since these will be randomly sorted when displaying to the user
151
+ Once you are done generating the test cards. Go back and evaulate the full list of concepts and facts provided as the input.
152
+
153
+ Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
154
+
155
+ 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.
156
+
157
+ Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
158
+
159
+ 1. Ensure every concept and fact has at least one test card (if not more).
160
+ 2. If any concept or fact is missing a test card, create one for it.
161
+ 3. Repeat this step until all concepts and facts are covered.
162
+
163
+ 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.
164
+ `;
165
+ function returnCardGenPrompt() {
166
+ return promptString;
167
+ }
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.returnTypologyPrompt = returnTypologyPrompt;
4
+ const typologyPromptString = `
5
+ You are a dedicated assistant that categorizes and summarizes educational content. You will process educational content (in JSON format) that represents text from diverse sources such as wikipedia, markdown notes, PDFs, book chapters, and websites.
6
+ You will be provided with the following:
7
+ 1. Title of the source
8
+ 2. A list of main headings in the source
9
+ 3. The source content
10
+
11
+ Perform the following tasks:
12
+
13
+ 1. Classify the content into one to three predefined fields of knowledge.
14
+ 2. Extract key concepts within the content. Be exhaustive and thorough.
15
+ 3. Extract concrete and relevant facts that are referenced in the content. Be exhaustive and thorough.
16
+ 4. Decide whether the content has any educational value and should be used to generate test material and quizzes based on the identified concepts and facts.
17
+ 5. If the generate_cards is true then summarize the content using a series of summary cards.
18
+
19
+ Output your answer as valid JSON, in the form:
20
+ json
21
+ {
22
+ "field": ["primary_field", "secondary_field", "tertiary_field"],
23
+ "concepts":
24
+ [
25
+ {
26
+ "concept_text": "concept_content",
27
+ "reference": "main_heading"
28
+ },
29
+ {...}
30
+ ],
31
+ "facts":
32
+ [
33
+ {
34
+ "fact_text": "fact_content",
35
+ "reference": "main_heading"
36
+ },
37
+ {...}
38
+ ],
39
+ "generate_cards": [
40
+ state: true or false,
41
+ reason: "reason for marking the source as false. Leave empty for true."
42
+ ],
43
+ "summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
44
+ }
45
+
46
+ Further instruction on how to perform these tasks are below.
47
+ 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.
48
+
49
+ 1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
50
+ 2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
51
+ 3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
52
+ 4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
53
+ 5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
54
+ 6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
55
+ 7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
56
+ 8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
57
+ 9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
58
+ 10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
59
+ 11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
60
+ 12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
61
+ 13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
62
+ 14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
63
+ 15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
64
+ 16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
65
+ 17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
66
+ 18. Other: Use for content that doesn’t fit into the above categories.
67
+ Extract key concepts within the content after classifying the field. This is a crucial part of the exercise. Be exhaustive and thorough.
68
+
69
+ 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.
70
+ 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail and is an important part of the subject matter of the source.
71
+ 3. **How to describe a concept**: The concept should be described so that a reader can comprehend the gist of it.
72
+ 4. **Character Limit**: Maintain a limit of 90 characters to ensure each concept is concise yet informative.
73
+ 5. **Reference**: Every concept must include 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 heading must exactly match one of the headings provided to you. Sometimes concepts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
74
+
75
+ List the concepts in the following JSON format:
76
+
77
+ json
78
+ "concepts":
79
+ [
80
+ {
81
+ "concept_text": "concept_content",
82
+ "reference": "main_heading"
83
+ },
84
+ {...}
85
+ ]
86
+ After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
87
+
88
+ 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
89
+ 2. **Selection Criteria**: Inlcude facts based on their significance to the content's main themes or concepts, their educational value and their foundational role in the subject.
90
+ 3. **Character Limit**: Maintain a limit of 90 characters for the to ensure each message is concise yet informative.
91
+ 4. **Reference**: Every fact must include 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 heading must exactly match one of the headings provided to you. Sometimes facts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
92
+
93
+ List the facts in the following JSON format:
94
+
95
+ json
96
+ "facts":
97
+ [
98
+ {
99
+ "fact_text": "fact_content",
100
+ "reference": "main_heading"
101
+ },
102
+ {...}
103
+ ]
104
+ After you have examined the content —its field, its concepts, and its facts— determine whether it justifies the creation of quiz materials.
105
+
106
+ Consider whether these elements offer the average learner meaningful insights, practical uses, or serve important educational aims. If, in your judgment, the material falls short of providing such value, explain why in fewer than 90 characters.
107
+
108
+ Reflect your in the JSON format as follows:
109
+
110
+ json
111
+ "generate_cards":
112
+ { state: true or false,
113
+ reason: "reason for marking the source as false. Leave empty for true."
114
+ }
115
+ After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards.
116
+
117
+ These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
118
+
119
+
120
+ 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
121
+ 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.
122
+ 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
123
+ 4. **Card limit**: Limit the total number of cards to less than or equal to 8.
124
+ 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.
125
+
126
+ Format your output in JSON as follows:
127
+
128
+ json
129
+ {
130
+ "summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "... up to 8 summary cards"]
131
+ }
132
+
133
+
134
+
135
+ `;
136
+ function returnTypologyPrompt() {
137
+ return typologyPromptString;
138
+ }