only_ever_generator 0.5.4 → 0.5.6
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 +5 -5
- package/dist/card_gen/generate_cards.js +2 -1
- package/dist/config.js +1 -1
- package/dist/constants/api_constants.js +1 -1
- package/dist/constants/prompt_data.js +4 -4
- package/dist/constants/source_data.js +234 -982
- package/dist/logger.js +4 -4
- package/dist/parse/parse_card/parse_cloze_card.js +12 -10
- package/dist/parse/parse_card/parse_flash_cards.js +33 -0
- package/dist/parse/parse_card/parse_match_card.js +1 -1
- package/dist/parse/parse_card/parse_mcq_card.js +1 -1
- package/dist/parse/parse_card_response.js +8 -31
- package/dist/parse/parse_source_content.js +30 -20
- package/dist/parse/response_format_typology.js +16 -16
- package/dist/services/open_ai_service.js +13 -10
- package/dist/typology_gen/generate_typology.js +16 -15
- package/dist/utils/generate_args.js +3 -3
- package/dist/utils/parse_openai_response.js +7 -7
- package/package.json +1 -1
- package/src/bootstrap/app.ts +69 -79
- package/src/card_gen/generate_cards.ts +6 -1
- package/src/config.ts +3 -3
- package/src/constants/api_constants.ts +3 -3
- package/src/constants/prompt_data.ts +24 -26
- package/src/constants/prompts/card_gen_prompt.ts +2 -4
- package/src/constants/source_data.ts +317 -1181
- package/src/index.ts +1 -2
- package/src/logger.ts +24 -25
- package/src/parse/parse_card/parse_cloze_card.ts +55 -43
- package/src/parse/parse_card/parse_flash_cards.ts +33 -0
- package/src/parse/parse_card/parse_match_card.ts +33 -33
- package/src/parse/parse_card/parse_mcq_card.ts +1 -1
- package/src/parse/parse_card_response.ts +28 -47
- package/src/parse/parse_source_content.ts +173 -168
- package/src/parse/response_format_card.ts +0 -2
- package/src/parse/response_format_typology.ts +42 -42
- package/src/services/open_ai_service.ts +50 -48
- package/src/typology_gen/generate_typology.ts +68 -60
- package/src/utils/generate_args.ts +25 -23
- package/src/utils/parse_openai_response.ts +17 -19
package/dist/bootstrap/app.js
CHANGED
|
@@ -33,14 +33,14 @@ class OnlyEverGenerator {
|
|
|
33
33
|
this.api_key = apiKey;
|
|
34
34
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
35
35
|
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
36
|
-
this.parsedContent = {
|
|
36
|
+
(this.parsedContent = {
|
|
37
37
|
title: parsedData.title,
|
|
38
38
|
headings: parsedData.headings,
|
|
39
39
|
content: parsedData.content,
|
|
40
40
|
taxonomy: parsedData.taxonomy,
|
|
41
|
-
},
|
|
41
|
+
}),
|
|
42
42
|
// parsedData.type == 'cards' ? this.typologyResponse = parsedData.taxonomy : this.typologyResponse = null;
|
|
43
|
-
this.typologyResponse = generationContent.content.taxonomy;
|
|
43
|
+
(this.typologyResponse = generationContent.content.taxonomy);
|
|
44
44
|
this.expectedFields = generationContent.content.fields; //returnFields();
|
|
45
45
|
this.promptForTypology = generationContent.prompt.typology;
|
|
46
46
|
this.promptForCardGen = generationContent.prompt.card_generation;
|
|
@@ -65,7 +65,7 @@ class OnlyEverGenerator {
|
|
|
65
65
|
};
|
|
66
66
|
this.cardgenResponse = yield this.generateCard(this.promptForCardGen, JSON.stringify(this.typologyResponse), false);
|
|
67
67
|
responseToReturn.push(this.cardgenResponse);
|
|
68
|
-
/// check if gap fill is required ie coverage determination
|
|
68
|
+
/// check if gap fill is required ie coverage determination
|
|
69
69
|
if (this.cardgenResponse.status_code == 200) {
|
|
70
70
|
this.gapFillResponse = yield this._generationForGapFill(this.typologyResponse, this.cardgenResponse);
|
|
71
71
|
responseToReturn.push(this.gapFillResponse);
|
|
@@ -116,7 +116,7 @@ class OnlyEverGenerator {
|
|
|
116
116
|
}
|
|
117
117
|
gapFill(factsMaps, aiCards) {
|
|
118
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
/// factsmap
|
|
119
|
+
/// factsmap
|
|
120
120
|
/// {
|
|
121
121
|
/// remaining_facts: [],
|
|
122
122
|
/// remaining_concepts: [],
|
|
@@ -17,7 +17,7 @@ class GenerateCards {
|
|
|
17
17
|
}
|
|
18
18
|
generateCards(prompt, parsedContent, isGapFill, taxonomy) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
21
21
|
let response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(prompt, parsedContent));
|
|
22
22
|
// console.log("response to card generation ", response);
|
|
23
23
|
response["type"] = isGapFill ? "gap_fill" : "card_gen";
|
|
@@ -26,6 +26,7 @@ class GenerateCards {
|
|
|
26
26
|
req_type: response.type,
|
|
27
27
|
req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
|
|
28
28
|
res_tokens: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
|
|
29
|
+
prompt_tokens_details: (_e = response.usage_data) === null || _e === void 0 ? void 0 : _e.prompt_tokens_details,
|
|
29
30
|
model: this.openAiService.model,
|
|
30
31
|
};
|
|
31
32
|
if (response.status_code == 200) {
|
package/dist/config.js
CHANGED
|
@@ -291,12 +291,12 @@ const promptData = {
|
|
|
291
291
|
2. If any concept or fact is missing a test card, create one for it.
|
|
292
292
|
3. Repeat this step until all concepts and facts are covered.
|
|
293
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
|
-
}
|
|
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
296
|
};
|
|
297
297
|
function returnPromptData() {
|
|
298
298
|
return {
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
typology: (0, typology_prompt_1.returnTypologyPrompt)(),
|
|
300
|
+
card_generation: (0, card_gen_prompt_1.returnCardGenPrompt)(),
|
|
301
301
|
};
|
|
302
302
|
}
|