only_ever_generator 1.0.0 → 1.0.1
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 +72 -3
- package/dist/class/parse/parse_source_content.js +62 -0
- package/dist/class/services/open_ai_service.js +3 -2
- package/dist/constants/prompts/card_gen_prompt.js +247 -53
- package/dist/constants/prompts/typology_prompt.js +12 -13
- package/dist/constants/source_data.js +1 -3
- package/dist/index.js +103 -25
- package/dist/service/open_ai_request.js +3 -4
- package/dist/utils/parse_openai_response.js +10 -1
- package/package.json +2 -2
- package/readme.md +32 -0
- package/src/bootstrap/app.ts +89 -4
- package/src/class/parse/parse_source_content.ts +71 -0
- package/src/class/services/open_ai_service.ts +4 -2
- package/src/constants/prompts/card_gen_prompt.ts +249 -55
- package/src/constants/prompts/typology_prompt.ts +12 -13
- package/src/constants/source_data.ts +2 -2
- package/src/index.ts +118 -25
- package/src/service/open_ai_request.ts +5 -6
- package/src/utils/parse_openai_response.ts +11 -0
package/dist/bootstrap/app.js
CHANGED
|
@@ -1,16 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { ParseSourceContent } from "../class/parse/parse_source_content";
|
|
2
3
|
// import { OpenAiService } from "../class/services/open_ai_service";
|
|
3
4
|
// export class OnlyEverGenerator{
|
|
4
5
|
// public api_key: string = '';
|
|
5
6
|
// public openAiService: OpenAiService | undefined;
|
|
6
|
-
//
|
|
7
|
+
// parsedContent: String = '';
|
|
8
|
+
// constructor(apiKey:string, content: Array<any>){
|
|
7
9
|
// this.api_key = apiKey;
|
|
8
10
|
// this.openAiService = new OpenAiService(apiKey);
|
|
11
|
+
// this.parsedContent = new ParseSourceContent(content).parse();
|
|
9
12
|
// };
|
|
13
|
+
// typologyResponse = {};
|
|
14
|
+
// cardgenResponse = {};
|
|
15
|
+
// summarizeResponse = {};
|
|
16
|
+
// async generate(
|
|
17
|
+
// args: GenerateArgs
|
|
18
|
+
// ): Promise<Array<any>> {
|
|
19
|
+
// const responseToReturn = [];
|
|
20
|
+
// const whatNeedsToBeGenerated = args.getWhatNeedsToBeGenerated();
|
|
21
|
+
// for(let elem of whatNeedsToBeGenerated)
|
|
22
|
+
// if(elem == 'generate_tyopology'){
|
|
23
|
+
// this.typologyResponse = await this.generateTypology(args.prompts.typology_prompt ?? '', this.parsedContent);
|
|
24
|
+
// responseToReturn.push(this.typologyResponse);
|
|
25
|
+
// }else if(elem == 'generate_card'){
|
|
26
|
+
// this.cardgenResponse = await this.generateCard(args.prompts.card_gen_prompt ?? '', this.parsedContent + JSON.stringify(this.typologyResponse));
|
|
27
|
+
// responseToReturn.push(this.cardgenResponse);
|
|
28
|
+
// }else if(elem == 'generate_summary'){
|
|
29
|
+
// this.summarizeResponse = await this.generateSummary(args.prompts.summary_prompt ?? '', this.parsedContent);
|
|
30
|
+
// responseToReturn.push(this.summarizeResponse);
|
|
31
|
+
// }
|
|
32
|
+
// return responseToReturn;
|
|
33
|
+
// }
|
|
34
|
+
// returnParsedContent(){
|
|
35
|
+
// return this.parsedContent;
|
|
36
|
+
// }
|
|
10
37
|
// async generateCard(prompt: String, content: String){
|
|
11
|
-
//
|
|
38
|
+
// let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
|
|
39
|
+
// response['type'] = 'card_gen';
|
|
40
|
+
// return response;
|
|
12
41
|
// }
|
|
13
42
|
// async generateTypology(prompt:String,content:String){
|
|
14
|
-
//
|
|
43
|
+
// let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
|
|
44
|
+
// response['type'] = 'typology';
|
|
45
|
+
// return response;
|
|
46
|
+
// }
|
|
47
|
+
// async generateSummary(prompt:String,content:String){
|
|
48
|
+
// let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
|
|
49
|
+
// response['type']= 'summary';
|
|
50
|
+
// return response;
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// export class GenerateArgs{
|
|
54
|
+
// public generate_card : boolean = false;
|
|
55
|
+
// public generate_typology: boolean = false;
|
|
56
|
+
// public generate_summary: boolean = false;
|
|
57
|
+
// public prompts = {
|
|
58
|
+
// typology_prompt: '',
|
|
59
|
+
// card_gen_prompt: '',
|
|
60
|
+
// summary_prompt: ''
|
|
61
|
+
// }
|
|
62
|
+
// constructor(generate_card: boolean,generate_typology: boolean, generate_summary: boolean, prompts = {
|
|
63
|
+
// typology_prompt: '',
|
|
64
|
+
// card_gen_prompt: '',
|
|
65
|
+
// summary_prompt: ''
|
|
66
|
+
// }){
|
|
67
|
+
// this.generate_card = generate_card;
|
|
68
|
+
// this.generate_typology = generate_typology;
|
|
69
|
+
// this.generate_summary = generate_summary;
|
|
70
|
+
// this.prompts = prompts
|
|
71
|
+
// }
|
|
72
|
+
// getWhatNeedsToBeGenerated(){
|
|
73
|
+
// let returnData = [];
|
|
74
|
+
// if(this.generate_typology == true){
|
|
75
|
+
// returnData.push('generate_tyopology')
|
|
76
|
+
// }
|
|
77
|
+
// if(this.generate_summary == true){
|
|
78
|
+
// returnData.push('generate_summary')
|
|
79
|
+
// }
|
|
80
|
+
// if(this.generate_card == true){
|
|
81
|
+
// returnData.push('generate_card');
|
|
82
|
+
// }
|
|
83
|
+
// return returnData;
|
|
15
84
|
// }
|
|
16
85
|
// }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParseSourceContent = void 0;
|
|
4
|
+
class ParseSourceContent {
|
|
5
|
+
constructor(sourceContent) {
|
|
6
|
+
this.titles_to_remove = ['See also', 'References', 'Further reading', 'External links', 'Notes and references', 'Bibliography', 'Notes', 'Cited sources'];
|
|
7
|
+
this.content = sourceContent;
|
|
8
|
+
}
|
|
9
|
+
parse() {
|
|
10
|
+
let dataAfterRemovingUnWantedBlocks = this.removeSectionsByTitle(this.content);
|
|
11
|
+
let afterSanitized = this.sanitizeBlocks(dataAfterRemovingUnWantedBlocks);
|
|
12
|
+
return JSON.stringify(afterSanitized);
|
|
13
|
+
}
|
|
14
|
+
removeSectionsByTitle(data) {
|
|
15
|
+
let dataAfterRemoving = [];
|
|
16
|
+
for (let elem of data) {
|
|
17
|
+
if (elem.block_type == 'heading' && this.titles_to_remove.includes(elem.content)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (elem.children) {
|
|
21
|
+
elem.children = this.removeSectionsByTitle(elem.children);
|
|
22
|
+
}
|
|
23
|
+
dataAfterRemoving.push(elem);
|
|
24
|
+
}
|
|
25
|
+
return dataAfterRemoving;
|
|
26
|
+
}
|
|
27
|
+
sanitizeWikiContent(content) {
|
|
28
|
+
// Remove newline characters
|
|
29
|
+
content = content.replace(/\\n/g, ' ');
|
|
30
|
+
// Remove internal link references, keeping only the link text
|
|
31
|
+
// Pattern explanation: [[link|text|index|wiki]] --> text
|
|
32
|
+
content = content.replace(/\[\[.*?\|(.*?)\|.*?\|wiki\]\]/g, '$1');
|
|
33
|
+
// Remove external links, keeping only the link text
|
|
34
|
+
// Pattern explanation: [url text] --> text
|
|
35
|
+
content = content.replace(/\[http[s]?:\/\/[^\s]+ ([^\]]+)\]/g, '$1');
|
|
36
|
+
// Remove Markdown link references, keeping only the link text
|
|
37
|
+
// Pattern explanation:  --> link text
|
|
38
|
+
content = content.replace(/\!\[([^\]]+)\]\([^\)]+\)/g, '$1');
|
|
39
|
+
return content;
|
|
40
|
+
}
|
|
41
|
+
sanitizeBlocks(blocks) {
|
|
42
|
+
let sanitizedBlocks = [];
|
|
43
|
+
blocks.forEach(block => {
|
|
44
|
+
let sanitizedBlock = {};
|
|
45
|
+
for (let key in block) {
|
|
46
|
+
let value = block[key];
|
|
47
|
+
if (typeof value === 'string') {
|
|
48
|
+
sanitizedBlock[key] = this.sanitizeWikiContent(value);
|
|
49
|
+
}
|
|
50
|
+
else if (Array.isArray(value)) {
|
|
51
|
+
sanitizedBlock[key] = this.sanitizeBlocks(value);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
sanitizedBlock[key] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
sanitizedBlocks.push(sanitizedBlock);
|
|
58
|
+
});
|
|
59
|
+
return sanitizedBlocks;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ParseSourceContent = ParseSourceContent;
|
|
@@ -12,12 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.OpenAiService = void 0;
|
|
13
13
|
const open_ai_request_1 = require("../../service/open_ai_request");
|
|
14
14
|
class OpenAiService {
|
|
15
|
-
constructor(apiKey) {
|
|
15
|
+
constructor(apiKey, model) {
|
|
16
16
|
this.api_key = apiKey;
|
|
17
|
+
this.model = model;
|
|
17
18
|
}
|
|
18
19
|
sendRequest(prompt, content) {
|
|
19
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return yield (0, open_ai_request_1.openAIRequest)(content, prompt, this.api_key);
|
|
21
|
+
return yield (0, open_ai_request_1.openAIRequest)(content, prompt, this.api_key, this.model);
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -2,74 +2,268 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.returnCardGenPrompt = void 0;
|
|
4
4
|
const promptString = `
|
|
5
|
-
|
|
6
|
-
Please generate an array of different types of question-and-answer pairs based on the provided content schema.
|
|
7
|
-
The types include flash cards, multiple choice questions (MCQs), and cloze cards. Each type has specific formatting requirements
|
|
8
|
-
as detailed below. Each question should come from a different H1 heading, ensuring diversity in the topics covered.
|
|
9
|
-
Format the response as JSON, adhering to the following example structures for each type of card:
|
|
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:
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
15
14
|
|
|
15
|
+
Follow these steps:
|
|
16
|
+
|
|
17
|
+
1. Analyze the content to identify any key concepts missing from the provided list.
|
|
18
|
+
2. Analyze the content to identify any important facts missing from the provided list.
|
|
19
|
+
3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
|
|
20
|
+
4. Ensure all concepts and facts have at least one test card.
|
|
21
|
+
|
|
22
|
+
Please format your response in the following format.
|
|
23
|
+
json
|
|
24
|
+
"missing_concepts": ["concept1", "concept2", "concept3", "..."],
|
|
25
|
+
"missing_facts": ["fact1", "fact2", "fact3", "..."],
|
|
26
|
+
"test_cards": [
|
|
27
|
+
{
|
|
28
|
+
"type": "flash" | "mcq" | "cloze" | "match",
|
|
29
|
+
"card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "right_choice 1": "...", "left_choice 1": "..." },
|
|
30
|
+
"card_reference": "source_title#heading",
|
|
31
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
32
|
+
"facts": ["Fact1", "Fact2", "..."]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
**Criteria**
|
|
37
|
+
• Each test card must include at least one concept or fact.
|
|
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
|
+
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
|
+
|
|
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 should be significant ideas within the content that are essential for understanding the main themes.
|
|
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
|
+
json
|
|
52
|
+
{
|
|
53
|
+
"missing_concepts": ["concept1", "concept2", "concept3", "..."]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Facts are objective statements supported by empirical evidence or observation, such as data on events, people, numbers, dates, or well-established ideas.
|
|
57
|
+
|
|
58
|
+
You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
|
|
59
|
+
|
|
60
|
+
1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
|
|
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. Only inlcude those that have not present in the list provided to you.
|
|
62
|
+
|
|
63
|
+
Record the facts in the following JSON format:
|
|
64
|
+
|
|
65
|
+
json
|
|
16
66
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
67
|
+
"missing_facts": ["fact1", "fact2", "fact3", "..."]
|
|
68
|
+
}
|
|
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
|
+
|
|
72
|
+
1. Clarity: Ensure the test content is clear and unambiguous.
|
|
73
|
+
2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
|
|
74
|
+
3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
|
|
75
|
+
4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
|
|
76
|
+
|
|
77
|
+
Test cards must be one of the following types:
|
|
78
|
+
|
|
79
|
+
1. Flashcards: Have a front and back.
|
|
80
|
+
|
|
81
|
+
json
|
|
82
|
+
{
|
|
83
|
+
"type": "flash",
|
|
84
|
+
"card_content": {
|
|
85
|
+
"front": "<content for the front>",
|
|
86
|
+
"back": "<content for the back>"
|
|
22
87
|
},
|
|
23
|
-
|
|
24
|
-
|
|
88
|
+
"card_reference": "source_title#heading",
|
|
89
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
90
|
+
"facts": ["Fact1", "Fact2", "..."]
|
|
25
91
|
}
|
|
26
92
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
93
|
+
- Each side must not exceed 300 characters.
|
|
94
|
+
2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
|
|
95
|
+
|
|
96
|
+
json
|
|
97
|
+
{
|
|
98
|
+
"type": "mcq",
|
|
99
|
+
"card_content": {
|
|
100
|
+
"prompt": "<question text>",
|
|
101
|
+
"choices": [
|
|
102
|
+
{"choice": "choice 1", "is_correct": true or false},
|
|
103
|
+
{"choice": "choice 2", "is_correct": true or false},
|
|
104
|
+
"... up to 8 choices"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"card_reference": "source_title#heading",
|
|
108
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
109
|
+
"facts": ["Fact1", "Fact2", "..."]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
• Minimum choices required: 2
|
|
113
|
+
• Maximum choices allowed: 8
|
|
114
|
+
• Minimum correct choices required: 1
|
|
115
|
+
• Maximum character length for the prompt: 320
|
|
116
|
+
• Maximum character length for each choice: 42
|
|
117
|
+
|
|
118
|
+
3. Cloze: Fill-in-the-blank style test card. Use double curly braces {{}} to indicate a cloze.
|
|
119
|
+
|
|
120
|
+
json
|
|
32
121
|
{
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
122
|
+
"type": "cloze",
|
|
123
|
+
"card_content": {
|
|
124
|
+
"prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
|
|
125
|
+
"options": [
|
|
126
|
+
{"option": "notes", "cloze": "c0"},
|
|
127
|
+
{"option": "scale", "cloze": "c1"},
|
|
128
|
+
{"option": "mode", "cloze": "c2"},
|
|
129
|
+
{"option": "chords", "cloze": "null"},
|
|
130
|
+
"... up to 8 choices"
|
|
131
|
+
]
|
|
43
132
|
},
|
|
44
|
-
|
|
45
|
-
|
|
133
|
+
"card_reference": "source_title#heading",
|
|
134
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
135
|
+
"facts": ["Fact1", "Fact2", "..."]
|
|
46
136
|
}
|
|
47
137
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
JSON Structure:
|
|
138
|
+
• Minimum choices required: 2
|
|
139
|
+
• Maximum choices allowed: 8
|
|
140
|
+
• Minimum correct choices required: 1
|
|
141
|
+
• Maximum character length for the prompt: 320
|
|
142
|
+
• Maximum character length for an individual cloze: 90
|
|
54
143
|
|
|
144
|
+
4. Match: Pairing items.
|
|
145
|
+
|
|
146
|
+
json
|
|
55
147
|
{
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{"option":"baidya","cloze":"c1"},
|
|
62
|
-
{"option":"Shreedhar","cloze":null},
|
|
63
|
-
{"option":"Pandey","cloze":null},
|
|
64
|
-
{"option":"Tuppi","cloze":null},
|
|
65
|
-
{"option":"Bajracharya","cloze":null}
|
|
66
|
-
]
|
|
148
|
+
"type": "match",
|
|
149
|
+
"card_content": {
|
|
150
|
+
"right_choice 1": "left_choice 1",
|
|
151
|
+
"right_choice 2": "left_choice 2",
|
|
152
|
+
"... up to 8 total pairs"
|
|
67
153
|
},
|
|
68
|
-
|
|
69
|
-
|
|
154
|
+
"card_reference": "source_title#heading",
|
|
155
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
156
|
+
"facts": ["Fact1", "Fact2", "..."]
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
• Maximum character length for each item in a pair: 42
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
The schema for each card type is below.
|
|
163
|
+
|
|
164
|
+
A flashcard consists of two sides: a front and a back. Both the front and back text content must not exceed more than 300 characters in length.
|
|
165
|
+
|
|
166
|
+
The content schema should be represented in this manner:
|
|
167
|
+
json
|
|
168
|
+
{
|
|
169
|
+
"front": "<content for the front of the flashcard>",
|
|
170
|
+
"back": "<content for the back of the flashcard>"
|
|
70
171
|
}
|
|
71
172
|
|
|
72
|
-
|
|
173
|
+
|
|
174
|
+
The schema for an mcq card is shown below.
|
|
175
|
+
|
|
176
|
+
json
|
|
177
|
+
{
|
|
178
|
+
"prompt": "<question text>",
|
|
179
|
+
"choices":
|
|
180
|
+
[
|
|
181
|
+
{
|
|
182
|
+
choice: "choice 1",
|
|
183
|
+
is_correct: true or false
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
choice: "choice 2",
|
|
187
|
+
is_correct: true or false
|
|
188
|
+
}
|
|
189
|
+
"... up to 8 choices"
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
Minimum choices required: 2
|
|
194
|
+
Maximum choices allowed: 8
|
|
195
|
+
Minimum correct choices required: 1
|
|
196
|
+
Maximum character length for the prompt: 320
|
|
197
|
+
Maximum character length for each choice: 42
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
For questions of the "type": "cloze", which refers to a fill-in-the-blank style question, the format is outlined below. I have used the sample text here because it is easier to illustrate the schema with an example:
|
|
201
|
+
|
|
202
|
+
json
|
|
203
|
+
{
|
|
204
|
+
"prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature."
|
|
205
|
+
"options":
|
|
206
|
+
[
|
|
207
|
+
{
|
|
208
|
+
"option: "notes",
|
|
209
|
+
"cloze": "c0"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"option: "scale",
|
|
213
|
+
"cloze": "c1"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"option: "mode",
|
|
217
|
+
"cloze": "c2"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"option: "chords",
|
|
221
|
+
"cloze": "null"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"option: "tilda",
|
|
225
|
+
"cloze": "null"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"option: "score",
|
|
229
|
+
"cloze": "null"
|
|
230
|
+
},
|
|
231
|
+
"... up to a maximum of 8 choices total"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
Minimum choices required: 2
|
|
236
|
+
Maximum choices allowed: 8
|
|
237
|
+
Minimum correct choices required: 1
|
|
238
|
+
Maximum character length for the prompt: 320
|
|
239
|
+
Maximum character length for an individual cloze: 90
|
|
240
|
+
|
|
241
|
+
The schema for match type cards are as follows.
|
|
242
|
+
json
|
|
243
|
+
{
|
|
244
|
+
"right_choice 1": "left_choice 1",
|
|
245
|
+
"right_choice 2": "left_choice 2"
|
|
246
|
+
"right_choice 3": "left_choice 3"
|
|
247
|
+
"... up to 8 total pairs"
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
Maximum character length for each item in a pair: 42
|
|
251
|
+
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.
|
|
252
|
+
PART 6
|
|
253
|
+
|
|
254
|
+
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.
|
|
255
|
+
|
|
256
|
+
Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
|
|
257
|
+
|
|
258
|
+
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.
|
|
259
|
+
|
|
260
|
+
Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
|
|
261
|
+
|
|
262
|
+
1. Ensure every concept and fact has at least one test card (if not more).
|
|
263
|
+
2. If any concept or fact is missing a test card, create one for it.
|
|
264
|
+
3. Repeat this step until all concepts and facts are covered.
|
|
265
|
+
|
|
266
|
+
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.
|
|
73
267
|
`;
|
|
74
268
|
function returnCardGenPrompt() {
|
|
75
269
|
return promptString;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.returnTypologyPrompt = void 0;
|
|
4
4
|
const typologyPromptString = `
|
|
5
|
-
As a dedicated assistant at a learning company, your role involves analyzing educational content to
|
|
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:
|
|
6
6
|
|
|
7
7
|
1. Classify the content into one to three predefined fields of knowledge.
|
|
8
8
|
2. Identify key concepts within the content.
|
|
@@ -12,16 +12,15 @@ As a dedicated assistant at a learning company, your role involves analyzing edu
|
|
|
12
12
|
|
|
13
13
|
Please format your findings in this JSON schema:
|
|
14
14
|
json
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
{
|
|
16
|
+
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
17
|
+
"concepts": ["concept1", "concept2", "concept3", "..."],
|
|
18
|
+
"facts": ["fact1", "fact2", "fact3", "..."],
|
|
19
|
+
"generate_cards": true or false
|
|
20
|
+
"summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
|
|
21
|
+
}
|
|
22
22
|
|
|
23
23
|
Further instruction on how to perform these tasks are below.
|
|
24
|
-
|
|
25
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.
|
|
26
25
|
|
|
27
26
|
1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
|
|
@@ -64,7 +63,8 @@ json
|
|
|
64
63
|
{
|
|
65
64
|
"facts": ["fact1", "fact2", "fact3", "..."]
|
|
66
65
|
}
|
|
67
|
-
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
68
|
|
|
69
69
|
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.
|
|
70
70
|
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.
|
|
@@ -74,7 +74,8 @@ json
|
|
|
74
74
|
{
|
|
75
75
|
"generate_cards": true or false
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
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
|
|
|
79
80
|
|
|
80
81
|
1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
@@ -87,8 +88,6 @@ json
|
|
|
87
88
|
{
|
|
88
89
|
"summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
Calculate the tokens that will be used, and try to generate completions with atleast more than 4k tokens
|
|
92
91
|
`;
|
|
93
92
|
function returnTypologyPrompt() {
|
|
94
93
|
return typologyPromptString;
|