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.
- package/dist/bootstrap/app.js +120 -0
- package/dist/card_gen/generate_cards.js +59 -0
- package/dist/config.js +9 -0
- package/dist/constants/api_constants.js +10 -0
- package/dist/constants/prompt_data.js +302 -0
- package/dist/constants/prompts/card_gen_prompt.js +167 -0
- package/dist/constants/prompts/typology_prompt.js +138 -0
- package/dist/constants/source_data.js +973 -0
- package/dist/embedding_generation/consolidation/global_consolidation.js +75 -0
- package/dist/embedding_generation/consolidation/local_consolidation.js +104 -0
- package/dist/embedding_generation/consolidation/write_consolidated_data.js +68 -0
- package/dist/embedding_generation/generate_embeddings.js +53 -0
- package/dist/embedding_generation/parse_embedding_response.js +28 -0
- package/dist/gap_fill/calculate_gap_fill.js +42 -0
- package/dist/helper/qdrant_db_methods.js +62 -0
- package/dist/index.js +96 -0
- package/dist/logger.js +41 -0
- package/dist/parse/parse_card/parse_cloze_card.js +125 -0
- package/dist/parse/parse_card/parse_flash_cards.js +33 -0
- package/dist/parse/parse_card/parse_match_card.js +81 -0
- package/dist/parse/parse_card/parse_mcq_card.js +103 -0
- package/dist/parse/parse_card_response.js +99 -0
- package/dist/parse/parse_source_content.js +185 -0
- package/dist/parse/response_format_card.js +371 -0
- package/dist/parse/response_format_typology.js +46 -0
- package/dist/services/open_ai_service.js +91 -0
- package/dist/services/qdrant_service.js +13 -0
- package/dist/typology-parsed-response.js +1935 -0
- package/dist/typology_gen/generate_typology.js +103 -0
- package/dist/utils/generate_args.js +27 -0
- package/dist/utils/parse_openai_response.js +23 -0
- package/package.json +3 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OnlyEverGenerator = void 0;
|
|
13
|
+
const generate_cards_1 = require("../card_gen/generate_cards");
|
|
14
|
+
const parse_source_content_1 = require("../parse/parse_source_content");
|
|
15
|
+
const open_ai_service_1 = require("../services/open_ai_service");
|
|
16
|
+
const generate_typology_1 = require("../typology_gen/generate_typology");
|
|
17
|
+
const generate_args_1 = require("../utils/generate_args");
|
|
18
|
+
const generate_embeddings_1 = require("../embedding_generation/generate_embeddings");
|
|
19
|
+
const local_consolidation_1 = require("../embedding_generation/consolidation/local_consolidation");
|
|
20
|
+
const global_consolidation_1 = require("../embedding_generation/consolidation/global_consolidation");
|
|
21
|
+
class OnlyEverGenerator {
|
|
22
|
+
constructor(apiKey, model, generationContent) {
|
|
23
|
+
this.api_key = "";
|
|
24
|
+
/// these fields will be populated inside the constructor
|
|
25
|
+
this.parsedContent = {};
|
|
26
|
+
this.promptForTypology = "";
|
|
27
|
+
this.promptForCardGen = "";
|
|
28
|
+
this.typologyResponse = undefined;
|
|
29
|
+
this.cardgenResponse = undefined;
|
|
30
|
+
this.summarizeResponse = {};
|
|
31
|
+
this.gapFillResponse = {};
|
|
32
|
+
this.api_key = apiKey;
|
|
33
|
+
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
34
|
+
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
35
|
+
(this.parsedContent = {
|
|
36
|
+
title: parsedData.title,
|
|
37
|
+
headings: parsedData.headings,
|
|
38
|
+
content: parsedData.content,
|
|
39
|
+
taxonomy: parsedData.taxonomy,
|
|
40
|
+
}),
|
|
41
|
+
(this.typologyResponse = generationContent.content.taxonomy);
|
|
42
|
+
this.expectedFields = generationContent.content.fields; //returnFields();
|
|
43
|
+
this.promptForTypology = generationContent.prompt.typology;
|
|
44
|
+
this.promptForCardGen = generationContent.prompt.card_generation;
|
|
45
|
+
}
|
|
46
|
+
generate() {
|
|
47
|
+
return __awaiter(this, arguments, void 0, function* (generate_typology = false, generate_card = false) {
|
|
48
|
+
let args = new generate_args_1.GenerateArgs(generate_card, generate_typology, false);
|
|
49
|
+
const responseToReturn = [];
|
|
50
|
+
const whatNeedsToBeGenerated = args.getWhatNeedsToBeGenerated();
|
|
51
|
+
for (let elem of whatNeedsToBeGenerated)
|
|
52
|
+
if (elem == "generate_tyopology") {
|
|
53
|
+
this.typologyResponse = yield this.generateTypology(this.promptForTypology);
|
|
54
|
+
const embeddings = yield this.generateEmbeddings(this.typologyResponse);
|
|
55
|
+
this.typologyResponse.concepts_facts = embeddings.concepts_facts;
|
|
56
|
+
this.typologyResponse.metadata.push(embeddings.metadata);
|
|
57
|
+
responseToReturn.push(this.typologyResponse);
|
|
58
|
+
}
|
|
59
|
+
else if (elem == "generate_card") {
|
|
60
|
+
if (this.shouldTheCardBeGeneratedAfterTypologyResponse()) {
|
|
61
|
+
this.parsedContent.taxonomy = {
|
|
62
|
+
concepts_facts: this.typologyResponse.concepts_facts,
|
|
63
|
+
generate_cards: this.typologyResponse.generate_cards,
|
|
64
|
+
};
|
|
65
|
+
this.cardgenResponse = yield this.generateCard(this.promptForCardGen, JSON.stringify(this.typologyResponse), false);
|
|
66
|
+
responseToReturn.push(this.cardgenResponse);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return responseToReturn;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
shouldTheCardBeGeneratedAfterTypologyResponse() {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
if (this.typologyResponse) {
|
|
75
|
+
return ((_b = (_a = this.typologyResponse) === null || _a === void 0 ? void 0 : _a.generate_cards) === null || _b === void 0 ? void 0 : _b.state) == true;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
generateCard(prompt_1, additionalContent_1, isGapFill_1) {
|
|
82
|
+
return __awaiter(this, arguments, void 0, function* (prompt, additionalContent, isGapFill, n = 0) {
|
|
83
|
+
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService).generateCards(prompt !== null && prompt !== void 0 ? prompt : "", JSON.stringify(this.parsedContent) + additionalContent, isGapFill, this.parsedContent.taxonomy, n);
|
|
84
|
+
return generateCardsResp;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
generateTypology(prompt) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, prompt, JSON.stringify(this.parsedContent), this.expectedFields).generate();
|
|
90
|
+
return response;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
generateEmbeddings(typologyResponse) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const concepts_facts = typologyResponse.concepts_facts;
|
|
96
|
+
const texts = concepts_facts.map((e) => e.text);
|
|
97
|
+
const embeddings = yield new generate_embeddings_1.GenerateEmbeddings(this.openAiService).generateEmbeddings(concepts_facts);
|
|
98
|
+
return embeddings;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
localConsolidation(concepts_facts, sourceId) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const embeddings = new local_consolidation_1.LocalConsolidation().consolidate(concepts_facts, sourceId);
|
|
104
|
+
return embeddings;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
globalConsolidation(concepts_facts, sourceId, threshold) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const embeddings = yield new global_consolidation_1.GlobalConsolidation().consolidate(concepts_facts, sourceId, threshold !== null && threshold !== void 0 ? threshold : 0.8);
|
|
110
|
+
// const writeConsolidatedData =
|
|
111
|
+
// new WriteConsolidatedData().writeConsolidatedData(
|
|
112
|
+
// embeddings,
|
|
113
|
+
// [],
|
|
114
|
+
// sourceId
|
|
115
|
+
// );
|
|
116
|
+
return embeddings;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.OnlyEverGenerator = OnlyEverGenerator;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GenerateCards = void 0;
|
|
13
|
+
const logger_1 = require("../logger");
|
|
14
|
+
const parse_card_response_1 = require("../parse/parse_card_response");
|
|
15
|
+
class GenerateCards {
|
|
16
|
+
constructor(openAiService) {
|
|
17
|
+
this.openAiService = openAiService;
|
|
18
|
+
}
|
|
19
|
+
generateCards(prompt_1, parsedContent_1, isGapFill_1, taxonomy_1) {
|
|
20
|
+
return __awaiter(this, arguments, void 0, function* (prompt, parsedContent, isGapFill, taxonomy, n = 0) {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
try {
|
|
23
|
+
let response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(prompt, parsedContent));
|
|
24
|
+
var updatedNumber = n + 1;
|
|
25
|
+
// console.log("response to card generation ", response);
|
|
26
|
+
// response["request_type"] = ;
|
|
27
|
+
response.metadata = {
|
|
28
|
+
req_time: (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
|
|
29
|
+
req_type: {
|
|
30
|
+
type: "depth",
|
|
31
|
+
n: updatedNumber,
|
|
32
|
+
bloom_level: 1,
|
|
33
|
+
},
|
|
34
|
+
req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
|
|
35
|
+
res_tokens: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
|
|
36
|
+
prompt_tokens_details: (_e = response.usage_data) === null || _e === void 0 ? void 0 : _e.prompt_tokens_details,
|
|
37
|
+
model: this.openAiService.model,
|
|
38
|
+
};
|
|
39
|
+
if (response.status_code == 200) {
|
|
40
|
+
response.metadata.status = "completed";
|
|
41
|
+
let parseCard = new parse_card_response_1.ParseCardResponse().parse(response, isGapFill, taxonomy);
|
|
42
|
+
return parseCard;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
response.metadata.status = "failed";
|
|
46
|
+
response.metadata.err_message = response.message;
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
new logger_1.ErrorLogger({
|
|
52
|
+
type: "card_generation",
|
|
53
|
+
data: e.message,
|
|
54
|
+
}).log();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.GenerateCards = GenerateCards;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("dotenv/config");
|
|
4
|
+
const config = {
|
|
5
|
+
openAIKey: process.env.OPEN_AI_KEY,
|
|
6
|
+
qdrantApiKey: process.env.QDRANT_API_KEY,
|
|
7
|
+
qdrantUrl: process.env.QDRANT_URL,
|
|
8
|
+
};
|
|
9
|
+
exports.default = config;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openAiEndPoint = openAiEndPoint;
|
|
4
|
+
exports.openAiEmbeddingEndPoint = openAiEmbeddingEndPoint;
|
|
5
|
+
function openAiEndPoint() {
|
|
6
|
+
return "https://api.openai.com/v1/chat/completions";
|
|
7
|
+
}
|
|
8
|
+
function openAiEmbeddingEndPoint() {
|
|
9
|
+
return "https://api.openai.com/v1/embeddings";
|
|
10
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.returnPromptData = returnPromptData;
|
|
4
|
+
const card_gen_prompt_1 = require("./prompts/card_gen_prompt");
|
|
5
|
+
const typology_prompt_1 = require("./prompts/typology_prompt");
|
|
6
|
+
const promptData = {
|
|
7
|
+
typology: {
|
|
8
|
+
role: `
|
|
9
|
+
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:
|
|
10
|
+
|
|
11
|
+
1. Classify the content into one to three predefined fields of knowledge.
|
|
12
|
+
2. Extract key concepts within the content.
|
|
13
|
+
3. Extract concrete facts that are relevant to the subject and referenced in the content.
|
|
14
|
+
4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
|
|
15
|
+
5. If the generate_cards is true then summarize the content using a series of summary cards.
|
|
16
|
+
|
|
17
|
+
Please format your findings in this JSON schema:
|
|
18
|
+
{
|
|
19
|
+
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
20
|
+
"concepts": ["concept1", "concept2", "concept3", "..."],
|
|
21
|
+
"facts": ["fact1", "fact2", "fact3", "..."],
|
|
22
|
+
"generate_cards": {
|
|
23
|
+
"state": true or false,
|
|
24
|
+
"false_reason": "reason for marking the source as false. Leave empty for true."
|
|
25
|
+
},
|
|
26
|
+
"summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Further instruction on how to perform these tasks are below.
|
|
31
|
+
`,
|
|
32
|
+
fields: `
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
|
|
36
|
+
2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
|
|
37
|
+
3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
|
|
38
|
+
4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
|
|
39
|
+
5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
|
|
40
|
+
6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
|
|
41
|
+
7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
|
|
42
|
+
8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
|
|
43
|
+
9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
|
|
44
|
+
10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
|
|
45
|
+
11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
|
|
46
|
+
12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
|
|
47
|
+
13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
|
|
48
|
+
14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
|
|
49
|
+
15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
|
|
50
|
+
16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
|
|
51
|
+
17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
|
|
52
|
+
18. Other: Use for content that doesn’t fit into the above categories.
|
|
53
|
+
`,
|
|
54
|
+
concepts: `
|
|
55
|
+
Extract key concepts within the content after classifying the field. Please be as exhaustive as possible.
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
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.
|
|
59
|
+
List the concepts in the following JSON format:
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
"concepts":
|
|
63
|
+
[
|
|
64
|
+
"concept1",
|
|
65
|
+
"concept2",
|
|
66
|
+
"concept3",
|
|
67
|
+
"..."
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
facts: `
|
|
72
|
+
After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
|
|
73
|
+
|
|
74
|
+
Definition of a Fact: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
|
|
75
|
+
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.
|
|
76
|
+
Record the facts in the following JSON format:
|
|
77
|
+
|
|
78
|
+
{
|
|
79
|
+
"facts": ["fact1", "fact2", "fact3", "..."]
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
generate: `
|
|
83
|
+
After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
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.
|
|
87
|
+
Make your decision using this criterion and reflect it in the JSON format as follows:
|
|
88
|
+
|
|
89
|
+
"generate_cards":
|
|
90
|
+
{ state: true or false,
|
|
91
|
+
false_reason: "reason for marking the source as false. Leave empty for true."
|
|
92
|
+
}
|
|
93
|
+
`,
|
|
94
|
+
summarize: `
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
Inclusion Criteria: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
98
|
+
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.
|
|
99
|
+
Character Limit: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
|
|
100
|
+
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.
|
|
101
|
+
Format your output in JSON as follows:
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
"summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
|
|
105
|
+
}
|
|
106
|
+
`,
|
|
107
|
+
},
|
|
108
|
+
card_generation: {
|
|
109
|
+
role: `
|
|
110
|
+
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:
|
|
111
|
+
|
|
112
|
+
1. Title of the source
|
|
113
|
+
2. Main headings
|
|
114
|
+
3. The content
|
|
115
|
+
4. The field of knowledge it belongs
|
|
116
|
+
5. Key concepts in the source
|
|
117
|
+
6. Important facts in the source.
|
|
118
|
+
7. Summary of the content using cards
|
|
119
|
+
|
|
120
|
+
Follow these steps:
|
|
121
|
+
|
|
122
|
+
1. Analyze the content to identify any key concepts missing from the provided list.
|
|
123
|
+
2. Analyze the content to identify any important facts missing from the provided list.
|
|
124
|
+
3. Generate test cards for each concept and fact, tethered to either the entire source or specific headings.
|
|
125
|
+
4. Ensure all concepts and facts have at least one test card.
|
|
126
|
+
|
|
127
|
+
Please format your response in the following format.
|
|
128
|
+
|
|
129
|
+
"missing_concepts": ["concept1", "concept2", "concept3", "..."],
|
|
130
|
+
"missing_facts": ["fact1", "fact2", "fact3", "..."],
|
|
131
|
+
"test_cards": [
|
|
132
|
+
{
|
|
133
|
+
"type": "flash" | "mcq" | "cloze" | "match",
|
|
134
|
+
"card_content": { "front": "...", "back": "..." | "prompt": "...", "choices": [ ... ] | "prompt": "...", "options": [ ... ] | "...": "...", "....": "..." },
|
|
135
|
+
"card_reference": "source_title#heading",
|
|
136
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
137
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
138
|
+
"bloom_level": <1-5>
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
**Criteria**
|
|
142
|
+
• Atleast one test card must be generated.
|
|
143
|
+
• Each test card must include at least one concept or fact.
|
|
144
|
+
• Each test card must include bloom_level.
|
|
145
|
+
• Flashcards must not exceed 15% of the total number of cards.
|
|
146
|
+
• Each concept and fact must have at least one test card.
|
|
147
|
+
|
|
148
|
+
Further instructions are provided below.
|
|
149
|
+
`,
|
|
150
|
+
concepts: `
|
|
151
|
+
You are provided with a list of identified concepts. Review this list and the content to determine if any concepts are missing.
|
|
152
|
+
|
|
153
|
+
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.
|
|
154
|
+
2. **Inclusion Criteria**: Include a concept only if it has not been previously included in the list provided to you.
|
|
155
|
+
|
|
156
|
+
List the concepts in the following JSON format:
|
|
157
|
+
{
|
|
158
|
+
"missing_concepts":
|
|
159
|
+
[
|
|
160
|
+
"concept1",
|
|
161
|
+
"concept2",
|
|
162
|
+
"concept3",
|
|
163
|
+
"..."
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
`,
|
|
167
|
+
facts: `
|
|
168
|
+
You are provided with a list of identified facts. Review this list and the content to determine if any facts are missing.
|
|
169
|
+
|
|
170
|
+
1. **Definition of a Fact**: Standalone information that is concrete and independently verifiable.
|
|
171
|
+
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.
|
|
172
|
+
|
|
173
|
+
Record the facts in the following JSON format:
|
|
174
|
+
{
|
|
175
|
+
"missing_facts": ["fact1", "fact2", "fact3", "..."]
|
|
176
|
+
}
|
|
177
|
+
`,
|
|
178
|
+
card_gen: `
|
|
179
|
+
After you have the complete list of concepts and facts, including any missing ones you identified, proceed to generate test cards for each.
|
|
180
|
+
|
|
181
|
+
1. Clarity: Ensure the test content is clear and unambiguous.
|
|
182
|
+
2. Specificity: Be specific about what you are asking. Avoid vague or overly broad questions or prompts.
|
|
183
|
+
3. Simplicity: Use simple and direct language. Avoid complex sentences or jargon unless testing understanding of that jargon.
|
|
184
|
+
4. Relevance: Ensure the test content is directly related to the key concepts or facts you want to test.
|
|
185
|
+
|
|
186
|
+
Include the following property for each card:
|
|
187
|
+
|
|
188
|
+
bloom_level: Indicate the level of Bloom’s Taxonomy the card corresponds to (from level 1 to level 5). Ensure that you produce a balanced number of cards across all levels, focusing on levels 1 through 5. Aim for a diverse range of cognitive challenges.
|
|
189
|
+
|
|
190
|
+
Make sure to include this field in each card.
|
|
191
|
+
Ensure that you produce at least one card for each concept and fact. Do not skip any concepts or facts, and be thorough in your coverage. Cards should span across different levels of Bloom’s Taxonomy, from level 1 (Remembering) to level 5 (Evaluating), but exclude level 6 (Creating).
|
|
192
|
+
|
|
193
|
+
Test cards must be one of the following types:
|
|
194
|
+
|
|
195
|
+
1. Flashcards: Have a front and back.
|
|
196
|
+
|
|
197
|
+
json:
|
|
198
|
+
{
|
|
199
|
+
"type": "flash",
|
|
200
|
+
"card_content": {
|
|
201
|
+
"front": "<content for the front>",
|
|
202
|
+
"back": "<content for the back>"
|
|
203
|
+
},
|
|
204
|
+
"card_reference": "source_title#heading",
|
|
205
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
206
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
207
|
+
"bloom_level": <1-5>
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
- Each side must not exceed 300 characters.
|
|
211
|
+
2. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
|
|
212
|
+
|
|
213
|
+
json:
|
|
214
|
+
{
|
|
215
|
+
"type": "mcq",
|
|
216
|
+
"card_content": {
|
|
217
|
+
"prompt": "<question text>",
|
|
218
|
+
"choices": [
|
|
219
|
+
{"choice": "choice 1", "is_correct": true or false},
|
|
220
|
+
{"choice": "choice 2", "is_correct": true or false},
|
|
221
|
+
"... up to 8 choices"
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"card_reference": "source_title#heading",
|
|
225
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
226
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
227
|
+
"bloom_level": <1-5>
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
• Minimum choices required: 2
|
|
231
|
+
• Maximum choices allowed: 8
|
|
232
|
+
• Minimum correct choices required: 1
|
|
233
|
+
• Maximum character length for the prompt: 320
|
|
234
|
+
• Maximum character length for each choice: 42
|
|
235
|
+
|
|
236
|
+
3. Cloze: A test card where a portion of text is masked for the learner to identify from the provided options. Use double curly braces {{c<n>: cloze_text}} to indicate a cloze, where n is the index number of the cloze (starting from 0) and cloze_text is the word or phrase being clozed.
|
|
237
|
+
|
|
238
|
+
json
|
|
239
|
+
{
|
|
240
|
+
"type": "cloze",
|
|
241
|
+
"card_content": {
|
|
242
|
+
"prompt": "Accidentals in music denote {{c0:notes}} that do not belong to the {{c1:scale}} or {{c2:mode}} indicated by the key signature.",
|
|
243
|
+
"options": [
|
|
244
|
+
{"option": "notes", "cloze": "c0"},
|
|
245
|
+
{"option": "scale", "cloze": "c1"},
|
|
246
|
+
{"option": "mode", "cloze": "c2"},
|
|
247
|
+
{"option": "chords", "cloze": "null"},
|
|
248
|
+
"... up to 8 choices"
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
"card_reference": "source_title#heading",
|
|
252
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
253
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
254
|
+
"bloom_level": <1-5>
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
• Minimum choices required: 2
|
|
258
|
+
• Maximum choices allowed: 8
|
|
259
|
+
• Minimum correct choices required: 1
|
|
260
|
+
• Maximum character length for the prompt: 320
|
|
261
|
+
• Maximum character length for an individual cloze: 90
|
|
262
|
+
|
|
263
|
+
4. Match: Pairing items.
|
|
264
|
+
|
|
265
|
+
json
|
|
266
|
+
{
|
|
267
|
+
"type": "match",
|
|
268
|
+
"card_content": {
|
|
269
|
+
"left_choice 1": "right_choice 1",
|
|
270
|
+
"left_choice 2": "right_choice 2",
|
|
271
|
+
"... up to 8 total pairs"
|
|
272
|
+
},
|
|
273
|
+
"card_reference": "source_title#heading",
|
|
274
|
+
"concepts": ["Concept1", "Concept2", "..."],
|
|
275
|
+
"facts": ["Fact1", "Fact2", "..."],
|
|
276
|
+
"bloom_level": <1-5>
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
• Maximum character length for each item in a pair: 42
|
|
280
|
+
`,
|
|
281
|
+
reference: `Each test card needs a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The reference schema is as follows: source_title#main_heading, where #main_heading is optional.`,
|
|
282
|
+
checkcoverage: `Once you are done generating the test cards. Go back and evaulate the full list of concepts and fact that include any of the missing concepts or facts along with the list that was provided as the input.
|
|
283
|
+
|
|
284
|
+
Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
|
|
285
|
+
|
|
286
|
+
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.
|
|
287
|
+
|
|
288
|
+
Once you are done generating the test cards, review the full list of concepts and facts, including any missing ones you identified.
|
|
289
|
+
|
|
290
|
+
1. Ensure every concept and fact has at least one test card (if not more).
|
|
291
|
+
2. If any concept or fact is missing a test card, create one for it.
|
|
292
|
+
3. Repeat this step until all concepts and facts are covered.
|
|
293
|
+
|
|
294
|
+
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.`,
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
function returnPromptData() {
|
|
298
|
+
return {
|
|
299
|
+
typology: (0, typology_prompt_1.returnTypologyPrompt)(),
|
|
300
|
+
card_generation: (0, card_gen_prompt_1.returnCardGenPrompt)(),
|
|
301
|
+
};
|
|
302
|
+
}
|