only_ever_generator 0.3.8 → 0.4.0
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.
- package/dist/bootstrap/app.js +18 -2
- package/dist/card_gen/generate_cards.js +8 -18
- package/dist/constants/api_constants.js +1 -2
- package/dist/constants/prompt_data.js +1 -2
- package/dist/constants/prompts/card_gen_prompt.js +72 -56
- package/dist/constants/prompts/typology_prompt.js +63 -25
- package/dist/constants/source_data.js +3 -4
- package/dist/gap_fill/calculate_gap_fill.js +1 -2
- package/dist/index.js +23 -23
- package/dist/parse/response_format_card.js +2 -3
- package/dist/parse/response_format_typology.js +1 -2
- package/dist/utils/parse_openai_response.js +2 -3
- package/package.json +7 -7
- package/readme.md +12 -0
- package/src/bootstrap/app.ts +25 -2
- package/src/card_gen/generate_cards.ts +7 -16
- package/src/constants/prompts/card_gen_prompt.ts +71 -54
- package/src/constants/prompts/typology_prompt.ts +62 -23
- package/src/index.ts +23 -23
package/dist/bootstrap/app.js
CHANGED
|
@@ -61,7 +61,7 @@ class OnlyEverGenerator {
|
|
|
61
61
|
responseToReturn.push(this.cardgenResponse);
|
|
62
62
|
/// check if gap fill is required ie coverage determination
|
|
63
63
|
if (this.cardgenResponse.status_code == 200) {
|
|
64
|
-
this.gapFillResponse = yield this.
|
|
64
|
+
this.gapFillResponse = yield this._generationForGapFill(this.typologyResponse, this.cardgenResponse);
|
|
65
65
|
responseToReturn.push(this.gapFillResponse);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -79,7 +79,7 @@ class OnlyEverGenerator {
|
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
_generationForGapFill(typologyData, cardGenData) {
|
|
83
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
84
|
let gapFill = (0, calculate_gap_fill_1.gapFilling)(typologyData, cardGenData);
|
|
85
85
|
let response;
|
|
@@ -108,5 +108,21 @@ class OnlyEverGenerator {
|
|
|
108
108
|
return response;
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
+
gapFill(factsMaps, aiCards) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
/// factsmap
|
|
114
|
+
/// {
|
|
115
|
+
/// remaining_facts: [],
|
|
116
|
+
/// remaining_concepts: [],
|
|
117
|
+
//}
|
|
118
|
+
/// aicards is data
|
|
119
|
+
let response;
|
|
120
|
+
response = yield this.generateCard(this.promptForCardGen +
|
|
121
|
+
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
122
|
+
JSON.stringify(factsMaps) +
|
|
123
|
+
"Exclude generating cards with content in the following", JSON.stringify(aiCards), true);
|
|
124
|
+
return response;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
111
127
|
}
|
|
112
128
|
exports.OnlyEverGenerator = OnlyEverGenerator;
|
|
@@ -199,20 +199,14 @@ class GenerateCards {
|
|
|
199
199
|
}
|
|
200
200
|
parseMatchCard(cardData) {
|
|
201
201
|
let content = cardData.card_content;
|
|
202
|
-
|
|
203
|
-
for (let key in content) {
|
|
204
|
-
if (content.hasOwnProperty(key)) {
|
|
205
|
-
transformedData[key] = [content[key]];
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
|
|
202
|
+
let displayTitle = this.generateMatchCardDisplayTitle(content);
|
|
209
203
|
let matchCard = {
|
|
210
204
|
type: {
|
|
211
205
|
category: 'learning',
|
|
212
206
|
sub_type: cardData.type,
|
|
213
207
|
},
|
|
214
208
|
heading: cardData.card_reference,
|
|
215
|
-
content:
|
|
209
|
+
content: content,
|
|
216
210
|
// content: cardData.card_content,
|
|
217
211
|
displayTitle: displayTitle,
|
|
218
212
|
concepts: cardData.concepts,
|
|
@@ -224,16 +218,12 @@ class GenerateCards {
|
|
|
224
218
|
generateMatchCardDisplayTitle(answers) {
|
|
225
219
|
let titles = [];
|
|
226
220
|
let counter = 65;
|
|
227
|
-
for (let
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
titles.push(`${letter}. ${key} -- ${value}`);
|
|
234
|
-
counter++;
|
|
235
|
-
// });
|
|
236
|
-
}
|
|
221
|
+
for (let data of answers) {
|
|
222
|
+
let value = data.right_item.join(',');
|
|
223
|
+
let left = data.left_item;
|
|
224
|
+
let letter = String.fromCharCode(counter);
|
|
225
|
+
titles.push(`${letter}. ${data} -- ${value}`);
|
|
226
|
+
counter++;
|
|
237
227
|
}
|
|
238
228
|
let displayTitle = titles.join(",");
|
|
239
229
|
return displayTitle;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.openAiEndPoint =
|
|
3
|
+
exports.openAiEndPoint = openAiEndPoint;
|
|
4
4
|
function openAiEndPoint() {
|
|
5
5
|
return 'https://api.openai.com/v1/chat/completions';
|
|
6
6
|
}
|
|
7
|
-
exports.openAiEndPoint = openAiEndPoint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnPromptData =
|
|
3
|
+
exports.returnPromptData = returnPromptData;
|
|
4
4
|
const card_gen_prompt_1 = require("./prompts/card_gen_prompt");
|
|
5
5
|
const typology_prompt_1 = require("./prompts/typology_prompt");
|
|
6
6
|
const promptData = {
|
|
@@ -300,4 +300,3 @@ function returnPromptData() {
|
|
|
300
300
|
"card_generation": (0, card_gen_prompt_1.returnCardGenPrompt)(''),
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
exports.returnPromptData = returnPromptData;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnCardGenPrompt =
|
|
3
|
+
exports.returnCardGenPrompt = returnCardGenPrompt;
|
|
4
4
|
const promptString = `
|
|
5
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:
|
|
6
6
|
|
|
@@ -67,12 +67,13 @@ json
|
|
|
67
67
|
{
|
|
68
68
|
"missing_facts": ["fact1", "fact2", "fact3", "..."]
|
|
69
69
|
}
|
|
70
|
-
After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
|
|
72
|
+
|
|
73
|
+
1. Clarity: Ensure the test content is clear and unambiguous.
|
|
74
|
+
2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
|
|
75
|
+
3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
|
|
76
|
+
4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
|
|
76
77
|
|
|
77
78
|
Include the following property for each card:
|
|
78
79
|
|
|
@@ -84,37 +85,39 @@ Test cards must be one of the following types:
|
|
|
84
85
|
|
|
85
86
|
1. Flashcards: Have a front and back.
|
|
86
87
|
|
|
87
|
-
json
|
|
88
|
+
json:
|
|
88
89
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
"type": "flash",
|
|
91
|
+
"card_content": {
|
|
92
|
+
"front": "<content for the front>",
|
|
93
|
+
"back": "<content for the back>"
|
|
94
|
+
},
|
|
95
|
+
"card_reference": "heading",
|
|
96
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
97
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
98
|
+
"bloom_level": <1-5>
|
|
98
99
|
}
|
|
100
|
+
|
|
99
101
|
- Each side must not exceed 300 characters.
|
|
100
102
|
2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
|
|
101
103
|
|
|
102
|
-
json
|
|
104
|
+
json:
|
|
103
105
|
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
"type": "mcq",
|
|
107
|
+
"card_content": {
|
|
108
|
+
"prompt": "<question text>",
|
|
109
|
+
"choices": [
|
|
110
|
+
{"choice": "choice 1", "is_correct": true or false},
|
|
111
|
+
{"choice": "choice 2", "is_correct": true or false},
|
|
112
|
+
"... up to 8 choices"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"card_reference": "heading",
|
|
116
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
117
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
118
|
+
"bloom_level": <1-5>
|
|
117
119
|
}
|
|
120
|
+
|
|
118
121
|
• Minimum choices required: 2
|
|
119
122
|
• Maximum choices allowed: 8
|
|
120
123
|
• Minimum correct choices required: 1
|
|
@@ -125,22 +128,23 @@ json
|
|
|
125
128
|
|
|
126
129
|
json
|
|
127
130
|
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
"type": "cloze",
|
|
132
|
+
"card_content": {
|
|
133
|
+
"prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
|
|
134
|
+
"options": [
|
|
135
|
+
{"option": "notes", "cloze": "c0"},
|
|
136
|
+
{"option": "scale", "cloze": "c1"},
|
|
137
|
+
{"option": "mode", "cloze": "c2"},
|
|
138
|
+
{"option": "chords", "cloze": "null"},
|
|
139
|
+
"... up to 8 choices"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"card_reference": "heading",
|
|
143
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
144
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
145
|
+
"bloom_level": <1-5>
|
|
143
146
|
}
|
|
147
|
+
|
|
144
148
|
• Minimum choices required: 2
|
|
145
149
|
• Maximum choices allowed: 8
|
|
146
150
|
• Minimum correct choices required: 1
|
|
@@ -148,20 +152,33 @@ json
|
|
|
148
152
|
• Maximum character length for an individual cloze: 90
|
|
149
153
|
|
|
150
154
|
4. Match: Pairing items.
|
|
155
|
+
|
|
151
156
|
json
|
|
152
157
|
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
|
|
158
|
+
"type": "match",
|
|
159
|
+
"card_content": [
|
|
160
|
+
{
|
|
161
|
+
"left_item": "left choice",
|
|
162
|
+
"right_item": [right item]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"left_item":" left choice",
|
|
166
|
+
"right_item": [right item]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"left_item": "left choice",
|
|
170
|
+
"right_item": [right item]
|
|
171
|
+
},
|
|
172
|
+
"... up to 8 total pairs"
|
|
173
|
+
],
|
|
174
|
+
"card_reference": "heading",
|
|
175
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
176
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
177
|
+
"bloom_level": <1-5>
|
|
163
178
|
}
|
|
179
|
+
|
|
164
180
|
• Maximum character length for each item in a pair: 42
|
|
181
|
+
|
|
165
182
|
|
|
166
183
|
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.
|
|
167
184
|
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.
|
|
@@ -175,7 +192,6 @@ Generate atleast 10 cards.
|
|
|
175
192
|
function returnCardGenPrompt(cardGenPrompt) {
|
|
176
193
|
return promptString;
|
|
177
194
|
}
|
|
178
|
-
exports.returnCardGenPrompt = returnCardGenPrompt;
|
|
179
195
|
// let concatenatedString: string = '';
|
|
180
196
|
// for (let key in cardGenPrompt) {
|
|
181
197
|
// if (cardGenPrompt.hasOwnProperty(key)) {
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnTypologyPrompt =
|
|
3
|
+
exports.returnTypologyPrompt = returnTypologyPrompt;
|
|
4
4
|
const typologyPromptString = `
|
|
5
|
-
|
|
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 PDFs, book chapters, videos, and websites. Follow these steps:
|
|
6
6
|
|
|
7
7
|
1. Classify the content into one to three predefined fields of knowledge.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
10
|
-
4. Decide whether the
|
|
8
|
+
2. Extract key concepts within the content. Be exhaustive and thorough.
|
|
9
|
+
3. Extract concrete facts that are relevant to the subject and referenced in the content.
|
|
10
|
+
4. Decide whether the provided text has educational value and should be used to generate test material and quizzes based on the identified concepts and facts.
|
|
11
11
|
5. If the generate_cards is true then summarize the content using a series of summary cards.
|
|
12
12
|
|
|
13
13
|
Please format your findings in this JSON schema:
|
|
14
14
|
json
|
|
15
15
|
{
|
|
16
16
|
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
17
|
-
"concepts":
|
|
18
|
-
|
|
17
|
+
"concepts":
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
"concept_text": "concept_content",
|
|
21
|
+
"reference": "source_title#main_heading"
|
|
22
|
+
},
|
|
23
|
+
{...}
|
|
24
|
+
],
|
|
25
|
+
"facts":
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"fact_text": "fact_content",
|
|
29
|
+
"reference": "source_title#main_heading"
|
|
30
|
+
},
|
|
31
|
+
{...}
|
|
32
|
+
],
|
|
19
33
|
"generate_cards": [
|
|
20
34
|
state: true or false,
|
|
21
|
-
|
|
35
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
22
36
|
],
|
|
23
|
-
"summary_cards": ["
|
|
37
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
24
38
|
}
|
|
25
39
|
|
|
26
40
|
Further instruction on how to perform these tasks are below.
|
|
@@ -44,54 +58,78 @@ Every source must be placed under a field. This is the broadest category of know
|
|
|
44
58
|
16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
|
|
45
59
|
17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
|
|
46
60
|
18. Other: Use for content that doesn’t fit into the above categories.
|
|
61
|
+
Extract key concepts within the content after classifying the field. This is a crucial part of the exercise. Be exhaustive and thorough.
|
|
47
62
|
|
|
48
|
-
|
|
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.
|
|
63
|
+
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.
|
|
51
64
|
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.
|
|
65
|
+
3. **How to describe a concept**: The concept should be described so that a reader can comprehend the gist of it.
|
|
66
|
+
4. **Character Limit**: Maintain a limit of 60 characters for the to ensure each concept is concise yet informative.
|
|
67
|
+
5. **Reference**: Every concept must include a reference. A reference can either be the entire source or a specific heading in the source. The reference indicates the part of the text that is most relevant for that particular concept. 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. If a concept needs to reference multiple sections or the entire source then simply leave the reference as empty.
|
|
52
68
|
|
|
53
69
|
List the concepts in the following JSON format:
|
|
70
|
+
|
|
54
71
|
json
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
"concepts":
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
"concept_text": "concept_content",
|
|
76
|
+
"reference": "source_title#main_heading"
|
|
77
|
+
},
|
|
78
|
+
{...}
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
|
|
59
82
|
|
|
60
83
|
1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
|
|
61
84
|
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.
|
|
85
|
+
3. **Character Limit**: Maintain a limit of 60 characters for the to ensure each message is concise yet informative.
|
|
86
|
+
4. **Reference**: Every fact must include a reference. The reference indicates the part of the text that is most relevant for that particular concept. 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. If a fact needs to reference multiple sections or the entire source then simply leave the reference as empty.
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
List the facts in the following JSON format:
|
|
64
89
|
json
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
"facts":
|
|
91
|
+
[
|
|
92
|
+
{
|
|
93
|
+
"fact_text": "fact_content",
|
|
94
|
+
"reference": "source_title#main_heading"
|
|
95
|
+
},
|
|
96
|
+
{...}
|
|
97
|
+
]
|
|
98
|
+
After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing (quiz) materials.
|
|
99
|
+
|
|
100
|
+
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 the source does not hold educational value that is worthy of generating testing material or quizzes for then please provide a reason in less than 90 characters.
|
|
69
101
|
|
|
70
102
|
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
103
|
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.
|
|
72
104
|
|
|
73
105
|
Make your decision using this criterion and reflect it in the JSON format as follows:
|
|
106
|
+
|
|
74
107
|
json
|
|
75
108
|
"generate_cards":
|
|
76
109
|
{ state: true or false,
|
|
77
|
-
|
|
110
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
78
111
|
}
|
|
79
112
|
|
|
80
|
-
|
|
113
|
+
After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards.
|
|
114
|
+
|
|
115
|
+
These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
|
|
81
116
|
|
|
82
117
|
|
|
83
118
|
1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
84
119
|
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
120
|
3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
|
|
121
|
+
4. **Card limit**: Limit the total number of cards to less than or equal to 8.
|
|
86
122
|
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
123
|
|
|
88
124
|
Format your output in JSON as follows:
|
|
125
|
+
|
|
89
126
|
json
|
|
90
127
|
{
|
|
91
|
-
"summary_cards": ["
|
|
128
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
92
129
|
}
|
|
130
|
+
|
|
131
|
+
|
|
93
132
|
`;
|
|
94
133
|
function returnTypologyPrompt() {
|
|
95
134
|
return typologyPromptString;
|
|
96
135
|
}
|
|
97
|
-
exports.returnTypologyPrompt = returnTypologyPrompt;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.returnFields = returnFields;
|
|
4
|
+
exports.returnSourceData = returnSourceData;
|
|
5
|
+
exports.returnHeadings = returnHeadings;
|
|
4
6
|
const sourceString = [
|
|
5
7
|
{
|
|
6
8
|
"block_type": "paragraph",
|
|
@@ -1254,7 +1256,6 @@ const headings = [
|
|
|
1254
1256
|
function returnFields() {
|
|
1255
1257
|
return ["Sciences", "Technology & Engineering", "Humanities & Cultural Studies", "Social Sciences & Global Studies", "Business & Management", "Health & Medicine", "Environmental Studies & Earth Sciences", "Education, Learning & Personal Development", "Creative & Performing Arts", "Law, Governance & Ethics", "Recreation, Lifestyle & Practical Skills", "Technology & Media Literacy", "Philosophy & Critical Thinking", "Space & Astronomical Sciences", "Agriculture & Food Sciences", "Trades & Craftsmanship", "Reference & Indexing", "Other"];
|
|
1256
1258
|
}
|
|
1257
|
-
exports.returnFields = returnFields;
|
|
1258
1259
|
const sourceContent = {
|
|
1259
1260
|
type: 'source',
|
|
1260
1261
|
title: 'Time zone',
|
|
@@ -1309,8 +1310,6 @@ const sourceContent = {
|
|
|
1309
1310
|
function returnSourceData() {
|
|
1310
1311
|
return sourceContent;
|
|
1311
1312
|
}
|
|
1312
|
-
exports.returnSourceData = returnSourceData;
|
|
1313
1313
|
function returnHeadings() {
|
|
1314
1314
|
return headings;
|
|
1315
1315
|
}
|
|
1316
|
-
exports.returnHeadings = returnHeadings;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gapFilling =
|
|
3
|
+
exports.gapFilling = gapFilling;
|
|
4
4
|
function isEmpty(obj) {
|
|
5
5
|
return Object.keys(obj).length === 0;
|
|
6
6
|
}
|
|
@@ -43,4 +43,3 @@ function gapFilling(typologyResponse, cardgenResponse) {
|
|
|
43
43
|
remainingFacts: remainingFacts,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
exports.gapFilling = gapFilling;
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.OnlyEverGenerator = void 0;
|
|
11
11
|
const app_1 = require("./bootstrap/app");
|
|
12
12
|
Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: function () { return app_1.OnlyEverGenerator; } });
|
|
13
|
-
//. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
14
|
-
//below this line
|
|
15
|
-
// let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-
|
|
13
|
+
// //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
14
|
+
// //below this line
|
|
15
|
+
// let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-4o", {
|
|
16
16
|
// prompt: returnPromptData(),
|
|
17
17
|
// content: returnSourceData(),
|
|
18
18
|
// });
|
|
@@ -28,27 +28,27 @@ Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: fun
|
|
|
28
28
|
// // let content = returnSourceData().toString()
|
|
29
29
|
// // let headings = returnHeadings();
|
|
30
30
|
// // // let aiRequest = await openAIRequest(prompt,content);
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
// });
|
|
34
|
-
// app.get("/typology", async (req, res) => {
|
|
35
|
-
// {
|
|
36
|
-
// // let typologyPrompt = returnTypologyPrompt();
|
|
37
|
-
// // let cardPrompt = returnCardGenPrompt();
|
|
38
|
-
// // let args = new GenerateArgs(
|
|
39
|
-
// // true,
|
|
40
|
-
// // true,
|
|
41
|
-
// // false,
|
|
42
|
-
// // {
|
|
43
|
-
// // typology_prompt: typologyPrompt,
|
|
44
|
-
// // card_gen_prompt: cardPrompt,
|
|
45
|
-
// // summary_prompt: "",
|
|
46
|
-
// // }
|
|
47
|
-
// // )
|
|
48
|
-
// let typologyRequest = await oeGen.generate(false, true);
|
|
49
|
-
// res.send(typologyRequest);
|
|
50
|
-
// }
|
|
31
|
+
// let aiRequest = await oeGen.generate(false,true);
|
|
32
|
+
// res.send(aiRequest);
|
|
51
33
|
// });
|
|
34
|
+
// // app.get("/typology", async (req, res) => {
|
|
35
|
+
// // {
|
|
36
|
+
// // let typologyPrompt = returnTypologyPrompt();
|
|
37
|
+
// // let cardPrompt = returnCardGenPrompt();
|
|
38
|
+
// // let args = new GenerateArgs(
|
|
39
|
+
// // true,
|
|
40
|
+
// // true,
|
|
41
|
+
// // false,
|
|
42
|
+
// // {
|
|
43
|
+
// // typology_prompt: typologyPrompt,
|
|
44
|
+
// // card_gen_prompt: cardPrompt,
|
|
45
|
+
// // summary_prompt: "",
|
|
46
|
+
// // }
|
|
47
|
+
// // )
|
|
48
|
+
// // let typologyRequest = await oeGen.generate(false, true);
|
|
49
|
+
// // res.send(typologyRequest);
|
|
50
|
+
// // }
|
|
51
|
+
// // });
|
|
52
52
|
// app.listen(port, () => {
|
|
53
53
|
// console.log(`Example app listening at http://localhost:${port}`);
|
|
54
54
|
// });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.returnResponse = returnResponse;
|
|
4
|
+
exports.parseResponse = parseResponse;
|
|
4
5
|
const responseData = {
|
|
5
6
|
"flash_cards": [
|
|
6
7
|
{
|
|
@@ -142,7 +143,6 @@ const responseData = {
|
|
|
142
143
|
function returnResponse() {
|
|
143
144
|
return responseData;
|
|
144
145
|
}
|
|
145
|
-
exports.returnResponse = returnResponse;
|
|
146
146
|
function parseResponse() {
|
|
147
147
|
let cardData = [];
|
|
148
148
|
let data = returnResponse();
|
|
@@ -162,7 +162,6 @@ function parseResponse() {
|
|
|
162
162
|
}
|
|
163
163
|
return cardData;
|
|
164
164
|
}
|
|
165
|
-
exports.parseResponse = parseResponse;
|
|
166
165
|
/// takes array of
|
|
167
166
|
function parseFlashCard(cards) {
|
|
168
167
|
let flashCardData = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnTypologyData =
|
|
3
|
+
exports.returnTypologyData = returnTypologyData;
|
|
4
4
|
const typologyResponse = {
|
|
5
5
|
"usage_data": {
|
|
6
6
|
"prompt_tokens": 11611,
|
|
@@ -44,4 +44,3 @@ const typologyResponse = {
|
|
|
44
44
|
function returnTypologyData() {
|
|
45
45
|
return typologyResponse;
|
|
46
46
|
}
|
|
47
|
-
exports.returnTypologyData = returnTypologyData;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseOpenAiSuccessResponse = parseOpenAiSuccessResponse;
|
|
4
|
+
exports.parseOpenAiFailureResponse = parseOpenAiFailureResponse;
|
|
4
5
|
function parseOpenAiSuccessResponse(responseData) {
|
|
5
6
|
let choices = JSON.parse(responseData.choices[0].message.content);
|
|
6
7
|
let usuage = responseData.usage;
|
|
@@ -12,7 +13,6 @@ function parseOpenAiSuccessResponse(responseData) {
|
|
|
12
13
|
'generated_at': new Date(createdTime * 1000)
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
exports.parseOpenAiSuccessResponse = parseOpenAiSuccessResponse;
|
|
16
16
|
function parseOpenAiFailureResponse(errorResponse) {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
// let statusCode =
|
|
@@ -21,4 +21,3 @@ function parseOpenAiFailureResponse(errorResponse) {
|
|
|
21
21
|
'message': (_b = (_a = errorResponse.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.code
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
exports.parseOpenAiFailureResponse = parseOpenAiFailureResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "only_ever_generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "npm run build && nodemon dist/index.js",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/express": "^4.17.21",
|
|
15
15
|
"@types/node": "^20.14.2",
|
|
16
|
+
"dotenv": "^16.4.5",
|
|
17
|
+
"express": "^4.19.2",
|
|
16
18
|
"nodemon": "^3.1.3",
|
|
17
19
|
"ts-node": "^10.9.2",
|
|
18
|
-
"typescript": "^5.4
|
|
19
|
-
"dotenv": "^16.4.5",
|
|
20
|
-
"express": "^4.19.2"
|
|
20
|
+
"typescript": "^5.5.4"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"axios": "^1.7.
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"axios": "^1.7.7",
|
|
24
|
+
"n": "^10.0.0",
|
|
25
|
+
"stable": "^0.1.8"
|
|
26
26
|
},
|
|
27
27
|
"eslintConfig": {
|
|
28
28
|
"parser": "typescript-eslint-parser",
|
package/readme.md
CHANGED
|
@@ -20,4 +20,16 @@ let oeGenerator = new OnlyEverGenerator(
|
|
|
20
20
|
let responsesArray = await oeGenerator.generate(true,true);
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
Exposed a new method ```gapFill``` from OnlyEverGenerator
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async gapFill(factsMaps: any, aiCards: Array<any>) {}
|
|
27
|
+
/// factsmap
|
|
28
|
+
/// {
|
|
29
|
+
/// remaining_facts: [],
|
|
30
|
+
/// remaining_concepts: [],
|
|
31
|
+
//}
|
|
32
|
+
|
|
33
|
+
/// aicards is array of ai cards
|
|
34
|
+
|
|
23
35
|
```
|
package/src/bootstrap/app.ts
CHANGED
|
@@ -79,7 +79,7 @@ export class OnlyEverGenerator {
|
|
|
79
79
|
|
|
80
80
|
/// check if gap fill is required ie coverage determination
|
|
81
81
|
if(this.cardgenResponse.status_code == 200) {
|
|
82
|
-
this.gapFillResponse = await this.
|
|
82
|
+
this.gapFillResponse = await this._generationForGapFill(this.typologyResponse, this.cardgenResponse);
|
|
83
83
|
responseToReturn.push(this.gapFillResponse);
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -99,7 +99,7 @@ export class OnlyEverGenerator {
|
|
|
99
99
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
async
|
|
102
|
+
async _generationForGapFill(typologyData: any, cardGenData: any) {
|
|
103
103
|
let gapFill = gapFilling(typologyData, cardGenData);
|
|
104
104
|
let response :any ;
|
|
105
105
|
if (
|
|
@@ -145,6 +145,29 @@ export class OnlyEverGenerator {
|
|
|
145
145
|
return response;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
async gapFill(factsMaps: any, aiCards: Array<any>) {
|
|
149
|
+
/// factsmap
|
|
150
|
+
/// {
|
|
151
|
+
/// remaining_facts: [],
|
|
152
|
+
/// remaining_concepts: [],
|
|
153
|
+
//}
|
|
154
|
+
|
|
155
|
+
/// aicards is data
|
|
156
|
+
let response :any ;
|
|
157
|
+
|
|
158
|
+
response = await this.generateCard(
|
|
159
|
+
this.promptForCardGen +
|
|
160
|
+
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
161
|
+
JSON.stringify(factsMaps) +
|
|
162
|
+
"Exclude generating cards with content in the following",
|
|
163
|
+
JSON.stringify(aiCards),
|
|
164
|
+
true
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
return response;
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
148
171
|
|
|
149
172
|
|
|
150
173
|
}
|
|
@@ -207,21 +207,15 @@ return question;
|
|
|
207
207
|
|
|
208
208
|
parseMatchCard(cardData: any) {
|
|
209
209
|
let content = cardData.card_content;
|
|
210
|
-
const transformedData: { [key: string]: string[] } = {};
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
if (content.hasOwnProperty(key)) {
|
|
214
|
-
transformedData[key] = [content[key]];
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
let displayTitle = this.generateMatchCardDisplayTitle(transformedData);
|
|
211
|
+
let displayTitle = this.generateMatchCardDisplayTitle(content);
|
|
218
212
|
let matchCard = {
|
|
219
213
|
type: {
|
|
220
214
|
category: 'learning',
|
|
221
215
|
sub_type: cardData.type,
|
|
222
216
|
},
|
|
223
217
|
heading: cardData.card_reference,
|
|
224
|
-
content:
|
|
218
|
+
content: content,
|
|
225
219
|
// content: cardData.card_content,
|
|
226
220
|
displayTitle: displayTitle,
|
|
227
221
|
concepts: cardData.concepts,
|
|
@@ -237,16 +231,13 @@ return question;
|
|
|
237
231
|
generateMatchCardDisplayTitle(answers: any) {
|
|
238
232
|
let titles: string[] = [];
|
|
239
233
|
let counter = 65;
|
|
240
|
-
for (let
|
|
241
|
-
|
|
242
|
-
let value =
|
|
243
|
-
|
|
244
|
-
// items.forEach((item: any) => {
|
|
234
|
+
for (let data of answers) {
|
|
235
|
+
|
|
236
|
+
let value = data.right_item.join(',');
|
|
237
|
+
let left = data.left_item;
|
|
245
238
|
let letter = String.fromCharCode(counter);
|
|
246
|
-
titles.push(`${letter}. ${
|
|
239
|
+
titles.push(`${letter}. ${data} -- ${value}`);
|
|
247
240
|
counter++;
|
|
248
|
-
// });
|
|
249
|
-
}
|
|
250
241
|
}
|
|
251
242
|
let displayTitle = titles.join(",");
|
|
252
243
|
return displayTitle;
|
|
@@ -64,12 +64,13 @@ json
|
|
|
64
64
|
{
|
|
65
65
|
"missing_facts": ["fact1", "fact2", "fact3", "..."]
|
|
66
66
|
}
|
|
67
|
-
After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
|
|
69
|
+
|
|
70
|
+
1. Clarity: Ensure the test content is clear and unambiguous.
|
|
71
|
+
2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
|
|
72
|
+
3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
|
|
73
|
+
4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
|
|
73
74
|
|
|
74
75
|
Include the following property for each card:
|
|
75
76
|
|
|
@@ -81,37 +82,39 @@ Test cards must be one of the following types:
|
|
|
81
82
|
|
|
82
83
|
1. Flashcards: Have a front and back.
|
|
83
84
|
|
|
84
|
-
json
|
|
85
|
+
json:
|
|
85
86
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
"type": "flash",
|
|
88
|
+
"card_content": {
|
|
89
|
+
"front": "<content for the front>",
|
|
90
|
+
"back": "<content for the back>"
|
|
91
|
+
},
|
|
92
|
+
"card_reference": "heading",
|
|
93
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
94
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
95
|
+
"bloom_level": <1-5>
|
|
95
96
|
}
|
|
97
|
+
|
|
96
98
|
- Each side must not exceed 300 characters.
|
|
97
99
|
2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
|
|
98
100
|
|
|
99
|
-
json
|
|
101
|
+
json:
|
|
100
102
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
"type": "mcq",
|
|
104
|
+
"card_content": {
|
|
105
|
+
"prompt": "<question text>",
|
|
106
|
+
"choices": [
|
|
107
|
+
{"choice": "choice 1", "is_correct": true or false},
|
|
108
|
+
{"choice": "choice 2", "is_correct": true or false},
|
|
109
|
+
"... up to 8 choices"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"card_reference": "heading",
|
|
113
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
114
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
115
|
+
"bloom_level": <1-5>
|
|
114
116
|
}
|
|
117
|
+
|
|
115
118
|
• Minimum choices required: 2
|
|
116
119
|
• Maximum choices allowed: 8
|
|
117
120
|
• Minimum correct choices required: 1
|
|
@@ -122,22 +125,23 @@ json
|
|
|
122
125
|
|
|
123
126
|
json
|
|
124
127
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
"type": "cloze",
|
|
129
|
+
"card_content": {
|
|
130
|
+
"prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
|
|
131
|
+
"options": [
|
|
132
|
+
{"option": "notes", "cloze": "c0"},
|
|
133
|
+
{"option": "scale", "cloze": "c1"},
|
|
134
|
+
{"option": "mode", "cloze": "c2"},
|
|
135
|
+
{"option": "chords", "cloze": "null"},
|
|
136
|
+
"... up to 8 choices"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"card_reference": "heading",
|
|
140
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
141
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
142
|
+
"bloom_level": <1-5>
|
|
140
143
|
}
|
|
144
|
+
|
|
141
145
|
• Minimum choices required: 2
|
|
142
146
|
• Maximum choices allowed: 8
|
|
143
147
|
• Minimum correct choices required: 1
|
|
@@ -145,20 +149,33 @@ json
|
|
|
145
149
|
• Maximum character length for an individual cloze: 90
|
|
146
150
|
|
|
147
151
|
4. Match: Pairing items.
|
|
152
|
+
|
|
148
153
|
json
|
|
149
154
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
|
|
155
|
+
"type": "match",
|
|
156
|
+
"card_content": [
|
|
157
|
+
{
|
|
158
|
+
"left_item": "left choice",
|
|
159
|
+
"right_item": [right item]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"left_item":" left choice",
|
|
163
|
+
"right_item": [right item]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"left_item": "left choice",
|
|
167
|
+
"right_item": [right item]
|
|
168
|
+
},
|
|
169
|
+
"... up to 8 total pairs"
|
|
170
|
+
],
|
|
171
|
+
"card_reference": "heading",
|
|
172
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
173
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
174
|
+
"bloom_level": <1-5>
|
|
160
175
|
}
|
|
176
|
+
|
|
161
177
|
• Maximum character length for each item in a pair: 42
|
|
178
|
+
|
|
162
179
|
|
|
163
180
|
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.
|
|
164
181
|
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.
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
const typologyPromptString = `
|
|
2
|
-
|
|
2
|
+
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 PDFs, book chapters, videos, and websites. Follow these steps:
|
|
3
3
|
|
|
4
4
|
1. Classify the content into one to three predefined fields of knowledge.
|
|
5
|
-
2.
|
|
6
|
-
3.
|
|
7
|
-
4. Decide whether the
|
|
5
|
+
2. Extract key concepts within the content. Be exhaustive and thorough.
|
|
6
|
+
3. Extract concrete facts that are relevant to the subject and referenced in the content.
|
|
7
|
+
4. Decide whether the provided text has educational value and should be used to generate test material and quizzes based on the identified concepts and facts.
|
|
8
8
|
5. If the generate_cards is true then summarize the content using a series of summary cards.
|
|
9
9
|
|
|
10
10
|
Please format your findings in this JSON schema:
|
|
11
11
|
json
|
|
12
12
|
{
|
|
13
13
|
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
14
|
-
"concepts":
|
|
15
|
-
|
|
14
|
+
"concepts":
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"concept_text": "concept_content",
|
|
18
|
+
"reference": "source_title#main_heading"
|
|
19
|
+
},
|
|
20
|
+
{...}
|
|
21
|
+
],
|
|
22
|
+
"facts":
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
"fact_text": "fact_content",
|
|
26
|
+
"reference": "source_title#main_heading"
|
|
27
|
+
},
|
|
28
|
+
{...}
|
|
29
|
+
],
|
|
16
30
|
"generate_cards": [
|
|
17
31
|
state: true or false,
|
|
18
|
-
|
|
32
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
19
33
|
],
|
|
20
|
-
"summary_cards": ["
|
|
34
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
Further instruction on how to perform these tasks are below.
|
|
@@ -41,52 +55,77 @@ Every source must be placed under a field. This is the broadest category of know
|
|
|
41
55
|
16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
|
|
42
56
|
17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
|
|
43
57
|
18. Other: Use for content that doesn’t fit into the above categories.
|
|
58
|
+
Extract key concepts within the content after classifying the field. This is a crucial part of the exercise. Be exhaustive and thorough.
|
|
44
59
|
|
|
45
|
-
|
|
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.
|
|
60
|
+
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.
|
|
48
61
|
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.
|
|
62
|
+
3. **How to describe a concept**: The concept should be described so that a reader can comprehend the gist of it.
|
|
63
|
+
4. **Character Limit**: Maintain a limit of 60 characters for the to ensure each concept is concise yet informative.
|
|
64
|
+
5. **Reference**: Every concept must include a reference. A reference can either be the entire source or a specific heading in the source. The reference indicates the part of the text that is most relevant for that particular concept. 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. If a concept needs to reference multiple sections or the entire source then simply leave the reference as empty.
|
|
49
65
|
|
|
50
66
|
List the concepts in the following JSON format:
|
|
67
|
+
|
|
51
68
|
json
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
"concepts":
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
"concept_text": "concept_content",
|
|
73
|
+
"reference": "source_title#main_heading"
|
|
74
|
+
},
|
|
75
|
+
{...}
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
|
|
56
79
|
|
|
57
80
|
1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
|
|
58
81
|
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.
|
|
82
|
+
3. **Character Limit**: Maintain a limit of 60 characters for the to ensure each message is concise yet informative.
|
|
83
|
+
4. **Reference**: Every fact must include a reference. The reference indicates the part of the text that is most relevant for that particular concept. 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. If a fact needs to reference multiple sections or the entire source then simply leave the reference as empty.
|
|
59
84
|
|
|
60
|
-
|
|
85
|
+
List the facts in the following JSON format:
|
|
61
86
|
json
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
"facts":
|
|
88
|
+
[
|
|
89
|
+
{
|
|
90
|
+
"fact_text": "fact_content",
|
|
91
|
+
"reference": "source_title#main_heading"
|
|
92
|
+
},
|
|
93
|
+
{...}
|
|
94
|
+
]
|
|
95
|
+
After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing (quiz) materials.
|
|
96
|
+
|
|
97
|
+
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 the source does not hold educational value that is worthy of generating testing material or quizzes for then please provide a reason in less than 90 characters.
|
|
66
98
|
|
|
67
99
|
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
100
|
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
101
|
|
|
70
102
|
Make your decision using this criterion and reflect it in the JSON format as follows:
|
|
103
|
+
|
|
71
104
|
json
|
|
72
105
|
"generate_cards":
|
|
73
106
|
{ state: true or false,
|
|
74
|
-
|
|
107
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
75
108
|
}
|
|
76
109
|
|
|
77
|
-
|
|
110
|
+
After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards.
|
|
111
|
+
|
|
112
|
+
These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
|
|
78
113
|
|
|
79
114
|
|
|
80
115
|
1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
81
116
|
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
117
|
3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
|
|
118
|
+
4. **Card limit**: Limit the total number of cards to less than or equal to 8.
|
|
83
119
|
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
120
|
|
|
85
121
|
Format your output in JSON as follows:
|
|
122
|
+
|
|
86
123
|
json
|
|
87
124
|
{
|
|
88
|
-
"summary_cards": ["
|
|
125
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
89
126
|
}
|
|
127
|
+
|
|
128
|
+
|
|
90
129
|
`;
|
|
91
130
|
|
|
92
131
|
|
package/src/index.ts
CHANGED
|
@@ -13,9 +13,9 @@ import { OnlyEverGenerator } from "./bootstrap/app";
|
|
|
13
13
|
/// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
|
|
14
14
|
export {OnlyEverGenerator};
|
|
15
15
|
|
|
16
|
-
//. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
17
|
-
//below this line
|
|
18
|
-
// let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-
|
|
16
|
+
// //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
17
|
+
// //below this line
|
|
18
|
+
// let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-4o", {
|
|
19
19
|
// prompt: returnPromptData(),
|
|
20
20
|
// content: returnSourceData(),
|
|
21
21
|
// });
|
|
@@ -33,28 +33,28 @@ import { OnlyEverGenerator } from "./bootstrap/app";
|
|
|
33
33
|
// // let content = returnSourceData().toString()
|
|
34
34
|
// // let headings = returnHeadings();
|
|
35
35
|
// // // let aiRequest = await openAIRequest(prompt,content);
|
|
36
|
-
//
|
|
37
|
-
//
|
|
36
|
+
// let aiRequest = await oeGen.generate(false,true);
|
|
37
|
+
// res.send(aiRequest);
|
|
38
38
|
// });
|
|
39
39
|
|
|
40
|
-
// app.get("/typology", async (req, res) => {
|
|
41
|
-
// {
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
// let typologyRequest = await oeGen.generate(false, true);
|
|
55
|
-
// res.send(typologyRequest);
|
|
56
|
-
// }
|
|
57
|
-
// });
|
|
40
|
+
// // app.get("/typology", async (req, res) => {
|
|
41
|
+
// // {
|
|
42
|
+
// // let typologyPrompt = returnTypologyPrompt();
|
|
43
|
+
// // let cardPrompt = returnCardGenPrompt();
|
|
44
|
+
// // let args = new GenerateArgs(
|
|
45
|
+
// // true,
|
|
46
|
+
// // true,
|
|
47
|
+
// // false,
|
|
48
|
+
// // {
|
|
49
|
+
// // typology_prompt: typologyPrompt,
|
|
50
|
+
// // card_gen_prompt: cardPrompt,
|
|
51
|
+
// // summary_prompt: "",
|
|
52
|
+
// // }
|
|
53
|
+
// // )
|
|
54
|
+
// // let typologyRequest = await oeGen.generate(false, true);
|
|
55
|
+
// // res.send(typologyRequest);
|
|
56
|
+
// // }
|
|
57
|
+
// // });
|
|
58
58
|
|
|
59
59
|
// app.listen(port, () => {
|
|
60
60
|
// console.log(`Example app listening at http://localhost:${port}`);
|