only_ever_generator 0.3.7 → 0.3.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 +5 -6
- package/dist/card_gen/generate_cards.js +7 -7
- package/dist/constants/source_data.js +937 -530
- package/dist/gap_fill/calculate_gap_fill.js +4 -0
- package/dist/typology_gen/generate_typology.js +5 -4
- package/dist/utils/parse_openai_response.js +0 -1
- package/package.json +1 -1
- package/src/bootstrap/app.ts +6 -8
- package/src/card_gen/generate_cards.ts +4 -4
- package/src/constants/source_data.ts +937 -530
- package/src/gap_fill/calculate_gap_fill.ts +4 -0
- package/src/typology_gen/generate_typology.ts +2 -1
- package/src/utils/parse_openai_response.ts +0 -1
package/dist/bootstrap/app.js
CHANGED
|
@@ -57,10 +57,7 @@ class OnlyEverGenerator {
|
|
|
57
57
|
else if (elem == "generate_card") {
|
|
58
58
|
/// for cards gen to occur, there must be presence of source taxonomy
|
|
59
59
|
if (this.shouldTheCardBeGeneratedAfterTypologyResponse()) {
|
|
60
|
-
this.cardgenResponse = yield this.generateCard(this.promptForCardGen,
|
|
61
|
-
"facts": this.typologyResponse.facts,
|
|
62
|
-
"concepts": this.typologyResponse.concepts
|
|
63
|
-
}), false);
|
|
60
|
+
this.cardgenResponse = yield this.generateCard(this.promptForCardGen, JSON.stringify(this.typologyResponse), false);
|
|
64
61
|
responseToReturn.push(this.cardgenResponse);
|
|
65
62
|
/// check if gap fill is required ie coverage determination
|
|
66
63
|
if (this.cardgenResponse.status_code == 200) {
|
|
@@ -88,8 +85,10 @@ class OnlyEverGenerator {
|
|
|
88
85
|
let response;
|
|
89
86
|
if (gapFill.remainingConcepts.length !== 0 ||
|
|
90
87
|
gapFill.remainingFacts.length !== 0) {
|
|
91
|
-
response = yield this.generateCard(this.promptForCardGen
|
|
92
|
-
|
|
88
|
+
response = yield this.generateCard(this.promptForCardGen +
|
|
89
|
+
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
90
|
+
JSON.stringify(gapFill) +
|
|
91
|
+
"Exclude generating cards with content in the following", JSON.stringify(cardGenData.cards_data), true);
|
|
93
92
|
}
|
|
94
93
|
return response;
|
|
95
94
|
});
|
|
@@ -17,16 +17,16 @@ class GenerateCards {
|
|
|
17
17
|
}
|
|
18
18
|
generateCards(prompt, parsedContent, isGapFill, headings) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b, _c;
|
|
20
|
+
var _a, _b, _c, _d;
|
|
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";
|
|
24
24
|
response.metadata = {
|
|
25
|
-
"req_time": response.generated_at,
|
|
25
|
+
"req_time": (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
|
|
26
26
|
"req_type": response.type,
|
|
27
|
-
"req_tokens": (
|
|
28
|
-
"res_tokens": (
|
|
29
|
-
|
|
27
|
+
"req_tokens": (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
|
|
28
|
+
"res_tokens": (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
|
|
29
|
+
"model": this.openAiService.model
|
|
30
30
|
};
|
|
31
31
|
if (response.status_code == 200) {
|
|
32
32
|
response.metadata.status = "completed";
|
|
@@ -163,7 +163,7 @@ class GenerateCards {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
parseClozeCard(data) {
|
|
166
|
-
let displayTitle = this.generateClozeCardDisplayTitle(data.card_content.
|
|
166
|
+
let displayTitle = this.generateClozeCardDisplayTitle(data.card_content.prompt, data.card_content.options);
|
|
167
167
|
let clozeCardData = {
|
|
168
168
|
type: {
|
|
169
169
|
category: 'learning',
|
|
@@ -172,7 +172,7 @@ class GenerateCards {
|
|
|
172
172
|
heading: data.card_reference,
|
|
173
173
|
displayTitle: displayTitle,
|
|
174
174
|
content: {
|
|
175
|
-
question: data.card_content.
|
|
175
|
+
question: data.card_content.prompt,
|
|
176
176
|
options: data.card_content.options,
|
|
177
177
|
},
|
|
178
178
|
concepts: data.concepts,
|