only_ever_generator 2.0.5 → 2.0.7
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.d.ts +9 -0
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +9 -2
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/card_gen/generate_cards.d.ts +11 -1
- package/dist/card_gen/generate_cards.d.ts.map +1 -1
- package/dist/card_gen/generate_cards.js +44 -17
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.d.ts +169 -0
- package/dist/helper/schema_helper/build_card_schema.d.ts.map +1 -0
- package/dist/helper/schema_helper/build_card_schema.js +139 -0
- package/dist/helper/schema_helper/build_card_schema.js.map +1 -0
- package/dist/index.js +1126 -897
- package/dist/index.js.map +1 -1
- package/dist/typology_gen/generate_typology.js +1 -1
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/app.ts +18 -1
- package/src/card_gen/generate_cards.ts +59 -25
- package/src/helper/schema_helper/build_card_schema.ts +137 -0
- package/src/index.ts +1145 -900
- package/src/typology_gen/generate_typology.ts +1 -1
package/dist/bootstrap/app.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export declare class OnlyEverGenerator {
|
|
|
22
22
|
promptId: string;
|
|
23
23
|
version: string;
|
|
24
24
|
};
|
|
25
|
+
generationVariables: {
|
|
26
|
+
bloom_instructions: string;
|
|
27
|
+
card_instructions: string;
|
|
28
|
+
card_examples: string;
|
|
29
|
+
};
|
|
25
30
|
expectedFields: Array<string>;
|
|
26
31
|
typologyResponse?: any;
|
|
27
32
|
cardgenResponse: any;
|
|
@@ -32,6 +37,10 @@ export declare class OnlyEverGenerator {
|
|
|
32
37
|
}, promptForConceptFacts: {
|
|
33
38
|
promptId: string;
|
|
34
39
|
version: string;
|
|
40
|
+
}, generationVariables: {
|
|
41
|
+
bloom_instructions: string;
|
|
42
|
+
card_instructions: string;
|
|
43
|
+
card_examples: string;
|
|
35
44
|
});
|
|
36
45
|
generate(generate_typology?: boolean, generate_card?: boolean): Promise<Array<any>>;
|
|
37
46
|
shouldTheCardBeGeneratedAfterTypologyResponse(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAO5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,qBAAa,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAM;IACrB,aAAa,EAAE,aAAa,CAAC;IAGpC,aAAa,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;QACf,QAAQ,EAAE,cAAc,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAa;IACd,iBAAiB,EAAE,MAAM,CAAM;IAC/B,gBAAgB,EAAE,MAAM,CAAM;IAC9B,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAGC;IACF,qBAAqB,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAGC;IACF,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IACnC,gBAAgB,CAAC,EAAE,GAAG,CAAa;IACnC,eAAe,EAAE,GAAG,CAAa;IACjC,iBAAiB,KAAM;gBAGrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,aAAa,EAChC,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAA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AAE,MAAM,EACb,iBAAiB,EAAE,aAAa,EAChC,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,EACD,qBAAqB,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,EACD,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB;IA6BG,QAAQ,CACZ,iBAAiB,GAAE,OAAe,EAClC,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAuEtB,6CAA6C;IAQvC,YAAY,CAAC,CAAC,GAAE,MAAU;IAe1B,gBAAgB;IAoBhB,oBAAoB;IAepB,kBAAkB,CAAC,gBAAgB,EAAE,GAAG;;;;;;;;;;;;;;;;;;IASxC,kBAAkB,CACtB,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,EACH,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;IASZ,mBAAmB,CACvB,cAAc,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,EACH,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAUpB"}
|
package/dist/bootstrap/app.js
CHANGED
|
@@ -20,7 +20,7 @@ const local_consolidation_1 = require("../embedding_generation/consolidation/loc
|
|
|
20
20
|
const global_consolidation_1 = require("../embedding_generation/consolidation/global_consolidation");
|
|
21
21
|
const generate_concept_facts_1 = require("../typology_gen/generate_concept_facts");
|
|
22
22
|
class OnlyEverGenerator {
|
|
23
|
-
constructor(apiKey, model, generationContent, promptForSummary, promptForConceptFacts) {
|
|
23
|
+
constructor(apiKey, model, generationContent, promptForSummary, promptForConceptFacts, generationVariables) {
|
|
24
24
|
this.api_key = "";
|
|
25
25
|
/// these fields will be populated inside the constructor
|
|
26
26
|
this.parsedContent = undefined;
|
|
@@ -34,6 +34,11 @@ class OnlyEverGenerator {
|
|
|
34
34
|
promptId: "",
|
|
35
35
|
version: "",
|
|
36
36
|
};
|
|
37
|
+
this.generationVariables = {
|
|
38
|
+
bloom_instructions: "",
|
|
39
|
+
card_instructions: "",
|
|
40
|
+
card_examples: "",
|
|
41
|
+
};
|
|
37
42
|
this.expectedFields = [];
|
|
38
43
|
this.typologyResponse = undefined;
|
|
39
44
|
this.cardgenResponse = undefined;
|
|
@@ -41,6 +46,7 @@ class OnlyEverGenerator {
|
|
|
41
46
|
this.promptForSummary = promptForSummary;
|
|
42
47
|
this.promptForConceptFacts = promptForConceptFacts;
|
|
43
48
|
this.api_key = apiKey;
|
|
49
|
+
this.generationVariables = generationVariables;
|
|
44
50
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
45
51
|
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
46
52
|
(this.parsedContent = {
|
|
@@ -101,6 +107,7 @@ class OnlyEverGenerator {
|
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
else if (elem == "generate_card") {
|
|
110
|
+
console.log("Generating card");
|
|
104
111
|
if (this.shouldTheCardBeGeneratedAfterTypologyResponse()) {
|
|
105
112
|
this.parsedContent.taxonomy = {
|
|
106
113
|
concepts_facts: (_d = (_c = this.typologyResponse) === null || _c === void 0 ? void 0 : _c.concepts_facts) !== null && _d !== void 0 ? _d : [],
|
|
@@ -137,7 +144,7 @@ class OnlyEverGenerator {
|
|
|
137
144
|
concepts_facts: (_b = this.typologyResponse) === null || _b === void 0 ? void 0 : _b.concepts_facts,
|
|
138
145
|
content: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.content,
|
|
139
146
|
};
|
|
140
|
-
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, JSON.stringify(content), this.parsedContent.taxonomy).generateCards(n);
|
|
147
|
+
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables).generateCards(n);
|
|
141
148
|
return generateCardsResp;
|
|
142
149
|
});
|
|
143
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA4D;AAC5D,yEAAqE;AACrE,0DAAsD;AACtD,qFAAiF;AACjF,mGAA+F;AAC/F,qGAAiG;AAMjG,mFAA8E;AAE9E,MAAa,iBAAiB;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA4D;AAC5D,yEAAqE;AACrE,0DAAsD;AACtD,qFAAiF;AACjF,mGAA+F;AAC/F,qGAAiG;AAMjG,mFAA8E;AAE9E,MAAa,iBAAiB;IA2C5B,YACE,MAAc,EACd,KAAa,EACb,iBAAgC,EAChC,gBAGC,EACD,qBAGC,EACD,mBAIC;QA1DI,YAAO,GAAW,EAAE,CAAC;QAG5B,yDAAyD;QACzD,kBAAa,GAOT,SAAS,CAAC;QACd,sBAAiB,GAAW,EAAE,CAAC;QAC/B,qBAAgB,GAAW,EAAE,CAAC;QAC9B,qBAAgB,GAGZ;YACF,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;SACZ,CAAC;QACF,0BA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I,CAAC,CAAC;YACxE,MAAM,UAAU,GAAG,MAAM,IAAI,wCAAkB,CAC7C,IAAI,CAAC,aAAa,CACnB,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACrC,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;IAEK,kBAAkB,CACtB,cAKG,EACH,QAAgB;;YAEhB,MAAM,UAAU,GAAG,IAAI,wCAAkB,EAAE,CAAC,WAAW,CACrD,cAAc,EACd,QAAQ,CACT,CAAC;YACF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;IAEK,mBAAmB,CACvB,cAMG,EACH,QAAgB,EAChB,SAAiB;;YAEjB,MAAM,UAAU,GAAG,MAAM,IAAI,0CAAmB,EAAE,CAAC,WAAW,CAC5D,cAAc,EACd,QAAQ,EACR,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;CACF;AAxQD,8CAwQC"}
|
|
@@ -5,12 +5,22 @@ export declare class GenerateCards {
|
|
|
5
5
|
openAiService: OpenAiService;
|
|
6
6
|
content: string;
|
|
7
7
|
taxonomy: SourceTaxonomy;
|
|
8
|
+
generationVariables: {
|
|
9
|
+
bloom_instructions: string;
|
|
10
|
+
card_instructions: string;
|
|
11
|
+
card_examples: string;
|
|
12
|
+
};
|
|
8
13
|
openAIHelper: OpenAIHelper;
|
|
9
14
|
promptForCardsGeneration: {
|
|
10
15
|
promptId: string;
|
|
11
16
|
version: string;
|
|
12
17
|
};
|
|
13
|
-
constructor(openAiService: OpenAiService, content: string, taxonomy: SourceTaxonomy
|
|
18
|
+
constructor(openAiService: OpenAiService, content: string, taxonomy: SourceTaxonomy, generationVariables: {
|
|
19
|
+
bloom_instructions: string;
|
|
20
|
+
card_instructions: string;
|
|
21
|
+
card_examples: string;
|
|
22
|
+
});
|
|
23
|
+
openAIResponse(): Promise<any>;
|
|
14
24
|
generateCards(n?: number): Promise<any>;
|
|
15
25
|
}
|
|
16
26
|
//# sourceMappingURL=generate_cards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.d.ts","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate_cards.d.ts","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,qBAAa,aAAa;IACxB,aAAa,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,mBAAmB,EAAE;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,YAAY,EAAE,YAAY,CAAC;IAC3B,wBAAwB,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAGC;gBAEA,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,EACxB,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB;IAcG,cAAc;IAsCd,aAAa,CAAC,CAAC,GAAE,MAAU;CA6DlC"}
|
|
@@ -11,10 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenerateCards = void 0;
|
|
13
13
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
14
|
+
const build_card_schema_1 = require("../helper/schema_helper/build_card_schema");
|
|
14
15
|
const logger_1 = require("../logger");
|
|
15
16
|
const parse_card_response_1 = require("../parse/parse_card_response");
|
|
16
17
|
class GenerateCards {
|
|
17
|
-
constructor(openAiService, content, taxonomy) {
|
|
18
|
+
constructor(openAiService, content, taxonomy, generationVariables) {
|
|
18
19
|
this.promptForCardsGeneration = {
|
|
19
20
|
promptId: "",
|
|
20
21
|
version: "",
|
|
@@ -23,31 +24,56 @@ class GenerateCards {
|
|
|
23
24
|
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key, this.openAiService.model, this.promptForCardsGeneration.promptId, this.promptForCardsGeneration.version);
|
|
24
25
|
this.content = content;
|
|
25
26
|
this.taxonomy = taxonomy;
|
|
27
|
+
this.generationVariables = generationVariables;
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
return __awaiter(this,
|
|
29
|
-
|
|
29
|
+
openAIResponse() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
console.log(this.generationVariables);
|
|
32
|
+
console.log(this.content);
|
|
30
33
|
try {
|
|
31
34
|
let response = yield this.openAIHelper.openAI.responses.create({
|
|
32
|
-
model: this.openAIHelper.model,
|
|
33
35
|
prompt: {
|
|
34
|
-
id:
|
|
35
|
-
version: this.promptForCardsGeneration.version,
|
|
36
|
+
id: "pmpt_688118a923e4819098176a13a2f401920d2ea17d881cc6c6",
|
|
36
37
|
variables: {
|
|
37
38
|
bloom_level: "1",
|
|
38
|
-
card_types: "
|
|
39
|
-
bloom_instructions:
|
|
40
|
-
card_instructions:
|
|
41
|
-
card_examples:
|
|
39
|
+
card_types: "mcq,cloze,match,flash",
|
|
40
|
+
bloom_instructions: this.generationVariables.bloom_instructions,
|
|
41
|
+
card_instructions: this.generationVariables.card_instructions,
|
|
42
|
+
card_examples: this.generationVariables.card_examples,
|
|
42
43
|
},
|
|
43
44
|
},
|
|
44
45
|
input: this.content,
|
|
45
46
|
store: false,
|
|
47
|
+
text: {
|
|
48
|
+
format: {
|
|
49
|
+
type: "json_schema",
|
|
50
|
+
name: "card_gen_schema",
|
|
51
|
+
strict: true,
|
|
52
|
+
schema: build_card_schema_1.cardSchema,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
46
55
|
});
|
|
56
|
+
console.log(response);
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.log(error);
|
|
61
|
+
new logger_1.ErrorLogger({
|
|
62
|
+
type: "card_generation",
|
|
63
|
+
data: error,
|
|
64
|
+
}).log();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
generateCards() {
|
|
69
|
+
return __awaiter(this, arguments, void 0, function* (n = 0) {
|
|
70
|
+
var _a, _b, _c, _d;
|
|
71
|
+
try {
|
|
47
72
|
// let response = await this.openAiService?.sendRequest(
|
|
48
73
|
// prompt,
|
|
49
74
|
// parsedContent
|
|
50
75
|
// );
|
|
76
|
+
let response = yield this.openAIResponse();
|
|
51
77
|
var updatedNumber = n + 1;
|
|
52
78
|
response.metadata = {
|
|
53
79
|
req_time: (_a = response.generated_at) !== null && _a !== void 0 ? _a : new Date(),
|
|
@@ -59,15 +85,16 @@ class GenerateCards {
|
|
|
59
85
|
req_tokens: (_b = response.usage_data) === null || _b === void 0 ? void 0 : _b.prompt_tokens,
|
|
60
86
|
res_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.completion_tokens,
|
|
61
87
|
prompt_tokens_details: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.prompt_tokens_details,
|
|
62
|
-
model:
|
|
88
|
+
model: response.model,
|
|
63
89
|
};
|
|
64
|
-
if (response.
|
|
90
|
+
if (response.status == "completed") {
|
|
65
91
|
response.metadata.status = "completed";
|
|
66
92
|
/// map response to generated_content
|
|
93
|
+
const testCardsArray = JSON.parse(response.output_text).test_cards;
|
|
67
94
|
const generated_data = {
|
|
68
95
|
metadata: response.metadata,
|
|
69
96
|
generated_content: {
|
|
70
|
-
test_cards:
|
|
97
|
+
test_cards: testCardsArray.map((card) => {
|
|
71
98
|
var _a, _b, _c;
|
|
72
99
|
return {
|
|
73
100
|
type: card.type,
|
|
@@ -78,9 +105,9 @@ class GenerateCards {
|
|
|
78
105
|
};
|
|
79
106
|
}),
|
|
80
107
|
},
|
|
81
|
-
usage_data: response.
|
|
82
|
-
generated_at: response.
|
|
83
|
-
status_code: response.
|
|
108
|
+
usage_data: response.usage,
|
|
109
|
+
generated_at: response.created_at,
|
|
110
|
+
status_code: response.status == "completed" ? 200 : 400,
|
|
84
111
|
};
|
|
85
112
|
let parseCard = new parse_card_response_1.ParseCardResponse().parse(generated_data, this.taxonomy, 1);
|
|
86
113
|
return parseCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,sCAAwC;AACxC,sEAAiE;AAKjE,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,iFAAuE;AACvE,sCAAwC;AACxC,sEAAiE;AAKjE,MAAa,aAAa;IAiBxB,YACE,aAA4B,EAC5B,OAAe,EACf,QAAwB,EACxB,mBAIC;QAfH,6BAAwB,GAGpB;YACF,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;SACZ,CAAC;QAWA,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAClC,IAAI,CAAC,aAAa,CAAC,OAAO,EAC1B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EACtC,IAAI,CAAC,wBAAwB,CAAC,O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,IAAI,CAAC,KAAK,mCAAI,EAAE;oCACvB,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,mCAAI,CAAC;iCACnC,CAAC;4BACJ,CAAC,CAAC;yBACH;wBACD,UAAU,EAAE,QAAQ,CAAC,KAAK;wBAC1B,YAAY,EAAE,QAAQ,CAAC,UAAU;wBACjC,WAAW,EAAE,QAAQ,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;qBACxD,CAAC;oBACF,IAAI,SAAS,GAAG,IAAI,uCAAiB,EAAE,CAAC,KAAK,CAC3C,cAAc,EACd,IAAI,CAAC,QAAQ,EACb,CAAC,CACF,CAAC;oBACF,OAAO,SAAS,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC;oBACpC,QAAQ,CAAC,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC;oBACjD,OAAO,QAAQ,CAAC;gBAClB,CAAC;YACH,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,IAAI,oBAAW,CAAC;oBACd,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,CAAC,CAAC,OAAO;iBAChB,CAAC,CAAC,GAAG,EAAE,CAAC;YACX,CAAC;QACH,CAAC;KAAA;CACF;AA1ID,sCA0IC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export declare const cardSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
test_cards: {
|
|
5
|
+
type: string;
|
|
6
|
+
items: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
type: {
|
|
10
|
+
type: string;
|
|
11
|
+
enum: string[];
|
|
12
|
+
};
|
|
13
|
+
card_content: {
|
|
14
|
+
anyOf: ({
|
|
15
|
+
type: string;
|
|
16
|
+
card_content: {
|
|
17
|
+
front: string;
|
|
18
|
+
back: string;
|
|
19
|
+
explanation: string;
|
|
20
|
+
};
|
|
21
|
+
minItems?: undefined;
|
|
22
|
+
maxItems?: undefined;
|
|
23
|
+
items?: undefined;
|
|
24
|
+
properties?: undefined;
|
|
25
|
+
required?: undefined;
|
|
26
|
+
additionalProperties?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
type: string;
|
|
29
|
+
minItems: number;
|
|
30
|
+
maxItems: number;
|
|
31
|
+
items: {
|
|
32
|
+
anyOf: ({
|
|
33
|
+
type: string;
|
|
34
|
+
properties: {
|
|
35
|
+
left_item: {
|
|
36
|
+
type: string;
|
|
37
|
+
maxLength: number;
|
|
38
|
+
};
|
|
39
|
+
right_item: {
|
|
40
|
+
type: string;
|
|
41
|
+
maxLength: number;
|
|
42
|
+
};
|
|
43
|
+
explanation?: undefined;
|
|
44
|
+
};
|
|
45
|
+
required: string[];
|
|
46
|
+
additionalProperties: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
type: string;
|
|
49
|
+
properties: {
|
|
50
|
+
explanation: {
|
|
51
|
+
type: string;
|
|
52
|
+
maxLength: number;
|
|
53
|
+
};
|
|
54
|
+
left_item?: undefined;
|
|
55
|
+
right_item?: undefined;
|
|
56
|
+
};
|
|
57
|
+
required: string[];
|
|
58
|
+
additionalProperties: boolean;
|
|
59
|
+
})[];
|
|
60
|
+
};
|
|
61
|
+
card_content?: undefined;
|
|
62
|
+
properties?: undefined;
|
|
63
|
+
required?: undefined;
|
|
64
|
+
additionalProperties?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
type: string;
|
|
67
|
+
properties: {
|
|
68
|
+
prompt: {
|
|
69
|
+
type: string;
|
|
70
|
+
maxLength: number;
|
|
71
|
+
pattern: string;
|
|
72
|
+
};
|
|
73
|
+
correct_options: {
|
|
74
|
+
type: string;
|
|
75
|
+
minItems: number;
|
|
76
|
+
maxItems: number;
|
|
77
|
+
items: {
|
|
78
|
+
type: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
incorrect_options: {
|
|
82
|
+
type: string;
|
|
83
|
+
minItems: number;
|
|
84
|
+
maxItems: number;
|
|
85
|
+
items: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
explanation: {
|
|
90
|
+
type: string;
|
|
91
|
+
maxLength: number;
|
|
92
|
+
};
|
|
93
|
+
choices?: undefined;
|
|
94
|
+
};
|
|
95
|
+
required: string[];
|
|
96
|
+
additionalProperties: boolean;
|
|
97
|
+
card_content?: undefined;
|
|
98
|
+
minItems?: undefined;
|
|
99
|
+
maxItems?: undefined;
|
|
100
|
+
items?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
type: string;
|
|
103
|
+
properties: {
|
|
104
|
+
prompt: {
|
|
105
|
+
type: string;
|
|
106
|
+
maxLength: number;
|
|
107
|
+
pattern?: undefined;
|
|
108
|
+
};
|
|
109
|
+
choices: {
|
|
110
|
+
type: string;
|
|
111
|
+
minItems: number;
|
|
112
|
+
maxItems: number;
|
|
113
|
+
items: {
|
|
114
|
+
type: string;
|
|
115
|
+
properties: {
|
|
116
|
+
choice: {
|
|
117
|
+
type: string;
|
|
118
|
+
maxLength: number;
|
|
119
|
+
};
|
|
120
|
+
is_correct: {
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
required: string[];
|
|
125
|
+
additionalProperties: boolean;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
explanation: {
|
|
129
|
+
type: string;
|
|
130
|
+
maxLength: number;
|
|
131
|
+
};
|
|
132
|
+
correct_options?: undefined;
|
|
133
|
+
incorrect_options?: undefined;
|
|
134
|
+
};
|
|
135
|
+
required: string[];
|
|
136
|
+
additionalProperties: boolean;
|
|
137
|
+
card_content?: undefined;
|
|
138
|
+
minItems?: undefined;
|
|
139
|
+
maxItems?: undefined;
|
|
140
|
+
items?: undefined;
|
|
141
|
+
})[];
|
|
142
|
+
};
|
|
143
|
+
concepts: {
|
|
144
|
+
type: string;
|
|
145
|
+
items: {
|
|
146
|
+
type: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
facts: {
|
|
150
|
+
type: string;
|
|
151
|
+
items: {
|
|
152
|
+
type: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
bloom_alignment: {
|
|
156
|
+
type: string;
|
|
157
|
+
maxLength: number;
|
|
158
|
+
description: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
required: string[];
|
|
162
|
+
additionalProperties: boolean;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
required: string[];
|
|
167
|
+
additionalProperties: boolean;
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=build_card_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_card_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwItB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cardSchema = void 0;
|
|
4
|
+
exports.cardSchema = {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
test_cards: {
|
|
8
|
+
type: "array",
|
|
9
|
+
items: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
type: {
|
|
13
|
+
type: "string",
|
|
14
|
+
enum: ["mcq"],
|
|
15
|
+
},
|
|
16
|
+
card_content: {
|
|
17
|
+
anyOf: [
|
|
18
|
+
// Flash Card
|
|
19
|
+
{
|
|
20
|
+
type: "flash",
|
|
21
|
+
card_content: {
|
|
22
|
+
front: "<content for the front>", // (max. 320 characters)
|
|
23
|
+
back: "<content for the back>", // (max. 320 characters)
|
|
24
|
+
explanation: "Clarify the concepts and facts in this card to the help the user understand the answer(s). Avoid meta-comments (e.g., “this card checks recall”). Keep it conversational, clear and concise. Don't repeat the answers verbatim. Stay within 320 characters. Include only if it adds real value or context.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
// Match Card
|
|
28
|
+
{
|
|
29
|
+
type: "array",
|
|
30
|
+
minItems: 1,
|
|
31
|
+
maxItems: 9,
|
|
32
|
+
items: {
|
|
33
|
+
anyOf: [
|
|
34
|
+
{
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
left_item: { type: "string", maxLength: 30 },
|
|
38
|
+
right_item: { type: "string", maxLength: 30 },
|
|
39
|
+
},
|
|
40
|
+
required: ["left_item", "right_item"],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
explanation: { type: "string", maxLength: 320 },
|
|
47
|
+
},
|
|
48
|
+
required: ["explanation"],
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// Cloze Card
|
|
55
|
+
{
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
prompt: {
|
|
59
|
+
type: "string",
|
|
60
|
+
maxLength: 320,
|
|
61
|
+
pattern: ".*{{.+?}}.*",
|
|
62
|
+
},
|
|
63
|
+
correct_options: {
|
|
64
|
+
type: "array",
|
|
65
|
+
minItems: 1,
|
|
66
|
+
maxItems: 4,
|
|
67
|
+
items: { type: "string" },
|
|
68
|
+
},
|
|
69
|
+
incorrect_options: {
|
|
70
|
+
type: "array",
|
|
71
|
+
minItems: 1,
|
|
72
|
+
maxItems: 7,
|
|
73
|
+
items: { type: "string" },
|
|
74
|
+
},
|
|
75
|
+
explanation: { type: "string", maxLength: 320 },
|
|
76
|
+
},
|
|
77
|
+
required: [
|
|
78
|
+
"prompt",
|
|
79
|
+
"correct_options",
|
|
80
|
+
"incorrect_options",
|
|
81
|
+
"explanation",
|
|
82
|
+
],
|
|
83
|
+
additionalProperties: false,
|
|
84
|
+
},
|
|
85
|
+
// MCQ Card
|
|
86
|
+
{
|
|
87
|
+
type: "object",
|
|
88
|
+
properties: {
|
|
89
|
+
prompt: { type: "string", maxLength: 320 },
|
|
90
|
+
choices: {
|
|
91
|
+
type: "array",
|
|
92
|
+
minItems: 2,
|
|
93
|
+
maxItems: 8,
|
|
94
|
+
items: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
choice: { type: "string", maxLength: 42 },
|
|
98
|
+
is_correct: { type: "boolean" },
|
|
99
|
+
},
|
|
100
|
+
required: ["choice", "is_correct"],
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
explanation: { type: "string", maxLength: 320 },
|
|
105
|
+
},
|
|
106
|
+
required: ["prompt", "choices", "explanation"],
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
concepts: {
|
|
112
|
+
type: "array",
|
|
113
|
+
items: { type: "string" },
|
|
114
|
+
},
|
|
115
|
+
facts: {
|
|
116
|
+
type: "array",
|
|
117
|
+
items: { type: "string" },
|
|
118
|
+
},
|
|
119
|
+
bloom_alignment: {
|
|
120
|
+
type: "string",
|
|
121
|
+
maxLength: 240,
|
|
122
|
+
description: "Explain why this card fits the bloom level you were asked to create (max. 240 chars)",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
required: [
|
|
126
|
+
"type",
|
|
127
|
+
"card_content",
|
|
128
|
+
"concepts",
|
|
129
|
+
"facts",
|
|
130
|
+
"bloom_alignment",
|
|
131
|
+
],
|
|
132
|
+
additionalProperties: false,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
required: ["test_cards"],
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=build_card_schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,KAAK,CAAC;qBACd;oBACD,YAAY,EAAE;wBACZ,KAAK,EAAE;4BACL,aAAa;4BACb;gCACE,IAAI,EAAE,OAAO;gCACb,YAAY,EAAE;oCACZ,KAAK,EAAE,yBAAyB,EAAE,wBAAwB;oCAC1D,IAAI,EAAE,wBAAwB,EAAE,wBAAwB;oCACxD,WAAW,EACT,4SAA4S;iCAC/S;6BACF;4BACD,aAAa;4BACb;gCACE,IAAI,EAAE,OAAO;gCACb,QAAQ,EAAE,CAAC;gCACX,QAAQ,EAAE,CAAC;gCACX,KAAK,EAAE;oCACL,KAAK,EAAE;wCACL;4CACE,IAAI,EAAE,QAAQ;4CACd,UAAU,EAAE;gDACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;gDAC5C,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;6CAC9C;4CACD,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;4CACrC,oBAAoB,EAAE,KAAK;yCAC5B;wCACD;4CACE,IAAI,EAAE,QAAQ;4CACd,UA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