only_ever_generator 6.0.0 → 6.0.2
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 +2 -1
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +6 -4
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/card_gen/generate_cards.d.ts +2 -1
- package/dist/card_gen/generate_cards.d.ts.map +1 -1
- package/dist/card_gen/generate_cards.js +18 -12
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.d.ts +1 -0
- package/dist/helper/schema_helper/build_card_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.js +29 -1
- package/dist/helper/schema_helper/build_card_schema.js.map +1 -1
- package/dist/index.js +63 -60
- package/dist/index.js.map +1 -1
- package/dist/typology_gen/generate_concept_facts.d.ts +2 -1
- package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -1
- package/dist/typology_gen/generate_concept_facts.js +5 -2
- package/dist/typology_gen/generate_concept_facts.js.map +1 -1
- package/dist/typology_gen/generate_typology.d.ts +2 -1
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +8 -3
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/app.ts +10 -4
- package/src/card_gen/generate_cards.ts +24 -13
- package/src/helper/schema_helper/build_card_schema.ts +20 -0
- package/src/index.ts +61 -60
- package/src/typology_gen/generate_concept_facts.ts +7 -2
- package/src/typology_gen/generate_typology.ts +10 -3
package/dist/bootstrap/app.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class OnlyEverGenerator {
|
|
|
14
14
|
};
|
|
15
15
|
promptForTypology: string;
|
|
16
16
|
promptForCardGen: string;
|
|
17
|
+
generationCurriculum: boolean;
|
|
17
18
|
promptIdForTypology: string;
|
|
18
19
|
promptIdForConceptFacts: string;
|
|
19
20
|
promptIdForCardsGeneration: string;
|
|
@@ -30,7 +31,7 @@ export declare class OnlyEverGenerator {
|
|
|
30
31
|
bloom_instructions: string;
|
|
31
32
|
card_instructions: string;
|
|
32
33
|
card_examples: string;
|
|
33
|
-
});
|
|
34
|
+
}, generationCurriculum: boolean);
|
|
34
35
|
generate(generate_typology?: boolean, generate_card?: boolean): Promise<Array<any>>;
|
|
35
36
|
shouldTheCardBeGeneratedAfterTypologyResponse(): boolean;
|
|
36
37
|
generateCard(n?: number): Promise<any>;
|
|
@@ -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;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,0BAA0B,EAAE,MAAM,CAAC;IAC1C,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAIC;IACF,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC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CAUpB"}
|
package/dist/bootstrap/app.js
CHANGED
|
@@ -20,12 +20,13 @@ 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, promptIdForTypology, promptIdForConceptFacts, promptIdForCardsGeneration, generationVariables) {
|
|
23
|
+
constructor(apiKey, model, generationContent, promptIdForTypology, promptIdForConceptFacts, promptIdForCardsGeneration, generationVariables, generationCurriculum) {
|
|
24
24
|
this.api_key = "";
|
|
25
25
|
/// these fields will be populated inside the constructor
|
|
26
26
|
this.parsedContent = undefined;
|
|
27
27
|
this.promptForTypology = "";
|
|
28
28
|
this.promptForCardGen = "";
|
|
29
|
+
this.generationCurriculum = false;
|
|
29
30
|
this.generationVariables = {
|
|
30
31
|
bloom_instructions: "",
|
|
31
32
|
card_instructions: "",
|
|
@@ -40,6 +41,7 @@ class OnlyEverGenerator {
|
|
|
40
41
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
41
42
|
this.api_key = apiKey;
|
|
42
43
|
this.generationVariables = generationVariables;
|
|
44
|
+
this.generationCurriculum = generationCurriculum;
|
|
43
45
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
44
46
|
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
45
47
|
(this.parsedContent = {
|
|
@@ -151,7 +153,7 @@ class OnlyEverGenerator {
|
|
|
151
153
|
concepts_facts: (_b = this.typologyResponse) === null || _b === void 0 ? void 0 : _b.concepts_facts,
|
|
152
154
|
content: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.content,
|
|
153
155
|
};
|
|
154
|
-
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.source_id) !== null && _e !== void 0 ? _e : "", JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables, this.promptIdForCardsGeneration).generateCards(n);
|
|
156
|
+
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.source_id) !== null && _e !== void 0 ? _e : "", JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables, this.promptIdForCardsGeneration, this.generationCurriculum).generateCards(n);
|
|
155
157
|
return generateCardsResp;
|
|
156
158
|
});
|
|
157
159
|
}
|
|
@@ -163,7 +165,7 @@ class OnlyEverGenerator {
|
|
|
163
165
|
? { h1_headings: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.headings) !== null && _f !== void 0 ? _f : [""] }
|
|
164
166
|
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] });
|
|
165
167
|
try {
|
|
166
|
-
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, this.expectedFields, this.promptIdForTypology).generate();
|
|
168
|
+
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, this.expectedFields, this.promptIdForTypology, this.generationCurriculum).generate();
|
|
167
169
|
return response;
|
|
168
170
|
}
|
|
169
171
|
catch (error) {
|
|
@@ -180,7 +182,7 @@ class OnlyEverGenerator {
|
|
|
180
182
|
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] }), (typologyResponse && typeof typologyResponse === "object"
|
|
181
183
|
? typologyResponse
|
|
182
184
|
: {}));
|
|
183
|
-
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, type, this.promptIdForConceptFacts).generate();
|
|
185
|
+
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, type, this.promptIdForConceptFacts, this.generationCurriculum).generate();
|
|
184
186
|
return response;
|
|
185
187
|
});
|
|
186
188
|
}
|
|
@@ -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;IAiC5B,YACE,MAAc,EACd,KAAa,EACb,iBAAgC,EAChC,mBAA2B,EAC3B,uBAA+B,EAC/B,0BAAkC,EAClC,mBAIC,EACD,oBAA6B;QA5CxB,YAAO,GAAW,EAAE,CAAC;QAG5B,yDAAyD;QACzD,kBAAa,GAOT,SAAS,CAAC;QACd,sBAAiB,GAAW,EAAE,CAAC;QAC/B,qBAAgB,G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ForCardsGeneration: string;
|
|
16
|
+
generationCurriculum: boolean;
|
|
16
17
|
constructor(openAiService: OpenAiService, sourceId: string, content: string, taxonomy: SourceTaxonomy, generationVariables: {
|
|
17
18
|
bloom_instructions: string;
|
|
18
19
|
card_instructions: string;
|
|
19
20
|
card_examples: string;
|
|
20
|
-
}, promptIdForCardsGeneration: string);
|
|
21
|
+
}, promptIdForCardsGeneration: string, generationCurriculum: boolean);
|
|
21
22
|
openAIResponse(): Promise<any>;
|
|
22
23
|
generateCards(n?: number): Promise<any>;
|
|
23
24
|
parseJson(response: any): any;
|
|
@@ -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;AAOvD,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,MAAM,CAAC;IACjB,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;IACpB,0BAA0B,EAAE,MAAM,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;gBAEnC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,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,EACD,0BAA0B,EAAE,MAAM,EAClC,oBAAoB,EAAE,OAAO;IAYzB,cAAc;IAoFd,aAAa,CAAC,CAAC,GAAE,MAAU;IAyEjC,SAAS,CAAC,QAAQ,EAAE,GAAG;CAWxB"}
|
|
@@ -15,7 +15,7 @@ const build_card_schema_1 = require("../helper/schema_helper/build_card_schema")
|
|
|
15
15
|
const logger_1 = require("../logger");
|
|
16
16
|
const parse_card_response_1 = require("../parse/parse_card_response");
|
|
17
17
|
class GenerateCards {
|
|
18
|
-
constructor(openAiService, sourceId, content, taxonomy, generationVariables, promptIdForCardsGeneration) {
|
|
18
|
+
constructor(openAiService, sourceId, content, taxonomy, generationVariables, promptIdForCardsGeneration, generationCurriculum) {
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
21
21
|
this.sourceId = sourceId;
|
|
@@ -23,13 +23,11 @@ class GenerateCards {
|
|
|
23
23
|
this.taxonomy = taxonomy;
|
|
24
24
|
this.generationVariables = generationVariables;
|
|
25
25
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
26
|
+
this.generationCurriculum = generationCurriculum;
|
|
26
27
|
}
|
|
27
28
|
openAIResponse() {
|
|
28
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
|
|
30
|
-
console.log(this.generationVariables.bloom_instructions);
|
|
31
|
-
console.log(this.generationVariables.card_instructions);
|
|
32
|
-
console.log(this.generationVariables.card_examples);
|
|
30
|
+
const schema = yield (0, build_card_schema_1.buildCardSchema)();
|
|
33
31
|
try {
|
|
34
32
|
let response = yield this.openAIHelper.openAI.responses.create({
|
|
35
33
|
prompt: {
|
|
@@ -53,15 +51,17 @@ class GenerateCards {
|
|
|
53
51
|
text: {
|
|
54
52
|
format: {
|
|
55
53
|
type: "json_schema",
|
|
56
|
-
name:
|
|
57
|
-
strict:
|
|
58
|
-
schema:
|
|
54
|
+
name: schema.name,
|
|
55
|
+
strict: schema.strict,
|
|
56
|
+
schema: schema.schema,
|
|
59
57
|
},
|
|
60
58
|
},
|
|
61
59
|
});
|
|
62
60
|
if (!response) {
|
|
63
61
|
yield (0, logger_1.log_error)({
|
|
64
|
-
flow:
|
|
62
|
+
flow: this.generationCurriculum
|
|
63
|
+
? "curriculum_manual_generation"
|
|
64
|
+
: "manual_generation",
|
|
65
65
|
data: JSON.stringify(response),
|
|
66
66
|
timestamp: new Date(),
|
|
67
67
|
error: "empty_openai_response",
|
|
@@ -78,7 +78,9 @@ class GenerateCards {
|
|
|
78
78
|
catch (error) {
|
|
79
79
|
if (error instanceof logger_1.ParsingError) {
|
|
80
80
|
yield (0, logger_1.log_error)({
|
|
81
|
-
flow:
|
|
81
|
+
flow: this.generationCurriculum
|
|
82
|
+
? "curriculum_manual_generation"
|
|
83
|
+
: "manual_generation",
|
|
82
84
|
data: error,
|
|
83
85
|
timestamp: new Date(),
|
|
84
86
|
error: "parsing_error",
|
|
@@ -92,7 +94,9 @@ class GenerateCards {
|
|
|
92
94
|
else {
|
|
93
95
|
console.log(error);
|
|
94
96
|
yield (0, logger_1.log_error)({
|
|
95
|
-
flow:
|
|
97
|
+
flow: this.generationCurriculum
|
|
98
|
+
? "curriculum_manual_generation"
|
|
99
|
+
: "manual_generation",
|
|
96
100
|
data: error,
|
|
97
101
|
timestamp: new Date(),
|
|
98
102
|
error: "error_in_card_generation",
|
|
@@ -163,7 +167,9 @@ class GenerateCards {
|
|
|
163
167
|
}
|
|
164
168
|
catch (e) {
|
|
165
169
|
yield (0, logger_1.log_error)({
|
|
166
|
-
flow:
|
|
170
|
+
flow: this.generationCurriculum
|
|
171
|
+
? "curriculum_manual_generation"
|
|
172
|
+
: "manual_generation",
|
|
167
173
|
data: e,
|
|
168
174
|
timestamp: new Date(),
|
|
169
175
|
error: "error_in_card_generation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,iFAGmD;AACnD,sCAAiE;AACjE,sEAAiE;AAKjE,MAAa,aAAa;IAaxB,YACE,aAA4B,EAC5B,QAAgB,EAChB,OAAe,EACf,QAAwB,EACxB,mBAIC,EACD,0BAAkC,EAClC,oBAA6B;QAE7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;QAC7D,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAEK,cAAc;;YAClB,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAe,GAAE,CAAC;YACvC,IAAI,CAAC;gBACH,IAAI,QAAQ,GAAQ,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;oBAClE,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI,CAAC,0BAA0B;wBACnC,SAAS,EAAE;4BACT,WAAW,EAAE,GAAG;4BAChB,UAAU,EAAE,uBAAuB;4BACnC,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,CAAC,kBAAkB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,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,MAAM,IAAA,kBAAS,EAAC;oBACd,IAAI,EAAE,IAAI,CAAC,oBAAoB;wBAC7B,CAAC,CAAC,8BAA8B;wBAChC,CAAC,CAAC,mBAAmB;oBACvB,IAAI,EAAE,CAAC;oBACP,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,KAAK,EAAE,0BAA0B;oBACjC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,IAAI,EAAE;wBACJ,YAAY,EAAE,OAAO;wBACrB,CAAC,EAAE,CAAC;qBACL;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;IAED,SAAS,CAAC,QAAa;QACrB,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC;YACnE,OAAO,cAAc,CAAC;QACxB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,qBAAY,CACpB,0CAA0C,EAC1C,QAAQ,CACT,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA5MD,sCA4MC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_card_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_card_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,oBAgB3B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ItB,CAAC"}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cardSchema = void 0;
|
|
12
|
+
exports.cardSchema = exports.buildCardSchema = void 0;
|
|
13
|
+
const mongo_helper_1 = require("../mongo_helper");
|
|
14
|
+
const buildCardSchema = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
(0, mongo_helper_1.setUp)();
|
|
16
|
+
const objectId = new mongo_helper_1.ObjectId("689c5cbd0d9d3bbda64b9584");
|
|
17
|
+
const schemaObj = yield mongo_helper_1.database.collection("_prompts").findOne({
|
|
18
|
+
_id: objectId,
|
|
19
|
+
});
|
|
20
|
+
if (!schemaObj) {
|
|
21
|
+
throw new Error("Schema not found");
|
|
22
|
+
}
|
|
23
|
+
const schema = schemaObj.schema;
|
|
24
|
+
if (!schema) {
|
|
25
|
+
throw new Error("Schema not found");
|
|
26
|
+
}
|
|
27
|
+
// Deep clone to avoid mutating the original
|
|
28
|
+
const populatedSchema = JSON.parse(schema);
|
|
29
|
+
return populatedSchema;
|
|
30
|
+
});
|
|
31
|
+
exports.buildCardSchema = buildCardSchema;
|
|
4
32
|
exports.cardSchema = {
|
|
5
33
|
type: "object",
|
|
6
34
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA4D;AAErD,MAAM,eAAe,GAAG,GAAS,EAAE;IACxC,IAAA,oBAAK,GAAE,CAAC;IACR,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,uBAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QAC9D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,4CAA4C;IAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AAhBW,QAAA,eAAe,mBAgB1B;AAEW,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,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,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC1B;oBACD,eAAe,EAAE;wBACf,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,GAAG;wBACd,WAAW,EACT,sFAAsF;qBACzF;iBACF;gBACD,QAAQ,EAAE;oBACR,MAAM;oBACN,cAAc;oBACd,UAAU;oBACV,OAAO;oBACP,iBAAiB;oBACjB,aAAa;iBACd;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;IACD,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,68 +9,71 @@
|
|
|
9
9
|
// import { OpenAiService } from "./services/open_ai_service";
|
|
10
10
|
// import { GenerateConceptFacts } from "./typology_gen/generate_concept_facts";
|
|
11
11
|
// import { BaseParamType } from "./types/base_param_type";
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
12
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
22
|
exports.OnlyEverGenerator = void 0;
|
|
14
23
|
const app_1 = require("./bootstrap/app");
|
|
15
24
|
Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: function () { return app_1.OnlyEverGenerator; } });
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// card_examples: cardExamples,
|
|
71
|
-
// }
|
|
72
|
-
// );
|
|
73
|
-
// const response = await onlyEverGenerator.generate(true, true);
|
|
74
|
-
// console.log(response);
|
|
75
|
-
// })();
|
|
25
|
+
const mongo_helper_1 = require("./helper/mongo_helper");
|
|
26
|
+
const get_prompts_1 = require("./services/get_prompts");
|
|
27
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
29
|
+
const openAIKey = "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";
|
|
30
|
+
const promptForSummary = {
|
|
31
|
+
promptId: "pmpt_687a8872d1c8819088a9cdc97dcb688b0893663621695594",
|
|
32
|
+
version: "13",
|
|
33
|
+
};
|
|
34
|
+
const promptForConceptFacts = {
|
|
35
|
+
promptId: "pmpt_687aa547f99c8193b99467ca53630c2607f5a8caf451e7e8",
|
|
36
|
+
version: "6",
|
|
37
|
+
};
|
|
38
|
+
(0, mongo_helper_1.setUp)();
|
|
39
|
+
const source = yield mongo_helper_1.database.collection("_source").findOne({
|
|
40
|
+
_id: new mongo_helper_1.ObjectId("6899abc683727361fc197b18"),
|
|
41
|
+
});
|
|
42
|
+
const contentForGen = {
|
|
43
|
+
prompt: {
|
|
44
|
+
typology: "",
|
|
45
|
+
card_generation: "",
|
|
46
|
+
},
|
|
47
|
+
content: {
|
|
48
|
+
source_id: ((_a = source === null || source === void 0 ? void 0 : source._id) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
49
|
+
title: (source === null || source === void 0 ? void 0 : source.title) || "",
|
|
50
|
+
type: (source === null || source === void 0 ? void 0 : source.source_type) || "",
|
|
51
|
+
headings: (source === null || source === void 0 ? void 0 : source.headings) || [],
|
|
52
|
+
content: (source === null || source === void 0 ? void 0 : source.content) || [],
|
|
53
|
+
fields: (source === null || source === void 0 ? void 0 : source.fields) || [],
|
|
54
|
+
taxonomy: (source === null || source === void 0 ? void 0 : source.generate_cards)
|
|
55
|
+
? {
|
|
56
|
+
generate_cards: (source === null || source === void 0 ? void 0 : source.generate_cards) || {
|
|
57
|
+
state: false,
|
|
58
|
+
reason: "",
|
|
59
|
+
},
|
|
60
|
+
concepts_facts: (source === null || source === void 0 ? void 0 : source.concepts_facts) || [],
|
|
61
|
+
fields: (source === null || source === void 0 ? void 0 : source.fields) || [],
|
|
62
|
+
}
|
|
63
|
+
: undefined,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const prompts = yield (0, get_prompts_1.getPrompts)("text");
|
|
67
|
+
const bloomInstructions = prompts.bloom_instructions;
|
|
68
|
+
const cardInstructions = prompts.card_instructions;
|
|
69
|
+
const cardExamples = prompts.card_examples;
|
|
70
|
+
console.log("Initializing OnlyEverGenerator");
|
|
71
|
+
const onlyEverGenerator = new app_1.OnlyEverGenerator(process.env.OPEN_AI_KEY, "o4-mini", contentForGen, "pmpt_687a8872d1c8819088a9cdc97dcb688b0893663621695594", "pmpt_687aa547f99c8193b99467ca53630c2607f5a8caf451e7e8", "pmpt_688118a923e4819098176a13a2f401920d2ea17d881cc6c6", {
|
|
72
|
+
bloom_instructions: bloomInstructions,
|
|
73
|
+
card_instructions: cardInstructions,
|
|
74
|
+
card_examples: cardExamples,
|
|
75
|
+
}, false);
|
|
76
|
+
const response = yield onlyEverGenerator.generate(true, true);
|
|
77
|
+
console.log(response);
|
|
78
|
+
}))();
|
|
76
79
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,iGAAiG;AACjG,+DAA+D;AAC/D,mGAAmG;AACnG,4FAA4F;AAC5F,yDAAyD;AACzD,uEAAuE;AACvE,8DAA8D;AAC9D,gFAAgF;AAChF,2DAA2D
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,iGAAiG;AACjG,+DAA+D;AAC/D,mGAAmG;AACnG,4FAA4F;AAC5F,yDAAyD;AACzD,uEAAuE;AACvE,8DAA8D;AAC9D,gFAAgF;AAChF,2DAA2D;;;;;;;;;;;;AAE3D,yCAAoD;AAK3C,kGALA,uBAAiB,OAKA;AAJ1B,wDAAkE;AAClE,wDAAoD;AAKpD,CAAC,GAAS,EAAE;;IACV,MAAM,SAAS,GACb,sKAAsK,CAAC;IACzK,MAAM,gBAAgB,GAAG;QACvB,QAAQ,EAAE,uDAAuD;QACjE,OAAO,EAAE,IAAI;KACd,CAAC;IACF,MAAM,qBAAqB,GAAG;QAC5B,QAAQ,EAAE,uDAAuD;QACjE,OAAO,EAAE,GAAG;KACb,CAAC;IAEF,IAAA,oBAAK,GAAE,CAAC;IAER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M,IAAA,wBAAU,EAAC,MAAM,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAE3C,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,MAAM,iBAAiB,GAAG,IAAI,uBAAiB,CAC7C,OAAO,CAAC,GAAG,CAAC,WAAqB,EACjC,SAAS,EACT,aAAa,EAEb,uDAAuD,EACvD,uDAAuD,EACvD,uDAAuD,EACvD;QACE,kBAAkB,EAAE,iBAAiB;QACrC,iBAAiB,EAAE,gBAAgB;QACnC,aAAa,EAAE,YAAY;KAC5B,EACD,KAAK,CACN,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ export declare class GenerateConceptFacts {
|
|
|
4
4
|
openAiService: OpenAiService;
|
|
5
5
|
openAIHelper: OpenAIHelper;
|
|
6
6
|
sourceId: string;
|
|
7
|
+
generationCurriculum: boolean;
|
|
7
8
|
content: {
|
|
8
9
|
title: string;
|
|
9
10
|
h1_headings?: string[];
|
|
@@ -17,7 +18,7 @@ export declare class GenerateConceptFacts {
|
|
|
17
18
|
h1_headings?: string[];
|
|
18
19
|
timecodes?: string[];
|
|
19
20
|
content: any[];
|
|
20
|
-
}, type: string, promptIdForConceptFacts: string);
|
|
21
|
+
}, type: string, promptIdForConceptFacts: string, generationCurriculum: boolean);
|
|
21
22
|
generate(): Promise<{
|
|
22
23
|
concepts_facts: any;
|
|
23
24
|
metadata: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_concept_facts.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,uBAAuB,EAAE,MAAM,CAAC;gBAErC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,EACD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"generate_concept_facts.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,uBAAuB,EAAE,MAAM,CAAC;gBAErC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,EACD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,MAAM,EAC/B,oBAAoB,EAAE,OAAO;IAWzB,QAAQ;;;;IA+Fd,SAAS,CAAC,QAAQ,EAAE,GAAG;CAWxB"}
|
|
@@ -14,7 +14,7 @@ const build_concept_facts_schema_1 = require("../helper/schema_helper/build_conc
|
|
|
14
14
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
15
15
|
const logger_1 = require("../logger");
|
|
16
16
|
class GenerateConceptFacts {
|
|
17
|
-
constructor(openAiService, sourceId, content, type, promptIdForConceptFacts) {
|
|
17
|
+
constructor(openAiService, sourceId, content, type, promptIdForConceptFacts, generationCurriculum) {
|
|
18
18
|
this.type = "";
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
@@ -22,6 +22,7 @@ class GenerateConceptFacts {
|
|
|
22
22
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
23
23
|
this.type = type;
|
|
24
24
|
this.sourceId = sourceId;
|
|
25
|
+
this.generationCurriculum = generationCurriculum;
|
|
25
26
|
}
|
|
26
27
|
generate() {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -98,7 +99,9 @@ class GenerateConceptFacts {
|
|
|
98
99
|
catch (error) {
|
|
99
100
|
console.log(error);
|
|
100
101
|
yield (0, logger_1.log_error)({
|
|
101
|
-
flow:
|
|
102
|
+
flow: this.generationCurriculum
|
|
103
|
+
? "curriculum_manual_generation"
|
|
104
|
+
: "manual_generation",
|
|
102
105
|
data: error,
|
|
103
106
|
timestamp: new Date(),
|
|
104
107
|
error: "error_in_concept_facts_generation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_concept_facts.js","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mGAA4F;AAC5F,2DAAuD;AAEvD,sCAAiE;AAEjE,MAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"generate_concept_facts.js","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mGAA4F;AAC5F,2DAAuD;AAEvD,sCAAiE;AAEjE,MAAa,oBAAoB;IAa/B,YACE,aAA4B,EAC5B,QAAgB,EAChB,OAKC,EACD,IAAY,EACZ,uBAA+B,EAC/B,oBAA6B;QAbxB,SAAI,GAAW,EAAE,CAAC;QAevB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAEK,QAAQ;;;YACZ,IAAI,CAAC;gBACH,MAAM,QAAQ,GACZ,IAAI,CAAC,IAAI,KAAK,MAAM;oBAClB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC;oBAClC,CAAC,CAAC,IAAI,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C;KAAA;IAED,SAAS,CAAC,QAAa;QACrB,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC;YACvE,OAAO,cAAc,CAAC;QACxB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,qBAAY,CACpB,0CAA0C,EAC1C,QAAQ,CACT,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA7ID,oDA6IC"}
|
|
@@ -3,6 +3,7 @@ export declare class GenerateTypology {
|
|
|
3
3
|
openAiService: OpenAiService;
|
|
4
4
|
type: string;
|
|
5
5
|
sourceId: string;
|
|
6
|
+
generationCurriculum: boolean;
|
|
6
7
|
content: {
|
|
7
8
|
title: string;
|
|
8
9
|
h1_headings?: string[];
|
|
@@ -16,7 +17,7 @@ export declare class GenerateTypology {
|
|
|
16
17
|
h1_headings?: string[];
|
|
17
18
|
timecodes?: string[];
|
|
18
19
|
content: any[];
|
|
19
|
-
}, expected_fields: Array<string>, promptIdForTypology: string);
|
|
20
|
+
}, expected_fields: Array<string>, promptIdForTypology: string, generationCurriculum: boolean);
|
|
20
21
|
generate(): Promise<any>;
|
|
21
22
|
parseTypologyOnSuccess(responseData: any): {
|
|
22
23
|
status_code: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAM;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAA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eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,mBAAmB,EAAE,MAAM,EAC3B,oBAAoB,EAAE,OAAO;IAYzB,QAAQ;IAkGd,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;;;;;;;IAexC,SAAS,CAAC,QAAQ,EAAE,GAAG;IAYvB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;;;;IAQ3B,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;CAQ/C"}
|
|
@@ -14,7 +14,7 @@ const openai_helper_1 = require("../helper/openai_helper");
|
|
|
14
14
|
const logger_1 = require("../logger");
|
|
15
15
|
const build_classify_summarize_schema_1 = require("../helper/schema_helper/build_classify_summarize_schema");
|
|
16
16
|
class GenerateTypology {
|
|
17
|
-
constructor(openAiService, type, sourceId, content, expected_fields, promptIdForTypology) {
|
|
17
|
+
constructor(openAiService, type, sourceId, content, expected_fields, promptIdForTypology, generationCurriculum) {
|
|
18
18
|
this.type = "";
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.type = type;
|
|
@@ -22,6 +22,7 @@ class GenerateTypology {
|
|
|
22
22
|
this.content = content;
|
|
23
23
|
this.expectedFields = expected_fields.map((elem) => elem.toLowerCase());
|
|
24
24
|
this.promptIdForTypology = promptIdForTypology;
|
|
25
|
+
this.generationCurriculum = generationCurriculum;
|
|
25
26
|
}
|
|
26
27
|
generate() {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -62,7 +63,9 @@ class GenerateTypology {
|
|
|
62
63
|
console.log(openAiResponse);
|
|
63
64
|
if (!openAiResponse) {
|
|
64
65
|
yield (0, logger_1.log_error)({
|
|
65
|
-
flow:
|
|
66
|
+
flow: this.generationCurriculum
|
|
67
|
+
? "curriculum_manual_generation"
|
|
68
|
+
: "manual_generation",
|
|
66
69
|
data: openAiResponse,
|
|
67
70
|
error: "empty_openai_response",
|
|
68
71
|
timestamp: new Date(),
|
|
@@ -103,7 +106,9 @@ class GenerateTypology {
|
|
|
103
106
|
catch (e) {
|
|
104
107
|
console.log(e);
|
|
105
108
|
yield (0, logger_1.log_error)({
|
|
106
|
-
flow:
|
|
109
|
+
flow: this.generationCurriculum
|
|
110
|
+
? "curriculum_manual_generation"
|
|
111
|
+
: "manual_generation",
|
|
107
112
|
data: e,
|
|
108
113
|
timestamp: new Date(),
|
|
109
114
|
error: "error_in_typology_generation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAkE;AAClE,sCAAiE;AAGjE,6GAAuG;AAEvG,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAkE;AAClE,sCAAiE;AAGjE,6GAAuG;AAEvG,MAAa,gBAAgB;IAa3B,YACE,aAA4B,EAC5B,IAAY,EACZ,QAAgB,EAChB,OAKC,EACD,eAA8B,EAC9B,mBAA2B,EAC3B,oBAA6B;QAvBxB,SAAI,GAAW,EAAE,CAAC;QAyBvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CACzD,IAAI,CAAC,WAAW,EAAE,CACnB,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IACK,QAAQ;;;YACZ,IAAI,CAAC;gBACH,MAAM,QAAQ,GACZ,IAAI,CAAC,IAAI,IAAI,OAAO;oB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,EAAE,gBAAgB,CAAC,CAAC;QACzE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI;YACxB,SAAS,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SAC7D,CAAC,CAAC,CAAC;IACN,CAAC;IAEK,sBAAsB,CAAC,YAAiB;;YAC5C,YAAY,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC;YAExC,OAAO;gBACL,WAAW,EAAE,YAAY,CAAC,WAAW;gBACrC,QAAQ,EAAE,YAAY,CAAC,QAAQ;aAChC,CAAC;QACJ,CAAC;KAAA;CACF;AAlLD,4CAkLC"}
|
package/package.json
CHANGED
package/src/bootstrap/app.ts
CHANGED
|
@@ -28,6 +28,7 @@ export class OnlyEverGenerator {
|
|
|
28
28
|
} = undefined;
|
|
29
29
|
promptForTypology: string = "";
|
|
30
30
|
promptForCardGen: string = "";
|
|
31
|
+
public generationCurriculum: boolean = false;
|
|
31
32
|
public promptIdForTypology: string;
|
|
32
33
|
public promptIdForConceptFacts: string;
|
|
33
34
|
public promptIdForCardsGeneration: string;
|
|
@@ -56,13 +57,15 @@ export class OnlyEverGenerator {
|
|
|
56
57
|
bloom_instructions: string;
|
|
57
58
|
card_instructions: string;
|
|
58
59
|
card_examples: string;
|
|
59
|
-
}
|
|
60
|
+
},
|
|
61
|
+
generationCurriculum: boolean
|
|
60
62
|
) {
|
|
61
63
|
this.promptIdForTypology = promptIdForTypology;
|
|
62
64
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
63
65
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
64
66
|
this.api_key = apiKey;
|
|
65
67
|
this.generationVariables = generationVariables;
|
|
68
|
+
this.generationCurriculum = generationCurriculum;
|
|
66
69
|
this.openAiService = new OpenAiService(
|
|
67
70
|
apiKey,
|
|
68
71
|
model ?? "gpt-3.5-turbo-1106"
|
|
@@ -197,7 +200,8 @@ export class OnlyEverGenerator {
|
|
|
197
200
|
JSON.stringify(content),
|
|
198
201
|
this.parsedContent!.taxonomy,
|
|
199
202
|
this.generationVariables,
|
|
200
|
-
this.promptIdForCardsGeneration
|
|
203
|
+
this.promptIdForCardsGeneration,
|
|
204
|
+
this.generationCurriculum
|
|
201
205
|
).generateCards(n);
|
|
202
206
|
return generateCardsResp;
|
|
203
207
|
}
|
|
@@ -218,7 +222,8 @@ export class OnlyEverGenerator {
|
|
|
218
222
|
this.parsedContent?.source_id ?? "",
|
|
219
223
|
content,
|
|
220
224
|
this.expectedFields,
|
|
221
|
-
this.promptIdForTypology
|
|
225
|
+
this.promptIdForTypology,
|
|
226
|
+
this.generationCurriculum
|
|
222
227
|
).generate();
|
|
223
228
|
return response;
|
|
224
229
|
} catch (error) {
|
|
@@ -243,7 +248,8 @@ export class OnlyEverGenerator {
|
|
|
243
248
|
this.parsedContent?.source_id ?? "",
|
|
244
249
|
content,
|
|
245
250
|
type,
|
|
246
|
-
this.promptIdForConceptFacts
|
|
251
|
+
this.promptIdForConceptFacts,
|
|
252
|
+
this.generationCurriculum
|
|
247
253
|
).generate();
|
|
248
254
|
return response;
|
|
249
255
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { OpenAIHelper } from "../helper/openai_helper";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
buildCardSchema,
|
|
4
|
+
cardSchema,
|
|
5
|
+
} from "../helper/schema_helper/build_card_schema";
|
|
3
6
|
import { ErrorLogger, log_error, ParsingError } from "../logger";
|
|
4
7
|
import { ParseCardResponse } from "../parse/parse_card_response";
|
|
5
8
|
import { OpenAiService } from "../services/open_ai_service";
|
|
@@ -18,6 +21,7 @@ export class GenerateCards {
|
|
|
18
21
|
};
|
|
19
22
|
openAIHelper: OpenAIHelper;
|
|
20
23
|
public promptIdForCardsGeneration: string;
|
|
24
|
+
public generationCurriculum: boolean;
|
|
21
25
|
constructor(
|
|
22
26
|
openAiService: OpenAiService,
|
|
23
27
|
sourceId: string,
|
|
@@ -28,7 +32,8 @@ export class GenerateCards {
|
|
|
28
32
|
card_instructions: string;
|
|
29
33
|
card_examples: string;
|
|
30
34
|
},
|
|
31
|
-
promptIdForCardsGeneration: string
|
|
35
|
+
promptIdForCardsGeneration: string,
|
|
36
|
+
generationCurriculum: boolean
|
|
32
37
|
) {
|
|
33
38
|
this.openAiService = openAiService;
|
|
34
39
|
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
@@ -37,13 +42,11 @@ export class GenerateCards {
|
|
|
37
42
|
this.taxonomy = taxonomy;
|
|
38
43
|
this.generationVariables = generationVariables;
|
|
39
44
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
45
|
+
this.generationCurriculum = generationCurriculum;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
async openAIResponse() {
|
|
43
|
-
|
|
44
|
-
console.log(this.generationVariables.bloom_instructions);
|
|
45
|
-
console.log(this.generationVariables.card_instructions);
|
|
46
|
-
console.log(this.generationVariables.card_examples);
|
|
49
|
+
const schema = await buildCardSchema();
|
|
47
50
|
try {
|
|
48
51
|
let response: any = await this.openAIHelper.openAI.responses.create({
|
|
49
52
|
prompt: {
|
|
@@ -68,15 +71,17 @@ export class GenerateCards {
|
|
|
68
71
|
text: {
|
|
69
72
|
format: {
|
|
70
73
|
type: "json_schema",
|
|
71
|
-
name:
|
|
72
|
-
strict:
|
|
73
|
-
schema:
|
|
74
|
+
name: schema.name,
|
|
75
|
+
strict: schema.strict,
|
|
76
|
+
schema: schema.schema,
|
|
74
77
|
},
|
|
75
78
|
},
|
|
76
79
|
});
|
|
77
80
|
if (!response) {
|
|
78
81
|
await log_error({
|
|
79
|
-
flow:
|
|
82
|
+
flow: this.generationCurriculum
|
|
83
|
+
? "curriculum_manual_generation"
|
|
84
|
+
: "manual_generation",
|
|
80
85
|
data: JSON.stringify(response),
|
|
81
86
|
timestamp: new Date(),
|
|
82
87
|
error: "empty_openai_response",
|
|
@@ -93,7 +98,9 @@ export class GenerateCards {
|
|
|
93
98
|
} catch (error) {
|
|
94
99
|
if (error instanceof ParsingError) {
|
|
95
100
|
await log_error({
|
|
96
|
-
flow:
|
|
101
|
+
flow: this.generationCurriculum
|
|
102
|
+
? "curriculum_manual_generation"
|
|
103
|
+
: "manual_generation",
|
|
97
104
|
data: error,
|
|
98
105
|
timestamp: new Date(),
|
|
99
106
|
error: "parsing_error",
|
|
@@ -106,7 +113,9 @@ export class GenerateCards {
|
|
|
106
113
|
} else {
|
|
107
114
|
console.log(error);
|
|
108
115
|
await log_error({
|
|
109
|
-
flow:
|
|
116
|
+
flow: this.generationCurriculum
|
|
117
|
+
? "curriculum_manual_generation"
|
|
118
|
+
: "manual_generation",
|
|
110
119
|
data: error,
|
|
111
120
|
timestamp: new Date(),
|
|
112
121
|
error: "error_in_card_generation",
|
|
@@ -178,7 +187,9 @@ export class GenerateCards {
|
|
|
178
187
|
}
|
|
179
188
|
} catch (e: any) {
|
|
180
189
|
await log_error({
|
|
181
|
-
flow:
|
|
190
|
+
flow: this.generationCurriculum
|
|
191
|
+
? "curriculum_manual_generation"
|
|
192
|
+
: "manual_generation",
|
|
182
193
|
data: e,
|
|
183
194
|
timestamp: new Date(),
|
|
184
195
|
error: "error_in_card_generation",
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { database, ObjectId, setUp } from "../mongo_helper";
|
|
2
|
+
|
|
3
|
+
export const buildCardSchema = async () => {
|
|
4
|
+
setUp();
|
|
5
|
+
const objectId = new ObjectId("689c5cbd0d9d3bbda64b9584");
|
|
6
|
+
const schemaObj = await database.collection("_prompts").findOne({
|
|
7
|
+
_id: objectId,
|
|
8
|
+
});
|
|
9
|
+
if (!schemaObj) {
|
|
10
|
+
throw new Error("Schema not found");
|
|
11
|
+
}
|
|
12
|
+
const schema = schemaObj.schema;
|
|
13
|
+
if (!schema) {
|
|
14
|
+
throw new Error("Schema not found");
|
|
15
|
+
}
|
|
16
|
+
// Deep clone to avoid mutating the original
|
|
17
|
+
const populatedSchema = JSON.parse(schema);
|
|
18
|
+
return populatedSchema;
|
|
19
|
+
};
|
|
20
|
+
|
|
1
21
|
export const cardSchema = {
|
|
2
22
|
type: "object",
|
|
3
23
|
properties: {
|
package/src/index.ts
CHANGED
|
@@ -16,68 +16,69 @@ import { BaseParamType } from "./types/base_param_type";
|
|
|
16
16
|
|
|
17
17
|
export { OnlyEverGenerator };
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
(async () => {
|
|
20
|
+
const openAIKey =
|
|
21
|
+
"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";
|
|
22
|
+
const promptForSummary = {
|
|
23
|
+
promptId: "pmpt_687a8872d1c8819088a9cdc97dcb688b0893663621695594",
|
|
24
|
+
version: "13",
|
|
25
|
+
};
|
|
26
|
+
const promptForConceptFacts = {
|
|
27
|
+
promptId: "pmpt_687aa547f99c8193b99467ca53630c2607f5a8caf451e7e8",
|
|
28
|
+
version: "6",
|
|
29
|
+
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
setUp();
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const source = await database.collection("_source").findOne({
|
|
34
|
+
_id: new ObjectId("6899abc683727361fc197b18"),
|
|
35
|
+
});
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
37
|
+
const contentForGen = {
|
|
38
|
+
prompt: {
|
|
39
|
+
typology: "",
|
|
40
|
+
card_generation: "",
|
|
41
|
+
},
|
|
42
|
+
content: {
|
|
43
|
+
source_id: source?._id?.toString() || "",
|
|
44
|
+
title: source?.title || "",
|
|
45
|
+
type: source?.source_type || "",
|
|
46
|
+
headings: source?.headings || [],
|
|
47
|
+
content: source?.content || [],
|
|
48
|
+
fields: source?.fields || [],
|
|
49
|
+
taxonomy: source?.generate_cards
|
|
50
|
+
? {
|
|
51
|
+
generate_cards: source?.generate_cards || {
|
|
52
|
+
state: false,
|
|
53
|
+
reason: "",
|
|
54
|
+
},
|
|
55
|
+
concepts_facts: source?.concepts_facts || [],
|
|
56
|
+
fields: source?.fields || [],
|
|
57
|
+
}
|
|
58
|
+
: undefined,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const prompts = await getPrompts("text");
|
|
62
|
+
const bloomInstructions = prompts.bloom_instructions;
|
|
63
|
+
const cardInstructions = prompts.card_instructions;
|
|
64
|
+
const cardExamples = prompts.card_examples;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
console.log("Initializing OnlyEverGenerator");
|
|
67
|
+
const onlyEverGenerator = new OnlyEverGenerator(
|
|
68
|
+
process.env.OPEN_AI_KEY as string,
|
|
69
|
+
"o4-mini",
|
|
70
|
+
contentForGen,
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
"pmpt_687a8872d1c8819088a9cdc97dcb688b0893663621695594",
|
|
73
|
+
"pmpt_687aa547f99c8193b99467ca53630c2607f5a8caf451e7e8",
|
|
74
|
+
"pmpt_688118a923e4819098176a13a2f401920d2ea17d881cc6c6",
|
|
75
|
+
{
|
|
76
|
+
bloom_instructions: bloomInstructions,
|
|
77
|
+
card_instructions: cardInstructions,
|
|
78
|
+
card_examples: cardExamples,
|
|
79
|
+
},
|
|
80
|
+
false
|
|
81
|
+
);
|
|
82
|
+
const response = await onlyEverGenerator.generate(true, true);
|
|
83
|
+
console.log(response);
|
|
84
|
+
})();
|
|
@@ -7,6 +7,7 @@ export class GenerateConceptFacts {
|
|
|
7
7
|
public openAiService: OpenAiService;
|
|
8
8
|
public openAIHelper: OpenAIHelper;
|
|
9
9
|
public sourceId: string;
|
|
10
|
+
public generationCurriculum: boolean;
|
|
10
11
|
public content: {
|
|
11
12
|
title: string;
|
|
12
13
|
h1_headings?: string[];
|
|
@@ -25,7 +26,8 @@ export class GenerateConceptFacts {
|
|
|
25
26
|
content: any[];
|
|
26
27
|
},
|
|
27
28
|
type: string,
|
|
28
|
-
promptIdForConceptFacts: string
|
|
29
|
+
promptIdForConceptFacts: string,
|
|
30
|
+
generationCurriculum: boolean
|
|
29
31
|
) {
|
|
30
32
|
this.openAiService = openAiService;
|
|
31
33
|
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
@@ -33,6 +35,7 @@ export class GenerateConceptFacts {
|
|
|
33
35
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
34
36
|
this.type = type;
|
|
35
37
|
this.sourceId = sourceId;
|
|
38
|
+
this.generationCurriculum = generationCurriculum;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
async generate() {
|
|
@@ -114,7 +117,9 @@ export class GenerateConceptFacts {
|
|
|
114
117
|
} catch (error) {
|
|
115
118
|
console.log(error);
|
|
116
119
|
await log_error({
|
|
117
|
-
flow:
|
|
120
|
+
flow: this.generationCurriculum
|
|
121
|
+
? "curriculum_manual_generation"
|
|
122
|
+
: "manual_generation",
|
|
118
123
|
data: error,
|
|
119
124
|
timestamp: new Date(),
|
|
120
125
|
error: "error_in_concept_facts_generation",
|
|
@@ -9,6 +9,7 @@ export class GenerateTypology {
|
|
|
9
9
|
public openAiService: OpenAiService;
|
|
10
10
|
public type: string = "";
|
|
11
11
|
public sourceId: string;
|
|
12
|
+
public generationCurriculum: boolean;
|
|
12
13
|
public content: {
|
|
13
14
|
title: string;
|
|
14
15
|
h1_headings?: string[];
|
|
@@ -28,7 +29,8 @@ export class GenerateTypology {
|
|
|
28
29
|
content: any[];
|
|
29
30
|
},
|
|
30
31
|
expected_fields: Array<string>,
|
|
31
|
-
promptIdForTypology: string
|
|
32
|
+
promptIdForTypology: string,
|
|
33
|
+
generationCurriculum: boolean
|
|
32
34
|
) {
|
|
33
35
|
this.openAiService = openAiService;
|
|
34
36
|
this.type = type;
|
|
@@ -38,6 +40,7 @@ export class GenerateTypology {
|
|
|
38
40
|
elem.toLowerCase()
|
|
39
41
|
);
|
|
40
42
|
this.promptIdForTypology = promptIdForTypology;
|
|
43
|
+
this.generationCurriculum = generationCurriculum;
|
|
41
44
|
}
|
|
42
45
|
async generate() {
|
|
43
46
|
try {
|
|
@@ -80,7 +83,9 @@ export class GenerateTypology {
|
|
|
80
83
|
console.log(openAiResponse);
|
|
81
84
|
if (!openAiResponse) {
|
|
82
85
|
await log_error({
|
|
83
|
-
flow:
|
|
86
|
+
flow: this.generationCurriculum
|
|
87
|
+
? "curriculum_manual_generation"
|
|
88
|
+
: "manual_generation",
|
|
84
89
|
data: openAiResponse,
|
|
85
90
|
error: "empty_openai_response",
|
|
86
91
|
timestamp: new Date(),
|
|
@@ -120,7 +125,9 @@ export class GenerateTypology {
|
|
|
120
125
|
} catch (e: any) {
|
|
121
126
|
console.log(e);
|
|
122
127
|
await log_error({
|
|
123
|
-
flow:
|
|
128
|
+
flow: this.generationCurriculum
|
|
129
|
+
? "curriculum_manual_generation"
|
|
130
|
+
: "manual_generation",
|
|
124
131
|
data: e,
|
|
125
132
|
timestamp: new Date(),
|
|
126
133
|
error: "error_in_typology_generation",
|